aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinicius Jose Latorre2007-07-26 13:41:29 +0000
committerVinicius Jose Latorre2007-07-26 13:41:29 +0000
commit3ced5caae444261e6ce5cea0ff6c20eb4a366ecd (patch)
tree9f730ae9cf14674b21c6ae4efbfa29e566e87e49
parentf4d70220bef14ffa14f42df7892bd8f15ab61f86 (diff)
downloademacs-3ced5caae444261e6ce5cea0ff6c20eb4a366ecd.tar.gz
emacs-3ced5caae444261e6ce5cea0ff6c20eb4a366ecd.zip
New: Header/Footer comment & Log messages
-rw-r--r--lisp/ChangeLog53
-rw-r--r--lisp/progmodes/ebnf-abn.el8
-rw-r--r--lisp/progmodes/ebnf-bnf.el8
-rw-r--r--lisp/progmodes/ebnf-dtd.el8
-rw-r--r--lisp/progmodes/ebnf-ebx.el8
-rw-r--r--lisp/progmodes/ebnf-iso.el10
-rw-r--r--lisp/progmodes/ebnf-yac.el8
-rw-r--r--lisp/progmodes/ebnf2ps.el818
8 files changed, 754 insertions, 167 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 881c5ee2f6f..65239278624 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,56 @@
12007-07-26 Vinicius Jose Latorre <viniciusjl@ig.com.br>
2
3 * progmodes/ebnf-abn.el (ebnf-abn-skip-comment):
4 * progmodes/ebnf-bnf.el (ebnf-bnf-skip-comment):
5 * progmodes/ebnf-dtd.el (ebnf-dtd-skip-comment):
6 * progmodes/ebnf-ebx.el (ebnf-ebx-skip-comment):
7 * progmodes/ebnf-iso.el (ebnf-iso-skip-comment):
8 * progmodes/ebnf-yac.el (ebnf-yac-skip-comment): New version.
9 New command actions for EPS header and EPS footer.
10
11 * progmodes/ebnf2ps.el: New command actions for EPS header and EPS
12 footer. Fix some problems with one-or-more, zero-or-more and
13 alternative constructions generation. Some log messages
14 implementation. Doc fix.
15 (ebnf-version): New version 4.4.
16 (ebnf-eps-header-font, ebnf-eps-header, ebnf-eps-footer-font)
17 (ebnf-eps-footer, ebnf-log): New options.
18 (ebnf-find-style, ebnf-eps-header-footer, ebnf-eps-header)
19 (ebnf-eps-footer, ebnf-eps-string, ebnf-eps-header-footer-comment)
20 (ebnf-eps-header-footer-p, ebnf-eps-header-comment)
21 (ebnf-eps-footer-comment, ebnf-eps-header-footer-file)
22 (ebnf-eps-header-footer-set, ebnf-log-header, ebnf-log): New funs.
23 (ebnf-style-custom-list, ebnf-style-database): Put new values.
24 (ebnf-print-directory, ebnf-print-file, ebnf-print-buffer)
25 (ebnf-print-region, ebnf-spool-directory, ebnf-spool-file)
26 (ebnf-spool-buffer, ebnf-spool-region, ebnf-eps-directory)
27 (ebnf-eps-file, ebnf-eps-buffer, ebnf-eps-region)
28 (ebnf-syntax-directory, ebnf-syntax-file, ebnf-syntax-buffer)
29 (ebnf-syntax-region, ebnf-parse-and-sort, ebnf-begin-job)
30 (ebnf-dimensions, ebnf-production-dimension, ebnf-terminal-dimension)
31 (ebnf-non-terminal-dimension, ebnf-special-dimension)
32 (ebnf-terminal-dimension1, ebnf-repeat-dimension)
33 (ebnf-except-dimension, ebnf-alternative-dimension)
34 (ebnf-optional-dimension, ebnf-one-or-more-dimension)
35 (ebnf-zero-or-more-dimension, ebnf-sequence-dimension): Insert log
36 message fun.
37 (ebnf-setup, ebnf-generate-one-or-more, ebnf-generate-zero-or-more)
38 (ebnf-begin-job, ebnf-begin-file, ebnf-eps-finish-and-write)
39 (ebnf-insert-ebnf-prologue, ebnf-production-dimension)
40 (ebnf-terminal-dimension1, ebnf-alternative-dimension)
41 (ebnf-one-or-more-dimension, ebnf-zero-or-more-dimension)
42 (ebnf-eps-add-context, ebnf-eps-add-production): Fix code.
43 (ebnf-eps-filename, ebnf-trim-right): Replace `?\s' by `?\ ' to keep
44 compatibility with Emacs 20 & 21.
45 (ebnf-eps-header-comment, ebnf-eps-footer-comment)
46 (ebnf-eps-file-alist, ebnf-basic-width-extra)
47 (ebnf-basic-empty-height): New vars.
48 (ebnf-prologue): Fix PostScript code.
49 (ebnf-make-empty, ebnf-make-terminal1, ebnf-make-or-more1)
50 (ebnf-make-production, ebnf-make-alternative, ebnf-make-optional)
51 (ebnf-make-except, ebnf-make-repeat, ebnf-make-sequence)
52 (ebnf-make-dup-sequence, ebnf-token-alternative): Add comments.
53
12007-07-25 Glenn Morris <rgm@gnu.org> 542007-07-25 Glenn Morris <rgm@gnu.org>
2 55
3 * Relicense all FSF files to GPLv3 or later. 56 * Relicense all FSF files to GPLv3 or later.
diff --git a/lisp/progmodes/ebnf-abn.el b/lisp/progmodes/ebnf-abn.el
index 5e0d4b41820..44034bde3d5 100644
--- a/lisp/progmodes/ebnf-abn.el
+++ b/lisp/progmodes/ebnf-abn.el
@@ -6,7 +6,7 @@
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Keywords: wp, ebnf, PostScript 8;; Keywords: wp, ebnf, PostScript
9;; Version: 1.1 9;; Version: 1.2
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -589,6 +589,12 @@ See documentation for variable `ebnf-abn-lex'."
589 ;; close EPS file 589 ;; close EPS file
590 ((and ebnf-eps-executing (= (following-char) ?\])) 590 ((and ebnf-eps-executing (= (following-char) ?\]))
591 (ebnf-eps-remove-context (ebnf-abn-eps-filename))) 591 (ebnf-eps-remove-context (ebnf-abn-eps-filename)))
592 ;; EPS header
593 ((and ebnf-eps-executing (= (following-char) ?H))
594 (ebnf-eps-header-comment (ebnf-abn-eps-filename)))
595 ;; EPS footer
596 ((and ebnf-eps-executing (= (following-char) ?F))
597 (ebnf-eps-footer-comment (ebnf-abn-eps-filename)))
592 ;; any other action in comment 598 ;; any other action in comment
593 (t 599 (t
594 (setq ebnf-action (aref ebnf-comment-table (following-char))) 600 (setq ebnf-action (aref ebnf-comment-table (following-char)))
diff --git a/lisp/progmodes/ebnf-bnf.el b/lisp/progmodes/ebnf-bnf.el
index 6ade2fdc900..8f6ecd99d24 100644
--- a/lisp/progmodes/ebnf-bnf.el
+++ b/lisp/progmodes/ebnf-bnf.el
@@ -6,7 +6,7 @@
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Keywords: wp, ebnf, PostScript 8;; Keywords: wp, ebnf, PostScript
9;; Version: 1.9 9;; Version: 1.10
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -537,6 +537,12 @@ See documentation for variable `ebnf-bnf-lex'."
537 ;; close EPS file 537 ;; close EPS file
538 ((and ebnf-eps-executing (= (following-char) ?\])) 538 ((and ebnf-eps-executing (= (following-char) ?\]))
539 (ebnf-eps-remove-context (ebnf-bnf-eps-filename))) 539 (ebnf-eps-remove-context (ebnf-bnf-eps-filename)))
540 ;; EPS header
541 ((and ebnf-eps-executing (= (following-char) ?H))
542 (ebnf-eps-header-comment (ebnf-bnf-eps-filename)))
543 ;; EPS footer
544 ((and ebnf-eps-executing (= (following-char) ?F))
545 (ebnf-eps-footer-comment (ebnf-bnf-eps-filename)))
540 ;; any other action in comment 546 ;; any other action in comment
541 (t 547 (t
542 (setq ebnf-action (aref ebnf-comment-table (following-char))) 548 (setq ebnf-action (aref ebnf-comment-table (following-char)))
diff --git a/lisp/progmodes/ebnf-dtd.el b/lisp/progmodes/ebnf-dtd.el
index 36fb314e642..855dd3813b8 100644
--- a/lisp/progmodes/ebnf-dtd.el
+++ b/lisp/progmodes/ebnf-dtd.el
@@ -6,7 +6,7 @@
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Keywords: wp, ebnf, PostScript 8;; Keywords: wp, ebnf, PostScript
9;; Version: 1.0 9;; Version: 1.1
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -1306,6 +1306,12 @@ See documentation for variable `ebnf-dtd-lex'."
1306 ;; close EPS file 1306 ;; close EPS file
1307 ((and ebnf-eps-executing (= (following-char) ?\])) 1307 ((and ebnf-eps-executing (= (following-char) ?\]))
1308 (ebnf-eps-remove-context (ebnf-dtd-eps-filename))) 1308 (ebnf-eps-remove-context (ebnf-dtd-eps-filename)))
1309 ;; EPS header
1310 ((and ebnf-eps-executing (= (following-char) ?H))
1311 (ebnf-eps-header-comment (ebnf-dtd-eps-filename)))
1312 ;; EPS footer
1313 ((and ebnf-eps-executing (= (following-char) ?F))
1314 (ebnf-eps-footer-comment (ebnf-dtd-eps-filename)))
1309 ;; any other action in comment 1315 ;; any other action in comment
1310 (t 1316 (t
1311 (setq ebnf-action (aref ebnf-comment-table (following-char)))) 1317 (setq ebnf-action (aref ebnf-comment-table (following-char))))
diff --git a/lisp/progmodes/ebnf-ebx.el b/lisp/progmodes/ebnf-ebx.el
index cca85a10c2d..90acb3b0b0c 100644
--- a/lisp/progmodes/ebnf-ebx.el
+++ b/lisp/progmodes/ebnf-ebx.el
@@ -6,7 +6,7 @@
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Keywords: wp, ebnf, PostScript 8;; Keywords: wp, ebnf, PostScript
9;; Version: 1.1 9;; Version: 1.2
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -539,6 +539,12 @@ See documentation for variable `ebnf-ebx-lex'."
539 ;; close EPS file 539 ;; close EPS file
540 ((and ebnf-eps-executing (= (following-char) ?\])) 540 ((and ebnf-eps-executing (= (following-char) ?\]))
541 (ebnf-eps-remove-context (ebnf-ebx-eps-filename))) 541 (ebnf-eps-remove-context (ebnf-ebx-eps-filename)))
542 ;; EPS header
543 ((and ebnf-eps-executing (= (following-char) ?H))
544 (ebnf-eps-header-comment (ebnf-ebx-eps-filename)))
545 ;; EPS footer
546 ((and ebnf-eps-executing (= (following-char) ?F))
547 (ebnf-eps-footer-comment (ebnf-ebx-eps-filename)))
542 ;; any other action in comment 548 ;; any other action in comment
543 (t 549 (t
544 (setq ebnf-action (aref ebnf-comment-table (following-char)))) 550 (setq ebnf-action (aref ebnf-comment-table (following-char))))
diff --git a/lisp/progmodes/ebnf-iso.el b/lisp/progmodes/ebnf-iso.el
index 802cf019d85..9b670b4dbfe 100644
--- a/lisp/progmodes/ebnf-iso.el
+++ b/lisp/progmodes/ebnf-iso.el
@@ -1,12 +1,12 @@
1;;; ebnf-iso.el --- parser for ISO EBNF 1;;; ebnf-iso.el --- parser for ISO EBNF
2 2
3;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 3;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Keywords: wp, ebnf, PostScript 8;; Keywords: wp, ebnf, PostScript
9;; Version: 1.8 9;; Version: 1.9
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -504,6 +504,12 @@ See documentation for variable `ebnf-iso-lex'."
504 ;; close EPS file 504 ;; close EPS file
505 ((and ebnf-eps-executing (= (following-char) ?\])) 505 ((and ebnf-eps-executing (= (following-char) ?\]))
506 (ebnf-eps-remove-context (ebnf-iso-eps-filename))) 506 (ebnf-eps-remove-context (ebnf-iso-eps-filename)))
507 ;; EPS header
508 ((and ebnf-eps-executing (= (following-char) ?H))
509 (ebnf-eps-header-comment (ebnf-iso-eps-filename)))
510 ;; EPS footer
511 ((and ebnf-eps-executing (= (following-char) ?F))
512 (ebnf-eps-footer-comment (ebnf-iso-eps-filename)))
507 ;; any other action in comment 513 ;; any other action in comment
508 (t 514 (t
509 (setq ebnf-action (aref ebnf-comment-table (following-char)))) 515 (setq ebnf-action (aref ebnf-comment-table (following-char))))
diff --git a/lisp/progmodes/ebnf-yac.el b/lisp/progmodes/ebnf-yac.el
index 829494cd7ef..c1b00bdddfc 100644
--- a/lisp/progmodes/ebnf-yac.el
+++ b/lisp/progmodes/ebnf-yac.el
@@ -6,7 +6,7 @@
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Keywords: wp, ebnf, PostScript 8;; Keywords: wp, ebnf, PostScript
9;; Version: 1.3 9;; Version: 1.4
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -459,6 +459,12 @@ See documentation for variable `ebnf-yac-lex'."
459 ;; close EPS file 459 ;; close EPS file
460 ((and ebnf-eps-executing (= (following-char) ?\])) 460 ((and ebnf-eps-executing (= (following-char) ?\]))
461 (ebnf-eps-remove-context (ebnf-yac-eps-filename))) 461 (ebnf-eps-remove-context (ebnf-yac-eps-filename)))
462 ;; EPS header
463 ((and ebnf-eps-executing (= (following-char) ?H))
464 (ebnf-eps-header-comment (ebnf-yac-eps-filename)))
465 ;; EPS footer
466 ((and ebnf-eps-executing (= (following-char) ?F))
467 (ebnf-eps-footer-comment (ebnf-yac-eps-filename)))
462 ;; any other action in comment 468 ;; any other action in comment
463 (t 469 (t
464 (setq ebnf-action (aref ebnf-comment-table (following-char)))) 470 (setq ebnf-action (aref ebnf-comment-table (following-char))))
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index 75fc250745e..be25293c643 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -1,12 +1,12 @@
1;;; ebnf2ps.el --- translate an EBNF to a syntactic chart on PostScript 1;;; ebnf2ps.el --- translate an EBNF to a syntactic chart on PostScript
2 2
3;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 3;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Keywords: wp, ebnf, PostScript 8;; Keywords: wp, ebnf, PostScript
9;; Version: 4.3 9;; Version: 4.4
10;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre 10;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
11 11
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
@@ -26,8 +26,8 @@
26;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 26;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27;; Boston, MA 02110-1301, USA. 27;; Boston, MA 02110-1301, USA.
28 28
29(defconst ebnf-version "4.3" 29(defconst ebnf-version "4.4"
30 "ebnf2ps.el, v 4.3 <2006/09/26 vinicius> 30 "ebnf2ps.el, v 4.4 <2007/02/12 vinicius>
31 31
32Vinicius's last change version. When reporting bugs, please also 32Vinicius's last change version. When reporting bugs, please also
33report the version of Emacs, if any, that ebnf2ps was running with. 33report the version of Emacs, if any, that ebnf2ps was running with.
@@ -448,6 +448,24 @@ Please send all bug fixes and enhancements to
448;; `ebnf-eps-region' execution. 448;; `ebnf-eps-region' execution.
449;; It's an error to try to close a not opened EPS file. 449;; It's an error to try to close a not opened EPS file.
450;; 450;;
451;; ;Hheader generate a header in current EPS file. The header string can
452;; have the following formats:
453;;
454;; %% prints a % character.
455;;
456;; %H prints the `ebnf-eps-header' (which see) value.
457;;
458;; %F prints the `ebnf-eps-footer' (which see) value.
459;;
460;; Any other format is ignored, that is, if, for example, it's
461;; used %s then %s characters are stripped out from the header.
462;; If header is an empty string, no header is generated until a
463;; non-empty header is specified or `ebnf-eps-header' has a
464;; non-empty string value.
465;;
466;; ;Ffooter generate a footer in current EPS file. Similar to ;H action
467;; comment.
468;;
451;; So if you have: 469;; So if you have:
452;; 470;;
453;; (setq ebnf-horizontal-orientation nil) 471;; (setq ebnf-horizontal-orientation nil)
@@ -546,6 +564,16 @@ Please send all bug fixes and enhancements to
546;; The production A is generated in both files ebnf--AA.eps and ebnf--BB.eps. 564;; The production A is generated in both files ebnf--AA.eps and ebnf--BB.eps.
547;; 565;;
548;; 566;;
567;; Log Messages
568;; ------------
569;;
570;; The buffer *Ebnf2ps Log* is where the ebnf2ps log messages are inserted.
571;; These messages are intended to help debugging ebnf2ps.
572;;
573;; The log messages are enabled by `ebnf-log' option (which see). The default
574;; value is nil, that is, no log messages are generated.
575;;
576;;
549;; Utilities 577;; Utilities
550;; --------- 578;; ---------
551;; 579;;
@@ -723,6 +751,14 @@ Please send all bug fixes and enhancements to
723;; 751;;
724;; `ebnf-eps-prefix' Specify EPS prefix file name. 752;; `ebnf-eps-prefix' Specify EPS prefix file name.
725;; 753;;
754;; `ebnf-eps-header-font' Specify EPS header font.
755;;
756;; `ebnf-eps-header' Specify EPS header.
757;;
758;; `ebnf-eps-footer-font' Specify EPS footer font.
759;;
760;; `ebnf-eps-footer' Specify EPS footer.
761;;
726;; `ebnf-use-float-format' Non-nil means use `%f' float format. 762;; `ebnf-use-float-format' Non-nil means use `%f' float format.
727;; 763;;
728;; `ebnf-stop-on-error' Non-nil means signal error and stop. 764;; `ebnf-stop-on-error' Non-nil means signal error and stop.
@@ -735,6 +771,8 @@ Please send all bug fixes and enhancements to
735;; `ebnf-optimize' Non-nil means optimize syntactic chart 771;; `ebnf-optimize' Non-nil means optimize syntactic chart
736;; of rules. 772;; of rules.
737;; 773;;
774;; `ebnf-log' Non-nil means generate log messages.
775;;
738;; To set the above options you may: 776;; To set the above options you may:
739;; 777;;
740;; a) insert the code in your ~/.emacs, like: 778;; a) insert the code in your ~/.emacs, like:
@@ -787,6 +825,9 @@ Please send all bug fixes and enhancements to
787;; To help to handle this situation, ebnf2ps has the following commands to 825;; To help to handle this situation, ebnf2ps has the following commands to
788;; handle styles: 826;; handle styles:
789;; 827;;
828;; `ebnf-find-style' Return style definition if NAME is already defined;
829;; otherwise, return nil.
830;;
790;; `ebnf-insert-style' Insert a new style NAME with inheritance INHERITS and 831;; `ebnf-insert-style' Insert a new style NAME with inheritance INHERITS and
791;; values VALUES. 832;; values VALUES.
792;; 833;;
@@ -1879,6 +1920,126 @@ See `ebnf-eps-buffer' and `ebnf-eps-region' commands."
1879 :group 'ebnf2ps) 1920 :group 'ebnf2ps)
1880 1921
1881 1922
1923(defcustom ebnf-eps-header-font '(11 Helvetica "Black" "White" bold)
1924 "*Specify EPS header font.
1925
1926See documentation for `ebnf-production-font'.
1927
1928See `ebnf-eps-buffer' and `ebnf-eps-region' commands."
1929 :type '(list :tag "EPS Header Font"
1930 (number :tag "Font Size")
1931 (symbol :tag "Font Name")
1932 (choice :tag "Foreground Color"
1933 (string :tag "Name")
1934 (other :tag "Default" nil))
1935 (choice :tag "Background Color"
1936 (string :tag "Name")
1937 (other :tag "Default" nil))
1938 (repeat :tag "Font Attributes" :inline t
1939 (choice (const bold) (const italic)
1940 (const underline) (const strikeout)
1941 (const overline) (const shadow)
1942 (const box) (const outline))))
1943 :version "22"
1944 :group 'ebnf2ps)
1945
1946
1947(defcustom ebnf-eps-header nil
1948 "*Specify EPS header.
1949
1950The value should be a string, a symbol or nil.
1951
1952String is inserted unchanged.
1953
1954For symbol bounded to a function, the function is called and should return a
1955string. For symbol bounded to a value, the value should be a string.
1956
1957If symbol is unbounded, it is silently ignored.
1958
1959Empty string or nil mean that no header will be generated.
1960
1961Note that when the header action comment (;H in EBNF syntax) is specified, the
1962string in the header action comment is processed and, if it returns a non-empty
1963string, it's used to generate the header. The header action comment accepts
1964the following formats:
1965
1966 %% prints a % character.
1967
1968 %H prints the `ebnf-eps-header' value.
1969
1970 %F prints the `ebnf-eps-footer' (which see) value.
1971
1972Any other format is ignored, that is, if, for example, it's used %s then %s
1973characters are stripped out from the header. If header action comment is an
1974empty string, no header is generated until a non-empty header is specified or
1975`ebnf-eps-header' has a non-empty string value."
1976 :type '(repeat (choice :menu-tag "EPS Header"
1977 :tag "EPS Header"
1978 string symbol (const :tag "No Header" nil )))
1979 :version "22"
1980 :group 'ebnf2ps)
1981
1982
1983(defcustom ebnf-eps-footer-font '(7 Helvetica "Black" "White" bold)
1984 "*Specify EPS footer font.
1985
1986See documentation for `ebnf-production-font'.
1987
1988See `ebnf-eps-buffer' and `ebnf-eps-region' commands."
1989 :type '(list :tag "EPS Footer Font"
1990 (number :tag "Font Size")
1991 (symbol :tag "Font Name")
1992 (choice :tag "Foreground Color"
1993 (string :tag "Name")
1994 (other :tag "Default" nil))
1995 (choice :tag "Background Color"
1996 (string :tag "Name")
1997 (other :tag "Default" nil))
1998 (repeat :tag "Font Attributes" :inline t
1999 (choice (const bold) (const italic)
2000 (const underline) (const strikeout)
2001 (const overline) (const shadow)
2002 (const box) (const outline))))
2003 :version "22"
2004 :group 'ebnf2ps)
2005
2006
2007(defcustom ebnf-eps-footer nil
2008 "*Specify EPS footer.
2009
2010The value should be a string, a symbol or nil.
2011
2012String is inserted unchanged.
2013
2014For symbol bounded to a function, the function is called and should return a
2015string. For symbol bounded to a value, the value should be a string.
2016
2017If symbol is unbounded, it is silently ignored.
2018
2019Empty string or nil mean that no footer will be generated.
2020
2021Note that when the footer action comment (;F in EBNF syntax) is specified, the
2022string in the footer action comment is processed and, if it returns a non-empty
2023string, it's used to generate the footer. The footer action comment accepts
2024the following formats:
2025
2026 %% prints a % character.
2027
2028 %H prints the `ebnf-eps-header' (which see) value.
2029
2030 %F prints the `ebnf-eps-footer' value.
2031
2032Any other format is ignored, that is, if, for example, it's used %s then %s
2033characters are stripped out from the footer. If footer action comment is an
2034empty string, no footer is generated until a non-empty footer is specified or
2035`ebnf-eps-footer' has a non-empty string value."
2036 :type '(repeat (choice :menu-tag "EPS Footer"
2037 :tag "EPS Footer"
2038 string symbol (const :tag "No Footer" nil )))
2039 :version "22"
2040 :group 'ebnf2ps)
2041
2042
1882(defcustom ebnf-entry-percentage 0.5 ; middle 2043(defcustom ebnf-entry-percentage 0.5 ; middle
1883 "*Specify entry height on alternatives. 2044 "*Specify entry height on alternatives.
1884 2045
@@ -2019,6 +2180,16 @@ The above optimizations are specially useful when `ebnf-syntax' is `yacc'."
2019 :version "20" 2180 :version "20"
2020 :group 'ebnf-optimization) 2181 :group 'ebnf-optimization)
2021 2182
2183
2184(defcustom ebnf-log nil
2185 "*Non-nil means generate log messages.
2186
2187The log messages are generated into the buffer *Ebnf2ps Log*.
2188These messages are intended to help debugging ebnf2ps."
2189 :type 'boolean
2190 :version "22"
2191 :group 'ebnf2ps)
2192
2022 2193
2023;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2194;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2024;; To make this file smaller, some commands go in a separate file. 2195;; To make this file smaller, some commands go in a separate file.
@@ -2063,6 +2234,7 @@ See also `ebnf-print-buffer'."
2063 (interactive 2234 (interactive
2064 (list (read-file-name "Directory containing EBNF files (print): " 2235 (list (read-file-name "Directory containing EBNF files (print): "
2065 nil default-directory))) 2236 nil default-directory)))
2237 (ebnf-log-header "(ebnf-print-directory %S)" directory)
2066 (ebnf-directory 'ebnf-print-buffer directory)) 2238 (ebnf-directory 'ebnf-print-buffer directory))
2067 2239
2068 2240
@@ -2075,6 +2247,7 @@ killed after process termination.
2075 2247
2076See also `ebnf-print-buffer'." 2248See also `ebnf-print-buffer'."
2077 (interactive "fEBNF file to generate PostScript and print from: ") 2249 (interactive "fEBNF file to generate PostScript and print from: ")
2250 (ebnf-log-header "(ebnf-print-file %S %S)" file do-not-kill-buffer-when-done)
2078 (ebnf-file 'ebnf-print-buffer file do-not-kill-buffer-when-done)) 2251 (ebnf-file 'ebnf-print-buffer file do-not-kill-buffer-when-done))
2079 2252
2080 2253
@@ -2091,6 +2264,7 @@ is nil, send the image to the printer. If FILENAME is a string, save
2091the PostScript image in a file with that name. If FILENAME is a 2264the PostScript image in a file with that name. If FILENAME is a
2092number, prompt the user for the name of the file to save in." 2265number, prompt the user for the name of the file to save in."
2093 (interactive (list (ps-print-preprint current-prefix-arg))) 2266 (interactive (list (ps-print-preprint current-prefix-arg)))
2267 (ebnf-log-header "(ebnf-print-buffer %S)" filename)
2094 (ebnf-print-region (point-min) (point-max) filename)) 2268 (ebnf-print-region (point-min) (point-max) filename))
2095 2269
2096 2270
@@ -2099,6 +2273,7 @@ number, prompt the user for the name of the file to save in."
2099 "Generate and print a PostScript syntactic chart image of the region. 2273 "Generate and print a PostScript syntactic chart image of the region.
2100Like `ebnf-print-buffer', but prints just the current region." 2274Like `ebnf-print-buffer', but prints just the current region."
2101 (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg))) 2275 (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg)))
2276 (ebnf-log-header "(ebnf-print-region %S %S %S)" from to filename)
2102 (run-hooks 'ebnf-hook) 2277 (run-hooks 'ebnf-hook)
2103 (or (ebnf-spool-region from to) 2278 (or (ebnf-spool-region from to)
2104 (ps-do-despool filename))) 2279 (ps-do-despool filename)))
@@ -2117,6 +2292,7 @@ See also `ebnf-spool-buffer'."
2117 (interactive 2292 (interactive
2118 (list (read-file-name "Directory containing EBNF files (spool): " 2293 (list (read-file-name "Directory containing EBNF files (spool): "
2119 nil default-directory))) 2294 nil default-directory)))
2295 (ebnf-log-header "(ebnf-spool-directory %S)" directory)
2120 (ebnf-directory 'ebnf-spool-buffer directory)) 2296 (ebnf-directory 'ebnf-spool-buffer directory))
2121 2297
2122 2298
@@ -2129,6 +2305,7 @@ killed after process termination.
2129 2305
2130See also `ebnf-spool-buffer'." 2306See also `ebnf-spool-buffer'."
2131 (interactive "fEBNF file to generate PostScript and spool from: ") 2307 (interactive "fEBNF file to generate PostScript and spool from: ")
2308 (ebnf-log-header "(ebnf-spool-file %S %S)" file do-not-kill-buffer-when-done)
2132 (ebnf-file 'ebnf-spool-buffer file do-not-kill-buffer-when-done)) 2309 (ebnf-file 'ebnf-spool-buffer file do-not-kill-buffer-when-done))
2133 2310
2134 2311
@@ -2140,6 +2317,7 @@ local buffer to be sent to the printer later.
2140 2317
2141Use the command `ebnf-despool' to send the spooled images to the printer." 2318Use the command `ebnf-despool' to send the spooled images to the printer."
2142 (interactive) 2319 (interactive)
2320 (ebnf-log-header "(ebnf-spool-buffer)")
2143 (ebnf-spool-region (point-min) (point-max))) 2321 (ebnf-spool-region (point-min) (point-max)))
2144 2322
2145 2323
@@ -2150,6 +2328,7 @@ Like `ebnf-spool-buffer', but spools just the current region.
2150 2328
2151Use the command `ebnf-despool' to send the spooled images to the printer." 2329Use the command `ebnf-despool' to send the spooled images to the printer."
2152 (interactive "r") 2330 (interactive "r")
2331 (ebnf-log-header "(ebnf-spool-region %S)" from to)
2153 (ebnf-generate-region from to 'ebnf-generate)) 2332 (ebnf-generate-region from to 'ebnf-generate))
2154 2333
2155 2334
@@ -2166,6 +2345,7 @@ See also `ebnf-eps-buffer'."
2166 (interactive 2345 (interactive
2167 (list (read-file-name "Directory containing EBNF files (EPS): " 2346 (list (read-file-name "Directory containing EBNF files (EPS): "
2168 nil default-directory))) 2347 nil default-directory)))
2348 (ebnf-log-header "(ebnf-eps-directory %S)" directory)
2169 (ebnf-directory 'ebnf-eps-buffer directory)) 2349 (ebnf-directory 'ebnf-eps-buffer directory))
2170 2350
2171 2351
@@ -2178,6 +2358,7 @@ killed after EPS generation.
2178 2358
2179See also `ebnf-eps-buffer'." 2359See also `ebnf-eps-buffer'."
2180 (interactive "fEBNF file to generate EPS file from: ") 2360 (interactive "fEBNF file to generate EPS file from: ")
2361 (ebnf-log-header "(ebnf-eps-file %S %S)" file do-not-kill-buffer-when-done)
2181 (ebnf-file 'ebnf-eps-buffer file do-not-kill-buffer-when-done)) 2362 (ebnf-file 'ebnf-eps-buffer file do-not-kill-buffer-when-done))
2182 2363
2183 2364
@@ -2200,8 +2381,9 @@ The EPS file name has the following form:
2200 file name used in this case will be \"ebnf--A_B_+_C.eps\". 2381 file name used in this case will be \"ebnf--A_B_+_C.eps\".
2201 2382
2202WARNING: This function does *NOT* ask any confirmation to override existing 2383WARNING: This function does *NOT* ask any confirmation to override existing
2203 files." 2384 files."
2204 (interactive) 2385 (interactive)
2386 (ebnf-log-header "(ebnf-eps-buffer)")
2205 (ebnf-eps-region (point-min) (point-max))) 2387 (ebnf-eps-region (point-min) (point-max)))
2206 2388
2207 2389
@@ -2224,8 +2406,9 @@ The EPS file name has the following form:
2224 file name used in this case will be \"ebnf--A_B_+_C.eps\". 2406 file name used in this case will be \"ebnf--A_B_+_C.eps\".
2225 2407
2226WARNING: This function does *NOT* ask any confirmation to override existing 2408WARNING: This function does *NOT* ask any confirmation to override existing
2227 files." 2409 files."
2228 (interactive "r") 2410 (interactive "r")
2411 (ebnf-log-header "(ebnf-eps-region %S %S)" from to)
2229 (let ((ebnf-eps-executing t)) 2412 (let ((ebnf-eps-executing t))
2230 (ebnf-generate-region from to 'ebnf-generate-eps))) 2413 (ebnf-generate-region from to 'ebnf-generate-eps)))
2231 2414
@@ -2247,6 +2430,7 @@ See also `ebnf-syntax-buffer'."
2247 (interactive 2430 (interactive
2248 (list (read-file-name "Directory containing EBNF files (syntax): " 2431 (list (read-file-name "Directory containing EBNF files (syntax): "
2249 nil default-directory))) 2432 nil default-directory)))
2433 (ebnf-log-header "(ebnf-syntax-directory %S)" directory)
2250 (ebnf-directory 'ebnf-syntax-buffer directory)) 2434 (ebnf-directory 'ebnf-syntax-buffer directory))
2251 2435
2252 2436
@@ -2259,6 +2443,7 @@ killed after syntax checking.
2259 2443
2260See also `ebnf-syntax-buffer'." 2444See also `ebnf-syntax-buffer'."
2261 (interactive "fEBNF file to check syntax: ") 2445 (interactive "fEBNF file to check syntax: ")
2446 (ebnf-log-header "(ebnf-syntax-file %S %S)" file do-not-kill-buffer-when-done)
2262 (ebnf-file 'ebnf-syntax-buffer file do-not-kill-buffer-when-done)) 2447 (ebnf-file 'ebnf-syntax-buffer file do-not-kill-buffer-when-done))
2263 2448
2264 2449
@@ -2266,13 +2451,15 @@ See also `ebnf-syntax-buffer'."
2266(defun ebnf-syntax-buffer () 2451(defun ebnf-syntax-buffer ()
2267 "Do a syntactic analysis of the current buffer." 2452 "Do a syntactic analysis of the current buffer."
2268 (interactive) 2453 (interactive)
2454 (ebnf-log-header "(ebnf-syntax-buffer)")
2269 (ebnf-syntax-region (point-min) (point-max))) 2455 (ebnf-syntax-region (point-min) (point-max)))
2270 2456
2271 2457
2272;;;###autoload 2458;;;###autoload
2273(defun ebnf-syntax-region (from to) 2459(defun ebnf-syntax-region (from to)
2274 "Do a syntactic analysis of region." 2460 "Do a syntactic analysis of a region."
2275 (interactive "r") 2461 (interactive "r")
2462 (ebnf-log-header "(ebnf-syntax-region %S %S)" from to)
2276 (ebnf-generate-region from to nil)) 2463 (ebnf-generate-region from to nil))
2277 2464
2278 2465
@@ -2287,6 +2474,8 @@ See also `ebnf-syntax-buffer'."
2287 " 2474 "
2288;;; ebnf2ps.el version %s 2475;;; ebnf2ps.el version %s
2289 2476
2477;;; Emacs version %S
2478
2290\(setq ebnf-special-show-delimiter %S 2479\(setq ebnf-special-show-delimiter %S
2291 ebnf-special-font %s 2480 ebnf-special-font %s
2292 ebnf-special-shape %s 2481 ebnf-special-shape %s
@@ -2333,20 +2522,28 @@ See also `ebnf-syntax-buffer'."
2333 ebnf-iso-normalize-p %S 2522 ebnf-iso-normalize-p %S
2334 ebnf-file-suffix-regexp %S 2523 ebnf-file-suffix-regexp %S
2335 ebnf-eps-prefix %S 2524 ebnf-eps-prefix %S
2525 ebnf-eps-header-font %s
2526 ebnf-eps-header %s
2527 ebnf-eps-footer-font %s
2528 ebnf-eps-footer %s
2336 ebnf-entry-percentage %S 2529 ebnf-entry-percentage %S
2337 ebnf-color-p %S 2530 ebnf-color-p %S
2338 ebnf-line-width %S 2531 ebnf-line-width %S
2339 ebnf-line-color %S 2532 ebnf-line-color %S
2533 ebnf-arrow-extra-width %S
2534 ebnf-arrow-scale %S
2340 ebnf-debug-ps %S 2535 ebnf-debug-ps %S
2341 ebnf-use-float-format %S 2536 ebnf-use-float-format %S
2342 ebnf-stop-on-error %S 2537 ebnf-stop-on-error %S
2343 ebnf-yac-ignore-error-recovery %S 2538 ebnf-yac-ignore-error-recovery %S
2344 ebnf-ignore-empty-rule %S 2539 ebnf-ignore-empty-rule %S
2345 ebnf-optimize %S) 2540 ebnf-optimize %S
2541 ebnf-log %S)
2346 2542
2347;;; ebnf2ps.el - end of settings 2543;;; ebnf2ps.el - end of settings
2348" 2544"
2349 ebnf-version 2545 ebnf-version
2546 emacs-version
2350 ebnf-special-show-delimiter 2547 ebnf-special-show-delimiter
2351 (ps-print-quote ebnf-special-font) 2548 (ps-print-quote ebnf-special-font)
2352 (ps-print-quote ebnf-special-shape) 2549 (ps-print-quote ebnf-special-shape)
@@ -2393,16 +2590,23 @@ See also `ebnf-syntax-buffer'."
2393 ebnf-iso-normalize-p 2590 ebnf-iso-normalize-p
2394 ebnf-file-suffix-regexp 2591 ebnf-file-suffix-regexp
2395 ebnf-eps-prefix 2592 ebnf-eps-prefix
2593 (ps-print-quote ebnf-eps-header-font)
2594 (ps-print-quote ebnf-eps-header)
2595 (ps-print-quote ebnf-eps-footer-font)
2596 (ps-print-quote ebnf-eps-footer)
2396 ebnf-entry-percentage 2597 ebnf-entry-percentage
2397 ebnf-color-p 2598 ebnf-color-p
2398 ebnf-line-width 2599 ebnf-line-width
2399 ebnf-line-color 2600 ebnf-line-color
2601 ebnf-arrow-extra-width
2602 ebnf-arrow-scale
2400 ebnf-debug-ps 2603 ebnf-debug-ps
2401 ebnf-use-float-format 2604 ebnf-use-float-format
2402 ebnf-stop-on-error 2605 ebnf-stop-on-error
2403 ebnf-yac-ignore-error-recovery 2606 ebnf-yac-ignore-error-recovery
2404 ebnf-ignore-empty-rule 2607 ebnf-ignore-empty-rule
2405 ebnf-optimize)) 2608 ebnf-optimize
2609 ebnf-log))
2406 2610
2407 2611
2408;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2612;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -2465,6 +2669,10 @@ See also `ebnf-syntax-buffer'."
2465 ebnf-iso-normalize-p 2669 ebnf-iso-normalize-p
2466 ebnf-file-suffix-regexp 2670 ebnf-file-suffix-regexp
2467 ebnf-eps-prefix 2671 ebnf-eps-prefix
2672 ebnf-eps-header-font
2673 ebnf-eps-header
2674 ebnf-eps-footer-font
2675 ebnf-eps-footer
2468 ebnf-entry-percentage 2676 ebnf-entry-percentage
2469 ebnf-color-p 2677 ebnf-color-p
2470 ebnf-line-width 2678 ebnf-line-width
@@ -2528,6 +2736,10 @@ See also `ebnf-syntax-buffer'."
2528 (ebnf-iso-normalize-p . nil) 2736 (ebnf-iso-normalize-p . nil)
2529 (ebnf-file-suffix-regexp . "\.[Bb][Nn][Ff]$") 2737 (ebnf-file-suffix-regexp . "\.[Bb][Nn][Ff]$")
2530 (ebnf-eps-prefix . "ebnf--") 2738 (ebnf-eps-prefix . "ebnf--")
2739 (ebnf-eps-header-font . '(11 Helvetica "Black" "White" bold))
2740 (ebnf-eps-header . nil)
2741 (ebnf-eps-footer-font . '(7 Helvetica "Black" "White" bold))
2742 (ebnf-eps-footer . nil)
2531 (ebnf-entry-percentage . 0.5) 2743 (ebnf-entry-percentage . 0.5)
2532 (ebnf-color-p . (or (fboundp 'x-color-values) ; Emacs 2744 (ebnf-color-p . (or (fboundp 'x-color-values) ; Emacs
2533 (fboundp 'color-instance-rgb-components))) ; XEmacs 2745 (fboundp 'color-instance-rgb-components))) ; XEmacs
@@ -2601,6 +2813,15 @@ Don't use this variable directly. Use functions `ebnf-insert-style',
2601 2813
2602 2814
2603;;;###autoload 2815;;;###autoload
2816(defun ebnf-find-style (name)
2817 "Return style definition if NAME is already defined; otherwise, return nil.
2818
2819See `ebnf-style-database' documentation."
2820 (interactive "SStyle name: ")
2821 (assoc name ebnf-style-database))
2822
2823
2824;;;###autoload
2604(defun ebnf-insert-style (name inherits &rest values) 2825(defun ebnf-insert-style (name inherits &rest values)
2605 "Insert a new style NAME with inheritance INHERITS and values VALUES. 2826 "Insert a new style NAME with inheritance INHERITS and values VALUES.
2606 2827
@@ -2735,18 +2956,20 @@ See `ebnf-style-database' documentation."
2735;; Internal variables 2956;; Internal variables
2736 2957
2737 2958
2738(defvar ebnf-eps-buffer-name " *EPS*") 2959(defvar ebnf-eps-buffer-name " *EPS*")
2739(defvar ebnf-parser-func nil) 2960(defvar ebnf-parser-func nil)
2740(defvar ebnf-eps-executing nil) 2961(defvar ebnf-eps-executing nil)
2741(defvar ebnf-eps-upper-x 0.0) 2962(defvar ebnf-eps-header-comment nil)
2963(defvar ebnf-eps-footer-comment nil)
2964(defvar ebnf-eps-upper-x 0.0)
2742(make-variable-buffer-local 'ebnf-eps-upper-x) 2965(make-variable-buffer-local 'ebnf-eps-upper-x)
2743(defvar ebnf-eps-upper-y 0.0) 2966(defvar ebnf-eps-upper-y 0.0)
2744(make-variable-buffer-local 'ebnf-eps-upper-y) 2967(make-variable-buffer-local 'ebnf-eps-upper-y)
2745(defvar ebnf-eps-prod-width 0.0) 2968(defvar ebnf-eps-prod-width 0.0)
2746(make-variable-buffer-local 'ebnf-eps-prod-width) 2969(make-variable-buffer-local 'ebnf-eps-prod-width)
2747(defvar ebnf-eps-max-height 0.0) 2970(defvar ebnf-eps-max-height 0.0)
2748(make-variable-buffer-local 'ebnf-eps-max-height) 2971(make-variable-buffer-local 'ebnf-eps-max-height)
2749(defvar ebnf-eps-max-width 0.0) 2972(defvar ebnf-eps-max-width 0.0)
2750(make-variable-buffer-local 'ebnf-eps-max-width) 2973(make-variable-buffer-local 'ebnf-eps-max-width)
2751 2974
2752 2975
@@ -2756,6 +2979,23 @@ See `ebnf-style-database' documentation."
2756See section \"Actions in Comments\" in ebnf2ps documentation.") 2979See section \"Actions in Comments\" in ebnf2ps documentation.")
2757 2980
2758 2981
2982(defvar ebnf-eps-file-alist nil
2983"Alist associating file name with EPS header and footer.
2984
2985Each element has the following form:
2986
2987 (EPS-FILENAME HEADER FOOTER)
2988
2989EPS-FILENAME is the EPS file name.
2990HEADER is the header string or nil.
2991FOOTER is the footer string or nil.
2992
2993It's generated during parsing and used during EPS generation.
2994
2995See `ebnf-eps-context' and section \"Actions in Comments\" in ebnf2ps
2996documentation.")
2997
2998
2759(defvar ebnf-eps-production-list nil 2999(defvar ebnf-eps-production-list nil
2760 "Alist associating production name with EPS file name list. 3000 "Alist associating production name with EPS file name list.
2761 3001
@@ -2800,41 +3040,43 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and
2800`ebnf-chart-shape'.") 3040`ebnf-chart-shape'.")
2801 3041
2802 3042
2803(defvar ebnf-limit nil) 3043(defvar ebnf-limit nil)
2804(defvar ebnf-action nil) 3044(defvar ebnf-action nil)
2805(defvar ebnf-action-list nil) 3045(defvar ebnf-action-list nil)
2806 3046
2807 3047
2808(defvar ebnf-default-p nil) 3048(defvar ebnf-default-p nil)
2809 3049
2810 3050
2811(defvar ebnf-font-height-P 0) 3051(defvar ebnf-font-height-P 0)
2812(defvar ebnf-font-height-T 0) 3052(defvar ebnf-font-height-T 0)
2813(defvar ebnf-font-height-NT 0) 3053(defvar ebnf-font-height-NT 0)
2814(defvar ebnf-font-height-S 0) 3054(defvar ebnf-font-height-S 0)
2815(defvar ebnf-font-height-E 0) 3055(defvar ebnf-font-height-E 0)
2816(defvar ebnf-font-height-R 0) 3056(defvar ebnf-font-height-R 0)
2817(defvar ebnf-font-width-P 0) 3057(defvar ebnf-font-width-P 0)
2818(defvar ebnf-font-width-T 0) 3058(defvar ebnf-font-width-T 0)
2819(defvar ebnf-font-width-NT 0) 3059(defvar ebnf-font-width-NT 0)
2820(defvar ebnf-font-width-S 0) 3060(defvar ebnf-font-width-S 0)
2821(defvar ebnf-font-width-E 0) 3061(defvar ebnf-font-width-E 0)
2822(defvar ebnf-font-width-R 0) 3062(defvar ebnf-font-width-R 0)
2823(defvar ebnf-space-T 0) 3063(defvar ebnf-space-T 0)
2824(defvar ebnf-space-NT 0) 3064(defvar ebnf-space-NT 0)
2825(defvar ebnf-space-S 0) 3065(defvar ebnf-space-S 0)
2826(defvar ebnf-space-E 0) 3066(defvar ebnf-space-E 0)
2827(defvar ebnf-space-R 0) 3067(defvar ebnf-space-R 0)
2828 3068
2829 3069
2830(defvar ebnf-basic-width 0) 3070(defvar ebnf-basic-width-extra 0)
2831(defvar ebnf-basic-height 0) 3071(defvar ebnf-basic-width 0)
2832(defvar ebnf-vertical-space 0) 3072(defvar ebnf-basic-height 0)
2833(defvar ebnf-horizontal-space 0) 3073(defvar ebnf-basic-empty-height 0)
3074(defvar ebnf-vertical-space 0)
3075(defvar ebnf-horizontal-space 0)
2834 3076
2835 3077
2836(defvar ebnf-settings nil) 3078(defvar ebnf-settings nil)
2837(defvar ebnf-fonts-required nil) 3079(defvar ebnf-fonts-required nil)
2838 3080
2839 3081
2840(defconst ebnf-debug 3082(defconst ebnf-debug
@@ -3179,8 +3421,8 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and
3179 3421
3180% --- Flow Stuff 3422% --- Flow Stuff
3181 3423
3182% height prepare_height |- line_height corner_height corner_height 3424% height prepare-height |- line_height corner_height corner_height
3183/prepare_height 3425/prepare-height
3184{dup 0 gt 3426{dup 0 gt
3185 {T sub hT} 3427 {T sub hT}
3186 {T add hT neg}ifelse 3428 {T add hT neg}ifelse
@@ -3206,7 +3448,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and
3206 {0.5 mul dup 3448 {0.5 mul dup
3207 1 corner_RA 3449 1 corner_RA
3208 0 corner_RD} 3450 0 corner_RD}
3209 {prepare_height 3451 {prepare-height
3210 1 corner_RA 3452 1 corner_RA
3211 exch 0 exch rlineto 3453 exch 0 exch rlineto
3212 0 corner_RD 3454 0 corner_RD
@@ -3227,7 +3469,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and
3227% \\ 3469% \\
3228% - 3470% -
3229/LLoop 3471/LLoop
3230{prepare_height 3472{prepare-height
3231 3 corner_LA 3473 3 corner_LA
3232 exch 0 exch rlineto 3474 exch 0 exch rlineto
3233 0 corner_RD 3475 0 corner_RD
@@ -3252,7 +3494,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and
3252 {0.5 mul dup 3494 {0.5 mul dup
3253 1 corner_LA 3495 1 corner_LA
3254 0 corner_LD} 3496 0 corner_LD}
3255 {prepare_height 3497 {prepare-height
3256 1 corner_LA 3498 1 corner_LA
3257 exch 0 exch rlineto 3499 exch 0 exch rlineto
3258 0 corner_LD 3500 0 corner_LD
@@ -3273,7 +3515,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and
3273% / 3515% /
3274% - 3516% -
3275/RLoop 3517/RLoop
3276{prepare_height 3518{prepare-height
3277 1 corner_RA 3519 1 corner_RA
3278 exch 0 exch rlineto 3520 exch 0 exch rlineto
3279 0 corner_LD 3521 0 corner_LD
@@ -4064,6 +4306,113 @@ end
4064 4306
4065 4307
4066;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4308;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4309;; Header & Footer
4310
4311
4312(defun ebnf-eps-header-footer (value)
4313 ;; evaluate header/footer value
4314 ;; return a string or nil
4315 (let ((tmp (if (symbolp value)
4316 (cond ((fboundp value) (funcall value))
4317 ((boundp value) (symbol-value value))
4318 (t nil))
4319 value)))
4320 (and (stringp tmp) tmp)))
4321
4322
4323(defun ebnf-eps-header ()
4324 ;; evaluate header value
4325 (ebnf-eps-header-footer ebnf-eps-header))
4326
4327
4328(defun ebnf-eps-footer ()
4329 ;; evaluate footer value
4330 (ebnf-eps-header-footer ebnf-eps-footer))
4331
4332
4333;; hacked fom `ps-output-string-prim' (ps-print.el)
4334(defun ebnf-eps-string (string)
4335 (let* ((str (string-as-unibyte string))
4336 (len (length str))
4337 (index 0)
4338 (new "(") ; insert start-string delimiter
4339 start special)
4340 ;; Find and quote special characters as necessary for PS
4341 ;; This skips everything except control chars, non-ASCII chars, (, ) and \.
4342 (while (setq start (string-match "[^]-~ -'*-[]" str index))
4343 (setq special (aref str start)
4344 new (concat new
4345 (substring str index start)
4346 (if (and (<= 0 special) (<= special 255))
4347 (aref ps-string-escape-codes special)
4348 ;; insert hexadecimal representation if character
4349 ;; code is out of range
4350 (format "\\%04X" special)))
4351 index (1+ start)))
4352 (concat new
4353 (and (< index len)
4354 (substring str index len))
4355 ")"))) ; insert end-string delimiter
4356
4357
4358(defun ebnf-eps-header-footer-comment (str)
4359 ;; parse header/footer comment string
4360 (let ((len (1- (length str)))
4361 (index 0)
4362 new start fmt)
4363 (while (setq start (string-match "%" str index))
4364 (setq fmt (if (< start len) (aref str (1+ start)) ?\?)
4365 new (concat new
4366 (substring str index start)
4367 (cond ((= fmt ?%) "%")
4368 ((= fmt ?H) (ebnf-eps-header))
4369 ((= fmt ?F) (ebnf-eps-footer))
4370 (t nil)
4371 ))
4372 index (+ start 2)))
4373 (ebnf-eps-string (concat new
4374 (and (<= index len)
4375 (substring str index (1+ len)))))))
4376
4377
4378(defun ebnf-eps-header-footer-p (value)
4379 ;; return t if value is non-nil and is not an empty string
4380 (not (or (null value)
4381 (and (stringp value) (string= value "")))))
4382
4383
4384(defun ebnf-eps-header-comment (str)
4385 ;; set header comment if header is on
4386 (when (ebnf-eps-header-footer-p ebnf-eps-header)
4387 (setq ebnf-eps-header-comment (ebnf-eps-header-footer-comment str))))
4388
4389
4390(defun ebnf-eps-footer-comment (str)
4391 ;; set footer comment if footer is on
4392 (when (ebnf-eps-header-footer-p ebnf-eps-footer)
4393 (setq ebnf-eps-footer-comment (ebnf-eps-header-footer-comment str))))
4394
4395
4396(defun ebnf-eps-header-footer-file (filename)
4397 ;; associate header and footer with a filename
4398 (let ((filehf (assoc filename ebnf-eps-file-alist))
4399 (header (or ebnf-eps-header-comment (ebnf-eps-header)))
4400 (footer (or ebnf-eps-footer-comment (ebnf-eps-footer))))
4401 (if (null filehf)
4402 (setq ebnf-eps-file-alist (cons (list filename header footer)
4403 ebnf-eps-file-alist))
4404 (setcar (nthcdr 1 filehf) header)
4405 (setcar (nthcdr 2 filehf) footer))))
4406
4407
4408(defun ebnf-eps-header-footer-set (filename)
4409 ;; set header and footer from a filename
4410 (let ((header-footer (assoc filename ebnf-eps-file-alist)))
4411 (setq ebnf-eps-header-comment (nth 1 header-footer)
4412 ebnf-eps-footer-comment (nth 2 header-footer))))
4413
4414
4415;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4067;; Formatting 4416;; Formatting
4068 4417
4069 4418
@@ -4513,7 +4862,9 @@ end
4513 (if sep 4862 (if sep
4514 (let ((ebnf-direction "L")) 4863 (let ((ebnf-direction "L"))
4515 (ebnf-node-generation sep)) 4864 (ebnf-node-generation sep))
4516 (ebnf-empty-alternative (- width ebnf-horizontal-space)))) 4865 (ebnf-empty-alternative (- width
4866 ebnf-horizontal-space
4867 ebnf-basic-width-extra))))
4517 (ps-output "EOS\n")) 4868 (ps-output "EOS\n"))
4518 4869
4519 4870
@@ -4528,7 +4879,7 @@ end
4528 (if node-sep 4879 (if node-sep
4529 (- (ebnf-node-height node-sep) 4880 (- (ebnf-node-height node-sep)
4530 (ebnf-node-entry node-sep)) 4881 (ebnf-node-entry node-sep))
4531 0)))) 4882 ebnf-basic-empty-height))))
4532 (ps-output (ebnf-format-float entry 4883 (ps-output (ebnf-format-float entry
4533 (+ (- (ebnf-node-height node-list) 4884 (+ (- (ebnf-node-height node-list)
4534 list-entry) 4885 list-entry)
@@ -4540,7 +4891,9 @@ end
4540 (if (ebnf-node-separator zero-or-more) 4891 (if (ebnf-node-separator zero-or-more)
4541 (let ((ebnf-direction "L")) 4892 (let ((ebnf-direction "L"))
4542 (ebnf-node-generation (ebnf-node-separator zero-or-more))) 4893 (ebnf-node-generation (ebnf-node-separator zero-or-more)))
4543 (ebnf-empty-alternative (- width ebnf-horizontal-space)))) 4894 (ebnf-empty-alternative (- width
4895 ebnf-horizontal-space
4896 ebnf-basic-width-extra))))
4544 (ps-output "EOS\n")) 4897 (ps-output "EOS\n"))
4545 4898
4546 4899
@@ -4662,7 +5015,9 @@ killed after process termination."
4662(defun ebnf-eps-filename (str) 5015(defun ebnf-eps-filename (str)
4663 (let* ((len (length str)) 5016 (let* ((len (length str))
4664 (stri 0) 5017 (stri 0)
4665 (new (make-string len ?\s))) 5018 ;; to keep compatibility with Emacs 20 & 21:
5019 ;; DO NOT REPLACE `?\ ' BY `?\s'
5020 (new (make-string len ?\ )))
4666 (while (< stri len) 5021 (while (< stri len)
4667 (aset new stri (aref ebnf-map-name (aref str stri))) 5022 (aset new stri (aref ebnf-map-name (aref str stri)))
4668 (setq stri (1+ stri))) 5023 (setq stri (1+ stri)))
@@ -4723,6 +5078,7 @@ killed after process termination."
4723 5078
4724 5079
4725(defun ebnf-parse-and-sort (start) 5080(defun ebnf-parse-and-sort (start)
5081 (ebnf-log "(ebnf-parse-and-sort %S)" start)
4726 (ebnf-begin-job) 5082 (ebnf-begin-job)
4727 (let ((tree (funcall ebnf-parser-func start))) 5083 (let ((tree (funcall ebnf-parser-func start)))
4728 (if ebnf-sort-production 5084 (if ebnf-sort-production
@@ -4861,7 +5217,10 @@ killed after process termination."
4861 ebnf-action nil 5217 ebnf-action nil
4862 ebnf-default-p nil 5218 ebnf-default-p nil
4863 ebnf-eps-context nil 5219 ebnf-eps-context nil
5220 ebnf-eps-file-alist nil
4864 ebnf-eps-production-list nil 5221 ebnf-eps-production-list nil
5222 ebnf-eps-header-comment nil
5223 ebnf-eps-footer-comment nil
4865 ebnf-eps-upper-x 0.0 5224 ebnf-eps-upper-x 0.0
4866 ebnf-eps-upper-y 0.0 5225 ebnf-eps-upper-y 0.0
4867 ebnf-font-height-P (ebnf-font-height ebnf-production-font) 5226 ebnf-font-height-P (ebnf-font-height ebnf-production-font)
@@ -4882,10 +5241,14 @@ killed after process termination."
4882 ebnf-space-E (* ebnf-font-height-E 0.5) 5241 ebnf-space-E (* ebnf-font-height-E 0.5)
4883 ebnf-space-R (* ebnf-font-height-R 0.5)) 5242 ebnf-space-R (* ebnf-font-height-R 0.5))
4884 (let ((basic (+ ebnf-font-height-T ebnf-font-height-NT))) 5243 (let ((basic (+ ebnf-font-height-T ebnf-font-height-NT)))
4885 (setq ebnf-basic-width (* basic 0.5) 5244 (setq ebnf-basic-width (* basic 0.5)
4886 ebnf-horizontal-space (+ basic basic) 5245 ebnf-horizontal-space (+ basic basic)
4887 ebnf-basic-height ebnf-basic-width 5246 ebnf-basic-empty-height (* ebnf-basic-width 0.5)
4888 ebnf-vertical-space ebnf-basic-width) 5247 ebnf-basic-height ebnf-basic-width
5248 ebnf-vertical-space ebnf-basic-width
5249 ebnf-basic-width-extra (- ebnf-basic-width
5250 ebnf-arrow-extra-width
5251 0.1)) ; error factor
4889 ;; ensures value is greater than zero 5252 ;; ensures value is greater than zero
4890 (or (and (numberp ebnf-production-horizontal-space) 5253 (or (and (numberp ebnf-production-horizontal-space)
4891 (> ebnf-production-horizontal-space 0.0)) 5254 (> ebnf-production-horizontal-space 0.0))
@@ -4893,7 +5256,18 @@ killed after process termination."
4893 ;; ensures value is greater than zero 5256 ;; ensures value is greater than zero
4894 (or (and (numberp ebnf-production-vertical-space) 5257 (or (and (numberp ebnf-production-vertical-space)
4895 (> ebnf-production-vertical-space 0.0)) 5258 (> ebnf-production-vertical-space 0.0))
4896 (setq ebnf-production-vertical-space basic)))) 5259 (setq ebnf-production-vertical-space basic)))
5260 (ebnf-log "(ebnf-begin-job)")
5261 (ebnf-log " ebnf-arrow-extra-width ............ : %7.3f" ebnf-arrow-extra-width)
5262 (ebnf-log " ebnf-arrow-scale .................. : %7.3f" ebnf-arrow-scale)
5263 (ebnf-log " ebnf-basic-width-extra ............ : %7.3f" ebnf-basic-width-extra)
5264 (ebnf-log " ebnf-basic-width .................. : %7.3f (T)" ebnf-basic-width)
5265 (ebnf-log " ebnf-horizontal-space ............. : %7.3f (4T)" ebnf-horizontal-space)
5266 (ebnf-log " ebnf-basic-empty-height ........... : %7.3f (hT)" ebnf-basic-empty-height)
5267 (ebnf-log " ebnf-basic-height ................. : %7.3f (T)" ebnf-basic-height)
5268 (ebnf-log " ebnf-vertical-space ............... : %7.3f (T)" ebnf-vertical-space)
5269 (ebnf-log " ebnf-production-horizontal-space .. : %7.3f (2T)" ebnf-production-horizontal-space)
5270 (ebnf-log " ebnf-production-vertical-space .... : %7.3f (2T)" ebnf-production-vertical-space))
4897 5271
4898 5272
4899(defsubst ebnf-shape-value (sym alist) 5273(defsubst ebnf-shape-value (sym alist)
@@ -4916,6 +5290,7 @@ killed after process termination."
4916 (progn 5290 (progn
4917 ;; adjust creator comment 5291 ;; adjust creator comment
4918 (end-of-line) 5292 (end-of-line)
5293 ;; (backward-char)
4919 (insert " & ebnf2ps v" ebnf-version) 5294 (insert " & ebnf2ps v" ebnf-version)
4920 ;; insert ebnf settings & engine 5295 ;; insert ebnf settings & engine
4921 (goto-char (point-max)) 5296 (goto-char (point-max))
@@ -4928,6 +5303,7 @@ killed after process termination."
4928 (when (buffer-modified-p buffer) 5303 (when (buffer-modified-p buffer)
4929 (save-excursion 5304 (save-excursion
4930 (set-buffer buffer) 5305 (set-buffer buffer)
5306 (ebnf-eps-header-footer-set filename)
4931 (setq ebnf-eps-upper-x (max ebnf-eps-upper-x ebnf-eps-max-width) 5307 (setq ebnf-eps-upper-x (max ebnf-eps-upper-x ebnf-eps-max-width)
4932 ebnf-eps-upper-y (if (zerop ebnf-eps-upper-y) 5308 ebnf-eps-upper-y (if (zerop ebnf-eps-upper-y)
4933 ebnf-eps-max-height 5309 ebnf-eps-max-height
@@ -4954,7 +5330,9 @@ killed after process termination."
4954 ebnf-non-terminal-font 5330 ebnf-non-terminal-font
4955 ebnf-special-font 5331 ebnf-special-font
4956 ebnf-except-font 5332 ebnf-except-font
4957 ebnf-repeat-font))) 5333 ebnf-repeat-font
5334 ebnf-eps-header-font
5335 ebnf-eps-footer-font)))
4958 "\n%%+ font "))) 5336 "\n%%+ font ")))
4959 "\n%%Pages: 0\n%%EndComments\n\n%%BeginProlog\n" 5337 "\n%%Pages: 0\n%%EndComments\n\n%%BeginProlog\n"
4960 ebnf-eps-prologue) 5338 ebnf-eps-prologue)
@@ -4980,6 +5358,42 @@ killed after process termination."
4980 (setq ebnf-settings 5358 (setq ebnf-settings
4981 (concat 5359 (concat
4982 "\n\n% === begin EBNF settings\n\n" 5360 "\n\n% === begin EBNF settings\n\n"
5361 (format "/Header %s def\n"
5362 (or ebnf-eps-header-comment "()"))
5363 (format "/Footer %s def\n"
5364 (or ebnf-eps-footer-comment "()"))
5365 ;; header
5366 (format "/ShowHeader %s def\n"
5367 (ebnf-boolean
5368 (ebnf-eps-header-footer-p ebnf-eps-header)))
5369 (format "/fH %s /%s DefFont\n"
5370 (ebnf-format-float
5371 (ebnf-font-size ebnf-eps-header-font))
5372 (ebnf-font-name-select ebnf-eps-header-font))
5373 (ebnf-format-color "/ForegroundH %s def %% %s\n"
5374 (ebnf-font-foreground ebnf-eps-header-font)
5375 "Black")
5376 (ebnf-format-color "/BackgroundH %s def %% %s\n"
5377 (ebnf-font-background ebnf-eps-header-font)
5378 "White")
5379 (format "/EffectH %d def\n"
5380 (ebnf-font-attributes ebnf-eps-header-font))
5381 ;; footer
5382 (format "/ShowFooter %s def\n"
5383 (ebnf-boolean
5384 (ebnf-eps-header-footer-p ebnf-eps-footer)))
5385 (format "/fF %s /%s DefFont\n"
5386 (ebnf-format-float
5387 (ebnf-font-size ebnf-eps-footer-font))
5388 (ebnf-font-name-select ebnf-eps-footer-font))
5389 (ebnf-format-color "/ForegroundF %s def %% %s\n"
5390 (ebnf-font-foreground ebnf-eps-footer-font)
5391 "Black")
5392 (ebnf-format-color "/BackgroundF %s def %% %s\n"
5393 (ebnf-font-background ebnf-eps-footer-font)
5394 "White")
5395 (format "/EffectF %d def\n"
5396 (ebnf-font-attributes ebnf-eps-footer-font))
4983 ;; production 5397 ;; production
4984 (format "/fP %s /%s DefFont\n" 5398 (format "/fP %s /%s DefFont\n"
4985 (ebnf-format-float (ebnf-font-size ebnf-production-font)) 5399 (ebnf-format-float (ebnf-font-size ebnf-production-font))
@@ -5136,6 +5550,7 @@ killed after process termination."
5136 5550
5137 5551
5138(defun ebnf-dimensions (tree) 5552(defun ebnf-dimensions (tree)
5553 (ebnf-log "(ebnf-dimensions tree)")
5139 (let ((ebnf-total (length tree)) 5554 (let ((ebnf-total (length tree))
5140 (ebnf-nprod 0)) 5555 (ebnf-nprod 0))
5141 (mapcar 'ebnf-production-dimension tree)) 5556 (mapcar 'ebnf-production-dimension tree))
@@ -5149,6 +5564,7 @@ killed after process termination."
5149 5564
5150;; [production width-fun dim-fun entry height width name production action] 5565;; [production width-fun dim-fun entry height width name production action]
5151(defun ebnf-production-dimension (production) 5566(defun ebnf-production-dimension (production)
5567 (ebnf-log "(ebnf-production-dimension production)")
5152 (ebnf-message-info "Calculating dimensions") 5568 (ebnf-message-info "Calculating dimensions")
5153 (ebnf-node-dimension-func (ebnf-node-production production)) 5569 (ebnf-node-dimension-func (ebnf-node-production production))
5154 (let* ((prod (ebnf-node-production production)) 5570 (let* ((prod (ebnf-node-production production))
@@ -5162,11 +5578,17 @@ killed after process termination."
5162 (ebnf-node-height production height) 5578 (ebnf-node-height production height)
5163 (ebnf-node-width production (+ (ebnf-node-width prod) 5579 (ebnf-node-width production (+ (ebnf-node-width prod)
5164 ebnf-line-width 5580 ebnf-line-width
5165 ebnf-horizontal-space)))) 5581 ebnf-horizontal-space
5582 ebnf-basic-width-extra)))
5583 (ebnf-log " production name : %S" (ebnf-node-name production))
5584 (ebnf-log " production entry : %7.3f" (ebnf-node-entry production))
5585 (ebnf-log " production height : %7.3f" (ebnf-node-height production))
5586 (ebnf-log " production width : %7.3f" (ebnf-node-width production)))
5166 5587
5167 5588
5168;; [terminal width-fun dim-fun entry height width name] 5589;; [terminal width-fun dim-fun entry height width name]
5169(defun ebnf-terminal-dimension (terminal) 5590(defun ebnf-terminal-dimension (terminal)
5591 (ebnf-log "(ebnf-terminal-dimension terminal)")
5170 (ebnf-terminal-dimension1 terminal 5592 (ebnf-terminal-dimension1 terminal
5171 ebnf-font-height-T 5593 ebnf-font-height-T
5172 ebnf-font-width-T 5594 ebnf-font-width-T
@@ -5175,6 +5597,7 @@ killed after process termination."
5175 5597
5176;; [non-terminal width-fun dim-fun entry height width name] 5598;; [non-terminal width-fun dim-fun entry height width name]
5177(defun ebnf-non-terminal-dimension (non-terminal) 5599(defun ebnf-non-terminal-dimension (non-terminal)
5600 (ebnf-log "(ebnf-non-terminal-dimension non-terminal)")
5178 (ebnf-terminal-dimension1 non-terminal 5601 (ebnf-terminal-dimension1 non-terminal
5179 ebnf-font-height-NT 5602 ebnf-font-height-NT
5180 ebnf-font-width-NT 5603 ebnf-font-width-NT
@@ -5183,6 +5606,7 @@ killed after process termination."
5183 5606
5184;; [special width-fun dim-fun entry height width name] 5607;; [special width-fun dim-fun entry height width name]
5185(defun ebnf-special-dimension (special) 5608(defun ebnf-special-dimension (special)
5609 (ebnf-log "(ebnf-special-dimension special)")
5186 (ebnf-terminal-dimension1 special 5610 (ebnf-terminal-dimension1 special
5187 ebnf-font-height-S 5611 ebnf-font-height-S
5188 ebnf-font-width-S 5612 ebnf-font-width-S
@@ -5194,9 +5618,16 @@ killed after process termination."
5194 (len (length (ebnf-node-name node)))) 5618 (len (length (ebnf-node-name node))))
5195 (ebnf-node-entry node (* height 0.5)) 5619 (ebnf-node-entry node (* height 0.5))
5196 (ebnf-node-height node height) 5620 (ebnf-node-height node height)
5197 (ebnf-node-width node (+ ebnf-basic-width ebnf-arrow-extra-width space 5621 (ebnf-node-width node (+ ebnf-basic-width
5622 ebnf-arrow-extra-width
5623 space
5198 (* len font-width) 5624 (* len font-width)
5199 space ebnf-basic-width)))) 5625 space
5626 ebnf-basic-width)))
5627 (ebnf-log " name : %S" (ebnf-node-name node))
5628 (ebnf-log " entry : %7.3f" (ebnf-node-entry node))
5629 (ebnf-log " height : %7.3f" (ebnf-node-height node))
5630 (ebnf-log " width : %7.3f" (ebnf-node-width node)))
5200 5631
5201 5632
5202(defconst ebnf-null-vector (vector t t t 0.0 0.0 0.0)) 5633(defconst ebnf-null-vector (vector t t t 0.0 0.0 0.0))
@@ -5204,6 +5635,7 @@ killed after process termination."
5204 5635
5205;; [repeat width-fun dim-fun entry height width times element] 5636;; [repeat width-fun dim-fun entry height width times element]
5206(defun ebnf-repeat-dimension (repeat) 5637(defun ebnf-repeat-dimension (repeat)
5638 (ebnf-log "(ebnf-repeat-dimension repeat)")
5207 (let ((times (ebnf-node-name repeat)) 5639 (let ((times (ebnf-node-name repeat))
5208 (element (ebnf-node-separator repeat))) 5640 (element (ebnf-node-separator repeat)))
5209 (if element 5641 (if element
@@ -5218,11 +5650,15 @@ killed after process termination."
5218 ebnf-arrow-extra-width 5650 ebnf-arrow-extra-width
5219 ebnf-space-R ebnf-space-R ebnf-space-R 5651 ebnf-space-R ebnf-space-R ebnf-space-R
5220 ebnf-horizontal-space 5652 ebnf-horizontal-space
5221 (* (length times) ebnf-font-width-R))))) 5653 (* (length times) ebnf-font-width-R))))
5654 (ebnf-log " repeat entry : %7.3f" (ebnf-node-entry repeat))
5655 (ebnf-log " repeat height : %7.3f" (ebnf-node-height repeat))
5656 (ebnf-log " repeat width : %7.3f" (ebnf-node-width repeat)))
5222 5657
5223 5658
5224;; [except width-fun dim-fun entry height width element element] 5659;; [except width-fun dim-fun entry height width element element]
5225(defun ebnf-except-dimension (except) 5660(defun ebnf-except-dimension (except)
5661 (ebnf-log "(ebnf-except-dimension except)")
5226 (let ((factor (ebnf-node-list except)) 5662 (let ((factor (ebnf-node-list except))
5227 (element (ebnf-node-separator except))) 5663 (element (ebnf-node-separator except)))
5228 (ebnf-node-dimension-func factor) 5664 (ebnf-node-dimension-func factor)
@@ -5241,11 +5677,15 @@ killed after process termination."
5241 ebnf-space-E ebnf-space-E 5677 ebnf-space-E ebnf-space-E
5242 ebnf-space-E ebnf-space-E 5678 ebnf-space-E ebnf-space-E
5243 ebnf-font-width-E 5679 ebnf-font-width-E
5244 ebnf-horizontal-space)))) 5680 ebnf-horizontal-space)))
5681 (ebnf-log " except entry : %7.3f" (ebnf-node-entry except))
5682 (ebnf-log " except height : %7.3f" (ebnf-node-height except))
5683 (ebnf-log " except width : %7.3f" (ebnf-node-width except)))
5245 5684
5246 5685
5247;; [alternative width-fun dim-fun entry height width list] 5686;; [alternative width-fun dim-fun entry height width list]
5248(defun ebnf-alternative-dimension (alternative) 5687(defun ebnf-alternative-dimension (alternative)
5688 (ebnf-log "(ebnf-alternative-dimension alternative)")
5249 (let ((body (ebnf-node-list alternative)) 5689 (let ((body (ebnf-node-list alternative))
5250 (lis (ebnf-node-list alternative))) 5690 (lis (ebnf-node-list alternative)))
5251 (while lis 5691 (while lis
@@ -5270,23 +5710,33 @@ killed after process termination."
5270 (- (ebnf-node-height tail) 5710 (- (ebnf-node-height tail)
5271 (ebnf-node-entry tail)))))) 5711 (ebnf-node-entry tail))))))
5272 (ebnf-node-height alternative height) 5712 (ebnf-node-height alternative height)
5273 (ebnf-node-width alternative (+ width ebnf-horizontal-space)) 5713 (ebnf-node-width alternative (+ width
5274 (ebnf-node-list alternative body)))) 5714 ebnf-horizontal-space
5715 ebnf-basic-width-extra))
5716 (ebnf-node-list alternative body)))
5717 (ebnf-log " alternative entry : %7.3f" (ebnf-node-entry alternative))
5718 (ebnf-log " alternative height : %7.3f" (ebnf-node-height alternative))
5719 (ebnf-log " alternative width : %7.3f" (ebnf-node-width alternative)))
5275 5720
5276 5721
5277;; [optional width-fun dim-fun entry height width element] 5722;; [optional width-fun dim-fun entry height width element]
5278(defun ebnf-optional-dimension (optional) 5723(defun ebnf-optional-dimension (optional)
5724 (ebnf-log "(ebnf-optional-dimension optional)")
5279 (let ((body (ebnf-node-list optional))) 5725 (let ((body (ebnf-node-list optional)))
5280 (ebnf-node-dimension-func body) 5726 (ebnf-node-dimension-func body)
5281 (ebnf-node-entry optional (ebnf-node-entry body)) 5727 (ebnf-node-entry optional (ebnf-node-entry body))
5282 (ebnf-node-height optional (+ (ebnf-node-height body) 5728 (ebnf-node-height optional (+ (ebnf-node-height body)
5283 ebnf-vertical-space)) 5729 ebnf-vertical-space))
5284 (ebnf-node-width optional (+ (ebnf-node-width body) 5730 (ebnf-node-width optional (+ (ebnf-node-width body)
5285 ebnf-horizontal-space)))) 5731 ebnf-horizontal-space)))
5732 (ebnf-log " optional entry : %7.3f" (ebnf-node-entry optional))
5733 (ebnf-log " optional height : %7.3f" (ebnf-node-height optional))
5734 (ebnf-log " optional width : %7.3f" (ebnf-node-width optional)))
5286 5735
5287 5736
5288;; [one-or-more width-fun dim-fun entry height width element separator] 5737;; [one-or-more width-fun dim-fun entry height width element separator]
5289(defun ebnf-one-or-more-dimension (or-more) 5738(defun ebnf-one-or-more-dimension (or-more)
5739 (ebnf-log "(ebnf-one-or-more-dimension or-more)")
5290 (let ((list-part (ebnf-node-list or-more)) 5740 (let ((list-part (ebnf-node-list or-more))
5291 (sep-part (ebnf-node-separator or-more))) 5741 (sep-part (ebnf-node-separator or-more)))
5292 (ebnf-node-dimension-func list-part) 5742 (ebnf-node-dimension-func list-part)
@@ -5294,7 +5744,7 @@ killed after process termination."
5294 (ebnf-node-dimension-func sep-part)) 5744 (ebnf-node-dimension-func sep-part))
5295 (let ((height (+ (if sep-part 5745 (let ((height (+ (if sep-part
5296 (ebnf-node-height sep-part) 5746 (ebnf-node-height sep-part)
5297 0.0) 5747 ebnf-basic-empty-height)
5298 ebnf-vertical-space 5748 ebnf-vertical-space
5299 (ebnf-node-height list-part))) 5749 (ebnf-node-height list-part)))
5300 (width (max (if sep-part 5750 (width (max (if sep-part
@@ -5304,14 +5754,21 @@ killed after process termination."
5304 (when sep-part 5754 (when sep-part
5305 (ebnf-adjust-width list-part width) 5755 (ebnf-adjust-width list-part width)
5306 (ebnf-adjust-width sep-part width)) 5756 (ebnf-adjust-width sep-part width))
5307 (ebnf-node-entry or-more (+ (- height (ebnf-node-height list-part)) 5757 (ebnf-node-entry or-more (+ (- height
5758 (ebnf-node-height list-part))
5308 (ebnf-node-entry list-part))) 5759 (ebnf-node-entry list-part)))
5309 (ebnf-node-height or-more height) 5760 (ebnf-node-height or-more height)
5310 (ebnf-node-width or-more (+ width ebnf-horizontal-space))))) 5761 (ebnf-node-width or-more (+ width
5762 ebnf-horizontal-space
5763 ebnf-basic-width-extra))))
5764 (ebnf-log " one-or-more entry : %7.3f" (ebnf-node-entry or-more))
5765 (ebnf-log " one-or-more height : %7.3f" (ebnf-node-height or-more))
5766 (ebnf-log " one-or-more width : %7.3f" (ebnf-node-width or-more)))
5311 5767
5312 5768
5313;; [zero-or-more width-fun dim-fun entry height width element separator] 5769;; [zero-or-more width-fun dim-fun entry height width element separator]
5314(defun ebnf-zero-or-more-dimension (or-more) 5770(defun ebnf-zero-or-more-dimension (or-more)
5771 (ebnf-log "(ebnf-zero-or-more-dimension or-more)")
5315 (let ((list-part (ebnf-node-list or-more)) 5772 (let ((list-part (ebnf-node-list or-more))
5316 (sep-part (ebnf-node-separator or-more))) 5773 (sep-part (ebnf-node-separator or-more)))
5317 (ebnf-node-dimension-func list-part) 5774 (ebnf-node-dimension-func list-part)
@@ -5319,7 +5776,7 @@ killed after process termination."
5319 (ebnf-node-dimension-func sep-part)) 5776 (ebnf-node-dimension-func sep-part))
5320 (let ((height (+ (if sep-part 5777 (let ((height (+ (if sep-part
5321 (ebnf-node-height sep-part) 5778 (ebnf-node-height sep-part)
5322 0.0) 5779 ebnf-basic-empty-height)
5323 ebnf-vertical-space 5780 ebnf-vertical-space
5324 (ebnf-node-height list-part) 5781 (ebnf-node-height list-part)
5325 ebnf-vertical-space)) 5782 ebnf-vertical-space))
@@ -5332,11 +5789,17 @@ killed after process termination."
5332 (ebnf-adjust-width sep-part width)) 5789 (ebnf-adjust-width sep-part width))
5333 (ebnf-node-entry or-more height) 5790 (ebnf-node-entry or-more height)
5334 (ebnf-node-height or-more height) 5791 (ebnf-node-height or-more height)
5335 (ebnf-node-width or-more (+ width ebnf-horizontal-space))))) 5792 (ebnf-node-width or-more (+ width
5793 ebnf-horizontal-space
5794 ebnf-basic-width-extra))))
5795 (ebnf-log " zero-or-more entry : %7.3f" (ebnf-node-entry or-more))
5796 (ebnf-log " zero-or-more height : %7.3f" (ebnf-node-height or-more))
5797 (ebnf-log " zero-or-more width : %7.3f" (ebnf-node-width or-more)))
5336 5798
5337 5799
5338;; [sequence width-fun dim-fun entry height width list] 5800;; [sequence width-fun dim-fun entry height width list]
5339(defun ebnf-sequence-dimension (sequence) 5801(defun ebnf-sequence-dimension (sequence)
5802 (ebnf-log "(ebnf-sequence-dimension sequence)")
5340 (let ((above 0.0) 5803 (let ((above 0.0)
5341 (below 0.0) 5804 (below 0.0)
5342 (width 0.0) 5805 (width 0.0)
@@ -5352,7 +5815,10 @@ killed after process termination."
5352 width (+ width (ebnf-node-width node)))) 5815 width (+ width (ebnf-node-width node))))
5353 (ebnf-node-entry sequence above) 5816 (ebnf-node-entry sequence above)
5354 (ebnf-node-height sequence (+ above below)) 5817 (ebnf-node-height sequence (+ above below))
5355 (ebnf-node-width sequence width))) 5818 (ebnf-node-width sequence width))
5819 (ebnf-log " sequence entry : %7.3f" (ebnf-node-entry sequence))
5820 (ebnf-log " sequence height : %7.3f" (ebnf-node-height sequence))
5821 (ebnf-log " sequence width : %7.3f" (ebnf-node-width sequence)))
5356 5822
5357 5823
5358;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 5824;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -5494,7 +5960,8 @@ killed after process termination."
5494 (let ((filename (ebnf-eps-filename name))) 5960 (let ((filename (ebnf-eps-filename name)))
5495 (if (member filename ebnf-eps-context) 5961 (if (member filename ebnf-eps-context)
5496 (error "Try to open an already opened EPS file: %s" filename) 5962 (error "Try to open an already opened EPS file: %s" filename)
5497 (setq ebnf-eps-context (cons filename ebnf-eps-context))))) 5963 (setq ebnf-eps-context (cons filename ebnf-eps-context)))
5964 (ebnf-eps-header-footer-file filename)))
5498 5965
5499 5966
5500(defun ebnf-eps-remove-context (name) 5967(defun ebnf-eps-remove-context (name)
@@ -5505,14 +5972,16 @@ killed after process termination."
5505 5972
5506 5973
5507(defun ebnf-eps-add-production (header) 5974(defun ebnf-eps-add-production (header)
5508 (and ebnf-eps-executing 5975 (when ebnf-eps-executing
5509 ebnf-eps-context 5976 (if ebnf-eps-context
5510 (let ((prod (assoc header ebnf-eps-production-list))) 5977 (let ((prod (assoc header ebnf-eps-production-list)))
5511 (if prod 5978 (if prod
5512 (setcdr prod (append ebnf-eps-context (cdr prod))) 5979 (setcdr prod (ebnf-dup-list
5513 (setq ebnf-eps-production-list 5980 (append ebnf-eps-context (cdr prod))))
5514 (cons (cons header (ebnf-dup-list ebnf-eps-context)) 5981 (setq ebnf-eps-production-list
5515 ebnf-eps-production-list)))))) 5982 (cons (cons header (ebnf-dup-list ebnf-eps-context))
5983 ebnf-eps-production-list))))
5984 (ebnf-eps-header-footer-file (ebnf-eps-filename header)))))
5516 5985
5517 5986
5518(defun ebnf-dup-list (old) 5987(defun ebnf-dup-list (old)
@@ -5567,7 +6036,9 @@ killed after process termination."
5567(defun ebnf-trim-right (str) 6036(defun ebnf-trim-right (str)
5568 (let* ((len (1- (length str))) 6037 (let* ((len (1- (length str)))
5569 (index len)) 6038 (index len))
5570 (while (and (> index 0) (= (aref str index) ?\s)) 6039 ;; to keep compatibility with Emacs 20 & 21:
6040 ;; DO NOT REPLACE `?\ ' BY `?\s'
6041 (while (and (> index 0) (= (aref str index) ?\ ))
5571 (setq index (1- index))) 6042 (setq index (1- index)))
5572 (if (= index len) 6043 (if (= index len)
5573 str 6044 str
@@ -5579,12 +6050,12 @@ killed after process termination."
5579 6050
5580 6051
5581(defun ebnf-make-empty (&optional width) 6052(defun ebnf-make-empty (&optional width)
5582 (vector 'ebnf-generate-empty 6053 (vector 'ebnf-generate-empty ; 0 generator
5583 'ignore 6054 'ignore ; 1 width fun
5584 'ignore 6055 'ignore ; 2 dimension fun
5585 0.0 6056 0.0 ; 3 entry
5586 0.0 6057 0.0 ; 4 height
5587 (or width ebnf-horizontal-space))) 6058 (or width ebnf-horizontal-space))) ; 5 width
5588 6059
5589 6060
5590(defun ebnf-make-terminal (name) 6061(defun ebnf-make-terminal (name)
@@ -5606,19 +6077,19 @@ killed after process termination."
5606 6077
5607 6078
5608(defun ebnf-make-terminal1 (name gen-func dim-func) 6079(defun ebnf-make-terminal1 (name gen-func dim-func)
5609 (vector gen-func 6080 (vector gen-func ; 0 generatore
5610 'ignore 6081 'ignore ; 1 width fun
5611 dim-func 6082 dim-func ; 2 dimension fun
5612 0.0 6083 0.0 ; 3 entry
5613 0.0 6084 0.0 ; 4 height
5614 0.0 6085 0.0 ; 5 width
5615 (let ((len (length name))) 6086 (let ((len (length name))) ; 6 name
5616 (cond ((> len 3) name) 6087 (cond ((> len 3) name)
5617 ((= len 3) (concat name " ")) 6088 ((= len 3) (concat name " "))
5618 ((= len 2) (concat " " name " ")) 6089 ((= len 2) (concat " " name " "))
5619 ((= len 1) (concat " " name " ")) 6090 ((= len 1) (concat " " name " "))
5620 (t " "))) 6091 (t " ")))
5621 ebnf-default-p)) 6092 ebnf-default-p)) ; 7 is default?
5622 6093
5623 6094
5624(defun ebnf-make-one-or-more (list-part &optional sep-part) 6095(defun ebnf-make-one-or-more (list-part &optional sep-part)
@@ -5636,70 +6107,71 @@ killed after process termination."
5636 6107
5637 6108
5638(defun ebnf-make-or-more1 (gen-func dim-func list-part sep-part) 6109(defun ebnf-make-or-more1 (gen-func dim-func list-part sep-part)
5639 (vector gen-func 6110 (vector gen-func ; 0 generator
5640 'ebnf-element-width 6111 'ebnf-element-width ; 1 width fun
5641 dim-func 6112 dim-func ; 2 dimension fun
5642 0.0 6113 0.0 ; 3 entry
5643 0.0 6114 0.0 ; 4 height
5644 0.0 6115 0.0 ; 5 width
5645 (if (listp list-part) 6116 (if (listp list-part) ; 6 element
5646 (ebnf-make-sequence list-part) 6117 (ebnf-make-sequence list-part)
5647 list-part) 6118 list-part)
5648 (if (and sep-part (listp sep-part)) 6119 (if (and sep-part (listp sep-part)) ; 7 separator
5649 (ebnf-make-sequence sep-part) 6120 (ebnf-make-sequence sep-part)
5650 sep-part))) 6121 sep-part)))
5651 6122
5652 6123
5653(defun ebnf-make-production (name prod action) 6124(defun ebnf-make-production (name prod action)
5654 (vector 'ebnf-generate-production 6125 (vector 'ebnf-generate-production ; 0 generator
5655 'ignore 6126 'ignore ; 1 width fun
5656 'ebnf-production-dimension 6127 'ebnf-production-dimension ; 2 dimension fun
5657 0.0 6128 0.0 ; 3 entry
5658 0.0 6129 0.0 ; 4 height
5659 0.0 6130 0.0 ; 5 width
5660 name 6131 name ; 6 production name
5661 prod 6132 prod ; 7 production body
5662 action)) 6133 action)) ; 8 production action
5663 6134
5664 6135
5665(defun ebnf-make-alternative (body) 6136(defun ebnf-make-alternative (body)
5666 (vector 'ebnf-generate-alternative 6137 (vector 'ebnf-generate-alternative ; 0 generator
5667 'ebnf-alternative-width 6138 'ebnf-alternative-width ; 1 width fun
5668 'ebnf-alternative-dimension 6139 'ebnf-alternative-dimension ; 2 dimension fun
5669 0.0 6140 0.0 ; 3 entry
5670 0.0 6141 0.0 ; 4 height
5671 0.0 6142 0.0 ; 5 width
5672 body)) 6143 body)) ; 6 alternative list
5673 6144
5674 6145
5675(defun ebnf-make-optional (body) 6146(defun ebnf-make-optional (body)
5676 (vector 'ebnf-generate-optional 6147 (vector 'ebnf-generate-optional ; 0 generator
5677 'ebnf-alternative-width 6148 'ebnf-alternative-width ; 1 width fun
5678 'ebnf-optional-dimension 6149 'ebnf-optional-dimension ; 2 dimension fun
5679 0.0 6150 0.0 ; 3 entry
5680 0.0 6151 0.0 ; 4 height
5681 0.0 6152 0.0 ; 5 width
5682 body)) 6153 body)) ; 6 optional element
5683 6154
5684 6155
5685(defun ebnf-make-except (factor exception) 6156(defun ebnf-make-except (factor exception)
5686 (vector 'ebnf-generate-except 6157 (vector 'ebnf-generate-except ; 0 generator
5687 'ignore 6158 'ignore ; 1 width fun
5688 'ebnf-except-dimension 6159 'ebnf-except-dimension ; 2 dimension fun
5689 0.0 6160 0.0 ; 3 entry
5690 0.0 6161 0.0 ; 4 height
5691 0.0 6162 0.0 ; 5 width
5692 factor 6163 factor ; 6 base element
5693 exception)) 6164 exception)) ; 7 exception element
5694 6165
5695 6166
5696(defun ebnf-make-repeat (times primary &optional upper) 6167(defun ebnf-make-repeat (times primary &optional upper)
5697 (vector 'ebnf-generate-repeat 6168 (vector 'ebnf-generate-repeat ; 0 generator
5698 'ignore 6169 'ignore ; 1 width fun
5699 'ebnf-repeat-dimension 6170 'ebnf-repeat-dimension ; 2 dimension fun
5700 0.0 6171 0.0 ; 3 entry
5701 0.0 6172 0.0 ; 4 height
5702 0.0 6173 0.0 ; 5 width
6174 ; 6 times
5703 (cond ((and times upper) ; L * U, L * L 6175 (cond ((and times upper) ; L * U, L * L
5704 (if (string= times upper) 6176 (if (string= times upper)
5705 (if (string= times "") 6177 (if (string= times "")
@@ -5712,27 +6184,27 @@ killed after process termination."
5712 (concat "* " upper)) 6184 (concat "* " upper))
5713 (t ; * 6185 (t ; *
5714 " * ")) 6186 " * "))
5715 primary)) 6187 primary)) ; 7 element
5716 6188
5717 6189
5718(defun ebnf-make-sequence (seq) 6190(defun ebnf-make-sequence (seq)
5719 (vector 'ebnf-generate-sequence 6191 (vector 'ebnf-generate-sequence ; 0 generator
5720 'ebnf-sequence-width 6192 'ebnf-sequence-width ; 1 width fun
5721 'ebnf-sequence-dimension 6193 'ebnf-sequence-dimension ; 2 dimension fun
5722 0.0 6194 0.0 ; 3 entry
5723 0.0 6195 0.0 ; 4 height
5724 0.0 6196 0.0 ; 5 width
5725 seq)) 6197 seq)) ; 6 sequence
5726 6198
5727 6199
5728(defun ebnf-make-dup-sequence (node seq) 6200(defun ebnf-make-dup-sequence (node seq)
5729 (vector 'ebnf-generate-sequence 6201 (vector 'ebnf-generate-sequence ; 0 generator
5730 'ebnf-sequence-width 6202 'ebnf-sequence-width ; 1 width fun
5731 'ebnf-sequence-dimension 6203 'ebnf-sequence-dimension ; 2 dimension fun
5732 (ebnf-node-entry node) 6204 (ebnf-node-entry node) ; 3 entry
5733 (ebnf-node-height node) 6205 (ebnf-node-height node) ; 4 height
5734 (ebnf-node-width node) 6206 (ebnf-node-width node) ; 5 width
5735 seq)) 6207 seq)) ; 6 sequence
5736 6208
5737 6209
5738;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 6210;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -5819,13 +6291,17 @@ killed after process termination."
5819(defun ebnf-token-alternative (body sequence) 6291(defun ebnf-token-alternative (body sequence)
5820 (if (null body) 6292 (if (null body)
5821 (if (cdr sequence) 6293 (if (cdr sequence)
6294 ;; no alternative
5822 sequence 6295 sequence
5823 (cons (car sequence) 6296 ;; empty element
6297 (cons (car sequence) ; token
5824 (ebnf-make-empty))) 6298 (ebnf-make-empty)))
5825 (cons (car sequence) 6299 (cons (car sequence) ; token
5826 (let ((seq (cdr sequence))) 6300 (let ((seq (cdr sequence)))
5827 (if (and (= (length body) 1) (null seq)) 6301 (if (and (= (length body) 1) (null seq))
6302 ;; alternative with one element
5828 (car body) 6303 (car body)
6304 ;; a real alternative
5829 (ebnf-make-alternative (nreverse (if seq 6305 (ebnf-make-alternative (nreverse (if seq
5830 (cons seq body) 6306 (cons seq body)
5831 body)))))))) 6307 body))))))))
@@ -5860,6 +6336,28 @@ killed after process termination."
5860 6336
5861 6337
5862;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 6338;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6339;; Log message
6340
6341
6342(defun ebnf-log-header (format-str &rest args)
6343 (when ebnf-log
6344 (apply
6345 'ebnf-log
6346 (concat
6347 "\n\n===============================================================\n\n"
6348 format-str)
6349 args)))
6350
6351
6352(defun ebnf-log (format-str &rest args)
6353 (when ebnf-log
6354 (save-excursion
6355 (set-buffer (get-buffer-create "*Ebnf2ps Log*"))
6356 (goto-char (point-max))
6357 (insert (apply 'format format-str args) "\n"))))
6358
6359
6360;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5863;; To make this file smaller, some commands go in a separate file. 6361;; To make this file smaller, some commands go in a separate file.
5864;; But autoload them here to make the separation invisible. 6362;; But autoload them here to make the separation invisible.
5865 6363