Variable: ebnf-prologue
ebnf-prologue is a variable defined in ebnf2ps.el.gz.
Value
"\n% === begin EBNF engine\n\n% --- Basic Definitions\n\n/fS F\n/SpaceS FontHeight 0.5 mul def\n/HeightS FontHeight FontHeight add def\n\n/fE F\n/SpaceE FontHeight 0.5 mul def\n/HeightE FontHeight FontHeight add def\n\n/fR F\n/SpaceR FontHeight 0.5 mul def\n/HeightR FontHeight FontHeight add def\n\n/fT F\n/SpaceT FontHeight 0.5 mul def\n/HeightT FontHeight FontHeight add def\n\n/fNT F\n/SpaceNT FontHeight 0.5 mul def\n/HeightNT FontHeight FontHeight add def\n\n/T HeightT HeightNT add 0.5 mul def\n/hT T 0.5 mul def\n/hT2 hT 0.5 mul ArrowScale mul def\n/hT4 hT 0.25 mul ArrowScale mul def\n\n/Er 0.1 def % Error factor\n\n\n/c{currentpoint}bind def\n/xyi{/xi c /yi exch def def}bind def\n/xyo{/xo c /yo exch def def}bind def\n/xyp{/xp c /yp exch def def}bind def\n/xyt{/xt c /yt exch def def}bind def\n\n% vertical movement: x y height vm\n/vm{add moveto}bind def\n\n% horizontal movement: x y width hm\n/hm{3 -1 roll exch add exch moveto}bind def\n\n% set color: [R G B] SetRGB\n/SetRGB{aload pop setrgbcolor}bind def\n\n% filling gray area: gray-scale FillGray\n/FillGray{gsave setgray fill grestore}bind def\n\n% filling color area: [R G B] FillRGB\n/FillRGB{gsave SetRGB fill grestore}bind def\n\n/Stroke{LineWidth setlinewidth LineColor SetRGB stroke}bind def\n/StrokeShape{borderwidth setlinewidth bordercolor SetRGB stroke}bind def\n/Gstroke{gsave Stroke grestore}bind def\n\n% Empty Line: width EL\n/EL{0 rlineto Gstroke}bind def\n\n% --- Arrows\n\n/Down{hT2 neg hT4 neg rlineto}bind def\n\n/Arrow\n{hT2 neg hT4 rmoveto\n hT2 hT4 neg rlineto\n Down\n}bind def\n\n/ArrowPath{c newpath moveto Arrow closepath}bind def\n\n/UpPath\n{c newpath moveto\n hT2 neg 0 rmoveto\n 0 hT4 rlineto\n hT2 hT4 neg rlineto\n closepath\n}bind def\n\n/DownPath\n{c newpath moveto\n hT2 neg 0 rmoveto\n 0 hT4 neg rlineto\n hT2 hT4 rlineto\n closepath\n}bind def\n\n%>Right Arrow: RA\n% \\\n% *---+\n% /\n/RA-vector\n[{} % 0 - none\n {hT2 neg hT4 rlineto} % 1 - semi-up\n {Down} % 2 - semi-down\n {Arrow} % 3 - simple\n {Gstroke ArrowPath} % 4 - transparent\n {Gstroke ArrowPath 1 FillGray} % 5 - hollow\n {Gstroke ArrowPath LineColor FillRGB} % 6 - full\n {Gstroke UpPath 1 FillGray} % 7 - semi-up-hollow\n {Gstroke UpPath LineColor FillRGB} % 8 - semi-up-full\n {Gstroke DownPath 1 FillGray} % 9 - semi-down-hollow\n {Gstroke DownPath LineColor FillRGB} % 10 - semi-down-full\n {Gstroke gsave UserArrow grestore} % 11 - user\n]def\n\n/RA\n{hT 0 rlineto\n c\n RA-vector ArrowShape get exec\n Gstroke\n moveto\n ExtraWidth 0 rmoveto\n}def\n\n% rotation DrawArrow\n/DrawArrow\n{gsave\n 0 0 translate\n rotate\n RA\n c\n grestore\n rmoveto\n}def\n\n%>Left Arrow: LA\n% /\n% +---*\n% \\\n/LA{180 DrawArrow}def\n\n%>Up Arrow: UA\n% +\n% /|\\\n% |\n% *\n/UA{90 DrawArrow}def\n\n%>Down Arrow: DA\n% *\n% |\n% \\|/\n% +\n/DA{270 DrawArrow}def\n\n% --- Corners\n\n%>corner Right Descendant: height arrow corner_RD\n% _ | arrow\n% / height > 0 | 0 - none\n% | | 1 - right\n% * ---------- | 2 - left\n% | | 3 - vertical\n% \\ height < 0 |\n% - |\n/cRD0-vector\n[% 0 - none\n {0 h rlineto\n hT 0 rlineto}\n % 1 - right\n {0 h rlineto\n RA}\n % 2 - left\n {hT 0 rmoveto xyi\n LA\n 0 h neg rlineto\n xi yi moveto}\n % 3 - vertical\n {hT h rmoveto xyi\n hT neg 0 rlineto\n h 0 gt{DA}{UA}ifelse\n xi yi moveto}\n]def\n\n/cRD-vector\n[{cRD0-vector arrow get exec} % 0 - miter\n {0 0 0 h hT h rcurveto} % 1 - rounded\n {hT h rlineto} % 2 - bevel\n]def\n\n/corner_RD\n{/arrow exch def /h exch def\n cRD-vector ChartShape get exec\n Gstroke\n}def\n\n%>corner Right Ascendant: height arrow corner_RA\n% | arrow\n% | height > 0 | 0 - none\n% / | 1 - right\n% *- ---------- | 2 - left\n% \\ | 3 - vertical\n% | height < 0 |\n% |\n/cRA0-vector\n[% 0 - none\n {hT 0 rlineto\n 0 h rlineto}\n % 1 - right\n {RA\n 0 h rlineto}\n % 2 - left\n {hT h rmoveto xyi\n 0 h neg rlineto\n LA\n xi yi moveto}\n % 3 - vertical\n {hT h rmoveto xyi\n h 0 gt{DA}{UA}ifelse\n hT neg 0 rlineto\n xi yi moveto}\n]def\n\n/cRA-vector\n[{cRA0-vector arrow get exec} % 0 - miter\n {0 0 hT 0 hT h rcurveto} % 1 - rounded\n {hT h rlineto} % 2 - bevel\n]def\n\n/corner_RA\n{/arrow exch def /h exch def\n cRA-vector ChartShape get exec\n Gstroke\n}def\n\n%>corner Left Descendant: height arrow corner_LD\n% _ | arrow\n% \\ height > 0 | 0 - none\n% | | 1 - right\n% * ---------- | 2 - left\n% | | 3 - vertical\n% / height < 0 |\n% - |\n/cLD0-vector\n[% 0 - none\n {0 h rlineto\n hT neg 0 rlineto}\n % 1 - right\n {hT neg h rmoveto xyi\n RA\n 0 h neg rlineto\n xi yi moveto}\n % 2 - left\n {0 h rlineto\n LA}\n % 3 - vertical\n {hT neg h rmoveto xyi\n hT 0 rlineto\n h 0 gt{DA}{UA}ifelse\n xi yi moveto}\n]def\n\n/cLD-vector\n[{cLD0-vector arrow get exec} % 0 - miter\n {0 0 0 h hT neg h rcurveto} % 1 - rounded\n {hT neg h rlineto} % 2 - bevel\n]def\n\n/corner_LD\n{/arrow exch def /h exch def\n cLD-vector ChartShape get exec\n Gstroke\n}def\n\n%>corner Left Ascendant: height arrow corner_LA\n% | arrow\n% | height > 0 | 0 - none\n% \\ | 1 - right\n% -* ---------- | 2 - left\n% / | 3 - vertical\n% | height < 0 |\n% |\n/cLA0-vector\n[% 0 - none\n {hT neg 0 rlineto\n 0 h rlineto}\n % 1 - right\n {hT neg h rmoveto xyi\n 0 h neg rlineto\n RA\n xi yi moveto}\n % 2 - left\n {LA\n 0 h rlineto}\n % 3 - vertical\n {hT neg h rmoveto xyi\n h 0 gt{DA}{UA}ifelse\n hT 0 rlineto\n xi yi moveto}\n]def\n\n/cLA-vector\n[{cLA0-vector arrow get exec} % 0 - miter\n {0 0 hT neg 0 hT neg h rcurveto} % 1 - rounded\n {hT neg h rlineto} % 2 - bevel\n]def\n\n/corner_LA\n{/arrow exch def /h exch def\n cLA-vector ChartShape get exec\n Gstroke\n}def\n\n% --- Flow Stuff\n\n% height prepare-height |- line_height corner_height corner_height\n/prepare-height\n{dup 0 gt\n {T sub hT}\n {T add hT neg}ifelse\n dup\n}def\n\n%>Left Alternative: height LAlt\n% _\n% /\n% | height > 0\n% |\n% /\n% *- ----------\n% \\\n% |\n% | height < 0\n% \\\n% -\n/LAlt\n{dup 0 eq\n {T exch rlineto}\n {dup abs T lt\n {0.5 mul dup\n 1 corner_RA\n 0 corner_RD}\n {prepare-height\n 1 corner_RA\n exch 0 exch rlineto\n 0 corner_RD\n }ifelse\n }ifelse\n}def\n\n%>Left Loop: height LLoop\n% _\n% /\n% | height > 0\n% |\n% \\\n% -* ----------\n% /\n% |\n% | height < 0\n% \\\n% -\n/LLoop\n{prepare-height\n 3 corner_LA\n exch 0 exch rlineto\n 0 corner_RD\n}def\n\n%>Right Alternative: height RAlt\n% _\n% \\\n% | height > 0\n% |\n% \\\n% -* ----------\n% /\n% |\n% | height < 0\n% /\n% -\n/RAlt\n{dup 0 eq\n {T neg exch rlineto}\n {dup abs T lt\n {0.5 mul dup\n 1 corner_LA\n 0 corner_LD}\n {prepare-height\n 1 corner_LA\n exch 0 exch rlineto\n 0 corner_LD\n }ifelse\n }ifelse\n}def\n\n%>Right Loop: height RLoop\n% _\n% \\\n% | height > 0\n% |\n% /\n% *- ----------\n% \\\n% |\n% | height < 0\n% /\n% -\n/RLoop\n{prepare-height\n 1 corner_RA\n exch 0 exch rlineto\n 0 corner_LD\n}def\n\n% --- Terminal, Non-terminal and Special Basics\n\n% string width prepare-width |- string\n/prepare-width\n{/width exch def\n dup stringwidth pop space add space add width exch sub ExtraWidth sub 0.5 mul\n /w exch def\n}def\n\n% string width begin-right\n/begin-right\n{xyo\n prepare-width\n w hT sub EL\n RA\n}def\n\n% end-right\n/end-right\n{xo width add Er add yo moveto\n w Er add neg EL\n xo yo moveto\n}def\n\n% string width begin-left\n/begin-left\n{xyo\n prepare-width\n w EL\n}def\n\n% end-left\n/end-left\n{xo width add Er add yo moveto\n hT w sub Er add EL\n LA\n xo yo moveto\n}def\n\n/ShapePath-vector\n[% 0 - miter\n {xx yy moveto\n xx YY lineto\n XX YY lineto\n XX yy lineto}\n % 1 - rounded\n {/half YY yy sub 0.5 mul abs def\n xx half add YY moveto\n 0 0 half neg 0 half neg half neg rcurveto\n 0 0 0 half neg half half neg rcurveto\n XX xx sub abs half sub half sub 0 rlineto\n 0 0 half 0 half half rcurveto\n 0 0 0 half half neg half rcurveto}\n % 2 - bevel\n {/quarter YY yy sub 0.25 mul abs def\n xx quarter add YY moveto\n quarter neg quarter neg rlineto\n 0 quarter quarter add neg rlineto\n quarter quarter neg rlineto\n XX xx sub abs quarter sub quarter sub 0 rlineto\n quarter quarter rlineto\n 0 quarter quarter add rlineto\n quarter neg quarter rlineto}\n]def\n\n/doShapePath\n{newpath\n ShapePath-vector shape get exec\n closepath\n}def\n\n/doShapeShadow\n{gsave\n Xshadow Xshadow add Xshadow add\n Yshadow Yshadow add Yshadow add translate\n doShapePath\n 0.9 FillGray\n grestore\n}def\n\n/doShape\n{gsave\n doShapePath\n shapecolor FillRGB\n StrokeShape\n grestore\n}def\n\n% string SBound |- string\n/SBound\n{/xx c dup /yy exch def\n FontHeight add /YY exch def def\n dup stringwidth pop xx add /XX exch def\n Effect 8 and 0 ne\n {/yy yy YShadow add def\n /XX XX XShadow add def\n }if\n}def\n\n% string SBox\n/SBox\n{gsave\n c space sub moveto\n SBound\n /XX XX space add space add def\n /YY YY space add def\n /yy yy space sub def\n shadow{doShapeShadow}if\n doShape\n space Descent abs rmoveto\n foreground SetRGB S\n grestore\n}def\n\n% --- Terminal\n\n% TeRminal: string TR\n/TR\n{/Effect EffectT def\n /shape ShapeT def\n /shapecolor BackgroundT def\n /borderwidth BorderWidthT def\n /bordercolor BorderColorT def\n /foreground ForegroundT def\n /shadow ShadowT def\n SBox\n}def\n\n%>Right Terminal: string width RT |- x y\n/RT\n{xyt\n /fT F\n /space SpaceT def\n begin-right\n TR\n end-right\n xt yt\n}def\n\n%>Left Terminal: string width LT |- x y\n/LT\n{xyt\n /fT F\n /space SpaceT def\n begin-left\n TR\n end-left\n xt yt\n}def\n\n%>Right Terminal Default: string width RTD |- x y\n/RTD\n{/-save- BorderWidthT def\n /BorderWidthT BorderWidthT DefaultWidth add def\n RT\n /BorderWidthT -save- def\n}def\n\n%>Left Terminal Default: string width LTD |- x y\n/LTD\n{/-save- BorderWidthT def\n /BorderWidthT BorderWidthT DefaultWidth add def\n LT\n /BorderWidthT -save- def\n}def\n\n% --- Non-Terminal\n\n% Non-Terminal: string NT\n/NT\n{/Effect EffectNT def\n /shape ShapeNT def\n /shapecolor BackgroundNT def\n /borderwidth BorderWidthNT def\n /bordercolor BorderColorNT def\n /foreground ForegroundNT def\n /shadow ShadowNT def\n SBox\n}def\n\n%>Right Non-Terminal: string width RNT |- x y\n/RNT\n{xyt\n /fNT F\n /space SpaceNT def\n begin-right\n NT\n end-right\n xt yt\n}def\n\n%>Left Non-Terminal: string width LNT |- x y\n/LNT\n{xyt\n /fNT F\n /space SpaceNT def\n begin-left\n NT\n end-left\n xt yt\n}def\n\n%>Right Non-Terminal Default: string width RNTD |- x y\n/RNTD\n{/-save- BorderWidthNT def\n /BorderWidthNT BorderWidthNT DefaultWidth add def\n RNT\n /BorderWidthNT -save- def\n}def\n\n%>Left Non-Terminal Default: string width LNTD |- x y\n/LNTD\n{/-save- BorderWidthNT def\n /BorderWidthNT BorderWidthNT DefaultWidth add def\n LNT\n /BorderWidthNT -save- def\n}def\n\n% --- Special\n\n% SPecial: string SP\n/SP\n{/Effect EffectS def\n /shape ShapeS def\n /shapecolor BackgroundS def\n /borderwidth BorderWidthS def\n /bordercolor BorderColorS def\n /foreground ForegroundS def\n /shadow ShadowS def\n SBox\n}def\n\n%>Right SPecial: string width RSP |- x y\n/RSP\n{xyt\n /fS F\n /space SpaceS def\n begin-right\n SP\n end-right\n xt yt\n}def\n\n%>Left SPecial: string width LSP |- x y\n/LSP\n{xyt\n /fS F\n /space SpaceS def\n begin-left\n SP\n end-left\n xt yt\n}def\n\n%>Right SPecial Default: string width RSPD |- x y\n/RSPD\n{/-save- BorderWidthS def\n /BorderWidthS BorderWidthS DefaultWidth add def\n RSP\n /BorderWidthS -save- def\n}def\n\n%>Left SPecial Default: string width LSPD |- x y\n/LSPD\n{/-save- BorderWidthS def\n /BorderWidthS BorderWidthS DefaultWidth add def\n LSP\n /BorderWidthS -save- def\n}def\n\n% --- Repeat and Except basics\n\n/begin-direction\n{/w width rwidth sub 0.5 mul def\n width 0 rmoveto}def\n\n/end-direction\n{gsave\n /xx c entry add /YY exch def def\n /yy YY height sub def\n /XX xx rwidth add def\n shadow{doShapeShadow}if\n doShape\n grestore\n}def\n\n/right-direction\n{begin-direction\n w neg EL\n xt yt moveto\n w hT sub EL RA\n end-direction\n}def\n\n/left-direction\n{begin-direction\n hT w sub EL LA\n xt yt moveto\n w EL\n end-direction\n}def\n\n% --- Repeat\n\n% entry height width rwidth begin-repeat\n/begin-repeat\n{/rwidth exch def\n /width exch def\n /height exch def\n /entry exch def\n /fR F\n /space SpaceR def\n /Effect EffectR def\n /shape ShapeR def\n /shapecolor BackgroundR def\n /borderwidth BorderWidthR def\n /bordercolor BorderColorR def\n /foreground ForegroundR def\n /shadow ShadowR def\n xyt\n}def\n\n% string end-repeat |- x y\n/end-repeat\n{gsave\n space Descent rmoveto\n foreground SetRGB S\n c Descent sub\n grestore\n exch space add exch moveto\n xt yt\n}def\n\n%>Right RePeat: string entry height width rwidth RRP |- x y\n/RRP{begin-repeat right-direction end-repeat}def\n\n%>Left RePeat: string entry height width rwidth LRP |- x y\n/LRP{begin-repeat left-direction end-repeat}def\n\n% --- Except\n\n% entry height width rwidth begin-except\n/begin-except\n{/rwidth exch def\n /width exch def\n /height exch def\n /entry exch def\n /fE F\n /space SpaceE def\n /Effect EffectE def\n /shape ShapeE def\n /shapecolor BackgroundE def\n /borderwidth BorderWidthE def\n /bordercolor BorderColorE def\n /foreground ForegroundE def\n /shadow ShadowE def\n xyt\n}def\n\n% x-width end-except |- x y\n/end-except\n{gsave\n space space add add Descent rmoveto\n (-) foreground SetRGB S\n grestore\n space 0 rmoveto\n xt yt\n}def\n\n%>Right EXcept: x-width entry height width rwidth REX |- x y\n/REX{begin-except right-direction end-except}def\n\n%>Left EXcept: x-width entry height width rwidth LEX |- x y\n/LEX{begin-except left-direction end-except}def\n\n% --- Sequence\n\n%>Beginning Of Sequence: BOS |- x y\n/BOS{currentpoint}bind def\n\n%>End Of Sequence: x y x1 y1 EOS |- x y\n/EOS{pop pop}bind def\n\n% --- Production\n\n%>Beginning Of Production: string width height BOP |- y x\n/BOP\n{xyp\n neg yp add /yw exch def\n xp add T sub /xw exch def\n dup length 0 gt % empty string ==> no production name\n {/Effect EffectP def\n /fP F ForegroundP SetRGB BackgroundP aload pop true BG S\n /Effect 0 def\n ( :) S false BG}{pop}ifelse\n xw yw moveto\n hT EL RA\n xp yw moveto\n T EL\n yp xp\n}def\n\n%>End Of Production: y x delta EOP\n/EOPH{add exch moveto}bind def % horizontal\n/EOPV{exch pop sub 0 exch moveto}bind def % vertical\n\n% --- Empty Alternative\n\n%>Empty Alternative: width EA |- x y\n/EA\n{gsave\n Er add 0 rlineto\n Stroke\n grestore\n c\n}def\n\n% --- Alternative\n\n%>AlTernative: h1 h2 ... hn n width AT |- x y\n/AT\n{xyo xo add /xw exch def\n xw yo moveto\n Er EL\n {xw yo moveto\n dup RAlt\n xo yo moveto\n LAlt}repeat\n xo yo\n}def\n\n% --- Optional\n\n%>OPtional: height width OP |- x y\n/OP\n{xyo\n T sub /ow exch def\n ow Er sub 0 rmoveto\n T Er add EL\n neg dup RAlt\n ow T sub neg EL\n xo yo moveto\n LAlt\n xo yo moveto\n T EL\n xo yo\n}def\n\n% --- List Flow\n\n%>One or More: height width OM |- x y\n/OM\n{xyo\n /ow exch def\n ow Er add 0 rmoveto\n T Er add neg EL\n dup RLoop\n xo T add yo moveto\n LLoop\n xo yo moveto\n T EL\n xo yo\n}def\n\n%>Zero or More: h2 h1 width ZM |- x y\n/ZM\n{xyo\n Er add EL\n Er neg 0 rmoveto\n dup RAlt\n exch dup RLoop\n xo yo moveto\n exch dup LAlt\n exch LLoop\n yo add xo T add exch moveto\n xo yo\n}def\n\n% === end EBNF engine\n\n"
Documentation
EBNF PostScript prologue.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/ebnf2ps.el.gz
(defconst ebnf-prologue
"
% === begin EBNF engine
% --- Basic Definitions
/fS F
/SpaceS FontHeight 0.5 mul def
/HeightS FontHeight FontHeight add def
/fE F
/SpaceE FontHeight 0.5 mul def
/HeightE FontHeight FontHeight add def
/fR F
/SpaceR FontHeight 0.5 mul def
/HeightR FontHeight FontHeight add def
/fT F
/SpaceT FontHeight 0.5 mul def
/HeightT FontHeight FontHeight add def
/fNT F
/SpaceNT FontHeight 0.5 mul def
/HeightNT FontHeight FontHeight add def
/T HeightT HeightNT add 0.5 mul def
/hT T 0.5 mul def
/hT2 hT 0.5 mul ArrowScale mul def
/hT4 hT 0.25 mul ArrowScale mul def
/Er 0.1 def % Error factor
/c{currentpoint}bind def
/xyi{/xi c /yi exch def def}bind def
/xyo{/xo c /yo exch def def}bind def
/xyp{/xp c /yp exch def def}bind def
/xyt{/xt c /yt exch def def}bind def
% vertical movement: x y height vm
/vm{add moveto}bind def
% horizontal movement: x y width hm
/hm{3 -1 roll exch add exch moveto}bind def
% set color: [R G B] SetRGB
/SetRGB{aload pop setrgbcolor}bind def
% filling gray area: gray-scale FillGray
/FillGray{gsave setgray fill grestore}bind def
% filling color area: [R G B] FillRGB
/FillRGB{gsave SetRGB fill grestore}bind def
/Stroke{LineWidth setlinewidth LineColor SetRGB stroke}bind def
/StrokeShape{borderwidth setlinewidth bordercolor SetRGB stroke}bind def
/Gstroke{gsave Stroke grestore}bind def
% Empty Line: width EL
/EL{0 rlineto Gstroke}bind def
% --- Arrows
/Down{hT2 neg hT4 neg rlineto}bind def
/Arrow
{hT2 neg hT4 rmoveto
hT2 hT4 neg rlineto
Down
}bind def
/ArrowPath{c newpath moveto Arrow closepath}bind def
/UpPath
{c newpath moveto
hT2 neg 0 rmoveto
0 hT4 rlineto
hT2 hT4 neg rlineto
closepath
}bind def
/DownPath
{c newpath moveto
hT2 neg 0 rmoveto
0 hT4 neg rlineto
hT2 hT4 rlineto
closepath
}bind def
%>Right Arrow: RA
% \\
% *---+
% /
/RA-vector
[{} % 0 - none
{hT2 neg hT4 rlineto} % 1 - semi-up
{Down} % 2 - semi-down
{Arrow} % 3 - simple
{Gstroke ArrowPath} % 4 - transparent
{Gstroke ArrowPath 1 FillGray} % 5 - hollow
{Gstroke ArrowPath LineColor FillRGB} % 6 - full
{Gstroke UpPath 1 FillGray} % 7 - semi-up-hollow
{Gstroke UpPath LineColor FillRGB} % 8 - semi-up-full
{Gstroke DownPath 1 FillGray} % 9 - semi-down-hollow
{Gstroke DownPath LineColor FillRGB} % 10 - semi-down-full
{Gstroke gsave UserArrow grestore} % 11 - user
]def
/RA
{hT 0 rlineto
c
RA-vector ArrowShape get exec
Gstroke
moveto
ExtraWidth 0 rmoveto
}def
% rotation DrawArrow
/DrawArrow
{gsave
0 0 translate
rotate
RA
c
grestore
rmoveto
}def
%>Left Arrow: LA
% /
% +---*
% \\
/LA{180 DrawArrow}def
%>Up Arrow: UA
% +
% /|\\
% |
% *
/UA{90 DrawArrow}def
%>Down Arrow: DA
% *
% |
% \\|/
% +
/DA{270 DrawArrow}def
% --- Corners
%>corner Right Descendant: height arrow corner_RD
% _ | arrow
% / height > 0 | 0 - none
% | | 1 - right
% * ---------- | 2 - left
% | | 3 - vertical
% \\ height < 0 |
% - |
/cRD0-vector
[% 0 - none
{0 h rlineto
hT 0 rlineto}
% 1 - right
{0 h rlineto
RA}
% 2 - left
{hT 0 rmoveto xyi
LA
0 h neg rlineto
xi yi moveto}
% 3 - vertical
{hT h rmoveto xyi
hT neg 0 rlineto
h 0 gt{DA}{UA}ifelse
xi yi moveto}
]def
/cRD-vector
[{cRD0-vector arrow get exec} % 0 - miter
{0 0 0 h hT h rcurveto} % 1 - rounded
{hT h rlineto} % 2 - bevel
]def
/corner_RD
{/arrow exch def /h exch def
cRD-vector ChartShape get exec
Gstroke
}def
%>corner Right Ascendant: height arrow corner_RA
% | arrow
% | height > 0 | 0 - none
% / | 1 - right
% *- ---------- | 2 - left
% \\ | 3 - vertical
% | height < 0 |
% |
/cRA0-vector
[% 0 - none
{hT 0 rlineto
0 h rlineto}
% 1 - right
{RA
0 h rlineto}
% 2 - left
{hT h rmoveto xyi
0 h neg rlineto
LA
xi yi moveto}
% 3 - vertical
{hT h rmoveto xyi
h 0 gt{DA}{UA}ifelse
hT neg 0 rlineto
xi yi moveto}
]def
/cRA-vector
[{cRA0-vector arrow get exec} % 0 - miter
{0 0 hT 0 hT h rcurveto} % 1 - rounded
{hT h rlineto} % 2 - bevel
]def
/corner_RA
{/arrow exch def /h exch def
cRA-vector ChartShape get exec
Gstroke
}def
%>corner Left Descendant: height arrow corner_LD
% _ | arrow
% \\ height > 0 | 0 - none
% | | 1 - right
% * ---------- | 2 - left
% | | 3 - vertical
% / height < 0 |
% - |
/cLD0-vector
[% 0 - none
{0 h rlineto
hT neg 0 rlineto}
% 1 - right
{hT neg h rmoveto xyi
RA
0 h neg rlineto
xi yi moveto}
% 2 - left
{0 h rlineto
LA}
% 3 - vertical
{hT neg h rmoveto xyi
hT 0 rlineto
h 0 gt{DA}{UA}ifelse
xi yi moveto}
]def
/cLD-vector
[{cLD0-vector arrow get exec} % 0 - miter
{0 0 0 h hT neg h rcurveto} % 1 - rounded
{hT neg h rlineto} % 2 - bevel
]def
/corner_LD
{/arrow exch def /h exch def
cLD-vector ChartShape get exec
Gstroke
}def
%>corner Left Ascendant: height arrow corner_LA
% | arrow
% | height > 0 | 0 - none
% \\ | 1 - right
% -* ---------- | 2 - left
% / | 3 - vertical
% | height < 0 |
% |
/cLA0-vector
[% 0 - none
{hT neg 0 rlineto
0 h rlineto}
% 1 - right
{hT neg h rmoveto xyi
0 h neg rlineto
RA
xi yi moveto}
% 2 - left
{LA
0 h rlineto}
% 3 - vertical
{hT neg h rmoveto xyi
h 0 gt{DA}{UA}ifelse
hT 0 rlineto
xi yi moveto}
]def
/cLA-vector
[{cLA0-vector arrow get exec} % 0 - miter
{0 0 hT neg 0 hT neg h rcurveto} % 1 - rounded
{hT neg h rlineto} % 2 - bevel
]def
/corner_LA
{/arrow exch def /h exch def
cLA-vector ChartShape get exec
Gstroke
}def
% --- Flow Stuff
% height prepare-height |- line_height corner_height corner_height
/prepare-height
{dup 0 gt
{T sub hT}
{T add hT neg}ifelse
dup
}def
%>Left Alternative: height LAlt
% _
% /
% | height > 0
% |
% /
% *- ----------
% \\
% |
% | height < 0
% \\
% -
/LAlt
{dup 0 eq
{T exch rlineto}
{dup abs T lt
{0.5 mul dup
1 corner_RA
0 corner_RD}
{prepare-height
1 corner_RA
exch 0 exch rlineto
0 corner_RD
}ifelse
}ifelse
}def
%>Left Loop: height LLoop
% _
% /
% | height > 0
% |
% \\
% -* ----------
% /
% |
% | height < 0
% \\
% -
/LLoop
{prepare-height
3 corner_LA
exch 0 exch rlineto
0 corner_RD
}def
%>Right Alternative: height RAlt
% _
% \\
% | height > 0
% |
% \\
% -* ----------
% /
% |
% | height < 0
% /
% -
/RAlt
{dup 0 eq
{T neg exch rlineto}
{dup abs T lt
{0.5 mul dup
1 corner_LA
0 corner_LD}
{prepare-height
1 corner_LA
exch 0 exch rlineto
0 corner_LD
}ifelse
}ifelse
}def
%>Right Loop: height RLoop
% _
% \\
% | height > 0
% |
% /
% *- ----------
% \\
% |
% | height < 0
% /
% -
/RLoop
{prepare-height
1 corner_RA
exch 0 exch rlineto
0 corner_LD
}def
% --- Terminal, Non-terminal and Special Basics
% string width prepare-width |- string
/prepare-width
{/width exch def
dup stringwidth pop space add space add width exch sub ExtraWidth sub 0.5 mul
/w exch def
}def
% string width begin-right
/begin-right
{xyo
prepare-width
w hT sub EL
RA
}def
% end-right
/end-right
{xo width add Er add yo moveto
w Er add neg EL
xo yo moveto
}def
% string width begin-left
/begin-left
{xyo
prepare-width
w EL
}def
% end-left
/end-left
{xo width add Er add yo moveto
hT w sub Er add EL
LA
xo yo moveto
}def
/ShapePath-vector
[% 0 - miter
{xx yy moveto
xx YY lineto
XX YY lineto
XX yy lineto}
% 1 - rounded
{/half YY yy sub 0.5 mul abs def
xx half add YY moveto
0 0 half neg 0 half neg half neg rcurveto
0 0 0 half neg half half neg rcurveto
XX xx sub abs half sub half sub 0 rlineto
0 0 half 0 half half rcurveto
0 0 0 half half neg half rcurveto}
% 2 - bevel
{/quarter YY yy sub 0.25 mul abs def
xx quarter add YY moveto
quarter neg quarter neg rlineto
0 quarter quarter add neg rlineto
quarter quarter neg rlineto
XX xx sub abs quarter sub quarter sub 0 rlineto
quarter quarter rlineto
0 quarter quarter add rlineto
quarter neg quarter rlineto}
]def
/doShapePath
{newpath
ShapePath-vector shape get exec
closepath
}def
/doShapeShadow
{gsave
Xshadow Xshadow add Xshadow add
Yshadow Yshadow add Yshadow add translate
doShapePath
0.9 FillGray
grestore
}def
/doShape
{gsave
doShapePath
shapecolor FillRGB
StrokeShape
grestore
}def
% string SBound |- string
/SBound
{/xx c dup /yy exch def
FontHeight add /YY exch def def
dup stringwidth pop xx add /XX exch def
Effect 8 and 0 ne
{/yy yy YShadow add def
/XX XX XShadow add def
}if
}def
% string SBox
/SBox
{gsave
c space sub moveto
SBound
/XX XX space add space add def
/YY YY space add def
/yy yy space sub def
shadow{doShapeShadow}if
doShape
space Descent abs rmoveto
foreground SetRGB S
grestore
}def
% --- Terminal
% TeRminal: string TR
/TR
{/Effect EffectT def
/shape ShapeT def
/shapecolor BackgroundT def
/borderwidth BorderWidthT def
/bordercolor BorderColorT def
/foreground ForegroundT def
/shadow ShadowT def
SBox
}def
%>Right Terminal: string width RT |- x y
/RT
{xyt
/fT F
/space SpaceT def
begin-right
TR
end-right
xt yt
}def
%>Left Terminal: string width LT |- x y
/LT
{xyt
/fT F
/space SpaceT def
begin-left
TR
end-left
xt yt
}def
%>Right Terminal Default: string width RTD |- x y
/RTD
{/-save- BorderWidthT def
/BorderWidthT BorderWidthT DefaultWidth add def
RT
/BorderWidthT -save- def
}def
%>Left Terminal Default: string width LTD |- x y
/LTD
{/-save- BorderWidthT def
/BorderWidthT BorderWidthT DefaultWidth add def
LT
/BorderWidthT -save- def
}def
% --- Non-Terminal
% Non-Terminal: string NT
/NT
{/Effect EffectNT def
/shape ShapeNT def
/shapecolor BackgroundNT def
/borderwidth BorderWidthNT def
/bordercolor BorderColorNT def
/foreground ForegroundNT def
/shadow ShadowNT def
SBox
}def
%>Right Non-Terminal: string width RNT |- x y
/RNT
{xyt
/fNT F
/space SpaceNT def
begin-right
NT
end-right
xt yt
}def
%>Left Non-Terminal: string width LNT |- x y
/LNT
{xyt
/fNT F
/space SpaceNT def
begin-left
NT
end-left
xt yt
}def
%>Right Non-Terminal Default: string width RNTD |- x y
/RNTD
{/-save- BorderWidthNT def
/BorderWidthNT BorderWidthNT DefaultWidth add def
RNT
/BorderWidthNT -save- def
}def
%>Left Non-Terminal Default: string width LNTD |- x y
/LNTD
{/-save- BorderWidthNT def
/BorderWidthNT BorderWidthNT DefaultWidth add def
LNT
/BorderWidthNT -save- def
}def
% --- Special
% SPecial: string SP
/SP
{/Effect EffectS def
/shape ShapeS def
/shapecolor BackgroundS def
/borderwidth BorderWidthS def
/bordercolor BorderColorS def
/foreground ForegroundS def
/shadow ShadowS def
SBox
}def
%>Right SPecial: string width RSP |- x y
/RSP
{xyt
/fS F
/space SpaceS def
begin-right
SP
end-right
xt yt
}def
%>Left SPecial: string width LSP |- x y
/LSP
{xyt
/fS F
/space SpaceS def
begin-left
SP
end-left
xt yt
}def
%>Right SPecial Default: string width RSPD |- x y
/RSPD
{/-save- BorderWidthS def
/BorderWidthS BorderWidthS DefaultWidth add def
RSP
/BorderWidthS -save- def
}def
%>Left SPecial Default: string width LSPD |- x y
/LSPD
{/-save- BorderWidthS def
/BorderWidthS BorderWidthS DefaultWidth add def
LSP
/BorderWidthS -save- def
}def
% --- Repeat and Except basics
/begin-direction
{/w width rwidth sub 0.5 mul def
width 0 rmoveto}def
/end-direction
{gsave
/xx c entry add /YY exch def def
/yy YY height sub def
/XX xx rwidth add def
shadow{doShapeShadow}if
doShape
grestore
}def
/right-direction
{begin-direction
w neg EL
xt yt moveto
w hT sub EL RA
end-direction
}def
/left-direction
{begin-direction
hT w sub EL LA
xt yt moveto
w EL
end-direction
}def
% --- Repeat
% entry height width rwidth begin-repeat
/begin-repeat
{/rwidth exch def
/width exch def
/height exch def
/entry exch def
/fR F
/space SpaceR def
/Effect EffectR def
/shape ShapeR def
/shapecolor BackgroundR def
/borderwidth BorderWidthR def
/bordercolor BorderColorR def
/foreground ForegroundR def
/shadow ShadowR def
xyt
}def
% string end-repeat |- x y
/end-repeat
{gsave
space Descent rmoveto
foreground SetRGB S
c Descent sub
grestore
exch space add exch moveto
xt yt
}def
%>Right RePeat: string entry height width rwidth RRP |- x y
/RRP{begin-repeat right-direction end-repeat}def
%>Left RePeat: string entry height width rwidth LRP |- x y
/LRP{begin-repeat left-direction end-repeat}def
% --- Except
% entry height width rwidth begin-except
/begin-except
{/rwidth exch def
/width exch def
/height exch def
/entry exch def
/fE F
/space SpaceE def
/Effect EffectE def
/shape ShapeE def
/shapecolor BackgroundE def
/borderwidth BorderWidthE def
/bordercolor BorderColorE def
/foreground ForegroundE def
/shadow ShadowE def
xyt
}def
% x-width end-except |- x y
/end-except
{gsave
space space add add Descent rmoveto
(-) foreground SetRGB S
grestore
space 0 rmoveto
xt yt
}def
%>Right EXcept: x-width entry height width rwidth REX |- x y
/REX{begin-except right-direction end-except}def
%>Left EXcept: x-width entry height width rwidth LEX |- x y
/LEX{begin-except left-direction end-except}def
% --- Sequence
%>Beginning Of Sequence: BOS |- x y
/BOS{currentpoint}bind def
%>End Of Sequence: x y x1 y1 EOS |- x y
/EOS{pop pop}bind def
% --- Production
%>Beginning Of Production: string width height BOP |- y x
/BOP
{xyp
neg yp add /yw exch def
xp add T sub /xw exch def
dup length 0 gt % empty string ==> no production name
{/Effect EffectP def
/fP F ForegroundP SetRGB BackgroundP aload pop true BG S
/Effect 0 def
( :) S false BG}{pop}ifelse
xw yw moveto
hT EL RA
xp yw moveto
T EL
yp xp
}def
%>End Of Production: y x delta EOP
/EOPH{add exch moveto}bind def % horizontal
/EOPV{exch pop sub 0 exch moveto}bind def % vertical
% --- Empty Alternative
%>Empty Alternative: width EA |- x y
/EA
{gsave
Er add 0 rlineto
Stroke
grestore
c
}def
% --- Alternative
%>AlTernative: h1 h2 ... hn n width AT |- x y
/AT
{xyo xo add /xw exch def
xw yo moveto
Er EL
{xw yo moveto
dup RAlt
xo yo moveto
LAlt}repeat
xo yo
}def
% --- Optional
%>OPtional: height width OP |- x y
/OP
{xyo
T sub /ow exch def
ow Er sub 0 rmoveto
T Er add EL
neg dup RAlt
ow T sub neg EL
xo yo moveto
LAlt
xo yo moveto
T EL
xo yo
}def
% --- List Flow
%>One or More: height width OM |- x y
/OM
{xyo
/ow exch def
ow Er add 0 rmoveto
T Er add neg EL
dup RLoop
xo T add yo moveto
LLoop
xo yo moveto
T EL
xo yo
}def
%>Zero or More: h2 h1 width ZM |- x y
/ZM
{xyo
Er add EL
Er neg 0 rmoveto
dup RAlt
exch dup RLoop
xo yo moveto
exch dup LAlt
exch LLoop
yo add xo T add exch moveto
xo yo
}def
% === end EBNF engine
"
"EBNF PostScript prologue.")