%%BeginResource: procset LoutDiagPrependGraphic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % PostScript @SysPrependGraphic file for @Diag Jeffrey H. Kingston % % Version 2.0 (includes CIRCUM label) September 1996 % % % % To assist in avoiding name clashes, the names of all symbols % % defined here begin with "ldiag". However, this is not feasible % % with user-defined labels and some labels used by users. % % % % is two numbers, a point. % % is one number, a length % % is one number, an angle in degrees % % is one number, the preferred length of a dash % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% errordict begin /handleerror { { /Times-Roman findfont 8 pt scalefont setfont 0 setgray 4 pt 4 pt moveto $error /errorname get dup ldiagdict exch known { ldiagdict exch get } { 100 string cvs } ifelse show ( Command: ) show $error /command get 100 string cvs show } stopped {} if showpage stop } def end % begin diagram: ldiagbegin - % must be defined outside ldiagdict since it loads it /ldiagbegin { xsize 0 0 ysize ldiagdict begin 5 -1 roll /ldiagmaxlabels exch def (@Diag) ldiagpushtagdict /OOY ldiagpointdef /OOX ldiagpointdef 0 0 /OOO ldiagpointdef } def % end diagram: - ldiagend - /ldiagend { ldiagpoptagdict end } def % concat strings: ldiagconcat % must be defined outside ldiagdict since used in ldiagpromotelabels /ldiagconcat { 2 copy length exch length add string dup 0 4 index putinterval dup 3 index length 3 index putinterval 3 1 roll pop pop } def % mconcat strings: ldiagmconcat % returns concatenation, separated by @ if first is non-empty % must be defined outside ldiagdict since used in ldiagpromotelabels /ldiagmconcat { 2 copy length exch length add 1 add string dup 0 4 index putinterval dup 3 index length (@) putinterval dup 3 index length 1 add 3 index putinterval 3 1 roll pop pop } def % show string in format start ... end: ldiagsends /ldiagsends { dup length 20 string cvs (: ) ldiagconcat exch dup 0 20 getinterval ( ... ) ldiagconcat 3 -1 roll exch ldiagconcat exch dup length 20 sub 20 getinterval ldiagconcat } def /ldiagdebugposy 432 def /ldiagdebugposx 72 def % ldiagdebugprint - % must be defined outside ldiagdict since used in arbitrary places % print plus count or stack entries, whichever is the smaller /ldiagdebugprint { exch gsave initgraphics ldiagdebugposy 72 lt { /ldiagdebugposx ldiagdebugposx 144 add store /ldiagdebugposy 432 store } { /ldiagdebugposy ldiagdebugposy 12 sub store } ifelse ldiagdebugposx ldiagdebugposy moveto /Times-Roman findfont 10 scalefont setfont 0 setgray show count 1 sub 2 copy lt { pop } { exch pop } ifelse 1 sub 0 exch 1 exch { /ldiagdebugposy ldiagdebugposy 12 sub store ldiagdebugposx 12 add ldiagdebugposy moveto index dup type (dicttype) eq { (begin dict) show { /ldiagdebugposy ldiagdebugposy 12 sub store ldiagdebugposx 12 add ldiagdebugposy moveto pop 100 string cvs show } forall /ldiagdebugposy ldiagdebugposy 12 sub store ldiagdebugposx 12 add ldiagdebugposy moveto (end dict) show } { 100 string cvs show } ifelse } for grestore } def /ldiagdict 200 dict def ldiagdict begin % error messages /dictfull (dictfull error: too many labels?) def /dictstackoverflow (dictstackoverflow error: labels nested too deeply?) def /execstackoverflow (execstackoverflow error: figure nested too deeply?) def /limitcheck (limitcheck error: figure nested too deeply or too large?) def /syntaxerror (syntaxerror error: syntax error in text of figure?) def /typecheck (typecheck error: syntax error in text of figure?) def /undefined (undefined error: unknown or misspelt label?) def /VMError (VMError error: run out of memory?) def % push pi onto stack: - ldiagpi /ldiagpi 3.14159 def % push e onto stack: - ldiage /ldiage 2.71828 def % arc directions /clockwise false def /anticlockwise true def % test equality between two angles: ldiagangleeq /ldiagangleeq { ldiagfixangle exch ldiagfixangle eq } def % test inequality between two angles: ldiaganglene /ldiaganglene { ldiagangleeq not } def % maximum of two numbers: ldiagmax /ldiagmax { 2 copy gt { pop } { exch pop } ifelse } def % minimum of two numbers: ldiagmin /ldiagmin { 2 copy lt { pop } { exch pop } ifelse } def % add two points: ldiagpadd /ldiagpadd { % (Entering padd) 4 ldiagdebugprint exch 3 1 roll add 3 1 roll add exch % (Leaving padd) 2 ldiagdebugprint } def % subtract first point from second: ldiagpsub /ldiagpsub { 3 2 roll sub 3 1 roll exch sub exch } def % max two points: ldiagpmax /ldiagpmax { exch 3 1 roll ldiagmax 3 1 roll ldiagmax exch } def % min two points: ldiagpmin /ldiagpmin { exch 3 1 roll ldiagmin 3 1 roll ldiagmin exch } def % scalar multiplication: ldiagpmul /ldiagpmul { dup 3 1 roll mul 3 1 roll mul exch } def % point at angle and distance: ldiagatangle /ldiagatangle { 2 copy cos mul 3 1 roll sin mul ldiagpadd } def % angle from one point to another: ldiagangleto /ldiagangleto { ldiagpsub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def % distance between two points: ldiagdistance /ldiagdistance { ldiagpsub dup mul exch dup mul add sqrt } def % stroke a solid line: ldiagsolid - /ldiagsolid { pop pop [] 0 setdash 1 setlinecap stroke } def % stroke a dashed line: ldiagdashed - /ldiagdashed { 2 copy div 2 le 1 index 0 le or { exch pop 1 pt ldiagmax [ exch dup ] 0 setdash } { dup [ exch 4 2 roll 2 copy div 1 sub 2 div ceiling dup 4 1 roll 1 add mul sub exch div ] 0 setdash } ifelse 0 setlinecap stroke } def % stroke a cdashed line: ldiagcdashed - /ldiagcdashed { % (Entering ldiagcdashed) 2 ldiagdebugprint 2 copy le 1 index 0 le or { exch pop 1 pt ldiagmax [ exch dup ] dup 0 get 2 div setdash } { dup [ 4 2 roll exch 2 copy exch div 2 div ceiling div 1 index sub ] exch 2 div setdash } ifelse 0 setlinecap stroke % (Leaving ldiagcdashed) 0 ldiagdebugprint } def % stroke a dotted line: ldiagdotted - /ldiagdotted { 2 copy le 1 index 0 le or { exch pop 1 pt ldiagmax [ exch 0 exch ] 0 setdash } { 1 index exch div ceiling div [ 0 3 2 roll ] 0 setdash } ifelse 1 setlinecap stroke } def % stroke a noline line: ldiagnoline - /ldiagnoline { pop pop } def /ldiagbox { 0 0 /SW ldiagpointdef xsize 0 /SE ldiagpointdef xsize ysize /NE ldiagpointdef 0 ysize /NW ldiagpointdef SE 0.5 ldiagpmul /S ldiagpointdef NW 0.5 ldiagpmul /W ldiagpointdef W SE ldiagpadd /E ldiagpointdef S NW ldiagpadd /N ldiagpointdef NE 0.5 ldiagpmul /CTR ldiagpointdef 0 dg /S@ANGLE ldiagangledef 45 dg /SE@ANGLE ldiagangledef 90 dg /E@ANGLE ldiagangledef 135 dg /NE@ANGLE ldiagangledef 180 dg /N@ANGLE ldiagangledef 225 dg /NW@ANGLE ldiagangledef 270 dg /W@ANGLE ldiagangledef 315 dg /SW@ANGLE ldiagangledef [ CTR NE ldiagpsub /ldiagboxcircum cvx ] ldiagcircumdef SW SE NE NW SW } def % shape and labels of the @CurveBox symbol % ldiagcurvebox /ldiagcurvebox { % (Entering ldiagcurvebox) 1 ldiagdebugprint ldiagdecodelength /cbmgn exch def xsize 0.5 mul ysize 0.5 mul /CTR ldiagpointdef xsize 0.5 mul 0 /S ldiagpointdef xsize ysize 0.5 mul /E ldiagpointdef xsize 0.5 mul ysize /N ldiagpointdef 0 ysize 0.5 mul /W ldiagpointdef cbmgn 0.293 mul cbmgn 0.293 mul /SW ldiagpointdef xsize cbmgn 0.293 mul sub cbmgn 0.293 mul /SE ldiagpointdef xsize cbmgn 0.293 mul sub ysize cbmgn 0.293 mul sub /NE ldiagpointdef cbmgn 0.293 mul ysize cbmgn 0.293 mul sub /NW ldiagpointdef 0 dg /S@ANGLE ldiagangledef 45 dg /SE@ANGLE ldiagangledef 90 dg /E@ANGLE ldiagangledef 135 dg /NE@ANGLE ldiagangledef 180 dg /N@ANGLE ldiagangledef 225 dg /NW@ANGLE ldiagangledef 270 dg /W@ANGLE ldiagangledef 315 dg /SW@ANGLE ldiagangledef [ xsize ysize 0.5 ldiagpmul cbmgn /ldiagcurveboxcircum cvx ] ldiagcircumdef cbmgn 0 xsize cbmgn sub 0 [ xsize cbmgn sub cbmgn ] xsize cbmgn xsize ysize cbmgn sub [ xsize cbmgn sub ysize cbmgn sub ] xsize cbmgn sub ysize cbmgn ysize [ cbmgn ysize cbmgn sub ] 0 ysize cbmgn sub 0 cbmgn [ cbmgn cbmgn ] cbmgn 0 % (Leaving ldiagcurvebox) 0 ldiagdebugprint } def % shadow of the @ShadowBox symbol % its shape and labels are done, somewhat inaccurately, with ldiagbox % ldiagshadow - /ldiagshadow { /lfshm exch def lfshm 0 moveto 0 lfshm neg rlineto xsize 0 rlineto 0 ysize rlineto lfshm neg 0 rlineto xsize 0 lineto closepath fill } def % shape and labels of the @Square symbol /ldiagsquare { xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef CTR xsize xsize ysize ysize ldiagpmax 0.5 ldiagpmul ldiagpadd /NE ldiagpointdef CTR 0 0 CTR NE ldiagdistance 135 ldiagatangle ldiagpadd /NW ldiagpointdef CTR 0 0 CTR NE ldiagdistance 225 ldiagatangle ldiagpadd /SW ldiagpointdef CTR 0 0 CTR NE ldiagdistance 315 ldiagatangle ldiagpadd /SE ldiagpointdef SW 0.5 ldiagpmul SE 0.5 ldiagpmul ldiagpadd /S ldiagpointdef NW 0.5 ldiagpmul NE 0.5 ldiagpmul ldiagpadd /N ldiagpointdef SW 0.5 ldiagpmul NW 0.5 ldiagpmul ldiagpadd /W ldiagpointdef SE 0.5 ldiagpmul NE 0.5 ldiagpmul ldiagpadd /E ldiagpointdef 0 dg /S@ANGLE ldiagangledef 45 dg /SE@ANGLE ldiagangledef 90 dg /E@ANGLE ldiagangledef 135 dg /NE@ANGLE ldiagangledef 180 dg /N@ANGLE ldiagangledef 225 dg /NW@ANGLE ldiagangledef 270 dg /W@ANGLE ldiagangledef 315 dg /SW@ANGLE ldiagangledef [ CTR NE ldiagpsub /ldiagboxcircum cvx ] ldiagcircumdef SW SE NE NW SW } def % shape and labels of the @Diamond symbol /ldiagdiamond { xsize 0 0.5 ldiagpmul /S ldiagpointdef 0 ysize 0.5 ldiagpmul /W ldiagpointdef S W ldiagpadd /CTR ldiagpointdef CTR W ldiagpadd /N ldiagpointdef CTR S ldiagpadd /E ldiagpointdef E N ldiagpadd 0.5 ldiagpmul /NE ldiagpointdef N W ldiagpadd 0.5 ldiagpmul /NW ldiagpointdef S W ldiagpadd 0.5 ldiagpmul /SW ldiagpointdef S E ldiagpadd 0.5 ldiagpmul /SE ldiagpointdef 0 dg /S@ANGLE ldiagangledef 90 dg /E@ANGLE ldiagangledef 180 dg /N@ANGLE ldiagangledef 270 dg /W@ANGLE ldiagangledef S E ldiagangleto /SE@ANGLE ldiagangledef E N ldiagangleto /NE@ANGLE ldiagangledef N W ldiagangleto /NW@ANGLE ldiagangledef W S ldiagangleto /SW@ANGLE ldiagangledef [ xsize ysize 0.5 ldiagpmul /ldiagdiamondcircum cvx ] ldiagcircumdef S E N W S } def % shape and labels of the @Ellipse symbol /ldiagellipse { xsize 0 0.5 ldiagpmul /S ldiagpointdef 0 ysize 0.5 ldiagpmul /W ldiagpointdef S W ldiagpadd /CTR ldiagpointdef CTR W ldiagpadd /N ldiagpointdef CTR S ldiagpadd /E ldiagpointdef CTR xsize 0 0.3536 ldiagpmul ldiagpadd 0 ysize 0.3536 ldiagpmul ldiagpadd /NE ldiagpointdef 0 ysize 0.3536 ldiagpmul CTR xsize 0 0.3536 ldiagpmul ldiagpadd ldiagpsub /SE ldiagpointdef xsize 0 0.3536 ldiagpmul CTR ldiagpsub 0 ysize 0.3536 ldiagpmul ldiagpadd /NW ldiagpointdef 0 ysize 0.3536 ldiagpmul xsize 0 0.3536 ldiagpmul CTR ldiagpsub ldiagpsub /SW ldiagpointdef [ xsize ysize 0.5 ldiagpmul /ldiagellipsecircum cvx ] ldiagcircumdef 0 dg /S@ANGLE ldiagangledef 90 dg /E@ANGLE ldiagangledef 180 dg /N@ANGLE ldiagangledef 270 dg /W@ANGLE ldiagangledef S E ldiagangleto /SE@ANGLE ldiagangledef E N ldiagangleto /NE@ANGLE ldiagangledef N W ldiagangleto /NW@ANGLE ldiagangledef W S ldiagangleto /SW@ANGLE ldiagangledef S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S } def % shape and labels of the @Circle symbol /ldiagcircle { xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef CTR xsize 0 ysize 0 ldiagpmax 0.5 ldiagpmul ldiagpadd /E ldiagpointdef CTR 0 0 CTR E ldiagdistance 45 ldiagatangle ldiagpadd /NE ldiagpointdef CTR 0 0 CTR E ldiagdistance 90 ldiagatangle ldiagpadd /N ldiagpointdef CTR 0 0 CTR E ldiagdistance 135 ldiagatangle ldiagpadd /NW ldiagpointdef CTR 0 0 CTR E ldiagdistance 180 ldiagatangle ldiagpadd /W ldiagpointdef CTR 0 0 CTR E ldiagdistance 225 ldiagatangle ldiagpadd /SW ldiagpointdef CTR 0 0 CTR E ldiagdistance 270 ldiagatangle ldiagpadd /S ldiagpointdef CTR 0 0 CTR E ldiagdistance 315 ldiagatangle ldiagpadd /SE ldiagpointdef [ S E ldiagpsub /ldiagellipsecircum cvx ] ldiagcircumdef 0 dg /S@ANGLE ldiagangledef 45 dg /SE@ANGLE ldiagangledef 90 dg /E@ANGLE ldiagangledef 135 dg /NE@ANGLE ldiagangledef 180 dg /N@ANGLE ldiagangledef 225 dg /NW@ANGLE ldiagangledef 270 dg /W@ANGLE ldiagangledef 315 dg /SW@ANGLE ldiagangledef S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S } def % shape and labels of the @VLine and @VArrow symbols /ldiagvline { xmark ysize ldiagprevious /FROM ldiagpointdef xmark 0 ldiagprevious /TO ldiagpointdef } def % points of a polygon around base with given no of sides, vert init angle: % ldiagpolygon ... /ldiagpolygon { exch round cvi exch xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef 90 sub CTR 2 copy ldiagmax 5 3 roll [ 4 copy pop /ldiagpolycircum cvx ] ldiagcircumdef exch dup 360 exch div exch 1 1 3 2 roll { 4 string cvs (P) exch ldiagconcat 3 copy exch pop (@ANGLE) ldiagconcat cvn exch 90 add exch ldiagangledef cvn 6 copy pop pop ldiagatangle 2 copy 10 2 roll 3 2 roll ldiagpointdef dup 3 1 roll add exch } for pop ldiagatangle } def % shape and labels of the @Isosceles triangle symbol /ldiagisosceles { xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef 0 0 /SW ldiagpointdef xsize 0 /SE ldiagpointdef xsize 0.5 mul ysize /N ldiagpointdef xsize 0.5 mul 0 /S ldiagpointdef SE 0.5 ldiagpmul N 0.5 ldiagpmul ldiagpadd /NE ldiagpointdef SW 0.5 ldiagpmul N 0.5 ldiagpmul ldiagpadd /NW ldiagpointdef [ xsize ysize /ldiagisoscelescircum cvx ] ldiagcircumdef 0 dg /SW@ANGLE ldiagangledef 0 dg /SE@ANGLE ldiagangledef 180 dg /N@ANGLE ldiagangledef 0 dg /S@ANGLE ldiagangledef SE N ldiagangleto /NE@ANGLE ldiagangledef N SW ldiagangleto /NW@ANGLE ldiagangledef SW SE N SW } def % next array element: ldiaggetnext true % or false /ldiaggetnext { 2 copy exch length ge { false } { 2 copy get exch 1 add exch true } ifelse } def % check whether thing is number: ldiagisnumbertype /ldiagisnumbertype { dup type dup /integertype eq exch /realtype eq or } def % check whether thing is an array: ldiagisarraytype /ldiagisarraytype { dup type /arraytype eq } def % check whether thing is an array: ldiagisnametype /ldiagisnametype { dup type /nametype eq } def % get next item: ldiaggetnextitem 0 % or 1 % or 2 /ldiaggetnextitem { ldiaggetnext { ldiagisarraytype { 1 } { ldiagisnumbertype { 3 1 roll ldiaggetnext { ldiagisnumbertype { 4 3 roll exch 2 } { pop 3 2 roll pop 0 } ifelse } { 3 2 roll pop 0 } ifelse } { pop 0 } ifelse } ifelse } { 0 } ifelse } def % approximate equality: num1 num2 approxeq /approxeq { dup 0 eq { pop 0 eq } { dup 3 1 roll sub exch div abs 0.001 lt } ifelse } def % set arc path: bool x1 y1 x2 y2 x0 y0 ldiagsetarc % the path goes from x1 y1 to x2 y2 about centre x0 y0, % anticlockwise if bool is true else clockwise. % The orientations of backwards pointing and forwards pointing % arrowheads are returned in the two angles, and % the length of the arc is returned in . /ldiagsetarc { % (Entering ldiagsetarc) 7 ldiagdebugprint 20 dict begin matrix currentmatrix 8 1 roll 2 copy translate 2 copy 8 2 roll 4 2 roll ldiagpsub 6 2 roll ldiagpsub dup /y1 exch def dup mul /y1s exch def dup /x1 exch def dup mul /x1s exch def dup /y2 exch def dup mul /y2s exch def dup /x2 exch def dup mul /x2s exch def /dist1 0 0 x1 y1 ldiagdistance def /dist2 0 0 x2 y2 ldiagdistance def y1s y2s approxeq { -1 } { y1s x2s mul y2s x1s mul sub y1s y2s sub div } ifelse /da exch def x1s x2s approxeq { -1 } { x1s y2s mul x2s y1s mul sub x1s x2s sub div } ifelse /db exch def da 0 gt db 0 gt and { % ( case 1, ellipse) 0 ldiagdebugprint /LMax da sqrt db sqrt ldiagmax def /scalex da sqrt LMax div def /scaley db sqrt LMax div def scalex scaley scale 0 0 LMax 0 0 x1 scalex mul y1 scaley mul ldiagangleto 0 0 x2 scalex mul y2 scaley mul ldiagangleto 2 copy eq { 360 add } if 2 copy 8 2 roll 5 index { arc } { arcn } ifelse 2 index 1 index { 90 sub } { 90 add } ifelse dup sin scaley mul exch cos scalex mul atan 2 index 2 index { 90 add } { 90 sub } ifelse dup sin scaley mul exch cos scalex mul atan 5 2 roll % res1 res2 ang1 ang2 anticlockwise { exch sub } { sub } ifelse dup 0 le { 360 add } if ldiagpi mul LMax mul 180 div } { dist1 dist2 approxeq % x1 y1 dist1 ( x1 y1, d) 3 ldiagdebugprint pop pop pop % x2 y2 dist2 ( x2 y2, d) 3 ldiagdebugprint pop pop pop { % ( case 2, circle) 0 ldiagdebugprint 0 0 dist1 0 0 x1 y1 ldiagangleto 0 0 x2 y2 ldiagangleto 2 copy eq { 360 add } if 2 copy 8 2 roll 5 index { arc } { arcn } ifelse 2 index 1 index { 90 sub } { 90 add } ifelse 2 index 2 index { 90 add } { 90 sub } ifelse 5 2 roll % res1 res2 ang1 ang2 clockwise { exch sub } { sub } ifelse dup 0 le { 360 add } if ldiagpi mul dist1 mul 180 div } { % ( case 3, line) 0 ldiagdebugprint x2 y2 lineto pop x2 y2 x1 y1 ldiagangleto x1 y1 x2 y2 ldiagangleto x1 y1 x2 y2 ldiagdistance } ifelse } ifelse 4 -1 roll setmatrix end % (Leaving ldiagsetarc) 3 ldiagdebugprint } def % ldiagsetcurve: set up a Bezier curve from x0 y0 to x3 y3 % and return arrowhead angles and length of curve (actually 0) % x0 y0 x1 y1 x2 y2 x3 y3 ldiagsetcurve /ldiagsetcurve { 8 copy curveto pop pop ldiagangleto 5 1 roll 4 2 roll ldiagangleto exch 0 } def % ldiagsetpath: convert a Diag path into a PostScript path % [ shape ] ldiagsetpath /ldiagsetpath { 10 dict begin 0 newpath /prevseen false def /curveseen false def { ldiaggetnextitem dup 0 eq { pop exit } { 1 eq { /curveseen true def /curve exch def curve length 0 eq { /curveseen false def } if } { /ycurr exch def /xcurr exch def prevseen { curveseen { curve length 4 eq { xprev yprev curve 0 get curve 1 get curve 2 get curve 3 get xcurr ycurr ldiagsetcurve pop pop pop } { xprev yprev xcurr ycurr curve length 1 ge { curve 0 get } { 0 } ifelse curve length 2 ge { curve 1 get } { 0 } ifelse curve length 3 ge { curve 2 get } { true } ifelse 7 1 roll ldiagsetarc pop pop pop } ifelse } { xcurr ycurr lineto } ifelse } { xcurr ycurr moveto } ifelse /xprev xcurr def /yprev ycurr def /prevseen true def /curveseen false def } ifelse } ifelse } loop pop pop end } def % ldiagpaintpath: paint a path of the given shape % /paint [ shape ] ldiagpaintpath - /ldiagpaintpath { ldiagsetpath cvx exec } def % stroke a path of the given shape in the given linestyle and dash length. % Return the origin and angle of the backward and forward arrow heads. % dashlength /linestyle [shape] ldiagdopath [ ] [ ] /ldiagdopath { 10 dict begin 0 /prevseen false def /curveseen false def /backarrow [] def /fwdarrow [] def { ldiaggetnextitem dup 0 eq { pop exit } { 1 eq { /curveseen true def /curve exch def curve length 0 eq { /prevseen false def } if } { /ycurr exch def /xcurr exch def prevseen { newpath xprev yprev moveto curveseen { curve length 4 eq { xprev yprev curve 0 get curve 1 get curve 2 get curve 3 get xcurr ycurr ldiagsetcurve } { xprev yprev xcurr ycurr curve length 1 ge { curve 0 get } { 0 } ifelse curve length 2 ge { curve 1 get } { 0 } ifelse curve length 3 ge { curve 2 get } { true } ifelse 7 1 roll ldiagsetarc } ifelse } { xcurr ycurr lineto xcurr ycurr xprev yprev ldiagangleto dup 180 sub xprev yprev xcurr ycurr ldiagdistance } ifelse 6 index 6 index cvx exec [ xprev yprev 5 -1 roll ] backarrow length 0 eq { /backarrow exch def } { pop } ifelse [ xcurr ycurr 4 -1 roll ] /fwdarrow exch def } if /xprev xcurr def /yprev ycurr def /prevseen true def /curveseen false def } ifelse } ifelse } loop pop pop pop pop backarrow length 0 eq { [ 0 0 0 ] } { backarrow } ifelse fwdarrow length 0 eq { [ 0 0 0 ] } { fwdarrow } ifelse end } def % stroke a path of the given shape in the given linestyle and dash length. % dashlength [ /linestyle ] [shape] ldiagdosegpath - /ldiagdosegpath { 12 dict begin 1 index /seg exch def 1 index length /seglength exch def 0 /segcount exch def 0 /prevseen false def /curveseen false def /backarrow [] def /fwdarrow [] def { ldiaggetnextitem dup 0 eq { pop exit } { 1 eq { /curveseen true def /curve exch def curve length 0 eq { /prevseen false def } if } { /ycurr exch def /xcurr exch def prevseen { newpath xprev yprev moveto curveseen { curve length 4 eq { xprev yprev curve 0 get curve 1 get curve 2 get curve 3 get xcurr ycurr ldiagsetcurve } { xprev yprev xcurr ycurr curve length 1 ge { curve 0 get } { 0 } ifelse curve length 2 ge { curve 1 get } { 0 } ifelse curve length 3 ge { curve 2 get } { true } ifelse 7 1 roll ldiagsetarc } ifelse } { xcurr ycurr lineto xcurr ycurr xprev yprev ldiagangleto dup 180 sub xprev yprev xcurr ycurr ldiagdistance } ifelse 6 index seg segcount seglength mod get cvx exec /segcount segcount 1 add def [ xprev yprev 5 -1 roll ] backarrow length 0 eq { /backarrow exch def } { pop } ifelse [ xcurr ycurr 4 -1 roll ] /fwdarrow exch def } if /xprev xcurr def /yprev ycurr def /prevseen true def /curveseen false def } ifelse } ifelse } loop pop pop pop pop end } def % ldiagnodebegin: start of node parameters % ldiagnodebegin - /ldiagnodebegin { % (Entering ldiagnodebegin) 0 ldiagdebugprint ldiagmaxlabels dict begin } def % ldiagnodeend: end of node parameters (so do the node) %