Changeset 4169 for trunk/lisp/progmodes/ebnf2ps.el
- Timestamp:
- 09/30/06 09:12:06 (2 years ago)
- Files:
-
- trunk/lisp (modified) (1 prop)
- trunk/lisp/progmodes/ebnf2ps.el (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp
- Property svn:ignore changed from
*.elc
MANIFEST
Makefile
Makefile.unix
makefile
elc.tar.gz
cus-load.el
finder-inf.el
subdirs.el
loaddefs.el
to
*.elc
MANIFEST
Makefile
Makefile.unix
makefile
elc.tar.gz
cus-load.el
finder-inf.el
subdirs.el
loaddefs.el
pre-mh-loaddefs.el-CMD
- Property svn:ignore changed from
trunk/lisp/progmodes/ebnf2ps.el
r4037 r4169 6 6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7 7 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 8 ;; Time-stamp: <200 5-09-18 07:27:20 deego>8 ;; Time-stamp: <2006/09/26 21:49:46 vinicius> 9 9 ;; Keywords: wp, ebnf, PostScript 10 ;; Version: 4. 211 ;; X-URL: http://www. cpqd.com.br/~vinicius/emacs/10 ;; Version: 4.3 11 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre 12 12 13 13 ;; This file is part of GNU Emacs. … … 28 28 ;; Boston, MA 02110-1301, USA. 29 29 30 (defconst ebnf-version "4. 2"31 "ebnf2ps.el, v 4. 2 <2004/04/04vinicius>30 (defconst ebnf-version "4.3" 31 "ebnf2ps.el, v 4.3 <2006/09/26 vinicius> 32 32 33 33 Vinicius's last change version. When reporting bugs, please also … … 74 74 ;; chart images of Emacs buffers: 75 75 ;; 76 ;; ebnf-print-directory77 ;; ebnf-print-file78 ;; ebnf-print-buffer79 ;; ebnf-print-region80 ;; ebnf-spool-directory81 ;; ebnf-spool-file82 ;; ebnf-spool-buffer83 ;; ebnf-spool-region84 ;; ebnf-eps-directory85 ;; ebnf-eps-file86 ;; ebnf-eps-buffer87 ;; ebnf-eps-region76 ;; ebnf-print-directory 77 ;; ebnf-print-file 78 ;; ebnf-print-buffer 79 ;; ebnf-print-region 80 ;; ebnf-spool-directory 81 ;; ebnf-spool-file 82 ;; ebnf-spool-buffer 83 ;; ebnf-spool-region 84 ;; ebnf-eps-directory 85 ;; ebnf-eps-file 86 ;; ebnf-eps-buffer 87 ;; ebnf-eps-region 88 88 ;; 89 89 ;; These commands all perform essentially the same function: they generate … … 95 95 ;; PostScript image is sent to the printer (or file): 96 96 ;; 97 ;; print - The PostScript image is immediately sent to the printer;98 ;; 99 ;; spool - The PostScript image is saved temporarily in an Emacs buffer.100 ;; Many images may be spooled locally before printing them. To101 ;; send the spooled images to the printer, use the command102 ;; `ebnf-despool'.103 ;; 104 ;; eps - The PostScript image is immediately sent to a EPS file.97 ;; print - The PostScript image is immediately sent to the printer; 98 ;; 99 ;; spool - The PostScript image is saved temporarily in an Emacs buffer. 100 ;; Many images may be spooled locally before printing them. To 101 ;; send the spooled images to the printer, use the command 102 ;; `ebnf-despool'. 103 ;; 104 ;; eps - The PostScript image is immediately sent to a EPS file. 105 105 ;; 106 106 ;; The spooling mechanism is the same as used by ps-print and was designed for … … 121 121 ;; determines how much of the buffer is printed: 122 122 ;; 123 ;; directory - Read files in the directory and print them.124 ;; 125 ;; file - Read file and print it.126 ;; 127 ;; buffer - Print the entire buffer.128 ;; 129 ;; region - Print just the current region.123 ;; directory - Read files in the directory and print them. 124 ;; 125 ;; file - Read file and print it. 126 ;; 127 ;; buffer - Print the entire buffer. 128 ;; 129 ;; region - Print just the current region. 130 130 ;; 131 131 ;; Two ebnf- command examples: 132 132 ;; 133 ;; ebnf-print-buffer - translate and print the entire buffer, and send it134 ;; immediately to the printer.135 ;; 136 ;; ebnf-spool-region - translate and print just the current region, and137 ;; spool the image in Emacs to send to the printer138 ;; later.133 ;; ebnf-print-buffer - translate and print the entire buffer, and send it 134 ;; immediately to the printer. 135 ;; 136 ;; ebnf-spool-region - translate and print just the current region, and 137 ;; spool the image in Emacs to send to the printer 138 ;; later. 139 139 ;; 140 140 ;; Note that `ebnf-eps-directory', `ebnf-eps-file', `ebnf-eps-buffer' and … … 149 149 ;; To translate and print your buffer, type 150 150 ;; 151 ;; M-x ebnf-print-buffer151 ;; M-x ebnf-print-buffer 152 152 ;; 153 153 ;; or substitute one of the other four ebnf- commands. The command will … … 155 155 ;; the command a prefix argument 156 156 ;; 157 ;; C-u M-x ebnf-print-buffer157 ;; C-u M-x ebnf-print-buffer 158 158 ;; 159 159 ;; it will save the PostScript image to a file instead of sending it to the … … 163 163 ;; `ebnf-despool': 164 164 ;; 165 ;; C-u M-x ebnf-despool165 ;; C-u M-x ebnf-despool 166 166 ;; 167 167 ;; When invoked this way, `ebnf-despool' will prompt you for the name of the … … 173 173 ;; Any of the `ebnf-' commands can be bound to keys. Here are some examples: 174 174 ;; 175 ;; (global-set-key 'f22 'ebnf-print-buffer) ;f22 is prsc176 ;; (global-set-key '(shift f22) 'ebnf-print-region)177 ;; (global-set-key '(control f22) 'ebnf-despool)175 ;; (global-set-key 'f22 'ebnf-print-buffer) ;f22 is prsc 176 ;; (global-set-key '(shift f22) 'ebnf-print-region) 177 ;; (global-set-key '(control f22) 'ebnf-despool) 178 178 ;; 179 179 ;; … … 524 524 ;; The following table summarizes the results: 525 525 ;; 526 ;; EPS FILE NAME NO SORT ASCENDING SORT DESCENDING SORT527 ;; ebnf--AA.eps A C A C C A528 ;; ebnf--BB.eps C B B C C B529 ;; ebnf--CC.eps A C B F A B C F F C B A530 ;; ebnf--D.eps D D D531 ;; ebnf--E.eps E E E532 ;; ebnf--G.eps G G G533 ;; ebnf--Z.eps Z Z Z526 ;; EPS FILE NAME NO SORT ASCENDING SORT DESCENDING SORT 527 ;; ebnf--AA.eps A C A C C A 528 ;; ebnf--BB.eps C B B C C B 529 ;; ebnf--CC.eps A C B F A B C F F C B A 530 ;; ebnf--D.eps D D D 531 ;; ebnf--E.eps E E E 532 ;; ebnf--G.eps G G G 533 ;; ebnf--Z.eps Z Z Z 534 534 ;; 535 535 ;; As you can see if EPS actions is not used, each single production is … … 692 692 ;; 693 693 ;; `ebnf-line-color' Specify flow line color. 694 ;; 695 ;; `ebnf-arrow-extra-width' Specify extra width for arrow shape 696 ;; drawing. 697 ;; 698 ;; `ebnf-arrow-scale' Specify the arrow scale. 694 699 ;; 695 700 ;; `ebnf-user-arrow' Specify a sexp for user arrow shape (a … … 825 830 ;; be drawn the flow line in the current element. 826 831 ;; 832 ;; extra is given by `ebnf-arrow-extra-width'. 833 ;; 827 834 ;; 828 835 ;; * SPECIAL, TERMINAL and NON-TERMINAL … … 836 843 ;; : +==============+...:............................... 837 844 ;; : : : : : : 838 ;; : : : : : :...................... 839 ;; : : : : : } font height }840 ;; : : : : :....... }841 ;; : : : : } font height / 2 }842 ;; : : : :........... }843 ;; : : : } text width } width844 ;; : : :.................. }845 ;; : : } font height / 2 }846 ;; : :...................... }847 ;; : } font height }848 ;; :............................................. 845 ;; : : : : : :......................... 846 ;; : : : : : } font height } 847 ;; : : : : :....... } 848 ;; : : : : } font height / 2 } 849 ;; : : : :........... } 850 ;; : : : } text width } width 851 ;; : : :.................. } 852 ;; : : } font height / 2 } 853 ;; : :...................... } 854 ;; : } font height + extra } 855 ;; :................................................. 849 856 ;; 850 857 ;; … … 977 984 ;; : +================+...:............................... 978 985 ;; : : : : : : : : 979 ;; : : : : : : : :...................... 980 ;; : : : : : : : } font height }981 ;; : : : : : : :....... }982 ;; : : : : : : } font height / 2 }983 ;; : : : : : :........... }984 ;; : : : : : } X width }985 ;; : : : : :............... }986 ;; : : : : } font height / 2 } width987 ;; : : : :.................. }988 ;; : : : } text width }989 ;; : : :..................... }990 ;; : : } font height / 2 }991 ;; : :........................ }992 ;; : } font height }993 ;; :............................................... 986 ;; : : : : : : : :.......................... 987 ;; : : : : : : : } font height } 988 ;; : : : : : : :....... } 989 ;; : : : : : : } font height / 2 } 990 ;; : : : : : :........... } 991 ;; : : : : : } X width } 992 ;; : : : : :............... } 993 ;; : : : : } font height / 2 } width 994 ;; : : : :.................. } 995 ;; : : : } text width } 996 ;; : : :..................... } 997 ;; : : } font height / 2 } 998 ;; : :........................ } 999 ;; : } font height + extra } 1000 ;; :................................................... 994 1001 ;; 995 1002 ;; … … 1004 1011 ;; : +==================+...:............................... 1005 1012 ;; : : : : : : : : 1006 ;; : : : : : : : :...................... 1007 ;; : : : : : : : } font height }1008 ;; : : : : : : :....... }1009 ;; : : : : : : } font height / 2 }1010 ;; : : : : : :........... }1011 ;; : : : : : } Y width }1012 ;; : : : : :............... }1013 ;; : : : : } font height } width1014 ;; : : : :................... }1015 ;; : : : } X width }1016 ;; : : :....................... }1017 ;; : : } font height / 2 }1018 ;; : :.......................... }1019 ;; : } font height }1020 ;; :................................................. 1013 ;; : : : : : : : :.......................... 1014 ;; : : : : : : : } font height } 1015 ;; : : : : : : :....... } 1016 ;; : : : : : : } font height / 2 } 1017 ;; : : : : : :........... } 1018 ;; : : : : : } Y width } 1019 ;; : : : : :............... } 1020 ;; : : : : } font height } width 1021 ;; : : : :................... } 1022 ;; : : : } X width } 1023 ;; : : :....................... } 1024 ;; : : } font height / 2 } 1025 ;; : :.......................... } 1026 ;; : } font height + extra } 1027 ;; :..................................................... 1021 1028 ;; 1022 1029 ;; NOTE: If Y element is empty, it's draw nothing at Y place. … … 1090 1097 ;; 1091 1098 ;; Thanks to Drew Adams <drew.adams@oracle.com> for suggestions: 1092 ;; - `ebnf-production-name-p', `ebnf-stop-on-error', 1099 ;; - `ebnf-arrow-extra-width', `ebnf-arrow-scale', 1100 ;; `ebnf-production-name-p', `ebnf-stop-on-error', 1093 1101 ;; `ebnf-file-suffix-regexp'and `ebnf-special-show-delimiter' variables. 1094 1102 ;; - `ebnf-delete-style', `ebnf-eps-file' and `ebnf-eps-directory' … … 1910 1918 :version "20" 1911 1919 :group 'ebnf2ps) 1920 1921 1922 (defcustom ebnf-arrow-extra-width 1923 (if (eq ebnf-arrow-shape 'none) 1924 0.0 1925 (* (sqrt 5.0) 0.65 ebnf-line-width)) 1926 "*Specify extra width for arrow shape drawing. 1927 1928 The extra width is used to avoid that the arrowhead and the terminal border 1929 overlap. It depens on `ebnf-arrow-shape' and `ebnf-line-width'." 1930 :type 'number 1931 :version "22" 1932 :group 'ebnf-shape) 1933 1934 1935 (defcustom ebnf-arrow-scale 1.0 1936 "*Specify the arrow scale. 1937 1938 Values lower than 1.0, shrink the arrow. 1939 Values greater than 1.0, expand the arrow." 1940 :type 'number 1941 :version "22" 1942 :group 'ebnf-shape) 1912 1943 1913 1944 … … 2860 2891 2861 2892 /T HeightT HeightNT add 0.5 mul def 2862 /hT T 0.5mul def2863 /hT2 hT 0.5 mul def2864 /hT4 hT 0.25 mul def2893 /hT T 0.5 mul def 2894 /hT2 hT 0.5 mul ArrowScale mul def 2895 /hT4 hT 0.25 mul ArrowScale mul def 2865 2896 2866 2897 /Er 0.1 def % Error factor … … 2948 2979 Gstroke 2949 2980 moveto 2981 ExtraWidth 0 rmoveto 2950 2982 }def 2951 2983 … … 3246 3278 /prepare-width 3247 3279 {/width exch def 3248 dup stringwidth pop space add space add width exch sub 0.5 mul3280 dup stringwidth pop space add space add width exch sub ExtraWidth sub 0.5 mul 3249 3281 /w exch def 3250 3282 }def … … 4878 4910 ;; adjust creator comment 4879 4911 (end-of-line) 4880 (backward-char)4881 4912 (insert " & ebnf2ps v" ebnf-version) 4882 4913 ;; insert ebnf settings & engine … … 5067 5098 (ebnf-boolean ebnf-repeat-shadow)) 5068 5099 ;; miscellaneous 5100 (format "/ExtraWidth %s def\n" 5101 (ebnf-format-float ebnf-arrow-extra-width)) 5102 (format "/ArrowScale %s def\n" 5103 (ebnf-format-float ebnf-arrow-scale)) 5069 5104 (format "/DefaultWidth %s def\n" 5070 5105 (ebnf-format-float ebnf-default-width)) … … 5153 5188 (ebnf-node-entry node (* height 0.5)) 5154 5189 (ebnf-node-height node height) 5155 (ebnf-node-width node (+ ebnf-basic-width space5190 (ebnf-node-width node (+ ebnf-basic-width ebnf-arrow-extra-width space 5156 5191 (* len font-width) 5157 5192 space ebnf-basic-width)))) … … 5174 5209 ebnf-space-R ebnf-space-R)) 5175 5210 (ebnf-node-width repeat (+ (ebnf-node-width element) 5211 ebnf-arrow-extra-width 5176 5212 ebnf-space-R ebnf-space-R ebnf-space-R 5177 5213 ebnf-horizontal-space … … 5195 5231 (ebnf-node-width except (+ (ebnf-node-width factor) 5196 5232 (ebnf-node-width element) 5233 ebnf-arrow-extra-width 5197 5234 ebnf-space-E ebnf-space-E 5198 5235 ebnf-space-E ebnf-space-E
