X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/a3e44e793796153ff1534be9c74fcab50b45de30..ab422c4d6899b1442cb6954c1829c1fb656b006c:/lisp/progmodes/ebnf2ps.el diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index 2cdc9fedcb..caa33d3644 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el @@ -1,7 +1,6 @@ ;;; ebnf2ps.el --- translate an EBNF to a syntactic chart on PostScript -;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -;; 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +;; Copyright (C) 1999-2013 Free Software Foundation, Inc. ;; Author: Vinicius Jose Latorre ;; Maintainer: Vinicius Jose Latorre @@ -44,7 +43,7 @@ Please send all bug fixes and enhancements to ;; ;; This package translates an EBNF to a syntactic chart on PostScript. ;; -;; To use ebnf2ps, insert in your ~/.emacs: +;; To use ebnf2ps, insert in your init file: ;; ;; (require 'ebnf2ps) ;; @@ -773,7 +772,7 @@ Please send all bug fixes and enhancements to ;; ;; To set the above options you may: ;; -;; a) insert the code in your ~/.emacs, like: +;; a) insert the code in your init file, like: ;; ;; (setq ebnf-terminal-shape 'bevel) ;; @@ -1129,8 +1128,8 @@ Please send all bug fixes and enhancements to ;; . Optimizations... ;; ;; -;; Acknowledgements -;; ---------------- +;; Acknowledgments +;; --------------- ;; ;; Thanks to Eli Zaretskii for some doc fixes. ;; @@ -1182,10 +1181,10 @@ Elements of ALIST that are not conses are ignored." ;;; Interface to the command system (defgroup postscript nil - "PostScript Group." + "Printing with PostScript" :tag "PostScript" :version "20" - :group 'emacs) + :group 'environment) (defgroup ebnf2ps nil @@ -1277,14 +1276,14 @@ Elements of ALIST that are not conses are ignored." (defcustom ebnf-horizontal-orientation nil - "*Non-nil means productions are drawn horizontally." + "Non-nil means productions are drawn horizontally." :type 'boolean :version "20" :group 'ebnf-displacement) (defcustom ebnf-horizontal-max-height nil - "*Non-nil means to use maximum production height in horizontal orientation. + "Non-nil means to use maximum production height in horizontal orientation. It is only used when `ebnf-horizontal-orientation' is non-nil." :type 'boolean @@ -1293,7 +1292,7 @@ It is only used when `ebnf-horizontal-orientation' is non-nil." (defcustom ebnf-production-horizontal-space 0.0 ; use ebnf2ps default value - "*Specify horizontal space in points between productions. + "Specify horizontal space in points between productions. Value less or equal to zero forces ebnf2ps to set a proper default value." :type 'number @@ -1302,7 +1301,7 @@ Value less or equal to zero forces ebnf2ps to set a proper default value." (defcustom ebnf-production-vertical-space 0.0 ; use ebnf2ps default value - "*Specify vertical space in points between productions. + "Specify vertical space in points between productions. Value less or equal to zero forces ebnf2ps to set a proper default value." :type 'number @@ -1311,7 +1310,7 @@ Value less or equal to zero forces ebnf2ps to set a proper default value." (defcustom ebnf-justify-sequence 'center - "*Specify justification of terms in a sequence inside alternatives. + "Specify justification of terms in a sequence inside alternatives. Valid values are: @@ -1325,14 +1324,14 @@ Valid values are: (defcustom ebnf-special-show-delimiter t - "*Non-nil means special delimiter (character `?') is shown." + "Non-nil means special delimiter (character `?') is shown." :type 'boolean :version "20" :group 'ebnf-special) (defcustom ebnf-special-font '(7 Courier "Black" "Gray95" bold italic) - "*Specify special font. + "Specify special font. See documentation for `ebnf-production-font'." :type '(list :tag "Special Font" @@ -1354,7 +1353,7 @@ See documentation for `ebnf-production-font'." (defcustom ebnf-special-shape 'bevel - "*Specify special box shape. + "Specify special box shape. See documentation for `ebnf-non-terminal-shape'." :type '(radio :tag "Special Shape" @@ -1364,28 +1363,28 @@ See documentation for `ebnf-non-terminal-shape'." (defcustom ebnf-special-shadow nil - "*Non-nil means special box will have a shadow." + "Non-nil means special box will have a shadow." :type 'boolean :version "20" :group 'ebnf-special) (defcustom ebnf-special-border-width 0.5 - "*Specify border width for special box." + "Specify border width for special box." :type 'number :version "20" :group 'ebnf-special) (defcustom ebnf-special-border-color "Black" - "*Specify border color for special box." + "Specify border color for special box." :type 'string :version "20" :group 'ebnf-special) (defcustom ebnf-except-font '(7 Courier "Black" "Gray90" bold italic) - "*Specify except font. + "Specify except font. See documentation for `ebnf-production-font'." :type '(list :tag "Except Font" @@ -1407,7 +1406,7 @@ See documentation for `ebnf-production-font'." (defcustom ebnf-except-shape 'bevel - "*Specify except box shape. + "Specify except box shape. See documentation for `ebnf-non-terminal-shape'." :type '(radio :tag "Except Shape" @@ -1417,28 +1416,28 @@ See documentation for `ebnf-non-terminal-shape'." (defcustom ebnf-except-shadow nil - "*Non-nil means except box will have a shadow." + "Non-nil means except box will have a shadow." :type 'boolean :version "20" :group 'ebnf-except) (defcustom ebnf-except-border-width 0.25 - "*Specify border width for except box." + "Specify border width for except box." :type 'number :version "20" :group 'ebnf-except) (defcustom ebnf-except-border-color "Black" - "*Specify border color for except box." + "Specify border color for except box." :type 'string :version "20" :group 'ebnf-except) (defcustom ebnf-repeat-font '(7 Courier "Black" "Gray85" bold italic) - "*Specify repeat font. + "Specify repeat font. See documentation for `ebnf-production-font'." :type '(list :tag "Repeat Font" @@ -1460,7 +1459,7 @@ See documentation for `ebnf-production-font'." (defcustom ebnf-repeat-shape 'bevel - "*Specify repeat box shape. + "Specify repeat box shape. See documentation for `ebnf-non-terminal-shape'." :type '(radio :tag "Repeat Shape" @@ -1470,28 +1469,28 @@ See documentation for `ebnf-non-terminal-shape'." (defcustom ebnf-repeat-shadow nil - "*Non-nil means repeat box will have a shadow." + "Non-nil means repeat box will have a shadow." :type 'boolean :version "20" :group 'ebnf-repeat) (defcustom ebnf-repeat-border-width 0.0 - "*Specify border width for repeat box." + "Specify border width for repeat box." :type 'number :version "20" :group 'ebnf-repeat) (defcustom ebnf-repeat-border-color "Black" - "*Specify border color for repeat box." + "Specify border color for repeat box." :type 'string :version "20" :group 'ebnf-repeat) (defcustom ebnf-terminal-font '(7 Courier "Black" "White") - "*Specify terminal font. + "Specify terminal font. See documentation for `ebnf-production-font'." :type '(list :tag "Terminal Font" @@ -1513,7 +1512,7 @@ See documentation for `ebnf-production-font'." (defcustom ebnf-terminal-shape 'miter - "*Specify terminal box shape. + "Specify terminal box shape. See documentation for `ebnf-non-terminal-shape'." :type '(radio :tag "Terminal Shape" @@ -1523,35 +1522,35 @@ See documentation for `ebnf-non-terminal-shape'." (defcustom ebnf-terminal-shadow nil - "*Non-nil means terminal box will have a shadow." + "Non-nil means terminal box will have a shadow." :type 'boolean :version "20" :group 'ebnf-terminal) (defcustom ebnf-terminal-border-width 1.0 - "*Specify border width for terminal box." + "Specify border width for terminal box." :type 'number :version "20" :group 'ebnf-terminal) (defcustom ebnf-terminal-border-color "Black" - "*Specify border color for terminal box." + "Specify border color for terminal box." :type 'string :version "20" :group 'ebnf-terminal) (defcustom ebnf-production-name-p t - "*Non-nil means production name will be printed." + "Non-nil means production name will be printed." :type 'boolean :version "20" :group 'ebnf-production) (defcustom ebnf-sort-production nil - "*Specify how productions are sorted. + "Specify how productions are sorted. Valid values are: @@ -1567,7 +1566,7 @@ Valid values are: (defcustom ebnf-production-font '(10 Helvetica "Black" "White" bold) - "*Specify production header font. + "Specify production header font. It is a list with the following form: @@ -1610,7 +1609,7 @@ See `ps-font-info-database' for valid font name." (defcustom ebnf-non-terminal-font '(7 Helvetica "Black" "White") - "*Specify non-terminal font. + "Specify non-terminal font. See documentation for `ebnf-production-font'." :type '(list :tag "Non-Terminal Font" @@ -1632,7 +1631,7 @@ See documentation for `ebnf-production-font'." (defcustom ebnf-non-terminal-shape 'round - "*Specify non-terminal box shape. + "Specify non-terminal box shape. Valid values are: @@ -1656,28 +1655,28 @@ Any other value is treated as `miter'." (defcustom ebnf-non-terminal-shadow nil - "*Non-nil means non-terminal box will have a shadow." + "Non-nil means non-terminal box will have a shadow." :type 'boolean :version "20" :group 'ebnf-non-terminal) (defcustom ebnf-non-terminal-border-width 1.0 - "*Specify border width for non-terminal box." + "Specify border width for non-terminal box." :type 'number :version "20" :group 'ebnf-non-terminal) (defcustom ebnf-non-terminal-border-color "Black" - "*Specify border color for non-terminal box." + "Specify border color for non-terminal box." :type 'string :version "20" :group 'ebnf-non-terminal) (defcustom ebnf-arrow-shape 'hollow - "*Specify the arrow shape. + "Specify the arrow shape. Valid values are: @@ -1734,7 +1733,7 @@ Any other value is treated as `none'." (defcustom ebnf-chart-shape 'round - "*Specify chart flow shape. + "Specify chart flow shape. See documentation for `ebnf-non-terminal-shape'." :type '(radio :tag "Chart Flow Shape" @@ -1744,7 +1743,7 @@ See documentation for `ebnf-non-terminal-shape'." (defcustom ebnf-user-arrow nil - "*Specify a sexp for user arrow shape (a PostScript code). + "Specify a sexp for user arrow shape (a PostScript code). When evaluated, the sexp should return nil or a string containing PostScript code. PostScript code should draw a right arrow. @@ -1784,7 +1783,7 @@ symbol `user'." (defcustom ebnf-syntax 'ebnf - "*Specify syntax to be recognized. + "Specify syntax to be recognized. Valid values are: @@ -1828,7 +1827,7 @@ Any other value is treated as `ebnf'." (defcustom ebnf-lex-comment-char ?\; - "*Specify the line comment character. + "Specify the line comment character. It's used only when `ebnf-syntax' is `ebnf'." :type 'character @@ -1837,7 +1836,7 @@ It's used only when `ebnf-syntax' is `ebnf'." (defcustom ebnf-lex-eop-char ?. - "*Specify the end of production character. + "Specify the end of production character. It's used only when `ebnf-syntax' is `ebnf'." :type 'character @@ -1846,7 +1845,7 @@ It's used only when `ebnf-syntax' is `ebnf'." (defcustom ebnf-terminal-regexp nil - "*Specify how it's a terminal name. + "Specify how it's a terminal name. If it's nil, the terminal name must be enclosed by `\"'. If it's a string, it should be a regexp that it'll be used to determine a @@ -1860,7 +1859,7 @@ It's used only when `ebnf-syntax' is `ebnf'." (defcustom ebnf-case-fold-search nil - "*Non-nil means ignore case on matching. + "Non-nil means ignore case on matching. It's only used when `ebnf-terminal-regexp' is non-nil and when `ebnf-syntax' is `ebnf'." @@ -1870,7 +1869,7 @@ It's only used when `ebnf-terminal-regexp' is non-nil and when `ebnf-syntax' is (defcustom ebnf-iso-alternative-p nil - "*Non-nil means use alternative ISO EBNF. + "Non-nil means use alternative ISO EBNF. It's only used when `ebnf-syntax' is `iso-ebnf'. @@ -1889,7 +1888,7 @@ This variable affects the following symbol set: (defcustom ebnf-iso-normalize-p nil - "*Non-nil means normalize ISO EBNF syntax names. + "Non-nil means normalize ISO EBNF syntax names. Normalize a name means that several contiguous spaces inside name become a single space, so \"A B C\" is normalized to \"A B C\". @@ -1901,7 +1900,7 @@ It's only used when `ebnf-syntax' is `iso-ebnf'." (defcustom ebnf-file-suffix-regexp "\.[Bb][Nn][Ff]$" - "*Specify file name suffix that contains EBNF. + "Specify file name suffix that contains EBNF. See `ebnf-eps-directory' command." :type 'regexp @@ -1910,7 +1909,7 @@ See `ebnf-eps-directory' command." (defcustom ebnf-eps-prefix "ebnf--" - "*Specify EPS prefix file name. + "Specify EPS prefix file name. See `ebnf-eps-buffer' and `ebnf-eps-region' commands." :type 'string @@ -1919,7 +1918,7 @@ See `ebnf-eps-buffer' and `ebnf-eps-region' commands." (defcustom ebnf-eps-header-font '(11 Helvetica "Black" "White" bold) - "*Specify EPS header font. + "Specify EPS header font. See documentation for `ebnf-production-font'. @@ -1943,7 +1942,7 @@ See `ebnf-eps-buffer' and `ebnf-eps-region' commands." (defcustom ebnf-eps-header nil - "*Specify EPS header. + "Specify EPS header. The value should be a string, a symbol or nil. @@ -1979,7 +1978,7 @@ empty string, no header is generated until a non-empty header is specified or (defcustom ebnf-eps-footer-font '(7 Helvetica "Black" "White" bold) - "*Specify EPS footer font. + "Specify EPS footer font. See documentation for `ebnf-production-font'. @@ -2003,7 +2002,7 @@ See `ebnf-eps-buffer' and `ebnf-eps-region' commands." (defcustom ebnf-eps-footer nil - "*Specify EPS footer. + "Specify EPS footer. The value should be a string, a symbol or nil. @@ -2039,7 +2038,7 @@ empty string, no footer is generated until a non-empty footer is specified or (defcustom ebnf-entry-percentage 0.5 ; middle - "*Specify entry height on alternatives. + "Specify entry height on alternatives. It must be a float between 0.0 (top) and 1.0 (bottom)." :type 'number @@ -2048,7 +2047,7 @@ It must be a float between 0.0 (top) and 1.0 (bottom)." (defcustom ebnf-default-width 0.6 - "*Specify additional border width over default terminal, non-terminal or + "Specify additional border width over default terminal, non-terminal or special." :type 'number :version "20" @@ -2058,21 +2057,21 @@ special." ;; Printing color requires x-color-values. (defcustom ebnf-color-p (or (fboundp 'x-color-values) ; Emacs (fboundp 'color-instance-rgb-components)) ; XEmacs - "*Non-nil means use color." + "Non-nil means use color." :type 'boolean :version "20" :group 'ebnf2ps) (defcustom ebnf-line-width 1.0 - "*Specify flow line width." + "Specify flow line width." :type 'number :version "20" :group 'ebnf2ps) (defcustom ebnf-line-color "Black" - "*Specify flow line color." + "Specify flow line color." :type 'string :version "20" :group 'ebnf2ps) @@ -2082,17 +2081,17 @@ special." (if (eq ebnf-arrow-shape 'none) 0.0 (* (sqrt 5.0) 0.65 ebnf-line-width)) - "*Specify extra width for arrow shape drawing. + "Specify extra width for arrow shape drawing. The extra width is used to avoid that the arrowhead and the terminal border -overlap. It depens on `ebnf-arrow-shape' and `ebnf-line-width'." +overlap. It depends on `ebnf-arrow-shape' and `ebnf-line-width'." :type 'number :version "22" :group 'ebnf-shape) (defcustom ebnf-arrow-scale 1.0 - "*Specify the arrow scale. + "Specify the arrow scale. Values lower than 1.0, shrink the arrow. Values greater than 1.0, expand the arrow." @@ -2102,7 +2101,7 @@ Values greater than 1.0, expand the arrow." (defcustom ebnf-debug-ps nil - "*Non-nil means to generate PostScript debug procedures. + "Non-nil means to generate PostScript debug procedures. It is intended to help PostScript programmers in debugging." :type 'boolean @@ -2111,7 +2110,7 @@ It is intended to help PostScript programmers in debugging." (defcustom ebnf-use-float-format t - "*Non-nil means use `%f' float format. + "Non-nil means use `%f' float format. The advantage of using float format is that ebnf2ps generates a little short PostScript file. @@ -2127,14 +2126,14 @@ when executing ebnf2ps, set `ebnf-use-float-format' to nil." (defcustom ebnf-stop-on-error nil - "*Non-nil means signal error and stop. Otherwise, signal error and continue." + "Non-nil means signal error and stop. Otherwise, signal error and continue." :type 'boolean :version "20" :group 'ebnf2ps) (defcustom ebnf-yac-ignore-error-recovery nil - "*Non-nil means ignore error recovery. + "Non-nil means ignore error recovery. It's only used when `ebnf-syntax' is `yacc'." :type 'boolean @@ -2143,7 +2142,7 @@ It's only used when `ebnf-syntax' is `yacc'." (defcustom ebnf-ignore-empty-rule nil - "*Non-nil means ignore empty rules. + "Non-nil means ignore empty rules. It's interesting to set this variable if your Yacc/Bison grammar has a lot of middle action rule." @@ -2153,7 +2152,7 @@ middle action rule." (defcustom ebnf-optimize nil - "*Non-nil means optimize syntactic chart of rules. + "Non-nil means optimize syntactic chart of rules. The following optimizations are done: @@ -2180,7 +2179,7 @@ The above optimizations are specially useful when `ebnf-syntax' is `yacc'." (defcustom ebnf-log nil - "*Non-nil means generate log messages. + "Non-nil means generate log messages. The log messages are generated into the buffer *Ebnf2ps Log*. These messages are intended to help debugging ebnf2ps." @@ -2230,8 +2229,8 @@ processed. See also `ebnf-print-buffer'." (interactive - (list (read-file-name "Directory containing EBNF files (print): " - nil default-directory))) + (list (read-directory-name "Directory containing EBNF files (print): " + nil default-directory))) (ebnf-log-header "(ebnf-print-directory %S)" directory) (ebnf-directory 'ebnf-print-buffer directory)) @@ -2288,8 +2287,8 @@ processed. See also `ebnf-spool-buffer'." (interactive - (list (read-file-name "Directory containing EBNF files (spool): " - nil default-directory))) + (list (read-directory-name "Directory containing EBNF files (spool): " + nil default-directory))) (ebnf-log-header "(ebnf-spool-directory %S)" directory) (ebnf-directory 'ebnf-spool-buffer directory)) @@ -2341,8 +2340,8 @@ processed. See also `ebnf-eps-buffer'." (interactive - (list (read-file-name "Directory containing EBNF files (EPS): " - nil default-directory))) + (list (read-directory-name "Directory containing EBNF files (EPS): " + nil default-directory))) (ebnf-log-header "(ebnf-eps-directory %S)" directory) (ebnf-directory 'ebnf-eps-buffer directory)) @@ -2426,8 +2425,8 @@ are processed. See also `ebnf-syntax-buffer'." (interactive - (list (read-file-name "Directory containing EBNF files (syntax): " - nil default-directory))) + (list (read-directory-name "Directory containing EBNF files (syntax): " + nil default-directory))) (ebnf-log-header "(ebnf-syntax-directory %S)" directory) (ebnf-directory 'ebnf-syntax-buffer directory)) @@ -3261,7 +3260,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and % --- Corners -%>corner Right Descendent: height arrow corner_RD +%>corner Right Descendant: height arrow corner_RD % _ | arrow % / height > 0 | 0 - none % | | 1 - right @@ -3300,7 +3299,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and Gstroke }def -%>corner Right Ascendent: height arrow corner_RA +%>corner Right Ascendant: height arrow corner_RA % | arrow % | height > 0 | 0 - none % / | 1 - right @@ -3339,7 +3338,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and Gstroke }def -%>corner Left Descendent: height arrow corner_LD +%>corner Left Descendant: height arrow corner_LD % _ | arrow % \\ height > 0 | 0 - none % | | 1 - right @@ -3378,7 +3377,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and Gstroke }def -%>corner Left Ascendent: height arrow corner_LA +%>corner Left Ascendant: height arrow corner_LA % | arrow % | height > 0 | 0 - none % \\ | 1 - right @@ -4008,7 +4007,7 @@ See documentation for `ebnf-terminal-shape', `ebnf-non-terminal-shape' and /#ebnf2ps#dict 230 dict def #ebnf2ps#dict begin -% Initiliaze variables to avoid name-conflicting with document variables. +% Initialize variables to avoid name-conflicting with document variables. % This is the case when using `bind' operator. /-fillp- 0 def /h 0 def /-ox- 0 def /half 0 def @@ -5038,7 +5037,7 @@ killed after process termination." (when gen-func (setq error-msg "EMPTY RULES" tree (ebnf-eliminate-empty-rules tree)) - (setq error-msg "OPTMIZE" + (setq error-msg "OPTIMIZE" tree (ebnf-optimize tree)) (setq error-msg "DIMENSIONS" tree (ebnf-dimensions tree)) @@ -6070,7 +6069,7 @@ killed after process termination." (defun ebnf-make-terminal1 (name gen-func dim-func) - (vector gen-func ; 0 generatore + (vector gen-func ; 0 generator 'ignore ; 1 width fun dim-func ; 2 dimension fun 0.0 ; 3 entry