emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/ebnf2ps.el,v


From: Vinicius Jose Latorre
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/ebnf2ps.el,v
Date: Wed, 27 Sep 2006 01:21:08 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Vinicius Jose Latorre <viniciusjl>      06/09/27 01:21:07

Index: progmodes/ebnf2ps.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/ebnf2ps.el,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- progmodes/ebnf2ps.el        20 Sep 2006 19:59:03 -0000      1.35
+++ progmodes/ebnf2ps.el        27 Sep 2006 01:21:07 -0000      1.36
@@ -5,9 +5,9 @@
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
-;; Time-stamp: <2006/09/15 18:58:18 vinicius>
+;; Time-stamp: <2006/09/26 21:49:46 vinicius>
 ;; Keywords: wp, ebnf, PostScript
-;; Version: 4.2
+;; Version: 4.3
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
 
 ;; This file is part of GNU Emacs.
@@ -27,8 +27,8 @@
 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 ;; Boston, MA 02110-1301, USA.
 
-(defconst ebnf-version "4.2"
-  "ebnf2ps.el, v 4.2 <2004/04/04 vinicius>
+(defconst ebnf-version "4.3"
+  "ebnf2ps.el, v 4.3 <2006/09/26 vinicius>
 
 Vinicius's last change version.  When reporting bugs, please also
 report the version of Emacs, if any, that ebnf2ps was running with.
@@ -692,6 +692,11 @@
 ;;
 ;; `ebnf-line-color'                   Specify flow line color.
 ;;
+;; `ebnf-arrow-extra-width'            Specify extra width for arrow shape
+;;                                     drawing.
+;;
+;; `ebnf-arrow-scale'                  Specify the arrow scale.
+;;
 ;; `ebnf-user-arrow'                   Specify a sexp for user arrow shape (a
 ;;                                     PostScript code).
 ;;
@@ -824,6 +829,8 @@
 ;;    entry            is the vertical position used to know where it should
 ;;                     be drawn the flow line in the current element.
 ;;
+;;    extra            is given by `ebnf-arrow-extra-width'.
+;;
 ;;
 ;;    * SPECIAL, TERMINAL and NON-TERMINAL
 ;;
@@ -835,7 +842,7 @@
 ;;       :   |   :      :   |   :  } font height / 2           }
 ;;       :   +==============+...:...............................
 ;;       :   :   :      :   :   :
-;;       :   :   :      :   :   :......................
+;;       :   :   :      :   :   :.........................
 ;;       :   :   :      :   :      } font height      }
 ;;       :   :   :      :   :.......                  }
 ;;       :   :   :      :          } font height / 2  }
@@ -844,8 +851,8 @@
 ;;       :   :   :..................                  }
 ;;       :   :                     } font height / 2  }
 ;;       :   :......................                  }
-;;       :                         } font height      }
-;;       :.............................................
+;;       :                         } font height + extra  }
+;;       :.................................................
 ;;
 ;;
 ;;    * OPTIONAL
@@ -976,7 +983,7 @@
 ;;       :   |  :  :  :   :   |   :  } font height / 2           }
 ;;       :   +================+...:...............................
 ;;       :   :  :  :  :   :   :   :
-;;       :   :  :  :  :   :   :   :......................
+;;       :   :  :  :  :   :   :   :..........................
 ;;       :   :  :  :  :   :   :      } font height      }
 ;;       :   :  :  :  :   :   :.......                  }
 ;;       :   :  :  :  :   :          } font height / 2  }
@@ -989,8 +996,8 @@
 ;;       :   :  :.....................                  }
 ;;       :   :                       } font height / 2  }
 ;;       :   :........................                  }
-;;       :                           } font height      }
-;;       :...............................................
+;;       :                           } font height + extra  }
+;;       :...................................................
 ;;
 ;;
 ;;    * EXCEPT
@@ -1003,7 +1010,7 @@
 ;;       :   |  :   :   :   :   |   :  } font height / 2           }
 ;;       :   +==================+...:...............................
 ;;       :   :  :   :   :   :   :   :
-;;       :   :  :   :   :   :   :   :......................
+;;       :   :  :   :   :   :   :   :..........................
 ;;       :   :  :   :   :   :   :      } font height      }
 ;;       :   :  :   :   :   :   :.......                  }
 ;;       :   :  :   :   :   :          } font height / 2  }
@@ -1016,8 +1023,8 @@
 ;;       :   :  :.......................                  }
 ;;       :   :                         } font height / 2  }
 ;;       :   :..........................                  }
-;;       :                             } font height      }
-;;       :.................................................
+;;       :                             } font height + extra  }
+;;       :.....................................................
 ;;
 ;;       NOTE: If Y element is empty, it's draw nothing at Y place.
 ;;
@@ -1089,7 +1096,8 @@
 ;; ----------------
 ;;
 ;; Thanks to Drew Adams <address@hidden> for suggestions:
-;;    - `ebnf-production-name-p', `ebnf-stop-on-error',
+;;    - `ebnf-arrow-extra-width', `ebnf-arrow-scale',
+;;     `ebnf-production-name-p', `ebnf-stop-on-error',
 ;;     `ebnf-file-suffix-regexp'and `ebnf-special-show-delimiter' variables.
 ;;    - `ebnf-delete-style', `ebnf-eps-file' and `ebnf-eps-directory'
 ;;     commands.
@@ -1911,6 +1919,29 @@
   :group 'ebnf2ps)
 
 
+(defcustom ebnf-arrow-extra-width
+  (if (eq ebnf-arrow-shape 'none)
+      0.0
+    (* (sqrt 5.0) 0.65 ebnf-line-width))
+  "*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'."
+  :type 'number
+  :version "22"
+  :group 'ebnf-shape)
+
+
+(defcustom ebnf-arrow-scale 1.0
+  "*Specify the arrow scale.
+
+Values lower than 1.0, shrink the arrow.
+Values greater than 1.0, expand the arrow."
+  :type 'number
+  :version "22"
+  :group 'ebnf-shape)
+
+
 (defcustom ebnf-debug-ps nil
   "*Non-nil means to generate PostScript debug procedures.
 
@@ -2860,8 +2891,8 @@
 
 /T HeightT HeightNT add 0.5 mul def
 /hT T 0.5 mul def
-/hT2 hT 0.5 mul def
-/hT4 hT 0.25 mul def
+/hT2 hT 0.5  mul ArrowScale mul def
+/hT4 hT 0.25 mul ArrowScale mul def
 
 /Er 0.1 def    % Error factor
 
@@ -2947,6 +2978,7 @@
  RA-vector ArrowShape get exec
  Gstroke
  moveto
+ ExtraWidth 0 rmoveto
 }def
 
 % rotation DrawArrow
@@ -3245,7 +3277,7 @@
 % string width prepare-width |- string
 /prepare-width
 {/width exch def
- dup stringwidth pop space add space add width exch sub 0.5 mul
+ dup stringwidth pop space add space add width exch sub ExtraWidth sub 0.5 mul
  /w exch def
 }def
 
@@ -4877,7 +4909,6 @@
         (progn
           ;; adjust creator comment
           (end-of-line)
-          (backward-char)
           (insert " & ebnf2ps v" ebnf-version)
           ;; insert ebnf settings & engine
           (goto-char (point-max))
@@ -5066,6 +5097,10 @@
              (format "/ShadowR       %s def\n"
                      (ebnf-boolean ebnf-repeat-shadow))
              ;; miscellaneous
+             (format "/ExtraWidth    %s def\n"
+                     (ebnf-format-float ebnf-arrow-extra-width))
+             (format "/ArrowScale    %s def\n"
+                     (ebnf-format-float ebnf-arrow-scale))
              (format "/DefaultWidth  %s def\n"
                      (ebnf-format-float ebnf-default-width))
              (format "/LineWidth     %s def\n"
@@ -5152,7 +5187,7 @@
        (len    (length (ebnf-node-name node))))
     (ebnf-node-entry  node (* height 0.5))
     (ebnf-node-height node height)
-    (ebnf-node-width  node (+ ebnf-basic-width space
+    (ebnf-node-width  node (+ ebnf-basic-width ebnf-arrow-extra-width space
                              (* len font-width)
                              space ebnf-basic-width))))
 
@@ -5173,6 +5208,7 @@
                                     ebnf-font-height-S)
                                ebnf-space-R ebnf-space-R))
     (ebnf-node-width  repeat (+ (ebnf-node-width element)
+                               ebnf-arrow-extra-width
                                ebnf-space-R ebnf-space-R ebnf-space-R
                                ebnf-horizontal-space
                                (* (length times) ebnf-font-width-R)))))
@@ -5194,6 +5230,7 @@
                                ebnf-space-E ebnf-space-E))
     (ebnf-node-width  except (+ (ebnf-node-width factor)
                                (ebnf-node-width element)
+                               ebnf-arrow-extra-width
                                ebnf-space-E ebnf-space-E
                                ebnf-space-E ebnf-space-E
                                ebnf-font-width-E




reply via email to

[Prev in Thread] Current Thread [Next in Thread]