aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2001-04-05 09:46:15 +0000
committerGerd Moellmann2001-04-05 09:46:15 +0000
commitdc2f8de4415c08a542f3f84fadffe8b2e0c0550f (patch)
treea67f115d2b6c8ea657eb89e28c9a078caa9077fe
parentde28797ffaff4822fa69be73ed644e1127581a83 (diff)
downloademacs-dc2f8de4415c08a542f3f84fadffe8b2e0c0550f.tar.gz
emacs-dc2f8de4415c08a542f3f84fadffe8b2e0c0550f.zip
Eliminate cl package dependence.
(char-valid-p, multibyte-string-p, string-make-multibyte): Define funs if they aren't defined yet. (ps-mule-encode-header-string, ps-mule-header-string-charsets): Eliminate cl package dependence.
-rw-r--r--lisp/ps-mule.el90
1 files changed, 58 insertions, 32 deletions
diff --git a/lisp/ps-mule.el b/lisp/ps-mule.el
index 2b302b9efbe..43ddd180ecb 100644
--- a/lisp/ps-mule.el
+++ b/lisp/ps-mule.el
@@ -106,6 +106,9 @@
106 (or (fboundp 'find-charset-region) 106 (or (fboundp 'find-charset-region)
107 (defun find-charset-region (beg end &optional table) 107 (defun find-charset-region (beg end &optional table)
108 (list 'ascii))) 108 (list 'ascii)))
109 (or (fboundp 'char-valid-p)
110 (defun char-valid-p (char)
111 (< (following-char) 256)))
109 (or (fboundp 'split-char) 112 (or (fboundp 'split-char)
110 (defun split-char (char) 113 (defun split-char (char)
111 (list (if (char-valid-p char) 114 (list (if (char-valid-p char)
@@ -146,7 +149,17 @@
146 str)) 149 str))
147 (or (fboundp 'define-ccl-program) 150 (or (fboundp 'define-ccl-program)
148 (defmacro define-ccl-program (name ccl-program &optional doc) 151 (defmacro define-ccl-program (name ccl-program &optional doc)
149 `(defconst ,name nil ,doc)))) 152 `(defconst ,name nil ,doc)))
153 (or (fboundp 'multibyte-string-p)
154 (defun multibyte-string-p (str)
155 (let ((len (length str))
156 (i 0)
157 multibyte)
158 (while (and (< i len) (not (setq multibyte (> (aref str i) 255))))
159 (setq i (1+ i)))
160 multibyte)))
161 (or (fboundp 'string-make-multibyte)
162 (defalias 'string-make-multibyte 'copy-sequence)))
150 163
151 164
152;;;###autoload 165;;;###autoload
@@ -1356,10 +1369,12 @@ FONTTAG should be a string \"/h0\" or \"/h1\"."
1356 (if (eq (car ps-mule-header-charsets) 'latin-iso8859-1) 1369 (if (eq (car ps-mule-header-charsets) 'latin-iso8859-1)
1357 ;; Latin1 characters can be printed by the standard PostScript 1370 ;; Latin1 characters can be printed by the standard PostScript
1358 ;; font. Converts the other non-ASCII characters to `?'. 1371 ;; font. Converts the other non-ASCII characters to `?'.
1359 (let ((len (length string))) 1372 (let ((len (length string))
1360 (dotimes (i len) 1373 (i 0))
1374 (while (< i len)
1361 (or (memq (char-charset (aref string i)) '(ascii latin-iso8859-1)) 1375 (or (memq (char-charset (aref string i)) '(ascii latin-iso8859-1))
1362 (aset string i ??))) 1376 (aset string i ??))
1377 (setq i (1+ i)))
1363 (setq string (encode-coding-string string 'iso-latin-1))) 1378 (setq string (encode-coding-string string 'iso-latin-1)))
1364 ;; We must prepare a font for the first non-ASCII and non-Latin1 1379 ;; We must prepare a font for the first non-ASCII and non-Latin1
1365 ;; character in STRING. 1380 ;; character in STRING.
@@ -1374,46 +1389,57 @@ FONTTAG should be a string \"/h0\" or \"/h1\"."
1374 ;; We don't have a proper font, or we can't print them on 1389 ;; We don't have a proper font, or we can't print them on
1375 ;; header because this kind of charset is not ASCII 1390 ;; header because this kind of charset is not ASCII
1376 ;; compatible. 1391 ;; compatible.
1377 (let ((len (length string))) 1392 (let ((len (length string))
1378 (dotimes (i len) 1393 (i 0))
1394 (while (< i len)
1379 (or (memq (char-charset (aref string i)) 1395 (or (memq (char-charset (aref string i))
1380 '(ascii latin-iso8859-1)) 1396 '(ascii latin-iso8859-1))
1381 (aset string i ??))) 1397 (aset string i ??))
1398 (setq i (1+ i)))
1382 (setq string (encode-coding-string string 'iso-latin-1))) 1399 (setq string (encode-coding-string string 'iso-latin-1)))
1383 (let ((charsets (list 'ascii (car ps-mule-header-charsets))) 1400 (let ((charsets (list 'ascii (car ps-mule-header-charsets)))
1384 (len (length string))) 1401 (len (length string))
1385 (dotimes (i len) 1402 (i 0))
1403 (while (< i len)
1386 (or (memq (char-charset (aref string i)) charsets) 1404 (or (memq (char-charset (aref string i)) charsets)
1387 (aset string i ??)))) 1405 (aset string i ??))
1406 (setq i (1+ i))))
1388 (setq string (ps-mule-string-encoding font-spec string nil t)))))) 1407 (setq string (ps-mule-string-encoding font-spec string nil t))))))
1389 string) 1408 string)
1390 1409
1391;;;###autoload 1410;;;###autoload
1392(defun ps-mule-header-string-charsets () 1411(defun ps-mule-header-string-charsets ()
1393 "Return a list of character sets that appears in header strings." 1412 "Return a list of character sets that appears in header strings."
1394 (let ((str "") 1413 (let ((str ""))
1395 len charset charset-list)
1396 (when ps-print-header 1414 (when ps-print-header
1397 (dolist (tail (list ps-left-header ps-right-header)) 1415 (let ((tail (list ps-left-header ps-right-header)))
1398 ;; Simulate what is done by ps-generate-header-line to get a 1416 (while tail
1399 ;; string to plot. 1417 ;; Simulate what is done by ps-generate-header-line to get a
1400 (let ((count 0)) 1418 ;; string to plot.
1401 (dolist (elt tail) 1419 (let ((count 0)
1402 (if (< count ps-header-lines) 1420 (tmp (car tail)))
1403 (setq str (concat str (cond ((stringp elt) elt) 1421 (setq tail (cdr tail))
1404 ((and (symbolp elt) (fboundp elt)) 1422 (while (and tmp (< count ps-header-lines))
1405 (funcall elt)) 1423 (let ((elt (car tmp)))
1406 ((and (symbolp elt) (boundp elt)) 1424 (setq tmp (cdr tmp)
1407 (symbol-value elt)) 1425 count (1+ count)
1408 (t ""))) 1426 str (concat str
1409 count (1+ count))))))) 1427 (cond ((stringp elt) elt)
1410 (setq len (length str)) 1428 ((and (symbolp elt) (fboundp elt))
1411 (dotimes (i len) 1429 (funcall elt))
1412 (setq charset (char-charset (aref str i))) 1430 ((and (symbolp elt) (boundp elt))
1413 (or (eq charset 'ascii) 1431 (symbol-value elt))
1414 (memq charset charset-list) 1432 (t ""))))))))))
1415 (setq charset-list (cons charset charset-list)))) 1433 (let ((len (length str))
1416 charset-list)) 1434 (i 0)
1435 charset-list)
1436 (while (< i len)
1437 (let ((charset (char-charset (aref str i))))
1438 (setq i (1+ i))
1439 (or (eq charset 'ascii)
1440 (memq charset charset-list)
1441 (setq charset-list (cons charset charset-list)))))
1442 charset-list)))
1417 1443
1418;;;###autoload 1444;;;###autoload
1419(defun ps-mule-begin-job (from to) 1445(defun ps-mule-begin-job (from to)