Function: ebnf-eps-string

ebnf-eps-string is a byte-compiled function defined in ebnf2ps.el.gz.

Signature

(ebnf-eps-string STRING)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ebnf2ps.el.gz
;; hacked from `ps-output-string-prim' (ps-print.el)
(defun ebnf-eps-string (string)
  (let* ((str   string)
	 (len   (length str))
	 (index 0)
	 (new   "(")			; insert start-string delimiter
	 start special)
    ;; Find and quote special characters as necessary for PS
    ;; This skips everything except control chars, non-ASCII chars,
    ;; (, ), \, and DEL.
    (while (setq start (string-match "[[:cntrl:][:nonascii:]\177()\\]"
                                     str index))
      (setq special (aref str start)
	    new     (concat new
			    (substring str index start)
			    (if (and (<= 0 special) (<= special 255))
				(aref ps-string-escape-codes special)
			      ;; insert hexadecimal representation if character
			      ;; code is out of range
			      (format "\\%04X" special)))
	    index   (1+ start)))
    (concat new
	    (and (< index len)
		 (substring str index len))
	    ")")))			; insert end-string delimiter