aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2000-08-01 19:58:35 +0000
committerGerd Moellmann2000-08-01 19:58:35 +0000
commitb685181ebbc0ffd9d24236ddad8acbe9b688c032 (patch)
treef287db675b893f724b90123a247bc9e410189ce0
parent10b0f752ea173626d4e8e5cd109cdfbd98cab0fe (diff)
downloademacs-b685181ebbc0ffd9d24236ddad8acbe9b688c032.tar.gz
emacs-b685181ebbc0ffd9d24236ddad8acbe9b688c032.zip
Update ps-print functions call. Indentation fix. Doc
fix. (ebnf-version): New version number (3.2). (ebnf-format-color, ebnf-begin-job): Code fix.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/progmodes/ebnf2ps.el160
2 files changed, 83 insertions, 84 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 59245c9f134..1e4ad53a315 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12000-08-01 Vinicius Jose Latorre <vinicius@cpqd.com.br>
2
3 * ebnf2ps.el: Update ps-print functions call. Indentation fix. Doc
4 fix.
5 (ebnf-version): New version number (3.2).
6 (ebnf-format-color, ebnf-begin-job): Code fix.
7
12000-08-01 Eli Zaretskii <eliz@is.elta.co.il> 82000-08-01 Eli Zaretskii <eliz@is.elta.co.il>
2 9
3 * net/net-utils.el (nslookup-font-lock-keywords): Don't condition 10 * net/net-utils.el (nslookup-font-lock-keywords): Don't condition
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index b1e53448837..509be6cc015 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -5,8 +5,9 @@
5;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> 5;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br>
6;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> 6;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
7;; Keywords: wp, ebnf, PostScript 7;; Keywords: wp, ebnf, PostScript
8;; Time-stamp: <99/12/11 21:41:24 vinicius> 8;; Time-stamp: <2000/07/29 13:09:47 vinicius>
9;; Version: 3.1 9;; Version: 3.2
10;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/Emacs.html
10 11
11;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
12 13
@@ -25,8 +26,8 @@
25;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 26;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26;; Boston, MA 02111-1307, USA. 27;; Boston, MA 02111-1307, USA.
27 28
28(defconst ebnf-version "3.1" 29(defconst ebnf-version "3.2"
29 "ebnf2ps.el, v 3.1 <99/12/11 vinicius> 30 "ebnf2ps.el, v 3.2 <2000/07/29 vinicius>
30 31
31Vinicius's last change version. When reporting bugs, please also 32Vinicius's last change version. When reporting bugs, please also
32report the version of Emacs, if any, that ebnf2ps was running with. 33report the version of Emacs, if any, that ebnf2ps was running with.
@@ -49,8 +50,9 @@ Please send all bug fixes and enhancements to
49;; 50;;
50;; (require 'ebnf2ps) 51;; (require 'ebnf2ps)
51;; 52;;
52;; ebnf2ps uses ps-print package (version 3.05.1 or later), so see ps-print to 53;; ebnf2ps uses ps-print package (version 5.2.3 or later), so see ps-print to
53;; know how to set options like landscape printing, page headings, margins, etc. 54;; know how to set options like landscape printing, page headings, margins,
55;; etc.
54;; 56;;
55;; NOTE: ps-print zebra stripes and line number options doesn't have effect on 57;; NOTE: ps-print zebra stripes and line number options doesn't have effect on
56;; ebnf2ps, they behave as it's turned off. 58;; ebnf2ps, they behave as it's turned off.
@@ -67,15 +69,15 @@ Please send all bug fixes and enhancements to
67;; Using ebnf2ps 69;; Using ebnf2ps
68;; ------------- 70;; -------------
69;; 71;;
70;; ebnf2ps provides six commands for generating PostScript syntatic chart images 72;; ebnf2ps provides six commands for generating PostScript syntatic chart
71;; of Emacs buffers: 73;; images of Emacs buffers:
72;; 74;;
73;; ebnf-print-buffer 75;; ebnf-print-buffer
74;; ebnf-print-region 76;; ebnf-print-region
75;; ebnf-spool-buffer 77;; ebnf-spool-buffer
76;; ebnf-spool-region 78;; ebnf-spool-region
77;; ebnf-eps-buffer 79;; ebnf-eps-buffer
78;; ebnf-eps-region 80;; ebnf-eps-region
79;; 81;;
80;; These commands all perform essentially the same function: they generate 82;; These commands all perform essentially the same function: they generate
81;; PostScript syntatic chart images suitable for printing on a PostScript 83;; PostScript syntatic chart images suitable for printing on a PostScript
@@ -85,14 +87,14 @@ Please send all bug fixes and enhancements to
85;; The word "print", "spool" and "eps" in the command name determines when the 87;; The word "print", "spool" and "eps" in the command name determines when the
86;; PostScript image is sent to the printer (or file): 88;; PostScript image is sent to the printer (or file):
87;; 89;;
88;; print - The PostScript image is immediately sent to the printer; 90;; print - The PostScript image is immediately sent to the printer;
89;; 91;;
90;; spool - The PostScript image is saved temporarily in an Emacs buffer. 92;; spool - The PostScript image is saved temporarily in an Emacs buffer.
91;; Many images may be spooled locally before printing them. To 93;; Many images may be spooled locally before printing them. To
92;; send the spooled images to the printer, use the command 94;; send the spooled images to the printer, use the command
93;; `ebnf-despool'. 95;; `ebnf-despool'.
94;; 96;;
95;; eps - The PostScript image is immediately sent to a EPS file. 97;; eps - The PostScript image is immediately sent to a EPS file.
96;; 98;;
97;; The spooling mechanism is the same as used by ps-print and was designed for 99;; The spooling mechanism is the same as used by ps-print and was designed for
98;; printing lots of small files to save paper that would otherwise be wasted on 100;; printing lots of small files to save paper that would otherwise be wasted on
@@ -105,24 +107,24 @@ Please send all bug fixes and enhancements to
105;; won't accidentally quit from Emacs while you have unprinted PostScript 107;; won't accidentally quit from Emacs while you have unprinted PostScript
106;; waiting in the spool buffer. If you do attempt to exit with spooled 108;; waiting in the spool buffer. If you do attempt to exit with spooled
107;; PostScript, you'll be asked if you want to print it, and if you decline, 109;; PostScript, you'll be asked if you want to print it, and if you decline,
108;; you'll be asked to confirm the exit; this is modeled on the confirmation that 110;; you'll be asked to confirm the exit; this is modeled on the confirmation
109;; Emacs uses for modified buffers. 111;; that Emacs uses for modified buffers.
110;; 112;;
111;; The word "buffer" or "region" in the command name determines how much of the 113;; The word "buffer" or "region" in the command name determines how much of the
112;; buffer is printed: 114;; buffer is printed:
113;; 115;;
114;; buffer - Print the entire buffer. 116;; buffer - Print the entire buffer.
115;; 117;;
116;; region - Print just the current region. 118;; region - Print just the current region.
117;; 119;;
118;; Two ebnf- command examples: 120;; Two ebnf- command examples:
119;; 121;;
120;; ebnf-print-buffer - translate and print the entire buffer, and send 122;; ebnf-print-buffer - translate and print the entire buffer, and send it
121;; it immediately to the printer. 123;; immediately to the printer.
122;; 124;;
123;; ebnf-spool-region - translate and print just the current region, and 125;; ebnf-spool-region - translate and print just the current region, and
124;; spool the image in Emacs to send to the printer 126;; spool the image in Emacs to send to the printer
125;; later. 127;; later.
126;; 128;;
127;; Note that `ebnf-eps-buffer' and `ebnf-eps-region' never spool the EPS image, 129;; Note that `ebnf-eps-buffer' and `ebnf-eps-region' never spool the EPS image,
128;; so they don't use the ps-print spooling mechanism. See section "Actions in 130;; so they don't use the ps-print spooling mechanism. See section "Actions in
@@ -257,8 +259,8 @@ Please send all bug fixes and enhancements to
257;; Logical Expression non-terminal 259;; Logical Expression non-terminal
258;; "(" OR AND "XOR" ")" terminal 260;; "(" OR AND "XOR" ")" terminal
259;; 261;;
260;; The line comment is controlled by `ebnf-lex-comment-char'. The default value 262;; The line comment is controlled by `ebnf-lex-comment-char'. The default
261;; is ?\; (character `;'). 263;; value is ?\; (character `;').
262;; 264;;
263;; The end of production is controlled by `ebnf-lex-eop-char'. The default 265;; The end of production is controlled by `ebnf-lex-eop-char'. The default
264;; value is ?. (character `.'). 266;; value is ?. (character `.').
@@ -332,8 +334,8 @@ Please send all bug fixes and enhancements to
332;; Form Feed 334;; Form Feed
333;; --------- 335;; ---------
334;; 336;;
335;; You may use form feed (^L \014) to force a production to start on a new page, 337;; You may use form feed (^L \014) to force a production to start on a new
336;; for example: 338;; page, for example:
337;; 339;;
338;; a) A = B | C. 340;; a) A = B | C.
339;; ^L 341;; ^L
@@ -362,9 +364,9 @@ Please send all bug fixes and enhancements to
362;; 364;;
363;; ;[EPS open a new EPS file. The EPS file name has the form: 365;; ;[EPS open a new EPS file. The EPS file name has the form:
364;; <PREFIX><NAME>.eps 366;; <PREFIX><NAME>.eps
365;; where <PREFIX> is given by variable `ebnf-eps-prefix' and <NAME> 367;; where <PREFIX> is given by variable `ebnf-eps-prefix' and
366;; is the string given by ;[ action comment, this string is mapped 368;; <NAME> is the string given by ;[ action comment, this string is
367;; to form a valid file name (see documentation for 369;; mapped to form a valid file name (see documentation for
368;; `ebnf-eps-buffer' or `ebnf-eps-region'). 370;; `ebnf-eps-buffer' or `ebnf-eps-region').
369;; It has effect only during `ebnf-eps-buffer' or 371;; It has effect only during `ebnf-eps-buffer' or
370;; `ebnf-eps-region' execution. 372;; `ebnf-eps-region' execution.
@@ -406,7 +408,8 @@ Please send all bug fixes and enhancements to
406;; Note that if ascending production sort is used, the productions A and B will 408;; Note that if ascending production sort is used, the productions A and B will
407;; be drawn in the same line instead of C and B. 409;; be drawn in the same line instead of C and B.
408;; 410;;
409;; If consecutive actions occur, only the last one takes effect, so if you have: 411;; If consecutive actions occur, only the last one takes effect, so if you
412;; have:
410;; 413;;
411;; A = X. 414;; A = X.
412;; ;< 415;; ;<
@@ -521,8 +524,8 @@ Please send all bug fixes and enhancements to
521;; `ebnf-production-horizontal-space' Specify horizontal space in points 524;; `ebnf-production-horizontal-space' Specify horizontal space in points
522;; between productions. 525;; between productions.
523;; 526;;
524;; `ebnf-production-vertical-space' Specify vertical space in points between 527;; `ebnf-production-vertical-space' Specify vertical space in points
525;; productions. 528;; between productions.
526;; 529;;
527;; `ebnf-justify-sequence' Specify justification of terms in a 530;; `ebnf-justify-sequence' Specify justification of terms in a
528;; sequence inside alternatives. 531;; sequence inside alternatives.
@@ -550,8 +553,8 @@ Please send all bug fixes and enhancements to
550;; 553;;
551;; `ebnf-non-terminal-shape' Specify non-terminal box shape. 554;; `ebnf-non-terminal-shape' Specify non-terminal box shape.
552;; 555;;
553;; `ebnf-non-terminal-shadow' Non-nil means non-terminal box will have 556;; `ebnf-non-terminal-shadow' Non-nil means non-terminal box will
554;; a shadow. 557;; have a shadow.
555;; 558;;
556;; `ebnf-non-terminal-border-width' Specify border width for non-terminal 559;; `ebnf-non-terminal-border-width' Specify border width for non-terminal
557;; box. 560;; box.
@@ -604,15 +607,16 @@ Please send all bug fixes and enhancements to
604;; 607;;
605;; `ebnf-line-color' Specify flow line color. 608;; `ebnf-line-color' Specify flow line color.
606;; 609;;
607;; `ebnf-user-arrow' Specify a user arrow shape (a PostScript 610;; `ebnf-user-arrow' Specify a user arrow shape (a
608;; code). 611;; PostScript code).
609;; 612;;
610;; `ebnf-debug-ps' Non-nil means to generate PostScript 613;; `ebnf-debug-ps' Non-nil means to generate PostScript
611;; debug procedures. 614;; debug procedures.
612;; 615;;
613;; `ebnf-lex-comment-char' Specify the line comment character. 616;; `ebnf-lex-comment-char' Specify the line comment character.
614;; 617;;
615;; `ebnf-lex-eop-char' Specify the end of production character. 618;; `ebnf-lex-eop-char' Specify the end of production
619;; character.
616;; 620;;
617;; `ebnf-syntax' Specify syntax to be recognized. 621;; `ebnf-syntax' Specify syntax to be recognized.
618;; 622;;
@@ -633,8 +637,8 @@ Please send all bug fixes and enhancements to
633;; 637;;
634;; `ebnf-ignore-empty-rule' Non-nil means ignore empty rules. 638;; `ebnf-ignore-empty-rule' Non-nil means ignore empty rules.
635;; 639;;
636;; `ebnf-optimize' Non-nil means optimize syntatic chart of 640;; `ebnf-optimize' Non-nil means optimize syntatic chart
637;; rules. 641;; of rules.
638;; 642;;
639;; To set the above options you may: 643;; To set the above options you may:
640;; 644;;
@@ -705,10 +709,10 @@ Please send all bug fixes and enhancements to
705;; and name this group. So when you wish to apply these settings it's only 709;; and name this group. So when you wish to apply these settings it's only
706;; needed to give the name. 710;; needed to give the name.
707;; 711;;
708;; There is also a notion of simple inheritance of style; so if you declare that 712;; There is also a notion of simple inheritance of style; so if you declare
709;; a style A inherits from a style B, all settings of B is applied first and 713;; that a style A inherits from a style B, all settings of B is applied first
710;; then the settings of A is applied. This is useful when you wish to modify 714;; and then the settings of A is applied. This is useful when you wish to
711;; some aspects of an existing style, but at same time wish to keep it 715;; modify some aspects of an existing style, but at same time wish to keep it
712;; unmodified. 716;; unmodified.
713;; 717;;
714;; See documentation for `ebnf-style-database'. 718;; See documentation for `ebnf-style-database'.
@@ -723,8 +727,8 @@ Please send all bug fixes and enhancements to
723;; font height is given by: 727;; font height is given by:
724;; (terminal font height + non-terminal font height) / 2 728;; (terminal font height + non-terminal font height) / 2
725;; 729;;
726;; entry is the vertical position used to know where it should be 730;; entry is the vertical position used to know where it should
727;; drawn the flow line in the current element. 731;; be drawn the flow line in the current element.
728;; 732;;
729;; 733;;
730;; * SPECIAL, TERMINAL and NON-TERMINAL 734;; * SPECIAL, TERMINAL and NON-TERMINAL
@@ -929,14 +933,14 @@ Please send all bug fixes and enhancements to
929;; 933;;
930;; ebnf2ps has two passes. The first pass does a lexical and syntatic analysis 934;; ebnf2ps has two passes. The first pass does a lexical and syntatic analysis
931;; of current buffer and generates an intermediate representation. The second 935;; of current buffer and generates an intermediate representation. The second
932;; pass uses the intermediate representation to generate the PostScript syntatic 936;; pass uses the intermediate representation to generate the PostScript
933;; chart. 937;; syntatic chart.
934;; 938;;
935;; The intermediate representation is a list of vectors, the vector element 939;; The intermediate representation is a list of vectors, the vector element
936;; represents a syntatic chart element. Below is a vector representation for 940;; represents a syntatic chart element. Below is a vector representation for
937;; each syntatic chart element. 941;; each syntatic chart element.
938;; 942;;
939;; [production WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH NAME PRODUCTION ACTION] 943;; [production WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH NAME PRODUCTION ACTION]
940;; [alternative WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH LIST] 944;; [alternative WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH LIST]
941;; [sequence WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH LIST] 945;; [sequence WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH LIST]
942;; [terminal WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH NAME DEFAULT] 946;; [terminal WIDTH-FUN DIM-FUN ENTRY HEIGHT WIDTH NAME DEFAULT]
@@ -1000,24 +1004,8 @@ Please send all bug fixes and enhancements to
1000 1004
1001(require 'ps-print) 1005(require 'ps-print)
1002 1006
1003(and (string< ps-print-version "3.05.1") 1007(and (string< ps-print-version "5.2.3")
1004 (error "`ebnf2ps' requires `ps-print' package version 3.05.1 or later")) 1008 (error "`ebnf2ps' requires `ps-print' package version 5.2.3 or later"))
1005
1006
1007;; temporary fix for ps-print
1008(or (fboundp 'set-buffer-multibyte)
1009 (defun set-buffer-multibyte (arg)
1010 (setq enable-multibyte-characters arg)))
1011
1012(or (fboundp 'string-as-unibyte)
1013 (defun string-as-unibyte (arg) arg))
1014
1015(or (fboundp 'string-as-multibyte)
1016 (defun string-as-multibyte (arg) arg))
1017
1018(or (fboundp 'charset-after)
1019 (defun charset-after (&optional arg)
1020 (char-charset (char-after arg))))
1021 1009
1022 1010
1023;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1011;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1539,10 +1527,10 @@ The anatomy of a right arrow is:
1539 : } hT2 } 1527 : } hT2 }
1540 :....................... 1528 :.......................
1541 1529
1542Where `hT', `hT2' and `hT4' are predefined PostScript variable names that can be 1530Where `hT', `hT2' and `hT4' are predefined PostScript variable names that can
1543used to generate your own arrow. As these variables are used along PostScript 1531be used to generate your own arrow. As these variables are used along
1544execution, *DON'T* modify the values of them. Instead, copy the values, if you 1532PostScript execution, *DON'T* modify the values of them. Instead, copy the
1545need to modify them. 1533values, if you need to modify them.
1546 1534
1547The relation between these variables is: hT = 2 * hT2 = 4 * hT4. 1535The relation between these variables is: hT = 2 * hT2 = 4 * hT4.
1548 1536
@@ -2158,8 +2146,8 @@ Each element has the following form:
2158CUSTOM is a symbol name style. 2146CUSTOM is a symbol name style.
2159INHERITS is a symbol name style from which the current style inherits the 2147INHERITS is a symbol name style from which the current style inherits the
2160context. If INHERITS is nil, means that there is no inheritance. 2148context. If INHERITS is nil, means that there is no inheritance.
2161VAR is a valid ebnf2ps symbol custom variable. See `ebnf-style-custom-list' for 2149VAR is a valid ebnf2ps symbol custom variable. See `ebnf-style-custom-list'
2162valid symbol variable. 2150for valid symbol variable.
2163VALUE is a sexp which it'll be evaluated to set the value to VAR. So, don't 2151VALUE is a sexp which it'll be evaluated to set the value to VAR. So, don't
2164forget to quote symbols and constant lists. See `default' style for an 2152forget to quote symbols and constant lists. See `default' style for an
2165example. 2153example.
@@ -3598,7 +3586,7 @@ end
3598 3586
3599(defun ebnf-format-color (format-str color default) 3587(defun ebnf-format-color (format-str color default)
3600 (let* ((the-color (or color default)) 3588 (let* ((the-color (or color default))
3601 (rgb (mapcar 'ps-color-value (ps-color-values the-color)))) 3589 (rgb (ps-color-scale the-color)))
3602 (format format-str 3590 (format format-str
3603 (concat "[" 3591 (concat "["
3604 (ebnf-format-float (nth 0 rgb) (nth 1 rgb) (nth 2 rgb)) 3592 (ebnf-format-float (nth 0 rgb) (nth 1 rgb) (nth 2 rgb))
@@ -3729,7 +3717,8 @@ end
3729 prod-name (ebnf-node-name prod) 3717 prod-name (ebnf-node-name prod)
3730 prod-width (ebnf-max-width prod) 3718 prod-width (ebnf-max-width prod)
3731 prod-height (ebnf-node-height prod) 3719 prod-height (ebnf-node-height prod)
3732 horizontal (memq (ebnf-node-action prod) ebnf-action-list)) 3720 horizontal (memq (ebnf-node-action prod)
3721 ebnf-action-list))
3733 ;; generate production in EPS buffer 3722 ;; generate production in EPS buffer
3734 (save-excursion 3723 (save-excursion
3735 (set-buffer eps-buffer) 3724 (set-buffer eps-buffer)
@@ -4273,7 +4262,7 @@ end
4273 4262
4274 4263
4275(defun ebnf-begin-job () 4264(defun ebnf-begin-job ()
4276 (ps-printing-region nil) 4265 (ps-printing-region nil nil)
4277 (if ebnf-use-float-format 4266 (if ebnf-use-float-format
4278 (setq ebnf-format-float "%1.3f" 4267 (setq ebnf-format-float "%1.3f"
4279 ebnf-message-float "%3.2f") 4268 ebnf-message-float "%3.2f")
@@ -4914,7 +4903,9 @@ Otherwise, it is treated as an empty string."
4914;; [sequence width-fun dim-fun entry height width list] 4903;; [sequence width-fun dim-fun entry height width list]
4915(defun ebnf-sequence-width (sequence width) 4904(defun ebnf-sequence-width (sequence width)
4916 (ebnf-node-list sequence 4905 (ebnf-node-list sequence
4917 (ebnf-justify-list sequence (ebnf-node-list sequence) width))) 4906 (ebnf-justify-list sequence
4907 (ebnf-node-list sequence)
4908 width)))
4918 4909
4919 4910
4920(defun ebnf-justify-list (node seq width) 4911(defun ebnf-justify-list (node seq width)
@@ -5217,7 +5208,8 @@ Otherwise, it is treated as an empty string."
5217 ;; ( A | B | EMPTY )- ==> A | B 5208 ;; ( A | B | EMPTY )- ==> A | B
5218 ((and (null exception) 5209 ((and (null exception)
5219 (eq kind 'ebnf-generate-alternative) 5210 (eq kind 'ebnf-generate-alternative)
5220 (eq (ebnf-node-kind (car (last (ebnf-node-list element)))) 5211 (eq (ebnf-node-kind
5212 (car (last (ebnf-node-list element))))
5221 'ebnf-generate-empty)) 5213 'ebnf-generate-empty))
5222 (let ((elt (ebnf-node-list element)) 5214 (let ((elt (ebnf-node-list element))
5223 bef) 5215 bef)