diff options
Diffstat (limited to 'doc/user/user.ps')
-rw-r--r-- | doc/user/user.ps | 5202 |
1 files changed, 5202 insertions, 0 deletions
diff --git a/doc/user/user.ps b/doc/user/user.ps new file mode 100644 index 0000000..203f7e3 --- /dev/null +++ b/doc/user/user.ps @@ -0,0 +1,5202 @@ +%!PS-Adobe-3.0 +%%Creator: Basser Lout Version 3.19 (March 2000) +%%CreationDate: Mon Apr 3 16:16:36 2000 +%%DocumentData: Binary +%%DocumentNeededResources: (atend) +%%DocumentSuppliedResources: (atend) +%%DocumentMedia: A4 595 842 0 white () +%%PageOrder: Ascend +%%Pages: (atend) +%%BoundingBox: 0 0 595 842 +%%EndComments + +%%BeginProlog +%%BeginResource: procset LoutStartUp +/m { 3 1 roll moveto show } bind def +/mo { 3 1 roll moveto true charpath stroke } bind def +/s { exch currentpoint exch pop moveto show } bind def +/so { exch currentpoint exch pop moveto true charpath stroke } bind def +/k { exch neg 0 rmoveto show } bind def +/ko { exch neg 0 rmoveto true charpath stroke } bind def +/ul { gsave setlinewidth dup 3 1 roll + moveto lineto stroke grestore } bind def +/in { 1440 mul } def +/cm { 567 mul } def +/pt { 20 mul } def +/em { 120 mul } def +/sp { louts mul } def +/vs { loutv mul } def +/ft { loutf mul } def +/dg { } def + +/LoutGraphic { + /louts exch def + /loutv exch def + /loutf exch def + /ymark exch def + /xmark exch def + /ysize exch def + /xsize exch def +} def + +/LoutGr2 { gsave translate LoutGraphic gsave } def + +/LoutFont +{ findfont exch scalefont setfont +} bind def + +/LoutRecode { + { findfont dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding exch def + currentdict end definefont pop + } + stopped pop +} bind def + +/BeginEPSF { + /LoutEPSFState save def + /dict_count countdictstack def + /op_count count 1 sub def + userdict begin + /showpage { } def + 0 setgray 0 setlinecap + 1 setlinewidth 0 setlinejoin + 10 setmiterlimit [] 0 setdash newpath + /languagelevel where + { pop languagelevel + 1 ne + { false setstrokeadjust false setoverprint + } if + } if +} bind def + +/EndEPSF { + count op_count sub { pop } repeat + countdictstack dict_count sub { end } repeat + LoutEPSFState restore +} bind def +%%EndResource + +%%BeginResource: encoding vec2 +/vec2 [ +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright +/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash +/zero /one /two /three /four /five /six /seven +/eight /nine /colon /semicolon /less /equal /greater /question +/at /A /B /C /D /E /F /G +/H /I /J /K /L /M /N /O +/P /Q /R /S /T /U /V /W +/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore +/quoteleft /a /b /c /d /e /f /g +/h /i /j /k /l /m /n /o +/p /q /r /s /t /u /v /w +/x /y /z /braceleft /bar /braceright /asciitilde /.notdef +/quotesinglbase /quotedblbase /ellipsis /OE /oe /quotedblleft /quotedblright /fi +/fl /endash /emdash /bullet /dagger /daggerdbl /florin /fraction +/dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent +/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron +/space /exclamdown /cent /sterling /currency /yen /brokenbar /section +/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron +/degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered +/cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown +/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla +/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis +/Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply +/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls +/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla +/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis +/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide +/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis +] def +%%EndResource + +%%BeginResource: procset LoutTabPrependGraphic +% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/tabf.lpg +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Tab % +% % +% To assist in avoiding name clashes, the names % +% of all these symbols begin with "ltab". % +% % +% Jeffrey H. Kingston % +% 24 September 1991 % +% 22 December 1992 % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% linewidth ltabhs - +% horizontal single line +/ltabhs +{ 0 0 moveto xsize 0 lineto + setlinewidth 0 setlinecap stroke +} def + +% linewidth ltabhsp - +% horizontal single line with projecting ends +/ltabhsp +{ 0 0 moveto xsize 0 lineto + setlinewidth 2 setlinecap stroke +} def + +% linewidth ltabhd - +% horizontal double line +/ltabhd +{ dup dup + 0 0 moveto xsize 0 lineto + 0 exch 3 mul moveto xsize exch 3 mul lineto + setlinewidth 0 setlinecap stroke +} def + +% linewidth ltabhdb - +% horizontal double line below mark +/ltabhdb +{ dup dup + 0 0 moveto xsize 0 lineto + 0 exch -3 mul moveto xsize exch -3 mul lineto + setlinewidth 0 setlinecap stroke +} def + +% linewidth ltabhdnw - +% horizontal double line with northwest corner +/ltabhdnw +{ dup dup dup dup + 0 0 moveto xsize 0 lineto + xsize exch 3 mul moveto + -3 mul exch 3 mul lineto + -3 mul 0 lineto + setlinewidth 0 setlinejoin 2 setlinecap stroke +} def + +% linewidth ltabhdne - +% horizontal double line with northeast corner +/ltabhdne +{ dup dup dup dup + 0 0 moveto xsize 0 lineto + 0 exch 3 mul moveto + 3 mul xsize add exch 3 mul lineto + 3 mul xsize add 0 lineto + setlinewidth 0 setlinejoin 2 setlinecap stroke +} def + +% linewidth ltabhdsw - +% horizontal double line with southwest corner +/ltabhdsw +{ dup dup dup dup + 0 0 moveto xsize 0 lineto + xsize exch -3 mul moveto + -3 mul exch -3 mul lineto + -3 mul 0 lineto + setlinewidth 0 setlinejoin 2 setlinecap stroke +} def + +% linewidth ltabhdse - +% horizontal double line with southeast corner +/ltabhdse +{ dup dup dup dup + 0 0 moveto xsize 0 lineto + 0 exch -3 mul moveto + 3 mul xsize add exch -3 mul lineto + 3 mul xsize add 0 lineto + setlinewidth 0 setlinejoin 2 setlinecap stroke +} def + +% linewidth ltabvs - +% vertical single line +/ltabvs +{ 0 0 moveto 0 ysize lineto + setlinewidth 0 setlinecap stroke +} def + +% linewidth ltabvd - +% vertical double line +/ltabvd +{ dup dup + 0 0 moveto 0 ysize lineto + -3 mul 0 moveto -3 mul ysize lineto + setlinewidth 0 setlinecap stroke +} def + +% linewidth ltabvdr - +% vertical double line to right of mark +/ltabvdr +{ dup dup + 0 0 moveto 0 ysize lineto + 3 mul 0 moveto 3 mul ysize lineto + setlinewidth 0 setlinecap stroke +} def +%%EndResource + +%%BeginResource: procset LoutTblPrependGraphic +% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/tblf.lpg +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Tbl Jeffrey H. Kingston % +% Version 1.0 June 1998 % +% % +% To assist in avoiding name clashes, the names of all symbols % +% defined here begin with "ltbl". % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% painting (i.e. filling): - ltblwhite - (etc.) +/ltblnopaint { } def +/ltblnochange { fill } def +/ltbldarkblue { 0.0 0.0 0.5 setrgbcolor fill } def +/ltblblue { 0.0 0.0 1.0 setrgbcolor fill } def +/ltbllightblue { 0.5 0.5 1.0 setrgbcolor fill } def +/ltbldarkgreen { 0.0 0.5 0.0 setrgbcolor fill } def +/ltblgreen { 0.0 1.0 0.0 setrgbcolor fill } def +/ltbllightgreen { 0.5 1.0 0.5 setrgbcolor fill } def +/ltbldarkred { 0.5 0.0 0.0 setrgbcolor fill } def +/ltblred { 1.0 0.0 0.0 setrgbcolor fill } def +/ltbllightred { 1.0 0.5 0.5 setrgbcolor fill } def +/ltbldarkcyan { 0.0 0.5 0.5 setrgbcolor fill } def +/ltblcyan { 0.0 1.0 1.0 setrgbcolor fill } def +/ltbllightcyan { 0.5 1.0 1.0 setrgbcolor fill } def +/ltbldarkmagenta { 0.5 0.0 0.5 setrgbcolor fill } def +/ltblmagenta { 1.0 0.0 1.0 setrgbcolor fill } def +/ltbllightmagenta { 1.0 0.5 1.0 setrgbcolor fill } def +/ltbldarkyellow { 0.5 0.5 0.0 setrgbcolor fill } def +/ltblyellow { 1.0 1.0 0.0 setrgbcolor fill } def +/ltbllightyellow { 1.0 1.0 0.5 setrgbcolor fill } def +/ltbldarkgray { 0.2 0.2 0.2 setrgbcolor fill } def +/ltblgray { 0.5 0.5 0.5 setrgbcolor fill } def +/ltbllightgray { 0.8 0.8 0.8 setrgbcolor fill } def +/ltbldarkgrey { 0.2 0.2 0.2 setrgbcolor fill } def +/ltblgrey { 0.5 0.5 0.5 setrgbcolor fill } def +/ltbllightgrey { 0.8 0.8 0.8 setrgbcolor fill } def +/ltblblack { 0.0 0.0 0.0 setrgbcolor fill } def +/ltblwhite { 1.0 1.0 1.0 setrgbcolor fill } def +%%EndResource + +%%BeginResource: procset LoutFigPrependGraphic +% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/figf.lpg +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Fig Jeffrey H. Kingston % +% Version 2.0 (includes CIRCUM label) January 1992 % +% % +% To assist in avoiding name clashes, the names of all symbols % +% defined here begin with "lfig". However, this is not feasible % +% with user-defined labels and some labels used by users. % +% % +% <point> is two numbers, a point. % +% <length> is one number, a length % +% <angle> is one number, an angle in degrees % +% <dashlength> 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 lfigdict exch known + { lfigdict exch get } + { 30 string cvs } ifelse + show + ( Command: ) show + $error /command get 30 string cvs show + } stopped {} if + showpage stop + } def +end + +% concat strings: <string> <string> lfigconcat <string> +% must be defined outside lfigdict since used in lfigpromotelabels +/lfigconcat +{ 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 + +% <string> lfigdebugprint - +% must be defined outside lfigdict since used in arbitrary places +% /lfigdebugprint +% { print +% (; operand stack:\n) print +% count copy +% count 2 idiv +% { == +% (\n) print +% } repeat +% (\n) print +% } def + +/lfigdict 120 dict def +lfigdict 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: - lfigpi <num> +/lfigpi 3.14159 def + +% arc directions +/clockwise false def +/anticlockwise true def + +% maximum of two numbers: <num> <num> lfigmax <num> +/lfigmax { 2 copy gt { pop } { exch pop } ifelse } def + +% minimum of two numbers: <num> <num> lfigmin <num> +/lfigmin { 2 copy lt { pop } { exch pop } ifelse } def + +% add two points: <point> <point> lfigpadd <point> +/lfigpadd { exch 3 1 roll add 3 1 roll add exch } def + +% subtract first point from second: <point> <point> lfigpsub <point> +/lfigpsub { 3 2 roll sub 3 1 roll exch sub exch } def + +% max two points: <point> <point> lfigpmax <point> +/lfigpmax { exch 3 1 roll lfigmax 3 1 roll lfigmax exch } def + +% min two points: <point> <point> lfigpmin <point> +/lfigpmin { exch 3 1 roll lfigmin 3 1 roll lfigmin exch } def + +% scalar multiplication: <point> <num> lfigpmul <point> +/lfigpmul { dup 3 1 roll mul 3 1 roll mul exch } def + +% point at angle and distance: <point> <length> <angle> lfigatangle <point> +/lfigatangle { 2 copy cos mul 3 1 roll sin mul lfigpadd } def + +% angle from one point to another: <point> <point> lfigangle <angle> +/lfigangle { lfigpsub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def + +% distance between two points: <point> <point> lfigdistance <length> +/lfigdistance { lfigpsub dup mul exch dup mul add sqrt } def + +% difference in x coords: <point> <point> lfigxdistance <length> +/lfigxdistance { pop 3 1 roll pop sub } def + +%difference in y coords: <point> <point> lfigydistance <length> +/lfigydistance { 3 1 roll pop sub exch pop } def + +% stroke a solid line: <length> <dashlength> lfigsolid - +/lfigsolid +{ pop pop [] 0 setdash stroke +} def + +% stroke a lfigdashed line: <length> <dashlength> lfigdashed - +/lfigdashed +{ 2 copy div 2 le 1 index 0 le or + { exch pop 1 pt lfigmax [ 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 stroke +} def + +% stroke a lfigcdashed line: <length> <dashlength> lfigcdashed - +/lfigcdashed +{ 2 copy le 1 index 0 le or + { exch pop 1 pt lfigmax [ 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 stroke +} def + +% stroke a dotted line: <length> <dashlength> lfigdotted - +/lfigdotted +{ 2 copy le 1 index 0 le or + { exch pop 1 pt lfigmax [ exch 0 exch ] 0 setdash } + { 1 index exch div ceiling div + [ 0 3 2 roll ] 0 setdash + } ifelse stroke +} def + +% stroke a noline line: <length> <dashlength> lfignoline - +/lfignoline +{ pop pop +} def + +% painting (i.e. filling): - lfigwhite - (etc.) +/lfignopaint { } def +/lfignochange { fill } def +/lfigdarkblue { 0.0 0.0 0.5 setrgbcolor fill } def +/lfigblue { 0.0 0.0 1.0 setrgbcolor fill } def +/lfiglightblue { 0.5 0.5 1.0 setrgbcolor fill } def +/lfigdarkgreen { 0.0 0.5 0.0 setrgbcolor fill } def +/lfiggreen { 0.0 1.0 0.0 setrgbcolor fill } def +/lfiglightgreen { 0.5 1.0 0.5 setrgbcolor fill } def +/lfigdarkred { 0.5 0.0 0.0 setrgbcolor fill } def +/lfigred { 1.0 0.0 0.0 setrgbcolor fill } def +/lfiglightred { 1.0 0.5 0.5 setrgbcolor fill } def +/lfigdarkcyan { 0.0 0.5 0.5 setrgbcolor fill } def +/lfigcyan { 0.0 1.0 1.0 setrgbcolor fill } def +/lfiglightcyan { 0.5 1.0 1.0 setrgbcolor fill } def +/lfigdarkmagenta { 0.5 0.0 0.5 setrgbcolor fill } def +/lfigmagenta { 1.0 0.0 1.0 setrgbcolor fill } def +/lfiglightmagenta { 1.0 0.5 1.0 setrgbcolor fill } def +/lfigdarkyellow { 0.5 0.5 0.0 setrgbcolor fill } def +/lfigyellow { 1.0 1.0 0.0 setrgbcolor fill } def +/lfiglightyellow { 1.0 1.0 0.5 setrgbcolor fill } def +/lfigdarkgray { 0.2 0.2 0.2 setrgbcolor fill } def +/lfiggray { 0.5 0.5 0.5 setrgbcolor fill } def +/lfiglightgray { 0.8 0.8 0.8 setrgbcolor fill } def +/lfigdarkgrey { 0.2 0.2 0.2 setrgbcolor fill } def +/lfiggrey { 0.5 0.5 0.5 setrgbcolor fill } def +/lfiglightgrey { 0.8 0.8 0.8 setrgbcolor fill } def +/lfigblack { 0.0 0.0 0.0 setrgbcolor fill } def +/lfigwhite { 1.0 1.0 1.0 setrgbcolor fill } def + +% line caps (and joins, not currently used) +/lfigbutt 0 def +/lfiground 1 def +/lfigprojecting 2 def +/lfigmiter 0 def +/lfigbevel 2 def + +% shape and labels of the @Box symbol +/lfigbox +{ + 0 0 /SW lfigpointdef + xsize 0 /SE lfigpointdef + xsize ysize /NE lfigpointdef + 0 ysize /NW lfigpointdef + SE 0.5 lfigpmul /S lfigpointdef + NW 0.5 lfigpmul /W lfigpointdef + W SE lfigpadd /E lfigpointdef + S NW lfigpadd /N lfigpointdef + NE 0.5 lfigpmul /CTR lfigpointdef + [ CTR NE lfigpsub /lfigboxcircum cvx ] lfigcircumdef + SW SE NE NW SW +} def + +% shape and labels of the @CurveBox symbol +/lfigcurvebox +{ + + xsize 0.5 mul ysize 0.5 mul /CTR lfigpointdef + xsize 0.5 mul 0 /S lfigpointdef + xsize ysize 0.5 mul /E lfigpointdef + xsize 0.5 mul ysize /N lfigpointdef + 0 ysize 0.5 mul /W lfigpointdef + + xmark 0.293 mul xmark 0.293 mul /SW lfigpointdef + xsize xmark 0.293 mul sub xmark 0.293 mul /SE lfigpointdef + xsize xmark 0.293 mul sub ysize xmark 0.293 mul sub /NE lfigpointdef + xmark 0.293 mul ysize xmark 0.293 mul sub /NW lfigpointdef + + [ xsize ysize 0.5 lfigpmul xmark /lfigcurveboxcircum cvx ] lfigcircumdef + + xmark 0 + xsize xmark sub 0 + [ xsize xmark sub xmark ] + xsize xmark + xsize ysize xmark sub + [ xsize xmark sub ysize xmark sub ] + xsize xmark sub ysize + xmark ysize + [ xmark ysize xmark sub ] + 0 ysize xmark sub + 0 xmark + [ xmark xmark ] + xmark 0 +} def + +% shadow of the @ShadowBox symbol +% its shape and labels are done, somewhat inaccurately, with lfigbox +/lfigshadow +{ xmark 2 mul 0 moveto xsize 0 lineto + xsize ysize xmark 2 mul sub lineto + xsize xmark sub ysize xmark 2 mul sub lineto + xsize xmark sub xmark lineto + xmark 2 mul xmark lineto closepath fill +} def + +% shape and labels of the @Square symbol +/lfigsquare +{ + xsize ysize 0.5 lfigpmul /CTR lfigpointdef + CTR xsize xsize ysize ysize lfigpmax 0.5 lfigpmul lfigpadd /NE lfigpointdef + CTR 0 0 CTR NE lfigdistance 135 lfigatangle lfigpadd /NW lfigpointdef + CTR 0 0 CTR NE lfigdistance 225 lfigatangle lfigpadd /SW lfigpointdef + CTR 0 0 CTR NE lfigdistance 315 lfigatangle lfigpadd /SE lfigpointdef + SW 0.5 lfigpmul SE 0.5 lfigpmul lfigpadd /S lfigpointdef + NW 0.5 lfigpmul NE 0.5 lfigpmul lfigpadd /N lfigpointdef + SW 0.5 lfigpmul NW 0.5 lfigpmul lfigpadd /W lfigpointdef + SE 0.5 lfigpmul NE 0.5 lfigpmul lfigpadd /E lfigpointdef + [ CTR NE lfigpsub /lfigboxcircum cvx ] lfigcircumdef + SW SE NE NW SW +} def + +% shape and labels of the @Diamond symbol +/lfigdiamond +{ + xsize 0 0.5 lfigpmul /S lfigpointdef + 0 ysize 0.5 lfigpmul /W lfigpointdef + S W lfigpadd /CTR lfigpointdef + CTR W lfigpadd /N lfigpointdef + CTR S lfigpadd /E lfigpointdef + [ xsize ysize 0.5 lfigpmul /lfigdiamondcircum cvx ] lfigcircumdef + S E N W S +} def + +% shape and labels of the @Ellipse symbol +/lfigellipse +{ + xsize 0 0.5 lfigpmul /S lfigpointdef + 0 ysize 0.5 lfigpmul /W lfigpointdef + S W lfigpadd /CTR lfigpointdef + CTR W lfigpadd /N lfigpointdef + CTR S lfigpadd /E lfigpointdef + CTR xsize 0 0.3536 lfigpmul lfigpadd 0 ysize 0.3536 lfigpmul lfigpadd /NE lfigpointdef + 0 ysize 0.3536 lfigpmul CTR xsize 0 0.3536 lfigpmul lfigpadd lfigpsub /SE lfigpointdef + xsize 0 0.3536 lfigpmul CTR lfigpsub 0 ysize 0.3536 lfigpmul lfigpadd /NW lfigpointdef + 0 ysize 0.3536 lfigpmul xsize 0 0.3536 lfigpmul CTR lfigpsub lfigpsub /SW lfigpointdef + [ xsize ysize 0.5 lfigpmul /lfigellipsecircum cvx ] lfigcircumdef + S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S +} def + +% shape and labels of the @Circle symbol +/lfigcircle +{ + xsize ysize 0.5 lfigpmul /CTR lfigpointdef + CTR xsize 0 ysize 0 lfigpmax 0.5 lfigpmul lfigpadd /E lfigpointdef + CTR 0 0 CTR E lfigdistance 45 lfigatangle lfigpadd /NE lfigpointdef + CTR 0 0 CTR E lfigdistance 90 lfigatangle lfigpadd /N lfigpointdef + CTR 0 0 CTR E lfigdistance 135 lfigatangle lfigpadd /NW lfigpointdef + CTR 0 0 CTR E lfigdistance 180 lfigatangle lfigpadd /W lfigpointdef + CTR 0 0 CTR E lfigdistance 225 lfigatangle lfigpadd /SW lfigpointdef + CTR 0 0 CTR E lfigdistance 270 lfigatangle lfigpadd /S lfigpointdef + CTR 0 0 CTR E lfigdistance 315 lfigatangle lfigpadd /SE lfigpointdef + [ S E lfigpsub /lfigellipsecircum cvx ] lfigcircumdef + S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S +} def + +% shape and labels of the @HLine and @HArrow symbols +/lfighline +{ + 0 ymark lfigprevious /FROM lfigpointdef + xsize ymark lfigprevious /TO lfigpointdef +} def + +% shape and labels of the @VLine and @VArrow symbols +/lfigvline +{ + xmark ysize lfigprevious /FROM lfigpointdef + xmark 0 lfigprevious /TO lfigpointdef +} def + +% points of a polygon around base with given no of sides, vert init angle: +% <sides> <angle> figpolygon <point> ... <point> +/lfigpolygon +{ xsize ysize 0.5 lfigpmul /CTR lfigpointdef + 90 sub CTR 2 copy lfigmax 5 3 roll + [ 4 copy pop /lfigpolycircum cvx ] lfigcircumdef + exch dup 360 exch div exch + 1 1 3 2 roll + { 4 string cvs (P) exch lfigconcat cvn + 6 copy pop pop lfigatangle 2 copy 10 2 roll + 3 2 roll lfigpointdef + dup 3 1 roll add exch + } for + pop lfigatangle +} def + +% next array element: <array> <index> lfiggetnext <array> <index> <any> true +% or <array> <index> false +/lfiggetnext +{ 2 copy exch length ge + { false } + { 2 copy get exch 1 add exch true } ifelse +} def + +% check whether thing is number: <any> lfigisnumbertype <any> <bool> +/lfigisnumbertype +{ dup type dup + /integertype eq exch /realtype eq or +} def + +% check whether thing is an array: <any> lfigisarraytype <any> <bool> +/lfigisarraytype { dup type /arraytype eq } def + +% get next item: <array> <index> lfiggetnextitem <array> <index> 0 +% or <array> <index> <array> 1 +% or <array> <index> <point> 2 +/lfiggetnextitem +{ lfiggetnext + { lfigisarraytype + { 1 + } + { lfigisnumbertype + { 3 1 roll + lfiggetnext + { lfigisnumbertype + { 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 + +% set arc path: bool x1 y1 x2 y2 x0 y0 lfigsetarc <angle> <angle> <dist> +% 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 <dist>. +/lfigsetarc +{ + 20 dict begin + matrix currentmatrix 8 1 roll + 2 copy translate 2 copy 8 2 roll + 4 2 roll lfigpsub 6 2 roll lfigpsub + 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 + + y1s y2s eq + { -1 + } + { y1s x2s mul y2s x1s mul sub y1s y2s sub div + } ifelse + /da exch def + + x1s x2s eq + { -1 + } + { x1s y2s mul x2s y1s mul sub x1s x2s sub div + } ifelse + /db exch def + + da 0 gt db 0 gt and + { /LMax da sqrt db sqrt lfigmax 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 lfigangle + 0 0 x2 scalex mul y2 scaley mul lfigangle + 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 lfigpi mul LMax mul 180 div + } + { 0 0 x1 y1 lfigdistance 0 0 x2 y2 lfigdistance eq + 0 0 x1 y1 lfigdistance 0 gt and + { 0 0 + 0 0 x1 y1 lfigdistance + 0 0 x1 y1 lfigangle + 0 0 x2 y2 lfigangle + 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 lfigpi mul 0 0 x1 y1 lfigdistance mul 180 div + } + { x2 y2 lineto pop + x2 y2 x1 y1 lfigangle + x1 y1 x2 y2 lfigangle + x1 y1 x2 y2 lfigdistance + } ifelse + } ifelse + 4 -1 roll setmatrix + end +} def + +% lfigsetcurve: 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 lfigsetcurve <angle> <angle> <length> +/lfigsetcurve +{ 8 copy curveto pop pop + lfigangle + 5 1 roll + 4 2 roll lfigangle + exch + 0 +} def + +% lfigpaintpath: paint a path of the given shape +% /paint [ shape ] lfigpaintpath - +/lfigpaintpath +{ + 10 dict begin + 0 newpath + /prevseen false def + /curveseen false def + { lfiggetnextitem + 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 + lfigsetcurve 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 + lfigsetarc 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 cvx exec + end +} 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] lfigdopath [<point> <angle>] [<point> <angle>] +/lfigdopath +{ + 10 dict begin + 0 + /prevseen false def + /curveseen false def + /backarrow [] def + /fwdarrow [] def + { + lfiggetnextitem + 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 lfigsetcurve + } + { 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 + lfigsetarc + } ifelse + } + { xcurr ycurr lineto + xcurr ycurr xprev yprev lfigangle dup 180 sub + xprev yprev xcurr ycurr lfigdistance + } 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 + +% lfigdoarrow: draw an arrow head of given form +% dashlength /lstyle /pstyle hfrac height width [ <point> <angle> ] lfigdoarrow - +/lfigdoarrow +{ matrix currentmatrix 8 1 roll + dup 0 get 1 index 1 get translate + 2 get rotate + [ 2 index neg 2 index 0 0 + 3 index 3 index neg + 1 index 10 index mul 0 + 7 index 7 index ] + 4 1 roll pop pop pop + dup 3 1 roll + gsave lfigpaintpath grestore lfigdopath pop pop + setmatrix +} def + +% arrow head styles +/lfigopen 0.0 def +/lfighalfopen 0.5 def +/lfigclosed 1.0 def + +% stroke no arrows, forward, back, and both +/lfignoarrow { pop pop pop pop pop pop pop pop } def +/lfigforward { 7 -1 roll lfigdoarrow pop } def +/lfigback { 8 -2 roll pop lfigdoarrow } def +/lfigboth { 8 -1 roll 7 copy lfigdoarrow pop 7 -1 roll lfigdoarrow } def + +% lfigprevious: return previous point on path +/lfigprevious +{ lfigisnumbertype + { 2 copy } + { lfigisarraytype + { 2 index 2 index } + { 0 0 } + ifelse + } ifelse +} def + +% label a point in 2nd top dictionary: <point> /name lfigpointdef - +/lfigpointdef +{ + % (Entering lfigpointdef) lfigdebugprint + [ 4 2 roll transform + /itransform cvx ] cvx + currentdict end + 3 1 roll + % currentdict length currentdict maxlength lt + % { def } + % { exec moveto (too many labels) show stop } + % ifelse + def + begin + % (Leaving lfigpointdef) lfigdebugprint +} def + +% promote labels from second top to third top dictionary +% <string> lfigpromotelabels - +/lfigpromotelabels +{ + % (Entering lfigpromotelabels) lfigdebugprint + currentdict end exch currentdict end + { exch 20 string cvs 2 index + (@) lfigconcat exch lfigconcat cvn exch def + } forall pop begin + % (Leaving lfigpromotelabels) lfigdebugprint +} def + +% show labels (except CIRCUM): - lfigshowlabels - +/lfigshowlabels +{ + % (Entering lfigshowlabels) lfigdebugprint + currentdict end + currentdict + { 1 index 20 string cvs (CIRCUM) search % if CIRCUM in key + { pop pop pop pop pop } + { pop cvx exec 2 copy + newpath 1.5 pt 0 360 arc + 0 setgray fill + /Times-Roman findfont 8 pt scalefont setfont + moveto 0.2 cm 0.1 cm rmoveto 20 string cvs show + } + ifelse + } forall + begin + % (Leaving lfigshowlabels) lfigdebugprint +} def + +% fix an angle to 0 <= res < 360: <angle> lfigfixangle <angle> +/lfigfixangle +{ + % (Entering lfigfixangle) lfigdebugprint + { dup 0 ge { exit } if + 360 add + } loop + { dup 360 lt { exit } if + 360 sub + } loop + % (Leaving lfigfixangle) lfigdebugprint +} def + +% find point on circumference of box: alpha a b lfigboxcircum x y +/lfigboxcircum +{ + % (Entering lfigboxcircum) lfigdebugprint + 4 dict begin + /b exch def + /a exch def + lfigfixangle /alpha exch def + 0 0 a b lfigangle /theta exch def + + % if alpha <= theta, return (a, a*tan(alpha)) + alpha theta le + { a a alpha sin mul alpha cos div } + { + % else if alpha <= 180 - theta, return (b*cot(alpha), b) + alpha 180 theta sub le + { b alpha cos mul alpha sin div b } + { + % else if alpha <= 180 + theta, return (-a, -a*tan(alpha)) + alpha 180 theta add le + { a neg a neg alpha sin mul alpha cos div } + { + % else if alpha <= 360 - theta, return (-b*cot(alpha), -b) + alpha 360 theta sub le + { b neg alpha cos mul alpha sin div b neg } + { + % else 360 - theta <= alpha, return (a, a*tan(alpha)) + a a alpha sin mul alpha cos div + } ifelse + } ifelse + } ifelse + } ifelse + end + % (Leaving lfigboxcircum) lfigdebugprint +} def + +% find quadratic roots (assume a != 0): a b c lfigqroots x1 x2 2 +% or x2 1 +% or 0 +/lfigqroots +{ + 4 dict begin + /c exch def + /b exch def + /a exch def + /disc b b mul 4 a c mul mul sub def + disc 0 lt + { 0 + } + { disc 0 eq + { b neg 2 a mul div + 1 + } + { b neg disc sqrt add 2 a mul div + b neg disc sqrt sub 2 a mul div + 2 + } + ifelse + } + ifelse + end +} def + +% work our which quadrant: <angle> lfigquadrant <0-3> +/lfigquadrant +{ dup 90 lt + { pop 0 + } + { dup 180 lt + { pop 1 + } + { 270 lt + { 2 + } + { 3 + } ifelse + } ifelse + } ifelse +} def + +% find curvebox circum, assuming upper right quadrant: alpha a b xmk lfigcb x y +/lfigcb +{ + 6 dict begin + /xmk exch def + /b exch def + /a exch def + /alpha exch def + /theta1 0 0 a b xmk sub lfigangle def + /theta2 0 0 a xmk sub b lfigangle def + alpha theta1 le + { % if alpha <= theta1, return (a, a*tan(alpha)) + a a alpha sin mul alpha cos div + } + { alpha theta2 ge + { % else if alpha > theta2, return (b*cot(alpha), b) + b alpha cos mul alpha sin div b + } + { + % else, return the intersection of line and circle + a xmk sub b xmk sub xmk 0 0 alpha lfigcircleintersect + dup 0 eq + { % should never happen, just return any reasonable point + pop + a b 0.5 lfigpmul + } + { 1 eq + { % should never happen, just return the point on top of stack + } + { % the usual case, two points on stack, return the larger + lfigpmax + } ifelse + } ifelse + } ifelse + } ifelse + end +} def + +% find point on circumference of curvebox: alpha a b xmk lfigcurveboxcircum x y +/lfigcurveboxcircum +{ + % (Entering lfigcurveboxcircum) lfigdebugprint + 5 dict begin + /xmk exch def + /b exch def + /a exch def + lfigfixangle /alpha exch def + + % work out which quadrant we are in, and reflect accordingly + /quad alpha lfigquadrant def + quad 0 eq + { alpha a b xmk lfigcb + } + { quad 1 eq + { 180 alpha sub a b xmk lfigcb exch neg exch + } + { quad 2 eq + { alpha 180 sub a b xmk lfigcb neg exch neg exch + } + { 360 alpha sub a b xmk lfigcb neg + } ifelse + } ifelse + } ifelse + end + % (Leaving lfigcurveboxcircum) lfigdebugprint +} def + +% find point on circumference of diamond: alpha a b lfigdiamondcircum x y +/lfigdiamondcircum +{ + % (Entering lfigdiamondcircum) lfigdebugprint + 4 dict begin + /b exch def + /a exch def + lfigfixangle /alpha exch def + b alpha cos abs mul a alpha sin abs mul add /denom exch def + a b mul alpha cos mul denom div + a b mul alpha sin mul denom div + end + % (Leaving lfigdiamondcircum) lfigdebugprint +} def + +% find point on circumference of ellipse: alpha a b lfigellipsecircum x y +/lfigellipsecircum +{ + % (Entering lfigellipsecircum) lfigdebugprint + 4 dict begin + /b exch def + /a exch def + lfigfixangle /alpha exch def + b alpha cos mul dup mul a alpha sin mul dup mul add sqrt /denom exch def + a b mul alpha cos mul denom div + a b mul alpha sin mul denom div + end + % (Leaving lfigellipsecircum) lfigdebugprint +} def + +% find point of intersection of two lines each defined by two points +% x1 y1 x2 y2 x3 y3 x4 y4 lfiglineintersect x y +/lfiglineintersect +{ + % (Entering lfiglineintersect) lfigdebugprint + 13 dict begin + /y4 exch def + /x4 exch def + /y3 exch def + /x3 exch def + /y2 exch def + /x2 exch def + /y1 exch def + /x1 exch def + x2 x1 sub /x21 exch def + x4 x3 sub /x43 exch def + y2 y1 sub /y21 exch def + y4 y3 sub /y43 exch def + y21 x43 mul y43 x21 mul sub /det exch def + + % calculate x + y21 x43 mul x1 mul + y43 x21 mul x3 mul sub + y3 y1 sub x21 mul x43 mul add + det div + + % calculate y + x21 y43 mul y1 mul + x43 y21 mul y3 mul sub + x3 x1 sub y21 mul y43 mul add + det neg div + + end + % (Leaving lfiglineintersect) lfigdebugprint +} def + +% find point on circumference of polygon +% alpha radius num theta lfigpolycircum x y +/lfigpolycircum +{ + % (Entering lfigpolycircum) lfigdebugprint + 13 dict begin + /theta exch def + /num exch def + /radius exch def + /alpha exch def + + % calculate delta, the angle from theta to alpha + alpha theta sub lfigfixangle + + % calculate the angle which is the multiple of 360/num closest to delta + 360 num div div truncate 360 num div mul theta add /anglea exch def + + % calculate the next multiple of 360/num after anglea + anglea 360 num div add /angleb exch def + + % intersect the line through these two points with the alpha line + anglea cos anglea sin angleb cos angleb sin + 0 0 alpha cos 2 mul alpha sin 2 mul + lfiglineintersect radius lfigpmul + + end + % (Leaving lfigpolycircum) lfigdebugprint +} def + +% find point of intersection of a point and a circle +% x0 y0 r x1 y1 theta lfigcircleintersect xa ya xb yb 2 +% or xb yb 1 +% or 0 +/lfigcircleintersect +{ + % (Entering lfigcircleintersect) lfigdebugprint + 15 dict begin + /theta exch def + /y1 exch def + /x1 exch def + /r exch def + /y0 exch def + /x0 exch def + + % if sin(theta) = 0 then line is horizontal and y must be y1 + theta sin abs 0.00001 lt + { + /a 1 def + /b -2 x0 mul def + /c x0 dup mul y1 y0 sub dup mul add r dup mul sub def + a b c lfigqroots dup + 0 eq + { pop + 0 + } + { 1 eq + { y1 1 + } + { y1 exch y1 2 + } ifelse + } ifelse + } + { + /ct theta cos theta sin div def + /a ct ct mul 1 add def + /b ct x1 x0 sub mul y1 add y0 sub 2 mul def + /c x1 x0 sub dup mul y1 y0 sub dup mul add r dup mul sub def + a b c lfigqroots dup + 0 eq + { pop + 0 + } + { 1 eq + { y1 add /yb exch def + yb y1 sub ct mul x1 add /xb exch def + xb yb 1 + } + { y1 add /ya exch def + ya y1 sub ct mul x1 add /xa exch def + y1 add /yb exch def + yb y1 sub ct mul x1 add /xb exch def + xa ya xb yb 2 + } ifelse + } ifelse + } ifelse + end + % (Leaving lfigcircleintersect) lfigdebugprint +} def + +% add CIRCUM operator with this body: <array> lfigcircumdef - +/lfigcircumdef +{ % (Entering lfigcircumdef) lfigdebugprint + /CIRCUM exch cvx + currentdict end + 3 1 roll + % currentdict length currentdict maxlength lt + % { def } + % { exec moveto (too many labels) show stop } + % ifelse + def + begin + % (Leaving lfigcircumdef) lfigdebugprint +} def + +end +%%EndResource + +%%BeginResource: procset LoutGraphPrependGraphic +% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/graphf.lpg +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Graph (Version 1.0) % +% % +% Version 1.0 by Jeffrey H. Kingston, December 1993. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +errordict begin + /handleerror + { + { /Times-Roman findfont 8 pt scalefont setfont + 0 setgray 4 pt 4 pt moveto + $error /errorname get + dup lgraphdict exch known + { lgraphdict exch get } + { 30 string cvs } ifelse + show + ( Command: ) show + $error /command get 30 string cvs show + } stopped {} if + showpage stop + } def +end + +/lgraphdict 200 dict def +lgraphdict begin + +% error messages +/dictfull (dictfull error) def +/dictstackoverflow (dictstackoverflow error) def +/execstackoverflow (execstackoverflow error: expression too complex?) def +/limitcheck (limitcheck error: graph too complex or too large?) def +/syntaxerror (syntaxerror error: syntax error in text of graph?) def +/typecheck (typecheck error: syntax error in text of graph?) def +/undefined (undefined error: unknown or misspelt symbol?) def +/rangecheck (rangecheck error: undefined expression (e.g. divide by zero)?) def +/VMError (VMError error: run out of memory?) def + +% random number between x and y inclusive: x y dorand num +/dorand { 1 index sub 1 add rand exch mod add } def + +% log to given base: base num dolog num +/dolog { ln exch ln div } def + +% maximum of two numbers: <num> <num> max <num> +/max { 2 copy gt { pop } { exch pop } ifelse } def + +% add two points: <point> <point> padd <point> +/padd { exch 3 1 roll add 3 1 roll add exch } def + +% subtract first point from second: <point> <point> psub <point> +/psub { 3 2 roll sub 3 1 roll exch sub exch } def + +% distance between two points: <point> <point> distance <length> +/distance { psub dup mul exch dup mul add sqrt } def + +% point at angle and distance: <point> <length> <angle> atangle <point> +/atangle { 2 copy cos mul 3 1 roll sin mul padd } def + +% angle from one point to another: <point> <point> angle <angle> +/angle { psub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def + + +% set up for line +% - linesetup <length> <dashlength> +/linesetup +{ newpath + xcurr ycurr trpoint xprev yprev trpoint + 4 copy moveto lineto distance dashlength +} def + +% set up for icon-avoiding line +% - ilinesetup <length> <dashlength> +/ilinesetup +{ newpath + xprev yprev trpoint xcurr ycurr trpoint 4 copy + 4 copy angle symbolsize 1.5 mul exch 4 2 roll pop pop atangle + 6 2 roll 4 2 roll + 4 copy angle symbolsize 1.5 mul exch 4 2 roll pop pop atangle + 4 copy moveto lineto distance dashlength +} def + + +% stroke a solid line: <length> <dashlength> solid - +/solid +{ pop pop [] 0 setdash linewidth setlinewidth stroke +} def + +% stroke a dashed line: <length> <dashlength> dashed - +/dashed +{ 2 copy 2 mul le 1 index 0 le or + { exch pop 1 pt max [ 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 linewidth setlinewidth stroke +} def + +% stroke a cdashed line: <length> <dashlength> cdashed - +/cdashed +{ 2 copy le 1 index 0 le or + { exch pop 1 pt max [ 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 linewidth setlinewidth stroke +} def + +% stroke a dotted line: <length> <dashlength> dotted - +/dotted +{ 2 copy le 1 index 0 le or + { exch pop 1 pt max [ exch 0 exch ] 0 setdash } + { 1 index exch div ceiling div 0.99999 mul + [ 0 3 2 roll ] 0 setdash + } ifelse gsave 1 setlinecap linewidth setlinewidth stroke grestore newpath +} def + +% stroke a noline line: <length> <dashlength> noline - +/noline +{ pop pop +} def + +% stroke a y histogram: - yhisto - +/yhisto +{ xprev yleft trpoint yextra sub moveto + xprev yprev trpoint lineto + xcurr yprev trpoint lineto + xcurr yleft trpoint yextra sub lineto + linewidth setlinewidth stroke +} def + +% stroke an x histogram: - xhisto - +/xhisto +{ xleft yprev trpoint exch xextra sub exch moveto + xcurr yprev trpoint lineto + xcurr ycurr trpoint lineto + xleft ycurr trpoint exch xextra sub exch lineto + linewidth setlinewidth stroke +} def + +% stroke a surface y histogram: - surfaceyhisto - +/surfaceyhisto +{ firstpair + { xprev yleft trpoint yextra sub moveto + xprev yprev trpoint lineto + } + { xprev yprev trpoint moveto + } ifelse + xcurr yprev trpoint lineto + lastpair + { xcurr yleft trpoint yextra sub lineto + } + { xcurr ycurr trpoint lineto + } ifelse + linewidth setlinewidth stroke +} def + +% stroke a surface x histogram: - surfacexhisto - +/surfacexhisto +{ firstpair + { xleft yprev trpoint exch xextra sub exch moveto + } + { xprev yprev trpoint moveto + } ifelse + xcurr yprev trpoint lineto + xcurr ycurr trpoint lineto + lastpair + { xleft ycurr trpoint exch xextra sub exch lineto + } if + linewidth setlinewidth stroke +} def + +% stroke a filled y histogram: - filledyhisto - +/filledyhisto +{ + linewidth setlinewidth + xprev yleft trpoint exch currentlinewidth 2 div add exch yextra sub moveto + xprev yprev trpoint exch currentlinewidth 2 div add exch lineto + xcurr yprev trpoint exch currentlinewidth 2 div sub exch lineto + xcurr yleft trpoint exch currentlinewidth 2 div sub exch yextra sub lineto + closepath fill +} def + +% stroke a filled x histogram: - filledxhisto - +/filledxhisto +{ + linewidth setlinewidth + xleft yprev trpoint currentlinewidth 2 div add exch xextra sub exch moveto + xcurr yprev trpoint currentlinewidth 2 div add lineto + xcurr ycurr trpoint currentlinewidth 2 div sub lineto + xleft ycurr trpoint currentlinewidth 2 div sub exch xextra sub exch lineto + closepath fill +} def + + +% cross: show a small cross +/cross +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg symbolsize neg rmoveto + symbolsize 2 mul symbolsize 2 mul rlineto + 0 symbolsize -2 mul rmoveto + symbolsize -2 mul symbolsize 2 mul rlineto + [] 0 setdash stroke +} def + +% plus: show a small plus +/plus +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg 0 rmoveto + symbolsize 2 mul 0 rlineto + symbolsize neg symbolsize neg rmoveto + 0 symbolsize 2 mul rlineto + [] 0 setdash stroke +} def + +% square: show a small square +/square +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg symbolsize neg rmoveto + symbolsize 2 mul 0 rlineto + 0 symbolsize 2 mul rlineto + symbolsize -2 mul 0 rlineto + closepath [] 0 setdash stroke +} def + +% filledsquare: show a small filled square +/filledsquare +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg symbolsize neg rmoveto + symbolsize 2 mul 0 rlineto + 0 symbolsize 2 mul rlineto + symbolsize -2 mul 0 rlineto + closepath gsave [] 0 setdash stroke grestore fill +} def + +% diamond: show a small diamond +/diamond +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg 0 rmoveto + symbolsize symbolsize neg rlineto + symbolsize symbolsize rlineto + symbolsize neg symbolsize rlineto + closepath [] 0 setdash stroke +} def + +% filleddiamond: show a small filled diamond +/filleddiamond +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg 0 rmoveto + symbolsize symbolsize neg rlineto + symbolsize symbolsize rlineto + symbolsize neg symbolsize rlineto + closepath gsave [] 0 setdash stroke grestore fill +} def + +% circle: show a small circle +/circle +{ newpath + xcurr ycurr trpoint symbolsize 0 360 arc [] 0 setdash stroke +} def + +% filledcircle: show a small filled circle +/filledcircle +{ newpath + xcurr ycurr trpoint symbolsize 0 360 arc gsave [] 0 setdash stroke grestore fill +} def + +% triangle: show a small triangle +/triangle +{ newpath + xcurr ycurr trpoint moveto + 0 symbolsize 1.5 mul rmoveto + symbolsize neg symbolsize -2.5 mul rlineto + symbolsize 2 mul 0 rlineto + closepath [] 0 setdash stroke +} def + +% filledtriangle: show a small filled triangle +/filledtriangle +{ newpath + xcurr ycurr trpoint moveto + 0 symbolsize 1.5 mul rmoveto + symbolsize neg symbolsize -2.5 mul rlineto + symbolsize 2 mul 0 rlineto + closepath gsave [] 0 setdash stroke grestore fill +} def + + +%plog: like log only with a base, and protected from failing if <= 0 +% base x plog res +/plog { dup 0 le { pop pop 0 } { ln exch ln div } ifelse } def + +% xtr: transform one x value logarithmically if xlog > 1 +% <num> xtr <num> +/xtr +{ xlog 1 gt + { xlog exch plog + } if +} def + +% ytr: transform one y value logarithmically if ylog > 1 +% <num> ytr <num> +/ytr +{ ylog 1 gt + { ylog exch plog + } if +} def + +% % trpoint: transform (x, y) in graph space into (x', y') in print space +% % x y trpoint x' y' +% /trpoint +% { exch xtr trxmin sub trxmax trxmin sub div xwidth mul xextra add +% exch ytr trymin sub trymax trymin sub div ywidth mul yextra add +% } def + + +% trpoint: transform (x, y) in graph space into (x', y') in print space +% x y trpoint x' y' +/trpoint +{ exch xtr xdecr { trxmax exch sub } { trxmin sub } ifelse + trxmax trxmin sub div xwidth mul xextra add + + exch ytr ydecr { trymax exch sub } { trymin sub } ifelse + trymax trymin sub div ywidth mul yextra add +} def + + +% yonly: interpolate x values 1, 2, ... into data +% [ data ] yonly [ newdata ] +/yonly +{ dup /tmp exch def + length [ exch 1 exch 1 exch + { dup tmp exch 1 sub get + } for + ] +} def + +% xonly: interpolate y values 1, 2, ... into data +% [ data ] yonly [ newdata ] +/xonly +{ dup /tmp exch def + length [ exch 1 exch 1 exch + { dup tmp exch 1 sub get exch + } for + ] +} def + +% xandy: no interpolation of x or y values +% [ data ] xandy [ data ] +/xandy {} def + + +% expstringwidth: calculate width of string containing optional exponent +% <string> expstringwidth <width> +/expstringwidth +{ (^) search + { exch pop stringwidth pop exch stringwidth pop 0.7 mul add } + { stringwidth pop } + ifelse +} def + +% expstringshow: show string containing optional exponent +% <string> expstringshow - +/expstringshow +{ (^) search + { exch pop show 0 0.5 ft rmoveto + gsave currentfont 0.7 scalefont setfont show grestore + } + { show + } + ifelse +} def + +% concatenate two strings: <string> <string> strconcat <string> +/strconcat +{ 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 + +% lgen: generate one label automatically +% num lgen num string +/lgen { dup 20 string cvs } def + +% loglgen: generate one logarithmic label (with exponent) +% <base> <exponent> loglgen <string> +/loglgen +{ 20 string cvs exch 20 string cvs + (^) strconcat exch strconcat +} def + + +% printxtick: print one x tick +% xpos printxtick - +/printxtick +{ newpath + yleft trpoint moveto 0 yextra neg rmoveto + 0 xticklength neg rlineto [] 0 setdash stroke +} def + +% printxlabel: print one x label +% (xlabel) xpos printxlabel - +/printxlabel +{ yleft trpoint moveto 0 yextra neg rmoveto + 0 xticklength neg rmoveto 0 0.9 ft neg rmoveto + xlog 1 gt { 0 0.3 ft neg rmoveto } if + dup expstringwidth -2 div 0 rmoveto expstringshow +} def + +% printytick: print one y tick +% ypos printytick - +/printytick +{ newpath + xleft exch trpoint moveto xextra neg 0 rmoveto + yticklength neg 0 rlineto [] 0 setdash stroke +} def + +% printylabel: print one y label +% (ylabel) ypos printylabel - +/printylabel +{ xleft exch trpoint moveto xextra neg 0 rmoveto + yticklength neg 0 rmoveto -0.3 ft -0.3 ft rmoveto + dup expstringwidth neg 0 rmoveto expstringshow +} def + +% printrtick: print one r tick +% ypos printrtick - +/printrtick +{ newpath + xright exch trpoint moveto xextra 0 rmoveto + rticklength 0 rlineto [] 0 setdash stroke +} def + +% printrlabel: print one r label +% (rlabel) ypos printrlabel - +/printrlabel +{ xright exch trpoint moveto xextra 0 rmoveto + rticklength 0 rmoveto 0.3 ft -0.3 ft rmoveto + expstringshow +} def + +% printticks: print ticks and labels +% /tickproc /labelproc [ tickandlabeldata ] min printticks - +/printticks +{ /prev exch def + { dup type dup dup /integertype eq exch /realtype eq or + { pop dup /prev exch def 2 index cvx exec + } + { /stringtype eq + { prev 2 index cvx exec + } + { pop + } ifelse + } ifelse + } forall + pop pop +} def + + +% printxaxistick: print one x axis tick +% xpos printxaxistick - +/printxaxistick +{ newpath + yaxis trpoint moveto 0 xticklength -2 div rmoveto + 0 xticklength rlineto [] 0 setdash stroke +} def + +% printxaxislabel: print one x axis label +% (xlabel) xpos printxaxislabel - +/printxaxislabel +{ yaxis trpoint moveto + 0 xticklength -2 div rmoveto 0 0.9 ft neg rmoveto + xlog 1 gt { 0 0.3 ft neg rmoveto } if + dup expstringwidth -2 div 0 rmoveto expstringshow +} def + +% printyaxistick: print one y axis tick +% ypos printyaxistick - +/printyaxistick +{ newpath + xaxis exch trpoint moveto + yticklength -2 div 0 rmoveto + yticklength 0 rlineto [] 0 setdash stroke +} def + +% printyaxislabel: print one y axis label +% (ylabel) ypos printyaxislabel - +/printyaxislabel +{ xaxis exch trpoint moveto + yticklength -2 div 0 rmoveto -0.3 ft -0.3 ft rmoveto + dup expstringwidth neg 0 rmoveto expstringshow +} def + + +% <val> minmax - +% perform minv := min(minv, val); maxv := max(maxv, val) +% allowing for the possibility of minv, maxv, val being false (undefined) +/minmax +{ dup false eq + { pop } + { minv false eq + { dup /minv exch def /maxv exch def } + { dup minv lt + { /minv exch def } + { dup maxv gt + { /maxv exch def } + { pop } + ifelse + } ifelse + } ifelse + } ifelse +} def + +% <ticks> ticksundef <ticks> <bool> +% returns true iff the ticks array is undefined (one false entry) +/ticksundef +{ dup length 1 eq + { dup 0 get false eq + } + { false } + ifelse +} def + +% <number> integral <boolean> +% true if the number has an integral value +/integral { dup round eq } def + +% ticksep ticks xory alldata minval maxval axis base ticksandlimits ticks min max base +% ticksandlimits: sort out value of x or y ticks and limits and log base +/ticksandlimits +{ /base exch def + /minv false def + /maxv false def + + % min and max of user-supplied minval, maxval, and axis + minmax minmax minmax + + % min and max of data points + { 0 get dup dup length 1 sub 3 index exch 2 exch + { get minmax dup + } for pop pop + } forall + pop dup + + % min and max of tick values + { dup type /stringtype eq + { pop } { minmax } ifelse + } forall + + % fix minv and maxv if undefined (false) or equal + minv false eq + { /minv -1 def /maxv 1 def } + { minv maxv eq + { minv 0 lt + { /minv 2 minv mul def /maxv 0 def + } + { minv 0 eq + { /minv -1 def /maxv 1 def + } + { /minv 0 def /maxv 2 maxv mul def + } ifelse + } ifelse + } if + } ifelse + + % invent ticks if undefined + ticksundef + { pop /ticksep exch def + + % if base is reasonable and minv is positive, logarithmic ticks + base 1 gt minv 0 gt and + { + % get integral log of minv and maxv + /logminv base minv plog floor cvi def + /logmaxv base maxv plog ceiling cvi def + + % if minv close to base, make it 1; reset minv and maxv + logminv 1 eq logmaxv 4 ge and { /logminv 0 def } if + /minv base logminv exp def + /maxv base logmaxv exp def + + % ticks := [ base**logminv, ... , base**logmaxv ] + [ logminv 1 logmaxv + { dup base exch exp + exch base exch loglgen + } for + ] + } + { % non-logarithmic ticks + { + % fix tick separation if undefined (0) or too small + /base 0 def + /delta maxv minv sub def + ticksep delta 30 div le + { /ticksep 10 delta log 1 sub ceiling exp def + ticksep delta 2 div ge + { /ticksep ticksep 2 div def } + { ticksep delta 5 div lt + { /ticksep 2 ticksep mul def + } if + } ifelse + } if + + % adjust minv and maxv to be multiples of ticksep + /minv minv ticksep div floor ticksep mul def + /maxv maxv ticksep div ceiling ticksep mul def + /delta maxv minv sub def + + % if minv or maxv near zero, move to zero and redo + minv ticksep eq + { /minv 0 def } + { maxv ticksep neg eq { /maxv 0 def } { exit } ifelse + } ifelse + } loop + + % if minv, maxv, and ticksep are all integral, set "makeint" to true + /makeint minv integral maxv integral ticksep integral and and def + + % ticks := [ minv, minv+ticksep, ... , maxv ] + [ 0 1 delta ticksep div round + { ticksep mul minv add makeint { cvi } if lgen } + for + ] + } ifelse + } + { exch pop + } ifelse + minv maxv base +} def + +% xset: set up all data for x axis, including limits and ticks +% xticksep xticks 0 alldata xmin xmax xlog xextra xdecr xaxis xticklength xset - +/xset +{ /xticklength exch def + /xaxis exch def + /xdecr exch def + /xextra exch def + xaxis exch ticksandlimits + /xlog exch def /xmax exch def /xmin exch def /xticks exch def + /xleft xdecr { xmax } { xmin } ifelse def + /xright xdecr { xmin } { xmax } ifelse def + /xwidth xsize xextra 2 mul sub def + /trxmin xmin xtr def /trxmax xmax xtr def +} def + +% yset: set up all data for y axis, including limits and yticks +% yticksep yticks 0 alldata ymin ymax ylog yextra ydecr yaxis yticklength yset - +/yset +{ /yticklength exch def + /yaxis exch def + /ydecr exch def + /yextra exch def + yaxis exch ticksandlimits + /ylog exch def /ymax exch def /ymin exch def /yticks exch def + /yleft ydecr { ymax } { ymin } ifelse def + /yright ydecr { ymin } { ymax } ifelse def + /ywidth ysize yextra 2 mul sub def + /trymin ymin ytr def /trymax ymax ytr def +} def + +% rset: set up all data for y axis (again), but including limits and rticks +% rticksep rticks 0 alldata ymin ymax ylog yextra ydecr yaxis rticklength rset - +/rset +{ /rticklength exch def + /yaxis exch def + /ydecr exch def + /yextra exch def + yaxis exch ticksandlimits + /ylog exch def /ymax exch def /ymin exch def /rticks exch def + /yleft ydecr { ymax } { ymin } ifelse def + /yright ydecr { ymin } { ymax } ifelse def + /ywidth ysize yextra 2 mul sub def + /trymin ymin ytr def /trymax ymax ytr def +} def + +% norset: set up data for no rticks +% - norset - +/norset +{ /rticklength 0 def + /rticks [] def +} def + +% framestyle: print a frame around the graph +/framestyle +{ 0 0 moveto xsize 0 lineto xsize ysize lineto + 0 ysize lineto closepath stroke + /printxtick /printxlabel xticks xleft printticks + /printytick /printylabel yticks ymin printticks + /printrtick /printrlabel rticks ymin printticks +} def + +% nonestyle: print nothing around the graph +/nonestyle +{ +} def + +% axesstyle: print axes for the graph (unless axis values missing) +/axesstyle +{ + xaxis false eq yaxis false eq or + { framestyle } + { xaxis yaxis trpoint dup 0 exch moveto xsize exch lineto + dup 0 moveto ysize lineto stroke + /printxaxistick /printxaxislabel xticks xleft printticks + /printyaxistick /printyaxislabel yticks ymin printticks + } ifelse +} def + +% rundata: run all data sets +/rundata +{ alldata + { gsave + dup dup dup dup + 4 get /dopaint exch def + 3 get /initrun exch def + 2 get /pairs exch def + 1 get /points exch def + 0 get /data exch def + dopaint + { data length 4 ge + { initrun + newpath + data 0 get ymin trpoint yextra sub moveto + 0 2 data length 2 sub + { dup 1 add + data exch get /ycurr exch def + data exch get /xcurr exch def + xcurr ycurr trpoint lineto + } for + data dup length 2 sub get ymin trpoint yextra sub lineto + closepath fill + } if + } if + initrun + data length 2 ge + { + /xcurr data 0 get def + /ycurr data 1 get def + points + data length 4 ge + { 2 2 data length 2 sub + { /xprev xcurr def + /yprev ycurr def + dup dup 2 eq /firstpair exch def + data length 2 sub eq /lastpair exch def + dup 1 add + data exch get /ycurr exch def + data exch get /xcurr exch def + pairs + points + } for + } if + } if + grestore + } forall +} def + +end +%%EndResource + +%%BeginResource: procset LoutFigPrependGraphic +% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/diagf.lpg +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% 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. % +% % +% <point> is two numbers, a point. % +% <length> is one number, a length % +% <angle> is one number, an angle in degrees % +% <dashlength> 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 } + { 50 string cvs } ifelse + show + ( Command: ) show + $error /command get 50 string cvs show + } stopped {} if + showpage stop + } def +end + +% begin diagram: <maxlabels> 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: <string> <string> ldiagconcat <string> +% 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 + +/ldiagdebugposy 432 def +/ldiagdebugposx 72 def + +% <string> <int> ldiagdebugprint - +% must be defined outside ldiagdict since used in arbitrary places +% print count or <int> stack entries, which ever 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 50 string cvs show + } 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 <num> +/ldiagpi 3.14159 def + +% push e onto stack: - ldiage <num> +/ldiage 2.71828 def + +% arc directions +/clockwise false def +/anticlockwise true def + +% test equality between two angles: <angle> <angle> ldiagangleeq <bool> +/ldiagangleeq { ldiagfixangle exch ldiagfixangle eq } def + +% test inequality between two angles: <angle> <angle> ldiaganglene <bool> +/ldiaganglene { ldiagangleeq not } def + +% maximum of two numbers: <num> <num> ldiagmax <num> +/ldiagmax { 2 copy gt { pop } { exch pop } ifelse } def + +% minimum of two numbers: <num> <num> ldiagmin <num> +/ldiagmin { 2 copy lt { pop } { exch pop } ifelse } def + +% add two points: <point> <point> ldiagpadd <point> +/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: <point> <point> ldiagpsub <point> +/ldiagpsub { 3 2 roll sub 3 1 roll exch sub exch } def + +% max two points: <point> <point> ldiagpmax <point> +/ldiagpmax { exch 3 1 roll ldiagmax 3 1 roll ldiagmax exch } def + +% min two points: <point> <point> ldiagpmin <point> +/ldiagpmin { exch 3 1 roll ldiagmin 3 1 roll ldiagmin exch } def + +% scalar multiplication: <point> <num> ldiagpmul <point> +/ldiagpmul { dup 3 1 roll mul 3 1 roll mul exch } def + +% point at angle and distance: <point> <length> <angle> ldiagatangle <point> +/ldiagatangle { 2 copy cos mul 3 1 roll sin mul ldiagpadd } def + +% angle from one point to another: <point> <point> ldiagangleto <angle> +/ldiagangleto { ldiagpsub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def + +% distance between two points: <point> <point> ldiagdistance <length> +/ldiagdistance { ldiagpsub dup mul exch dup mul add sqrt } def + +% stroke a solid line: <length> <dashlength> ldiagsolid - +/ldiagsolid +{ pop pop [] 0 setdash 1 setlinecap stroke +} def + +% stroke a dashed line: <length> <dashlength> 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: <length> <dashlength> 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: <length> <dashlength> 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: <length> <dashlength> ldiagnoline - +/ldiagnoline +{ pop pop +} def + +% painting (i.e. filling): - ldiagwhite - (etc.) +/ldiagnopaint { } def +/ldiagnochange { fill } def +/ldiagdarkblue { 0.0 0.0 0.5 setrgbcolor fill } def +/ldiagblue { 0.0 0.0 1.0 setrgbcolor fill } def +/ldiaglightblue { 0.5 0.5 1.0 setrgbcolor fill } def +/ldiagdarkgreen { 0.0 0.5 0.0 setrgbcolor fill } def +/ldiaggreen { 0.0 1.0 0.0 setrgbcolor fill } def +/ldiaglightgreen { 0.5 1.0 0.5 setrgbcolor fill } def +/ldiagdarkred { 0.5 0.0 0.0 setrgbcolor fill } def +/ldiagred { 1.0 0.0 0.0 setrgbcolor fill } def +/ldiaglightred { 1.0 0.5 0.5 setrgbcolor fill } def +/ldiagdarkcyan { 0.0 0.5 0.5 setrgbcolor fill } def +/ldiagcyan { 0.0 1.0 1.0 setrgbcolor fill } def +/ldiaglightcyan { 0.5 1.0 1.0 setrgbcolor fill } def +/ldiagdarkmagenta { 0.5 0.0 0.5 setrgbcolor fill } def +/ldiagmagenta { 1.0 0.0 1.0 setrgbcolor fill } def +/ldiaglightmagenta { 1.0 0.5 1.0 setrgbcolor fill } def +/ldiagdarkyellow { 0.5 0.5 0.0 setrgbcolor fill } def +/ldiagyellow { 1.0 1.0 0.0 setrgbcolor fill } def +/ldiaglightyellow { 1.0 1.0 0.5 setrgbcolor fill } def +/ldiagdarkgray { 0.2 0.2 0.2 setrgbcolor fill } def +/ldiaggray { 0.5 0.5 0.5 setrgbcolor fill } def +/ldiaglightgray { 0.8 0.8 0.8 setrgbcolor fill } def +/ldiagdarkgrey { 0.2 0.2 0.2 setrgbcolor fill } def +/ldiaggrey { 0.5 0.5 0.5 setrgbcolor fill } def +/ldiaglightgrey { 0.8 0.8 0.8 setrgbcolor fill } def +/ldiagblack { 0.0 0.0 0.0 setrgbcolor fill } def +/ldiagwhite { 1.0 1.0 1.0 setrgbcolor fill } def + +% shape and labels of the @Box symbol +/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 +% <margin> ldiagcurvebox <shape> +/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 +% <shadowmargin> 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: +% <sides> <angle> ldiagpolygon <point> ... <point> +/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: <array> <index> ldiaggetnext <array> <index> <any> true +% or <array> <index> false +/ldiaggetnext +{ 2 copy exch length ge + { false } + { 2 copy get exch 1 add exch true } ifelse +} def + +% check whether thing is number: <any> ldiagisnumbertype <any> <bool> +/ldiagisnumbertype +{ dup type dup + /integertype eq exch /realtype eq or +} def + +% check whether thing is an array: <any> ldiagisarraytype <any> <bool> +/ldiagisarraytype { dup type /arraytype eq } def + +% check whether thing is an array: <any> ldiagisnametype <any> <bool> +/ldiagisnametype { dup type /nametype eq } def + +% get next item: <array> <index> ldiaggetnextitem <array> <index> 0 +% or <array> <index> <array> 1 +% or <array> <index> <point> 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 <boolean> +/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 <angle> <angle> <dist> +% 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 <dist>. +/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 <angle> <angle> <length> +/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 [<point> <angle>] [<point> <angle>] +/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) +% <outline> <dashlength> <style> <linewidth> <paint> ldiagnodeend - +/ldiagnodeend +{ + % (Entering ldiagnodeend) 0 ldiagdebugprint + end % matches begin in ldiagnodebegin + 4 index gsave ldiagpaintpath grestore + 3 index ldiagsetpath clip newpath + 2 mul setlinewidth + 3 -1 roll ldiagdosegpath + % (Leaving ldiagnodeend) 0 ldiagdebugprint +} def + +% ldiaglinkbegin: start of link parameters +% <direct> ldiaglinkbegin - +/ldiaglinkbegin +{ ldiagmaxlabels dict begin + 1 eq /direct exch def +} def + +% ldiaglinkend: end of link parameters (so do the link) +% <outline> <dashlength> <style> <linewidth> ldiaglinkend - +/ldiaglinkend +{ + end % matches begin in ldiaglinkbegin + setlinewidth + 3 -1 roll ldiagdosegpath +} def + +% ldiagdoarrow: draw an arrow head of given form +% dashlength /lstyle /pstyle hfrac height width [ <point> <angle> ] ldiagdoarrow - +/ldiagdoarrow +{ matrix currentmatrix 8 1 roll + dup 0 get 1 index 1 get translate + 2 get rotate + [ 2 index neg 2 index 0 0 + 3 index 3 index neg + 1 index 10 index mul 0 + 7 index 7 index ] + 4 1 roll pop pop pop + dup 3 1 roll + gsave ldiagpaintpath grestore ldiagdopath pop pop + setmatrix +} def + +% arrow head styles +/ldiagopen 0.0 def +/ldiaghalfopen 0.5 def +/ldiagclosed 1.0 def + +% stroke no arrows, forward, back, and both +/ldiagnoarrow { pop pop pop pop pop pop pop pop } def +/ldiagforward { 7 -1 roll ldiagdoarrow pop } def +/ldiagback { 8 -2 roll pop ldiagdoarrow } def +/ldiagboth { 8 -1 roll 7 copy ldiagdoarrow pop 7 -1 roll ldiagdoarrow } def + +% ldiagprevious: return previous point on path +/ldiagprevious +{ ldiagisnumbertype + { 2 copy } + { ldiagisarraytype + { 2 index 2 index } + { 0 0 } + ifelse + } ifelse +} def + +% Tag dictionary operators +% +% Diag's tag dictionaries are kept on the same stack as other dictionaries, +% since there is nowhere else to put them. However, they are managed like +% a separate stack using the following operators: +% +% <tag> ldiagpushtagdict - Push a new, empty tag dictionary +% ldiagtoptagdict dict Find the top tag dictionary +% ldiagpoptagdict - Pop and destroy the top tag dictionary +% ldiagpopuptagdict - Pop top tag dict and promote its entries +% ldiagdebugtagdict - Debug print of dictionary stack +% +% They are distinguished from other dictionaries by containing /ldiagtagdict, +% whose value is the <tag> which is used by ldiagpopuptagdict, +% and they are hopefully never the target of any non-tag definition because +% they are never the top dictionary, since push places the new dict second. + +/ldiagpushtagdict +{ ldiagmaxlabels dict dup + currentdict end exch begin begin + exch /ldiagtagdict exch put +} def + +/ldiagtoptagdict +{ /ldiagtagdict where not + { (Diag internal error: no tag dictionary) show stop + } if +} def + +/ldiagpoptagdict +{ + % (Entering poptagdict) 0 ldiagdebugprint + % ldiagdebugtagdict + mark + { currentdict end + dup /ldiagtagdict known + { exit + } if + } loop + pop + counttomark + { begin + } repeat + pop + % (Leaving poptagdict) 0 ldiagdebugprint + % ldiagdebugtagdict +} def + +% promote labels from top tag dictionary to second top tag dictionary +% each prefixed by <string>@ if <string> (value of /ldiagtagdict) is not empty +% - ldiagpopuptagdict - +/ldiagpopuptagdict +{ + ldiagtagdict + % (Entering ldiagpopuptagdict) 1 ldiagdebugprint + % ldiagdebugtagdict + ldiagtoptagdict ldiagpoptagdict ldiagtoptagdict exch + { exch 50 string cvs 3 index + dup length 0 ne + { (@) ldiagconcat + } if + exch ldiagconcat cvn exch 2 index 3 1 roll put + } forall + pop pop + % (Leaving ldiagpopuptagdict) 0 ldiagdebugprint + % ldiagdebugtagdict +} def + +% debug tag dictionary stack +/ldiagdebugtagdict +{ (Entering ldiagdebugtagdict) 0 ldiagdebugprint + 30 array dictstack + { dup /ldiagtagdict known + { dup /ldiagtagdict get 0 ldiagdebugprint + { pop 50 string cvs ( ) exch ldiagconcat + dup 0 ldiagdebugprint + pop + } + forall + } + { pop (other) 0 ldiagdebugprint + } ifelse + } forall + (Leaving ldiagdebugtagdict) 0 ldiagdebugprint +} def + +% label a point in top tag dictionary: <point> /name ldiagpointdef - +/ldiagpointdef +{ + % (Entering ldiagpointdef) 3 ldiagdebugprint + [ 4 2 roll transform /itransform cvx ] cvx + ldiagtoptagdict 3 1 roll put + % (Leaving ldiagpointdef) 0 ldiagdebugprint +} def + +% label an angle in top tag dictionary: <angle> /name ldiagangledef - +/ldiagangledef +{ + % (Entering ldiagangledef) 2 ldiagdebugprint + exch ldiagfixangle ldiagtoptagdict 3 1 roll put + % (Leaving ldiagangledef) 0 ldiagdebugprint +} def + +% add CIRCUM operator with this body: <array> ldiagcircumdef - +/ldiagcircumdef +{ % (Entering ldiagcircumdef) 1 ldiagdebugprint + /CIRCUM exch cvx + ldiagtoptagdict 3 1 roll put + % currentdict end + % 3 1 roll + % def + % begin + % (Leaving ldiagcircumdef) 0 ldiagdebugprint +} def + +% show points (except CIRCUM and ANGLE): - ldiagshowpoints - +/ldiagshowpoints +{ + % (Entering ldiagshowpoints) 0 ldiagdebugprint + ldiagtoptagdict + { 1 index 50 string cvs + (ldiagdebugpos) search + { pop pop pop pop pop } + { + (CIRCUM) search % if CIRCUM in key + { pop pop pop pop pop } + { + (ANGLE) search % if ANGLE in key + { + pop pop pop pop pop + } + { + (ldiagtagdict) search + { + pop pop pop pop pop + } + { + pop cvx exec + newpath 2.0 pt 0 360 arc 0 setgray fill pop + } ifelse + } ifelse + } ifelse + } ifelse + } forall + % (Leaving ldiagshowpoints) 0 ldiagdebugprint +} def + + +/ldiagshowtags +{ + % (Entering ldiagshowtags) 0 ldiagdebugprint + ldiagtoptagdict + { 1 index 50 string cvs + % dup 0 ldiagdebugprint + (ldiagdebugpos) search + { pop pop pop pop pop } + { + (CIRCUM) search % if CIRCUM in key + { pop pop pop pop pop } + { + (ANGLE) search % if ANGLE in key + { + pop pop pop pop pop + } + { + (ldiagtagdict) search + { + pop pop pop pop pop + } + { + pop cvx exec 2 copy + gsave + newpath 2.0 pt 0 360 arc 0 setgray fill + /Times-Roman findfont 8 pt scalefont setfont + translate 40 rotate 0.2 cm 0.1 cm moveto 20 string cvs show + grestore + } ifelse + } ifelse + } ifelse + } ifelse + } forall + % (Leaving ldiagshowtags) 0 ldiagdebugprint +} def + + +% show angles: - ldiagshowangles - +/ldiagshowangles +{ + % (Entering ldiagshowangles) 0 ldiagdebugprint + ldiagtoptagdict + { 1 index 20 string cvs + % dup 0 ldiagdebugprint + (ldiagdebugpos) search + { pop pop pop pop pop } + { + (ldiagtagdict) search + { + pop pop pop pop pop + } + { + (CIRCUM) search % if CIRCUM in key + { pop pop pop pop pop } + { + (@ANGLE) search % if ANGLE in key, draw the angle at the point + { + % (showing ANGLE) 5 ldiagdebugprint + gsave exch pop exch pop cvx + % (about to execute) 1 ldiagdebugprint + exec translate rotate 0.8 0.8 scale pop + newpath 0 0 2.0 pt 0 360 arc 0 setgray fill + newpath 4 pt 0 moveto 9 pt 0 lineto + 9 pt 1.5 pt lineto 11 pt 0 lineto 9 pt -1.5 pt lineto + 9 pt 0 lineto [] 0 setdash 4 pt setlinewidth 0 setlinejoin + stroke grestore + % (finished ANGLE) 5 ldiagdebugprint + } + { + % else must be a point, we aren't showing those + pop pop pop + } ifelse + } ifelse + } ifelse + } ifelse + } forall + % (Leaving ldiagshowangles) 0 ldiagdebugprint +} def + +% fix an angle to 0 <= res < 360: <angle> ldiagfixangle <angle> +/ldiagfixangle +{ + % (Entering ldiagfixangle) 1 ldiagdebugprint + { dup 0 ge { exit } if + 360 add + } loop + { dup 360 lt { exit } if + 360 sub + } loop + % (Leaving ldiagfixangle) 1 ldiagdebugprint +} def + +% find point on circumference of box: alpha a b ldiagboxcircum x y +/ldiagboxcircum +{ + % (Entering ldiagboxcircum) 3 ldiagdebugprint + 4 dict begin + /b exch def + /a exch def + ldiagfixangle /alpha exch def + 0 0 a b ldiagangleto /theta exch def + + % if alpha <= theta, return (a, a*tan(alpha)) + alpha theta le + { a a alpha sin mul alpha cos div } + { + % else if alpha <= 180 - theta, return (b*cot(alpha), b) + alpha 180 theta sub le + { b alpha cos mul alpha sin div b } + { + % else if alpha <= 180 + theta, return (-a, -a*tan(alpha)) + alpha 180 theta add le + { a neg a neg alpha sin mul alpha cos div } + { + % else if alpha <= 360 - theta, return (-b*cot(alpha), -b) + alpha 360 theta sub le + { b neg alpha cos mul alpha sin div b neg } + { + % else 360 - theta <= alpha, return (a, a*tan(alpha)) + a a alpha sin mul alpha cos div + } ifelse + } ifelse + } ifelse + } ifelse + end + % (Leaving ldiagboxcircum) 2 ldiagdebugprint +} def + +% find quadratic roots (assume a != 0): a b c ldiagqroots x1 x2 2 +% or x2 1 +% or 0 +/ldiagqroots +{ + 4 dict begin + /c exch def + /b exch def + /a exch def + /disc b b mul 4 a c mul mul sub def + disc 0 lt + { 0 + } + { disc 0 eq + { b neg 2 a mul div + 1 + } + { b neg disc sqrt add 2 a mul div + b neg disc sqrt sub 2 a mul div + 2 + } + ifelse + } + ifelse + end +} def + +% work our which quadrant: <angle> ldiagquadrant <0-3> +/ldiagquadrant +{ dup 90 lt + { pop 0 + } + { dup 180 lt + { pop 1 + } + { 270 lt + { 2 + } + { 3 + } ifelse + } ifelse + } ifelse +} def + +% find curvebox circum, assuming upper right quadrant: alpha a b xmk ldiagcb x y +/ldiagcb +{ + 6 dict begin + /xmk exch def + /b exch def + /a exch def + /alpha exch def + /theta1 0 0 a b xmk sub ldiagangleto def + /theta2 0 0 a xmk sub b ldiagangleto def + alpha theta1 le + { % if alpha <= theta1, return (a, a*tan(alpha)) + a a alpha sin mul alpha cos div + } + { alpha theta2 ge + { % else if alpha > theta2, return (b*cot(alpha), b) + b alpha cos mul alpha sin div b + } + { + % else, return the intersection of line and circle + a xmk sub b xmk sub xmk 0 0 alpha ldiagcircleintersect + dup 0 eq + { % should never happen, just return any reasonable point + pop + a b 0.5 ldiagpmul + } + { 1 eq + { % should never happen, just return the point on top of stack + } + { % the usual case, two points on stack, return the larger + ldiagpmax + } ifelse + } ifelse + } ifelse + } ifelse + end +} def + +% find point on circumference of curvebox: alpha a b xmk ldiagcurveboxcircum x y +/ldiagcurveboxcircum +{ + % (Entering ldiagcurveboxcircum) 4 ldiagdebugprint + 5 dict begin + /xmk exch def + /b exch def + /a exch def + ldiagfixangle /alpha exch def + + % work out which quadrant we are in, and reflect accordingly + /quad alpha ldiagquadrant def + quad 0 eq + { alpha a b xmk ldiagcb + } + { quad 1 eq + { 180 alpha sub a b xmk ldiagcb exch neg exch + } + { quad 2 eq + { alpha 180 sub a b xmk ldiagcb neg exch neg exch + } + { 360 alpha sub a b xmk ldiagcb neg + } ifelse + } ifelse + } ifelse + end + % (Leaving ldiagcurveboxcircum) 2 ldiagdebugprint +} def + +% find point on circumference of diamond: alpha a b ldiagdiamondcircum x y +/ldiagdiamondcircum +{ + % (Entering ldiagdiamondcircum) 3 ldiagdebugprint + 4 dict begin + /b exch def + /a exch def + ldiagfixangle /alpha exch def + b alpha cos abs mul a alpha sin abs mul add /denom exch def + a b mul alpha cos mul denom div + a b mul alpha sin mul denom div + end + % (Leaving ldiagdiamondcircum) 2 ldiagdebugprint +} def + +% find point on circumference of ellipse: alpha a b ldiagellipsecircum x y +/ldiagellipsecircum +{ + % (Entering ldiagellipsecircum) 3 ldiagdebugprint + 4 dict begin + /b exch def + /a exch def + ldiagfixangle /alpha exch def + b alpha cos mul dup mul a alpha sin mul dup mul add sqrt /denom exch def + a b mul alpha cos mul denom div + a b mul alpha sin mul denom div + end + % (Leaving ldiagellipsecircum) 2 ldiagdebugprint +} def + +% find point on circumference of isosceles: alpha a b ldiagisoscelescircum x y +/ldiagisoscelescircum +{ + % (Entering ldiagisoscelescircum) 3 ldiagdebugprint + 7 dict begin + /b exch def + /a exch def + /alpha exch ldiagfixangle def + /theta1 90 def + /theta2 a b 0.5 ldiagpmul 0 0 ldiagangleto def + /theta3 a b 0.5 ldiagpmul a 0 ldiagangleto def + alpha theta1 ge alpha theta2 le and + { 0 0 a 2 div b + } + { alpha theta2 ge alpha theta3 le and + { 0 0 a 0 + } + { a 0 a 2 div b + } ifelse + } ifelse + a 2 div b 2 div 2 copy 1 ft alpha ldiagatangle ldiaglineintersect + a 2 div b 2 div 4 2 roll ldiagpsub + end + % (Leaving ldiagisoscelescircum) 2 ldiagdebugprint +} def + +% find point of intersection of two lines each defined by two points +% x1 y1 x2 y2 x3 y3 x4 y4 ldiaglineintersect x y +/ldiaglineintersect +{ + % (Entering ldiaglineintersect) 8 ldiagdebugprint + 13 dict begin + /y4 exch def + /x4 exch def + /y3 exch def + /x3 exch def + /y2 exch def + /x2 exch def + /y1 exch def + /x1 exch def + x2 x1 sub /x21 exch def + x4 x3 sub /x43 exch def + y2 y1 sub /y21 exch def + y4 y3 sub /y43 exch def + y21 x43 mul y43 x21 mul sub /det exch def + + % calculate x + y21 x43 mul x1 mul + y43 x21 mul x3 mul sub + y3 y1 sub x21 mul x43 mul add + det div + + % calculate y + x21 y43 mul y1 mul + x43 y21 mul y3 mul sub + x3 x1 sub y21 mul y43 mul add + det neg div + + end + % (Leaving ldiaglineintersect) 2 ldiagdebugprint +} def + +% find point on circumference of polygon +% alpha radius num theta ldiagpolycircum x y +/ldiagpolycircum +{ + % (Entering ldiagpolycircum) 4 ldiagdebugprint + 13 dict begin + /theta exch def + /num exch def + /radius exch def + /alpha exch def + + % calculate delta, the angle from theta to alpha + alpha theta sub ldiagfixangle + + % calculate the angle which is the multiple of 360/num closest to delta + 360 num div div truncate 360 num div mul theta add /anglea exch def + + % calculate the next multiple of 360/num after anglea + anglea 360 num div add /angleb exch def + + % intersect the line through these two points with the alpha line + anglea cos anglea sin angleb cos angleb sin + 0 0 alpha cos 2 mul alpha sin 2 mul + ldiaglineintersect radius ldiagpmul + + end + % (Leaving ldiagpolycircum) 2 ldiagdebugprint +} def + +% find point of intersection of a line and a circle +% x0 y0 r x1 y1 theta ldiagcircleintersect xa ya xb yb 2 +% or xb yb 1 +% or 0 +/ldiagcircleintersect +{ + % (Entering ldiagcircleintersect) 6 ldiagdebugprint + 15 dict begin + /theta exch def + /y1 exch def + /x1 exch def + /r exch def + /y0 exch def + /x0 exch def + + % if sin(theta) = 0 then line is horizontal and y must be y1 + theta sin abs 0.00001 lt + { + /a 1 def + /b -2 x0 mul def + /c x0 dup mul y1 y0 sub dup mul add r dup mul sub def + a b c ldiagqroots dup + 0 eq + { pop + 0 + } + { 1 eq + { y1 1 + } + { y1 exch y1 2 + } ifelse + } ifelse + } + { + /ct theta cos theta sin div def + /a ct ct mul 1 add def + /b ct x1 x0 sub mul y1 add y0 sub 2 mul def + /c x1 x0 sub dup mul y1 y0 sub dup mul add r dup mul sub def + a b c ldiagqroots dup + 0 eq + { pop + 0 + } + { 1 eq + { y1 add /yb exch def + yb y1 sub ct mul x1 add /xb exch def + xb yb 1 + } + { y1 add /ya exch def + ya y1 sub ct mul x1 add /xa exch def + y1 add /yb exch def + yb y1 sub ct mul x1 add /xb exch def + xa ya xb yb 2 + } ifelse + } ifelse + } ifelse + end + % (Leaving ldiagcircleintersect) 1 ldiagdebugprint +} def + +% find line which is the perpendicular bisector of two points, defined +% by two points +% x1 y1 x2 y2 ldiaglinebetween x3 y3 x4 y4 +/ldiaglinebetween +{ % (Entering ldiaglinebetween) 4 ldiagdebugprint + /y2 exch def /x2 exch def + /y1 exch def /x1 exch def + + % let x3, y3 be the point halfway between the two points + x1 y1 x2 y2 ldiagpadd 0.5 ldiagpmul + /y3 exch def /x3 exch def + + % find a point perpendicular to x3, y3 + x3 y3 50 x1 y1 x2 y2 ldiagangleto 90 dg add ldiagatangle + + % plus x3 y3 gives the two points + x3 y3 + + % (Leaving ldiaglinebetween) 4 ldiagdebugprint +} def + +% find <proc>@<string>: <proc> <string> ldiagfindlabel <any> true +% <proc> <string> false +/ldiagfindlabel +{ + % (Entering ldiagfindlabel) 2 ldiagdebugprint + exch dup length 1 ne + { exch false + % (Leaving ldiagfindabel (length not 1)) 3 ldiagdebugprint + } + { dup 0 get type /nametype ne + { exch false + % (Leaving ldiagfindabel (not a name)) 3 ldiagdebugprint + } + { dup 0 get 50 string cvs (@) ldiagconcat 2 index ldiagconcat dup where + { exch get exch pop exch pop cvx exec true + % (Leaving ldiagfindlabel with success) 100 ldiagdebugprint + } + { + pop exch false + % (Leaving ldiagfindabel (concat not sensible)) 3 ldiagdebugprint + } ifelse + } ifelse + } ifelse +} bind def + +% execute <proc>@<string> or else default: <proc> <string> ldiagdolabel <various> +/ldiagdolabel +{ + % (Entering ldiagdolabel) 2 ldiagdebugprint + ldiagfindlabel not + { + dup (CIRCUM) eq + { pop pop pop 0 0 + } + { + dup (ANGLE) eq + { pop pop 0 + } + { pop cvx exec + } ifelse + } ifelse + } if + % (Leaving ldiagdolabel) 2 ldiagdebugprint +} bind def + +% execute a proc depending on whether number is negative, zero, or positive +% procneg proczero procpos number ldiagsigncase <anything> +/ldiagsigncase +{ + % (Entering ldiagsigncase) 4 ldiagdebugprint + dup 0 lt + { pop pop pop exec + } + { 0 gt + { exch pop exch pop exec + } + { pop exch pop exec + } ifelse + } ifelse + % (Leaving ldiagsigncase) 0 ldiagdebugprint +} bind def + +% execute proci if angle is in ith quadrant +% proc45 proc270 proc180 proc90 proc0 proc315 proc225 proc135 angle ldiagquadcase <anything> +/ldiagquadcase +{ + % (Entering ldiagquadcase) 9 ldiagdebugprint + round ldiagfixangle cvi dup 90 mod 0 eq + { 90 idiv 4 add } { 90 idiv } ifelse + 8 exch roll pop pop pop pop pop pop pop exec + % (Leaving ldiagquadcase) 0 ldiagdebugprint +} bind def + +% decode Lout length into PostScript length +% <string> ldiagdecodelength <number> +/ldiagdecodelength +{ + % (Entering ldiagdecodelength) 1 ldiagdebugprint + (f) search + { exch pop exch pop cvr ft + } + { (c) search + { exch pop exch pop cvr cm + } + { (p) search + { exch pop exch pop cvr pt + } + { (m) search + { exch pop exch pop cvr em + } + { (s) search + { exch pop exch pop cvr sp + } + { (v) search + { exch pop exch pop cvr vs + } + { (i) search + { exch pop exch pop cvr in + } + { pop 0 + } ifelse + } ifelse + } ifelse + } ifelse + } ifelse + } ifelse + } ifelse + % (Leaving ldiagdecodelength) 1 ldiagdebugprint +} def + +% implement aabout function +% logical form: <circum> <extra> <centre> aabout <point> +% actual form: { <labelorpoint> } cvlit <length> [ <point> ] cvx aabout <point> +/ldiagaabout +{ + /centre exch def + /extra exch def + /circum exch def + + /ZXCTR [ centre ] cvx def + /ZFCTR [ circum (CTR) ldiagdolabel ] cvx def + /ZAREF ZFCTR ZXCTR ldiagangleto def + /ZAMIN 0 dg def + /ZPMIN [ circum (CTR) ldiagdolabel ZAREF ZAMIN sub + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMIN sub ldiagatangle + ldiagpadd ] cvx def + + /ZAMAX 90 dg def + /ZPMAX [ circum (CTR) ldiagdolabel ZAREF ZAMAX sub + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMAX sub ldiagatangle + ldiagpadd ] cvx def + + 1 1 20 + { /xval exch def + /ZAMID ZAMIN ZAMAX add 0.5 mul def + /ZPMID [ circum (CTR) ldiagdolabel ZAREF ZAMID sub + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMID sub ldiagatangle + ldiagpadd ] cvx def + ZPMID ZXCTR ldiagdistance ZFCTR ZXCTR ldiagdistance gt + { + /ZAMAX [ ZAMID ] cvx def + /ZPMAX [ ZPMID ] cvx def + } + { + /ZAMIN [ ZAMID ] cvx def + /ZPMIN [ ZPMID ] cvx def + } ifelse + } for + ZPMID +} def + +% implement cabout function +% logical form: <circum> <extra> <centre> cabout <point> +% actual form: { <labelorpoint> } cvlit <length> [ <point> ] cvx cabout <point> +/ldiagcabout +{ + /centre exch def + /extra exch def + /circum exch def + + /ZXCTR [ centre ] cvx def + /ZFCTR [ circum (CTR) ldiagdolabel ] cvx def + /ZAREF ZFCTR ZXCTR ldiagangleto def + /ZAMIN 0 dg def + /ZPMIN [ circum (CTR) ldiagdolabel ZAREF ZAMIN add + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMIN add ldiagatangle + ldiagpadd ] cvx def + + /ZAMAX 90 dg def + /ZPMAX [ circum (CTR) ldiagdolabel ZAREF ZAMAX add + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMAX add ldiagatangle + ldiagpadd ] cvx def + + 1 1 20 + { /xval exch def + /ZAMID ZAMIN ZAMAX add 0.5 mul def + /ZPMID [ circum (CTR) ldiagdolabel ZAREF ZAMID add + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMID add ldiagatangle + ldiagpadd ] cvx def + ZPMID ZXCTR ldiagdistance ZFCTR ZXCTR ldiagdistance gt + { + /ZAMAX [ ZAMID ] cvx def + /ZPMAX [ ZPMID ] cvx def + } + { + /ZAMIN [ ZAMID ] cvx def + /ZPMIN [ ZPMID ] cvx def + } ifelse + } for + ZPMID +} def + +% fromarrowlength toarrowlength { from } { to } xindent zindent ldiaglinepath - +/ldiaglinepath +{ + % (entering ldiaglinepath) 0 ldiagdebugprint + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagangleto + /FROM@ANGLE ldiagangledef + from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd + /FROM ldiagpointdef + + FROM@ANGLE /TO@ANGLE ldiagangledef + to (CTR) ldiagdolabel TO@ANGLE 180 dg sub to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TO@ANGLE 180 dg sub ldiagatangle ldiagpadd /TO ldiagpointdef + + FROM 0.5 ldiagpmul TO 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + FROM@ANGLE /LMID@ANGLE ldiagangledef + + /XINDENT xindent FROM LMID ldiagdistance ldiagmin def + FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + + /ZINDENT zindent TO LMID ldiagdistance ldiagmin def + 0 0 ZINDENT FROM@ANGLE ldiagatangle TO ldiagpsub /LTO ldiagpointdef + FROM@ANGLE /LTO@ANGLE ldiagangledef + + direct { FROM TO } { FROM LFROM LMID LTO TO } ifelse + + % (leaving ldiaglinepath) 0 ldiagdebugprint +} def + +% fromarrowlength toarrowlength { from } { to } xindent zindent pathgap ldiagdoublelinepath - +/ldiagdoublelinepath +{ + % (entering ldiagdoublelinepath) 0 ldiagdebugprint + /pathgap exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagangleto + /FROM@ANGLE ldiagangledef + from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd + /FROM ldiagpointdef + + FROM@ANGLE /TO@ANGLE ldiagangledef + to (CTR) ldiagdolabel TO@ANGLE 180 dg sub to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TO@ANGLE 180 dg sub ldiagatangle ldiagpadd /TO ldiagpointdef + + FROM 0.5 ldiagpmul TO 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + FROM@ANGLE /LMID@ANGLE ldiagangledef + + /XINDENT xindent FROM LMID ldiagdistance ldiagmin def + FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + + /ZINDENT zindent TO LMID ldiagdistance ldiagmin def + 0 0 ZINDENT FROM@ANGLE ldiagatangle TO ldiagpsub /LTO ldiagpointdef + FROM@ANGLE /LTO@ANGLE ldiagangledef + + direct { + FROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + TO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + [] + FROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + TO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + } + { + FROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + LFROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + LMID pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + LTO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + TO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + [] + FROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + LFROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + LMID pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + LTO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + TO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + } ifelse + + % (leaving ldiagdoublelinepath) 0 ldiagdebugprint +} def + +% fromarrowlen toarrowlen { from } { to } xindent zindent bias ldiagacurvepath - +/ldiagacurvepath +{ + % (entering ldiagacurvepath) 0 ldiagdebugprint + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + %/B1 bias 0.02 ft ldiagmax def + %/B2 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagdistance 0.5 mul def + %/BIAS B1 B2 ldiagmin def + /BIAS bias 0.02 ft ldiagmax def + /XMID [ from (CTR) ldiagdolabel 0.5 ldiagpmul + to (CTR) ldiagdolabel 0.5 ldiagpmul ldiagpadd ] cvx def + /XTOP [ XMID 0 0 BIAS from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto 90 dg sub ldiagatangle ldiagpadd ] cvx def + /CTR [ from (CTR) ldiagdolabel XTOP ldiaglinebetween + to (CTR) ldiagdolabel XTOP ldiaglinebetween + ldiaglineintersect ] cvx def + + from fromarrowlength [ CTR ] cvx ldiagaabout /FROM ldiagpointdef + from (CTR) ldiagdolabel FROM ldiagdistance 0 gt + { from (CTR) ldiagdolabel FROM ldiagangleto + } + { CTR FROM ldiagangleto 90 dg add + } ifelse /FROM@ANGLE ldiagangledef + + to toarrowlength [ CTR ] cvx ldiagcabout /TO ldiagpointdef + TO to (CTR) ldiagdolabel ldiagdistance 0 gt + { TO to (CTR) ldiagdolabel ldiagangleto + } + { CTR TO ldiagangleto 90 dg add + } ifelse /TO@ANGLE ldiagangledef + + /RADIUS CTR FROM ldiagdistance def + CTR 0 0 RADIUS CTR FROM ldiagangleto 360 dg CTR TO ldiagangleto + add CTR FROM ldiagangleto sub cvi 360 mod 0.5 mul add + ldiagatangle ldiagpadd /LMID ldiagpointdef + CTR LMID ldiagangleto 90 dg add /LMID@ANGLE ldiagangledef + + /XINDENT xindent FROM LMID ldiagdistance ldiagmin def + CTR 0 0 RADIUS CTR FROM 0 0 XINDENT FROM@ANGLE ldiagatangle + ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LFROM ldiagpointdef + CTR LFROM ldiagangleto 90 dg add /LFROM@ANGLE ldiagangledef + + /ZINDENT zindent TO LMID ldiagdistance ldiagmin def + CTR 0 0 RADIUS CTR TO 0 0 ZINDENT TO@ANGLE 180 dg add + ldiagatangle ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LTO ldiagpointdef + CTR LTO ldiagangleto 90 dg add /LTO@ANGLE ldiagangledef + + direct + { FROM [CTR] TO } + { FROM [CTR] LFROM [CTR] LMID [CTR] LTO [CTR] TO } + ifelse + + % (leaving ldiagacurvepath) 0 ldiagdebugprint +} def + +% fromarrowlen toarrowlen { from } { to } xindent zindent bias ldiagccurvepath - +/ldiagccurvepath +{ + % (entering ldiagccurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + %/B1 bias 0.02 ft ldiagmax def + %/B2 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagdistance 0.5 mul def + %/BIAS B1 B2 ldiagmin def + /BIAS bias 0.02 ft ldiagmax def + /XMID [ from (CTR) ldiagdolabel 0.5 ldiagpmul + to (CTR) ldiagdolabel 0.5 ldiagpmul ldiagpadd ] cvx def + /XTOP [ XMID 0 0 BIAS from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto 90 dg add ldiagatangle ldiagpadd ] cvx def + /CTR [ from (CTR) ldiagdolabel XTOP ldiaglinebetween + to (CTR) ldiagdolabel XTOP ldiaglinebetween ldiaglineintersect ] cvx def + + from fromarrowlength [ CTR ] cvx ldiagcabout /FROM ldiagpointdef + from (CTR) ldiagdolabel FROM ldiagdistance 0 gt + { from (CTR) ldiagdolabel FROM ldiagangleto } + { CTR FROM ldiagangleto 90 dg sub } + ifelse /FROM@ANGLE ldiagangledef + + to toarrowlength [ CTR ] cvx ldiagaabout /TO ldiagpointdef + TO to (CTR) ldiagdolabel ldiagdistance 0 gt + { TO to (CTR) ldiagdolabel ldiagangleto } + { CTR TO ldiagangleto 90 dg sub } + ifelse /TO@ANGLE ldiagangledef + + /RADIUS [ CTR FROM ldiagdistance ] cvx def + CTR 0 0 RADIUS CTR TO ldiagangleto 360 dg CTR FROM ldiagangleto add + CTR TO ldiagangleto sub cvi 360 cvi mod 2 div add ldiagatangle + ldiagpadd /LMID ldiagpointdef + CTR LMID ldiagangleto 90 dg sub /LMID@ANGLE ldiagangledef + + /XINDENT [ xindent FROM LMID ldiagdistance ldiagmin ] cvx def + CTR 0 0 RADIUS CTR FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd + ldiagangleto ldiagatangle ldiagpadd /LFROM ldiagpointdef + CTR LFROM ldiagangleto 90 dg sub /LFROM@ANGLE ldiagangledef + + /ZINDENT [ zindent TO LMID ldiagdistance ldiagmin ] cvx def + CTR 0 0 RADIUS CTR TO 0 0 ZINDENT TO@ANGLE 180 dg add ldiagatangle + ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LTO ldiagpointdef + CTR LTO ldiagangleto 90 dg sub /LTO@ANGLE ldiagangledef + + direct + { FROM [CTR clockwise] TO } + { FROM [CTR clockwise] LFROM [CTR clockwise] + LMID [CTR clockwise] LTO [CTR clockwise] TO } + ifelse + % (leaving ldiagccurvepath) 0 ldiagdebugprint +} def + + +% farr tarr { from } { to } xindent zindent [frompt] [topt] ldiagbezierpath - +/ldiagbezierpath +{ + % (entering ldiagbezierpath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + cvx /topt exch def + cvx /frompt exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel frompt ldiagangleto /FROM@ANGLE ldiagangledef + from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel + ldiagpadd 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd + /FROM ldiagpointdef + + topt to (CTR) ldiagdolabel ldiagangleto /TO@ANGLE ldiagangledef + to (CTR) ldiagdolabel TO@ANGLE 180 dg add to (CIRCUM) ldiagdolabel + ldiagpadd 0 0 toarrowlength TO@ANGLE 180 dg add ldiagatangle ldiagpadd + /TO ldiagpointdef + + FROM 0 0 xindent FROM@ANGLE ldiagatangle ldiagpadd + /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + + TO 0 0 zindent TO@ANGLE 180 dg add ldiagatangle ldiagpadd + /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + + FROM TO ldiagpadd frompt ldiagpadd topt ldiagpadd 0.25 ldiagpmul + /LMID ldiagpointdef + + FROM [frompt topt] TO + + % (leaving ldiagbezierpath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + + +% farr tarr { from } { to } xindent zindent ldiagvhlinepath - +/ldiagvhlinepath +{ + % (entering ldiagvhlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /CTR [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel exch pop ] cvx def + /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + + from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef + FANG /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef + TANG 180 dg add /TO@ANGLE ldiagangledef + + /FDIST [ FROM CTR ldiagdistance ] cvx def + /TDIST [ TO CTR ldiagdistance ] cvx def + /XINDENT [ xindent FDIST ldiagmin ] cvx def + /ZINDENT [ zindent TDIST ldiagmin ] cvx def + FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + + CTR /LMID ldiagpointdef + 0 0 1 ft FANG 180 dg add ldiagatangle + 0 0 1 ft TANG 180 dg add ldiagatangle + ldiagangleto /LMID@ANGLE ldiagangledef + + FROM LFROM LMID LTO TO + + % (leaving ldiagvhlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent radius ldiagvhcurvepath - +/ldiagvhcurvepath +{ + % (entering ldiagvhcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /CTR [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel exch pop ] cvx def + /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + + from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef + FANG /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef + TANG 180 dg add /TO@ANGLE ldiagangledef + + /FDIST [ FROM CTR ldiagdistance ] cvx def + /TDIST [ TO CTR ldiagdistance ] cvx def + /RADIUS [ radius FDIST TDIST ldiagmin ldiagmin ] cvx def + /XINDENT [ xindent FDIST RADIUS sub ldiagmin ] cvx def + /ZINDENT [ zindent TDIST RADIUS sub ldiagmin ] cvx def + + FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + + /FCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd ] cvx def + /TCTR [ CTR 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def + /XCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd + 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def + XCTR 0 0 RADIUS XCTR CTR ldiagangleto ldiagatangle ldiagpadd + /LMID ldiagpointdef + FCTR TCTR ldiagangleto /LMID@ANGLE ldiagangledef + + FROM LFROM FCTR + {[XCTR clockwise]} {} {} {} {} {[XCTR]} {[XCTR clockwise]} {[XCTR]} + FCTR TCTR ldiagangleto ldiagquadcase + TCTR LTO TO + + % (leaving ldiagvhcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent ldiaghvlinepath - +/ldiaghvlinepath +{ + % (entering ldiaghvlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /CTR [ to (CTR) ldiagdolabel pop from (CTR) ldiagdolabel exch pop ] cvx def + /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + + from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef + FANG /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef + TANG 180 dg add /TO@ANGLE ldiagangledef + + /FDIST [ FROM CTR ldiagdistance ] cvx def + /TDIST [ TO CTR ldiagdistance ] cvx def + /XINDENT [ xindent FDIST ldiagmin ] cvx def + /ZINDENT [ zindent TDIST ldiagmin ] cvx def + + FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + + CTR /LMID ldiagpointdef + 0 0 1 ft FANG 180 dg add ldiagatangle + 0 0 1 ft TANG 180 dg add ldiagatangle ldiagangleto + /LMID@ANGLE ldiagangledef + + FROM LFROM LMID LTO TO + + % (leaving ldiaghvlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent radius ldiaghvcurvepath - +/ldiaghvcurvepath +{ + % (entering ldiaghvcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /CTR [ to (CTR) ldiagdolabel pop from (CTR) ldiagdolabel exch pop ] cvx def + /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + + from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef + FANG /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef + TANG 180 dg add /TO@ANGLE ldiagangledef + + /FDIST [ FROM CTR ldiagdistance ] cvx def + /TDIST [ TO CTR ldiagdistance ] cvx def + /RADIUS [ radius FDIST TDIST ldiagmin ldiagmin ] cvx def + /XINDENT [ xindent FDIST RADIUS sub ldiagmin ] cvx def + /ZINDENT [ zindent TDIST RADIUS sub ldiagmin ] cvx def + FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + + /FCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd ] cvx def + /TCTR [ CTR 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def + /XCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd + 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def + XCTR 0 0 RADIUS XCTR CTR ldiagangleto ldiagatangle ldiagpadd + /LMID ldiagpointdef + FCTR TCTR ldiagangleto /LMID@ANGLE ldiagangledef + + FROM LFROM FCTR + {[XCTR]} {} {} {} {} {[XCTR clockwise]} {[XCTR]} {[XCTR clockwise]} + FCTR TCTR ldiagangleto ldiagquadcase + TCTR LTO TO + + % (leaving ldiaghvcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias ldiaglvrlinepath - +/ldiaglvrlinepath +{ + % (entering ldiaglvrlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel 180 dg from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength 180 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 180 dg /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel 180 dg to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength 180 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 0 dg /TO@ANGLE ldiagangledef + + /XLEFT [ FROM pop TO pop ldiagmin bias sub ] cvx def + XLEFT FROM exch pop /P1 ldiagpointdef + XLEFT TO exch pop /P2 ldiagpointdef + /VERT [ P1 P2 ldiagangleto ] cvx def + P1 P1 0 0 1 ft 180 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle + ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef + P2 P2 0 0 1 ft 0 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle + ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef + + P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + VERT /LMID@ANGLE ldiagangledef + + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def + XINDENT 0 FROM ldiagpsub /LFROM ldiagpointdef + 180 dg /LFROM@ANGLE ldiagangledef + ZINDENT 0 TO ldiagpsub /LTO ldiagpointdef + 0 dg /LTO@ANGLE ldiagangledef + + FROM LFROM P1 LMID P2 LTO TO + + % (leaving ldiaglvrlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias radius ldiaglvrcurvepath - +/ldiaglvrcurvepath +{ + % (entering ldiaglvrcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel 180 dg from (CIRCUM) ldiagdolabel ldiagpadd 0 0 + fromarrowlength 180 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 180 dg /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel 180 dg to (CIRCUM) ldiagdolabel ldiagpadd 0 0 + toarrowlength 180 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 0 dg /TO@ANGLE ldiagangledef + /XLEFT [ FROM pop TO pop ldiagmin bias sub ] cvx def + /XP1 [ XLEFT FROM exch pop ] cvx def + /XP2 [ XLEFT TO exch pop ] cvx def + /VERT [ XP1 XP2 ldiagangleto ] cvx def + XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + VERT /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + XINDENT 0 FROM ldiagpsub /LFROM ldiagpointdef + 180 dg /LFROM@ANGLE ldiagangledef + ZINDENT 0 TO ldiagpsub /LTO ldiagpointdef + 0 dg /LTO@ANGLE ldiagangledef + /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def + /XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def + /XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def + XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd + /P1 ldiagpointdef + XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef + /XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def + /XP2POST [ XP2 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ XP2PRE 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def + XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd + /P2 ldiagpointdef + XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef + FROM LFROM XP1PRE + { } { [XP1CTR] P1 [XP1CTR] } { } { [XP1CTR clockwise] P1 [XP1CTR clockwise] } + { } { } { } { } VERT round ldiagquadcase + XP1POST LMID XP2PRE + { } { [XP2CTR] P2 [XP2CTR] } { } { [XP2CTR clockwise] P2 [XP2CTR clockwise] } + { } { } { } { } VERT round ldiagquadcase + XP2POST LTO TO + + % (leaving ldiaglvrcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias ldiagrvllinepath - +/ldiagrvllinepath +{ + % (entering ldiagrvllinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel 0 dg from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength 0 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 0 dg /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel 0 dg to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength 0 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 180 dg /TO@ANGLE ldiagangledef + /XRIGHT [ FROM pop TO pop ldiagmax bias add ] cvx def + XRIGHT FROM exch pop /P1 ldiagpointdef + XRIGHT TO exch pop /P2 ldiagpointdef + /VERT [ P1 P2 ldiagangleto ] cvx def + P1 P1 0 0 1 ft 0 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle + ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef + P2 P2 0 0 1 ft 180 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle + ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef + P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + VERT /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def + FROM XINDENT 0 ldiagpadd /LFROM ldiagpointdef + 0 dg /LFROM@ANGLE ldiagangledef + TO ZINDENT 0 ldiagpadd /LTO ldiagpointdef + 180 dg /LTO@ANGLE ldiagangledef + FROM LFROM P1 LMID P2 LTO TO + + % (leaving ldiagrvllinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + + +% farr tarr { from } { to } xindent zindent bias radius ldiagrvlcurvepath - +/ldiagrvlcurvepath +{ + % (entering ldiagrvlcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel 0 dg from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength 0 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 0 dg /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel 0 dg to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength 0 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 180 dg /TO@ANGLE ldiagangledef + /XRIGHT [ FROM pop TO pop ldiagmax bias add ] cvx def + /XP1 [ XRIGHT FROM exch pop ] cvx def + /XP2 [ XRIGHT TO exch pop ] cvx def + /VERT [ XP1 XP2 ldiagangleto ] cvx def + XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + VERT /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + FROM XINDENT 0 ldiagpadd /LFROM ldiagpointdef + 0 dg /LFROM@ANGLE ldiagangledef + TO ZINDENT 0 ldiagpadd /LTO ldiagpointdef + 180 dg /LTO@ANGLE ldiagangledef + /RADIUS [ radius XP1 XP2 ldiagdistance 0.5 mul ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def + /XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def + /XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def + XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd + /P1 ldiagpointdef + XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef + /XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def + /XP2POST [ XP2 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ XP2PRE 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def + XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd + /P2 ldiagpointdef + XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef + FROM LFROM XP1PRE + {} {[XP1CTR clockwise] P1 [XP1CTR clockwise]} {} {[XP1CTR] P1 [XP1CTR]} + {} {} {} {} VERT round ldiagquadcase + XP1POST LMID XP2PRE + {} {[XP2CTR clockwise] P2 [XP2CTR clockwise]} {} {[XP2CTR] P2 [XP2CTR]} + {} {} {} {} VERT round ldiagquadcase + XP2POST LTO TO + + % (leaving ldiagrvlcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias fbias tbias ldiagdwraplinepath - +/ldiagdwraplinepath +{ + % (entering ldiagdwraplinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /tbias exch def + /fbias exch def + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop + lt { 180 dg } { 0 dg } ifelse ] cvx def + from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd 0 0 + fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + DIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef + DIRN /TO@ANGLE ldiagangledef + FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd /P1 ldiagpointdef + DIRN 180 dg eq { 225 dg } { -45 dg } ifelse /P1@ANGLE ldiagangledef + TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd + /P4 ldiagpointdef + DIRN 180 dg eq { 135 dg } { 45 dg } ifelse /P4@ANGLE ldiagangledef + /YC [ from (CTR) ldiagdolabel 270 dg from (CIRCUM) ldiagdolabel ldiagpadd + exch pop to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd + exch pop ldiagmin bias 0 ldiagmax sub ] cvx def + P1 pop YC /P2 ldiagpointdef + P4@ANGLE 180 dg sub /P2@ANGLE ldiagangledef + P4 pop YC /P3 ldiagpointdef + P1@ANGLE 180 dg sub /P3@ANGLE ldiagangledef + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + /ZINDENT [ zindent TO P4 ldiagdistance ldiagmin ] cvx def + TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + P2 0.5 ldiagpmul P3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + DIRN 180 dg sub /LMID@ANGLE ldiagangledef + FROM P1 P2 P3 P4 TO + + % (leaving ldiagdwraplinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias fbias tbias radius +% ldiagdwrapcurvepath - +/ldiagdwrapcurvepath +{ + % (entering ldiagdwrapcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /tbias exch def + /fbias exch def + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt + { 180 dg } { 0 dg } ifelse ] cvx def + /CLOCK [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt + { anticlockwise } { clockwise } ifelse ] cvx def + from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + DIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef + DIRN /TO@ANGLE ldiagangledef + /XP1 [ FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd ] cvx def + /XP4 [ TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd ] cvx def + /YC [ from (CTR) ldiagdolabel 270 dg from (CIRCUM) ldiagdolabel ldiagpadd + exch pop to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd + exch pop ldiagmin bias 0 ldiagmax sub ] cvx def + /XP2 [ XP1 pop YC ] cvx def + /XP3 [ XP4 pop YC ] cvx def + /RP1 [ radius XP1 FROM ldiagdistance XP1 XP2 ldiagdistance 2 div + ldiagmin ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RP1 XP1 FROM ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP1POST [ XP1 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP1CTR [ XP1PRE 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def + XP1CTR 0 0 RP1 XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd /P1 ldiagpointdef + XP1CTR P1 ldiagangleto DIRN add 90 dg sub /P1@ANGLE ldiagangledef + /RP2 [ radius XP1 XP2 ldiagdistance 2 div XP2 XP3 ldiagdistance 2 div + ldiagmin ldiagmin ] cvx def + /XP2PRE [ XP2 0 0 RP2 XP2 XP1 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP2POST [ XP2 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ XP2PRE 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def + XP2CTR 0 0 RP2 XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef + XP2CTR P2 ldiagangleto DIRN add 90 dg sub /P2@ANGLE ldiagangledef + /RP3 [ radius XP2 XP3 ldiagdistance 2 div XP3 XP4 ldiagdistance 2 div + ldiagmin ldiagmin ] cvx def + /XP3PRE [ XP3 0 0 RP3 XP3 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP3POST [ XP3 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP3CTR [ XP3PRE 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def + XP3CTR 0 0 RP3 XP3CTR XP3 ldiagangleto ldiagatangle ldiagpadd /P3 ldiagpointdef + XP3CTR P3 ldiagangleto DIRN add 90 dg sub /P3@ANGLE ldiagangledef + /RP4 [ radius XP4 XP3 ldiagdistance 2 div XP4 TO ldiagdistance + ldiagmin ldiagmin ] cvx def + /XP4PRE [ XP4 0 0 RP4 XP4 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP4POST [ XP4 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP4CTR [ XP4PRE 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def + XP4CTR 0 0 RP4 XP4CTR XP4 ldiagangleto ldiagatangle ldiagpadd /P4 ldiagpointdef + XP4CTR P4 ldiagangleto DIRN add 90 dg sub /P4@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1PRE ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + XP2 0.5 ldiagpmul XP3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + DIRN 180 dg sub /LMID@ANGLE ldiagangledef + /ZINDENT [ zindent TO XP4POST ldiagdistance ldiagmin ] cvx def + TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + FROM LFROM + XP1PRE [XP1CTR CLOCK] XP1POST + XP2PRE [XP2CTR CLOCK] XP2POST + LMID + XP3PRE [XP3CTR CLOCK] XP3POST + XP4PRE [XP4CTR CLOCK] XP4POST + LTO TO + + % (leaving ldiagdwrapcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias fbias tbias ldiaguwraplinepath - +/ldiaguwraplinepath +{ + % (entering ldiaguwraplinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /tbias exch def + /fbias exch def + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt + { 180 dg } { 0 dg } ifelse ] cvx def + from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + DIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef + DIRN /TO@ANGLE ldiagangledef + FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd /P1 ldiagpointdef + DIRN 180 dg eq { 135 dg } { 45 dg } ifelse /P1@ANGLE ldiagangledef + TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd + /P4 ldiagpointdef + DIRN 180 dg eq { 225 dg } { -45 dg } ifelse /P4@ANGLE ldiagangledef + /YC [ from (CTR) ldiagdolabel 90 dg from (CIRCUM) ldiagdolabel ldiagpadd + exch pop to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd + exch pop ldiagmax bias 0 ldiagmax add ] cvx def + P1 pop YC /P2 ldiagpointdef + P4@ANGLE 180 dg sub /P2@ANGLE ldiagangledef + P4 pop YC /P3 ldiagpointdef + P1@ANGLE 180 dg sub /P3@ANGLE ldiagangledef + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + /ZINDENT [ zindent TO P4 ldiagdistance ldiagmin ] cvx def + TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + P2 0.5 ldiagpmul P3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + DIRN 180 dg sub /LMID@ANGLE ldiagangledef + FROM P1 P2 P3 P4 TO + + % (leaving ldiaguwraplinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias fbias tbias radius +% ldiaguwrapcurvepath - +/ldiaguwrapcurvepath +{ + % (entering ldiaguwrapcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /tbias exch def + /fbias exch def + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt + { 180 dg } { 0 dg } ifelse ] cvx def + /CLOCK [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt + { clockwise } { anticlockwise } ifelse ] cvx def + from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + DIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef + DIRN /TO@ANGLE ldiagangledef + /XP1 [ FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd ] cvx def + /XP4 [ TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd ] cvx def + /YC [ from (CTR) ldiagdolabel 90 dg from (CIRCUM) ldiagdolabel ldiagpadd + exch pop to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd + exch pop ldiagmax bias 0 ldiagmax add ] cvx def + /XP2 [ XP1 pop YC ] cvx def + /XP3 [ XP4 pop YC ] cvx def + /RP1 [ radius XP1 FROM ldiagdistance XP1 XP2 ldiagdistance 2 div + ldiagmin ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RP1 XP1 FROM ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP1POST [ XP1 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP1CTR [ XP1PRE 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def + XP1CTR 0 0 RP1 XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd /P1 ldiagpointdef + XP1CTR P1 ldiagangleto DIRN add 90 dg add /P1@ANGLE ldiagangledef + /RP2 [ radius XP1 XP2 ldiagdistance 2 div XP2 XP3 ldiagdistance 2 div + ldiagmin ldiagmin ] cvx def + /XP2PRE [ XP2 0 0 RP2 XP2 XP1 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP2POST [ XP2 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ XP2PRE 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def + XP2CTR 0 0 RP2 XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef + XP2CTR P2 ldiagangleto DIRN add 90 dg add /P2@ANGLE ldiagangledef + /RP3 [ radius XP2 XP3 ldiagdistance 2 div XP3 XP4 ldiagdistance 2 div + ldiagmin ldiagmin ] cvx def + /XP3PRE [ XP3 0 0 RP3 XP3 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP3POST [ XP3 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP3CTR [ XP3PRE 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def + XP3CTR 0 0 RP3 XP3CTR XP3 ldiagangleto ldiagatangle ldiagpadd /P3 ldiagpointdef + XP3CTR P3 ldiagangleto DIRN add 90 dg add /P3@ANGLE ldiagangledef + /RP4 [ radius XP4 XP3 ldiagdistance 2 div XP4 TO ldiagdistance + ldiagmin ldiagmin ] cvx def + /XP4PRE [ XP4 0 0 RP4 XP4 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP4POST [ XP4 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def + /XP4CTR [ XP4PRE 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def + XP4CTR 0 0 RP4 XP4CTR XP4 ldiagangleto ldiagatangle ldiagpadd /P4 ldiagpointdef + XP4CTR P4 ldiagangleto DIRN add 90 dg add /P4@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1PRE ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + XP2 0.5 ldiagpmul XP3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + DIRN 180 dg sub /LMID@ANGLE ldiagangledef + /ZINDENT [ zindent TO XP4POST ldiagdistance ldiagmin ] cvx def + TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + FROM LFROM + XP1PRE [XP1CTR CLOCK] XP1POST + XP2PRE [XP2CTR CLOCK] XP2POST + LMID + XP3PRE [XP3CTR CLOCK] XP3POST + XP4PRE [XP4CTR CLOCK] XP4POST + LTO TO + + % (leaving ldiaguwrapcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% shape and labels of the @SolidArrowHead symbol +% - ldiagsolidarrowhead - +/ldiagsolidarrowhead +{ + 0 0 xsize ysize 0.5 mul 0 ysize +} def + +% shape and labels of the @OpenArrowHead symbol +% <pathwidth> ldiagopenarrowhead - +/ldiagopenarrowhead +{ + /pathwidth exch def + /PSW [ 0 0 ] cvx def + /PNW [ 0 ysize ] cvx def + /PE [ xsize ysize 0.5 mul ] cvx def + /REL [ 0 0 pathwidth PE PNW ldiagangleto 90 add ldiagatangle ] cvx def + /PNA [ 0 ysize 0.5 mul pathwidth 0.5 mul add ] cvx def + /PSA [ 0 ysize 0.5 mul pathwidth 0.5 mul sub ] cvx def + /PNI [ PNA PNA xsize 0 ldiagpadd PNW REL ldiagpadd + PE REL ldiagpadd ldiaglineintersect ] cvx def + /PSI [ 0 pathwidth PNI ldiagpsub ] cvx def + + PSW PE PNW PNI PNA PSA PSI PSW +} def + +% shape and labels of the @HalfOpenArrowHead symbol +% <pathwidth> ldiaghalfopenarrowhead - +/ldiaghalfopenarrowhead +{ + /pathwidth exch def + 0 0 + xsize ysize 0.5 mul + 0 ysize + xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul add + 0 ysize 0.5 mul pathwidth 0.5 mul add + 0 ysize 0.5 mul pathwidth 0.5 mul sub + xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul sub + 0 0 +} def + +% shape and labels of the @SolidCurvedArrowHead symbol +% - ldiagsolidcurvedarrowhead - +/ldiagsolidcurvedarrowhead +{ + 0 0 + [0 0 xsize ysize 0.5 mul ldiaglinebetween + xsize 0 xsize ysize ldiaglineintersect clockwise] + xsize ysize 0.5 mul + [xsize ysize 0.5 mul 0 ysize ldiaglinebetween + xsize 0 xsize ysize ldiaglineintersect clockwise] + 0 ysize +} def + +% shape and labels of the @OpenCurvedArrowHead symbol +% <pathwidth> ldiagopencurvedarrowhead - +/ldiagopencurvedarrowhead +{ + /pathwidth exch def + /LR [ 0 0 xsize ysize 0.5 mul ldiaglinebetween + xsize 0 xsize ysize ldiaglineintersect + ] cvx def + /UR [ xsize ysize 0.5 mul 0 ysize ldiaglinebetween + xsize 0 xsize ysize ldiaglineintersect + ] cvx def + /PW2 [ pathwidth 0.5 mul ] cvx def + /UMID [ + 0 ysize 0.5 mul PW2 add + xsize ysize 0.5 mul PW2 add + 0 ysize 0 0 1 ft UR 0 ysize ldiagangleto 90 add ldiagatangle + ldiagpadd 0 ysize ldiaglineintersect + ] cvx def + /LMID [ 0 pathwidth UMID ldiagpsub ] cvx def + 0 0 + [LR clockwise] + xsize ysize 0.5 mul + [UR clockwise] + 0 ysize + UMID + 0 ysize 0.5 mul PW2 add + 0 ysize 0.5 mul PW2 sub + LMID + 0 0 +} def + +% shape and labels of the @HalfOpenCurvedArrowHead symbol +% <pathwidth> ldiaghalfopencurvedarrowhead - +/ldiaghalfopencurvedarrowhead +{ + /pathwidth exch def + /LR [ 0 0 xsize ysize 0.5 mul ldiaglinebetween + xsize 0 xsize ysize ldiaglineintersect + ] cvx def + /UR [ xsize ysize 0.5 mul 0 ysize ldiaglinebetween + xsize 0 xsize ysize ldiaglineintersect + ] cvx def + /BR [ 0 0 LR 0 ysize UR ldiaglineintersect ] cvx def + /BRAD [ 0 0 BR ldiagdistance ] cvx def + /PW2 [ pathwidth 0.5 mul ] cvx def + /XDIST [ BRAD dup mul PW2 dup mul sub sqrt ] cvx def + /UMID [ BR XDIST PW2 ldiagpadd ] cvx def + /LMID [ BR XDIST 0 PW2 sub ldiagpadd ] cvx def + 0 0 + [LR clockwise] + xsize ysize 0.5 mul + [UR clockwise] + 0 ysize + [BR clockwise] + UMID + 0 ysize 0.5 mul PW2 add + 0 ysize 0.5 mul PW2 sub + LMID + [BR clockwise] + 0 0 +} def + +end +%%EndResource + +%%BeginResource: procset LoutBasicSetup +% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/bsf.lpg + +% width height linethickness louteuro - +% draw a Euro symbol of this width and height with this line thickness +/louteuro { + 20 dict begin + /eurothick exch def + /euroheight exch def + /eurowidth exch def + /eurostrokewidth euroheight 0.8 mul def + /eurostep eurothick 60 cos mul 60 sin div def + /eurotheta 40 def + + % llx lly width thickness louteurobox - + % draw angled box starting at (llx, lly) with given width and thickness + /louteurobox + { + /euroboxthick exch def + /euroboxwidth exch def + newpath moveto euroboxwidth 0 rlineto + eurostep euroboxthick rlineto + euroboxwidth neg 0 rlineto closepath fill + } def + + % lower cross stroke + 0 euroheight 2 div eurothick 1.5 mul sub + eurostrokewidth eurothick louteurobox + + % upper cross stroke + 0 euroheight 2 div eurothick 0.5 mul add + eurostrokewidth eurostep 2 mul add eurothick louteurobox + + % circular part + /eurohctr eurowidth euroheight 2 div eurotheta cos mul sub def + /eurovctr euroheight 2 div def + newpath + eurohctr eurovctr eurovctr eurotheta 350 eurotheta sub arc + eurohctr eurovctr eurovctr eurothick sub 365 eurotheta sub eurotheta arcn + closepath fill + end +} def + +% path for @FullWidthRule symbol +/LoutRule +{ 0 0 moveto xsize 0 lineto +} def + +% path for @Box symbol +/LoutBox +{ 0 0 moveto xsize 0 lineto + xsize ysize lineto 0 ysize lineto + closepath +} def + +% path for @CurveBox symbol +/LoutCurveBox +{ xmark 0 moveto + xsize xmark sub xmark xmark 270 360 arc + xsize xmark sub ysize xmark sub xmark 0 90 arc + xmark ysize xmark sub xmark 90 180 arc + xmark xmark xmark 180 270 arc + closepath +} def + +% path for @ShadowBox symbol +/LoutShadowBox +{ xmark 2 mul 0 moveto xsize 0 lineto + xsize ysize xmark 2 mul sub lineto + xsize xmark sub ysize xmark 2 mul sub lineto + xsize xmark sub xmark lineto + xmark 2 mul xmark lineto + closepath +} def + +% set up dictionary containing margin note data: parity LoutMargSet - +/LoutMargSet +{ /LoutMargDict 12 dict def + LoutMargDict begin + /parity exch def + /matr matrix currentmatrix def + /rightx xsize def + /lefty ysize def % highest allowable point for top of next left note + /righty ysize def % highest allowable point for top of next right note + /max { 2 copy gt { pop } { exch pop } ifelse } def + /min { 2 copy lt { pop } { exch pop } ifelse } def + end +} def + +%translate coordinate system for marginal notes: type LoutMargShift - +% where type 0 is left margin, 1 is right margin, 2 is outer, 3 is inner +/LoutMargShift +{ LoutMargDict begin + + % y coordinate of top of note, in margin coords, before vertical adjust + 0 ysize transform matr itransform exch pop + + % decide whether left or right margin based on type and parity + exch [ 0 1 parity 1 parity sub ] exch get 0 eq + { + % left margin: adjust top of note downwards if overlaps previous note + lefty min + + % bottom of note is new lefty position and also translate position + ysize sub dup /lefty exch def + + % want right edge of note at coordinate zero + xsize neg exch + } + { + % right margin: adjust top of note downwards if overlaps previous note + righty min + + % bottom of note is new righty position and also translate position + ysize sub dup /righty exch def + + % want left edge of note at coordinate rightx + rightx exch + } ifelse + + % stack now contains coord of bottom left corner in margin coordinates + matr setmatrix translate + end +} def + +% create LoutPageDict with left, right, foot, top for @Place symbol users +/LoutPageSet +{ + /LoutPageDict 5 dict def + LoutPageDict begin + /matr matrix currentmatrix def + /left 0 def + /right xsize def + /foot 0 def + /top ysize def + end + +} def + +%%EndResource + +%%EndProlog + +%%BeginSetup +%%IncludeResource: font Times-Roman +/Times-Romanfnt82 vec2 /Times-Roman LoutRecode +/fnt82 { /Times-Romanfnt82 LoutFont } def +%%IncludeResource: font Helvetica +/Helveticafnt35 vec2 /Helvetica LoutRecode +/fnt35 { /Helveticafnt35 LoutFont } def +%%IncludeResource: font Symbol +/fnt78 { /Symbol LoutFont } def +%%EndSetup + +%%Page: 11 1 +%%BeginPageSetup +%%PageResources: font Times-Roman +%%+ font Times-Italic +%%+ font Times-Bold +%%+ font Helvetica +/pgsave save def +%%IncludeResource: font Times-Italic +/Times-Italicfnt83 vec2 /Times-Italic LoutRecode +/fnt83 { /Times-Italicfnt83 LoutFont } def +%%IncludeResource: font Times-Bold +/Times-Boldfnt84 vec2 /Times-Bold LoutRecode +/fnt84 { /Times-Boldfnt84 LoutFont } def +0.0500 dup scale 10 setlinewidth +%%EndPageSetup +gsave +0 0 translate +240 fnt82 0.0 0.0 0.0 setrgbcolor 11900 16840 0 16840 240 288 60 LoutGraphic +gsave +LoutPageSet +grestore +gsave +0 16840 translate +0.0000 rotate +9066 14006 0 14006 240 288 60 1417 -15423 LoutGr2 +1 LoutMargSet +grestore +240 fnt83 0 13843(1.10.)m 574(Notes)s 1174(on)s 1468(P)s 19(erl)k +1920(and)s 2346(P)s 19(od)k 240 fnt84 8839 13840(11)m +0 13250(1.10.)m 591(Notes)s 1216(on)s 1525(P)s 4(erl)k +2000(and)s 2441(P)s 4(od)k 240 fnt82 480 12818(The)m +923(Perl)s 1378(programming)s 2749(language)s 153 fnt82 3609 12907(1)m +240 fnt82 3744 12818(is)m 3970(quite)s 4520(a)s 4702(dif\207cult)s +5533(one)s 5951(for)s 6305(the)s 220 fnt35 6668 12815(prg2lout)m +240 fnt82 7532 12818(program)m 8418(to)s 8673(deal)s 0 12530(with,)m +526(and)s 924(our)s 1297(boast)s 1855(that)s 2267(programs)s +3215(can)s 3598(be)s 3873(included)s 4749(with)s 5225(`absolutely)s +6335(no)s 6621(modi\207cations')s 8029(is)s 8233(not)s 8592(quite)s +0 12242(true)m 427(for)s 765(Perl.)s 480 11868(Here)m 1000(is)s +1211(the)s 1560(complete)s 2493(list)s 2844(of)s 3116(problem)s +3974(areas.)s 4629(In)s 4885(most)s 5411(cases)s 5967(the)s +6316(ef)s 6(fect)k 6912(is)s 7123(to)s 7363(get)s +7716(the)s 8065(formatting)s 0 11580(wrong)m 675(o)s 3(v)k 3(er)k +1164(a)s 1341(short)s 1889(re)s 3(gion,)k 2615(which)s +3267(is)s 3488(not)s 3864(perhaps)s 4670(so)s 4946(disastrous;)s +6025(and)s 6439(it)s 6642(should)s 7349(be)s 7642(easy)s +8131(to)s 8381(modify)s 0 11292(your)m 507(Perl)s 955(program)s +1834(without)s 2634(changing)s 3574(its)s 3859(meaning,)s 4799(to)s +5046(w)s 2(ork)k 5606(around)s 6338(these)s 6894(problems.)s +7957(After)s 8529(all,)s 8883(in)s 0 11004(Perl)m 439(there)s +972(is)s 1182(al)s 2(w)k 2(ays)k 1893(more)s +2440(than)s 2909(one)s 3311(w)s 2(ay)k 3762(to)s +4001(do)s 4294(it.)s 0 10499(1.)m 240 fnt83 480 10501(Her)m 8(e-documents)k +240 fnt82 2108 10499(such)m 2604(as)s 960 10047(<<"EOF")m 960 9759(These lines will be read as though)m +960 9471(enclosed in double quotes)m 960 9183(EOF)m 480 8729(will)m 910(be)s 1196(handled)s +2017(correctly)s 2923(only)s 3407(if)s 3629(the)s 3981(string)s +4583(used)s 5084(to)s 5327(terminate)s 6289(the)s 6641(document)s +7649(is)s 7864(one)s 8270(of)s 240 fnt83 8546 8731(EOF)m +240 fnt82 9019 8729(,)m 240 fnt83 480 8443(EO)m 9(T)k +240 fnt82 941 8441(,)m 240 fnt83 1040 8443(END)m 240 fnt82 +1514 8441(,)m 1613(and)s 2009(the)s 2348(empty)s 2992(string.)s +3692(This)s 4160(terminating)s 5305(string)s 5894(may)s 6352(be)s +6626(enclosed)s 7512(in)s 7747(all)s 8032(three)s 8556(kinds)s +480 8153(of)m 761(quotes,)s 1504(or)s 1773(in)s 2027(none.)s +2668(An)s 3(ything)k 3633(after)s 4140(the)s 4498(<<)s +4833(symbol)s 5604(on)s 5911(the)s 6270(same)s 6827(line)s +7252(will)s 7689(be)s 7981(treated)s 8699(as)s 8960(a)s +480 7865(string,)m 1131(which)s 1773(means)s 2435(that)s 2853(stack)s 2(ed)k +3626(here-documents)s 5204(will)s 5630(not)s 5996(be)s 6278(printed)s +7013(properly)s 15(.)k 0 7362(2.)m 480(When)s 220 fnt35 +1115 7359(prg2lout)m 240 fnt82 1969 7362(is)m 2186(scanning)s 3096(the)s +3451(program)s 4327(looking)s 5118(for)s 5463(the)s 5817(be)s 3(ginning)k +6832(of)s 7109(a)s 7281(le)s 3(xical)k 7976(unit,)s +8461(it)s 8660(may)s 480 7074(come)m 1074(upon)s 1632(a)s +220 fnt35 1819 7071(/)m 240 fnt82 1964 7074(character)m 9(,)k +2957(and)s 3382(this)s 240 fnt83 3799 7076(initial)m 220 fnt35 +4450 7071(/)m 240 fnt82 4594 7074(\(not)m 5060(subsequent)s 6205(ones)s +6716(in)s 6980(the)s 7349(same)s 7917(le)s 3(xical)k +8626(unit\))s 480 6786(it)m 691(\207nds)s 1227(dif\207cult)s 2062(to)s +2320(interpret,)s 3254(since)s 3820(it)s 4031(may)s 4517(be)s +4818(the)s 5185(be)s 3(ginning)k 6212(of)s 6502(a)s +6687(re)s 3(gular)k 7439(e)s 3(xpression,)k 8585(to)s +8844(be)s 480 6498(formatted)m 1460(lik)s 2(e)k 1865(a)s +2024(string,)s 2668(or)s 2920(it)s 3105(may)s 3564(be)s +3839(a)s 3998(complete)s 4923(le)s 3(xical)k 5604(unit)s +6029(denoting)s 6913(di)s 6(vision.)k 7835(The)s 8256(program)s +480 6210(chooses)m 1308(the)s 1675(re)s 3(gular)k 2427(e)s 3(xpression)k +3524(\(or)s 3881(equi)s 6(v)k 6(alently)k 15(,)k +5162(string\))s 5853(interpretation)s 7216(if)s 7452(the)s 220 fnt35 +7819 6207(/)m 240 fnt82 7962 6210(character)m 8916(is)s 480 5922(immediately)m +1714(preceded)s 2620(by)s 220 fnt35 2900 5919(q)m 240 fnt82 +3009 5922(,)m 220 fnt35 3101 5919(qq)m 240 fnt82 3332 5922(,)m +220 fnt35 3424 5919(qx)m 240 fnt82 3654 5922(,)m 220 fnt35 +3747 5919(qw)m 240 fnt82 4025 5922(,)m 220 fnt35 4117 5919(qr)m +240 fnt82 4312 5922(,)m 220 fnt35 4405 5919(m)m 240 fnt82 +4574 5922(,)m 220 fnt35 4666 5919(s)m 240 fnt82 4769 5922(,)m +220 fnt35 4861 5919(y)m 240 fnt82 4969 5922(,)m 5062(or)s +220 fnt35 5306 5919(tr)m 240 fnt82 5440 5922(.)m 5590(It)s +5780(also)s 6203(chooses)s 6998(the)s 7331(re)s 3(gular)k +8049(e)s 3(xpression)k 480 5634(interpretation)m 1834(if)s 2063(the)s +220 fnt35 2423 5631(/)m 240 fnt82 2558 5634(character)m 3504(is)s +3726(immediately)s 4986(preceded)s 5918(by)s 6224(zero,)s 6754(one,)s +7219(or)s 7489(tw)s 2(o)k 7911(space)s 8510(or)s +8781(tab)s 480 5346(characters,)m 1549(which)s 2186(are)s 2528(themselv)s 3(es)k +3633(immediately)s 4876(preceded)s 5792(by)s 6081(a)s 6242(complete)s +7169(le)s 3(xical)k 7852(unit)s 8279(which)s 8916(is)s +480 5058(either)m 220 fnt35 1078 5055(=)m 240 fnt82 1198 5058(,)m +220 fnt35 1300 5055(=~)m 240 fnt82 1543 5058(,)m 220 fnt35 +1645 5055(!~)m 240 fnt82 1821 5058(,)m 220 fnt35 1923 5055(split)m +240 fnt82 2308 5058(,)m 2410(or)s 220 fnt35 2664 5055(if)m +240 fnt82 2770 5058(.)m 2929(Otherwise)s 3961(it)s 4148(chooses)s +4952(the)s 5295(di)s 6(vision)k 6112(interpretation.)s 7557(In)s +7808(the)s 8151(rare)s 8571(cases)s 480 4770(where)m 1120(this)s +1517(rule)s 1945(f)s 2(ails,)k 2460(you)s 2876(can)s +3266(force)s 220 fnt35 3812 4767(prg2lout)m 240 fnt82 4661 4770(to)m +4901(choose)s 5622(the)s 5971(re)s 3(gular)k 6705(e)s 3(xpression)k +7783(interpretation)s 480 4482(by)m 777(placing)s 1537(an)s 220 fnt35 +1823 4479(m)m 240 fnt82 2055 4482(in)m 2301(front)s 2829(of)s +3103(the)s 3454(initial)s 220 fnt35 4068 4479(/)m 240 fnt82 +4195 4482(\(this)m 4673(does)s 5167(not)s 5536(change)s 6273(the)s +6624(meaning)s 7504(of)s 7778(the)s 8130(program\),)s 480 4194(and)m +910(you)s 1352(can)s 1768(force)s 2341(the)s 2716(di)s 6(vision)k +3565(interpretation)s 4935(by)s 5256(placing)s 6040(at)s 6299(least)s +6823(three)s 7383(spaces)s 8085(before)s 8778(the)s 220 fnt35 +480 3903(/)m 240 fnt82 604 3906(character)m 13(.)k 0 3448(3.)m +480(The)s 220 fnt35 910 3445(prg2lout)m 240 fnt82 1761 3448(program)m +2634(recognises)s 3697(complete)s 4632(substitution)s 5808(operators,)s 6807(such)s +7306(as)s 220 fnt35 7559 3445(s/abc/ABC/)m 240 fnt82 8722 3448(and)m +220 fnt35 480 3157(s{abc}{ABC})m 240 fnt82 1677 3160(,)m 1799(as)s +2065(indi)s 6(vidual)k 3100(le)s 3(xical)k 3804(units,)s +4392(and)s 4812(it)s 5019(formats)s 5815(them)s 6369(as)s +6635(it)s 6843(does)s 7349(strings.)s 8166(Ho)s 6(we)k 6(v)k 3(er)k 9(,)k +480 2872(its)m 774(rule)s 1219(for)s 1575(deciding)s 2470(where)s +3128(these)s 3693(units)s 4227(end)s 4650(is)s 4878(rather)s +5512(simple-minded:)s 7130(at)s 7380(the)s 7746(start,)s 8281(it)s +8492(w)s 2(orks)k 480 2584(out)m 846(what)s 1372(character)s +2306(\207nishes)s 3089(the)s 3438(unit)s 3870(\(in)s 4193(the)s +4541(e)s 3(xamples)k 5493(abo)s 3(v)k 3(e,)k +220 fnt35 6167 2581(/)m 240 fnt82 6291 2584(and)m 220 fnt35 +6696 2581(})m 240 fnt82 6820 2584(respecti)m 6(v)k 3(ely\),)k +8152(and)s 8557(scans)s 480 2296(along)m 1070(until)s 1569(it)s +1767(reaches)s 2540(the)s 2894(second)s 3622(occurrence)s 4732(of)s +5009(this)s 5411(character)s 6351(not)s 6722(preceded)s 7649(by)s +7949(the)s 220 fnt35 8303 2293(\\)m 240 fnt82 8433 2296(escape)m +480 2008(character)m 13(.)k 1505(This)s 1981(is)s 2191(inadequate)s +3283(in)s 3526(tw)s 2(o)k 3936(respects.)s 4869(Firstly)s 15(,)k +220 fnt35 960 1510(s{{}}{})m 240 fnt82 480 1016(is)m 698(a)s +872(complete)s 1812(le)s 3(g)k 1(al)k 2336(substitution)s +3517(e)s 3(xpression)k 4602(in)s 4853(Perl,)s 5353(b)s 4(ut)k +220 fnt35 5723 1013(prg2lout)m 240 fnt82 6579 1016(will)m 7013(think)s +7575(it)s 7775(ends)s 8273(after)s 8778(the)s 480 728(second)m +220 fnt35 1203 725(})m 240 fnt82 1267 728(,)m 1374(and)s +1778(so)s 2044(format)s 2740(the)s 3088(rest)s 3492(of)s +3763(it)s 3955(wrongly)s 15(.)k 4902(Secondly)s 15(,)k +5885(and)s 6289(more)s 6836(seriously)s 15(,)k 1134 0 0 0 240 288 60 0 307 LoutGr2 +0 0 moveto xsize 0 lineto stroke +grestore + +grestore +122 fnt82 +0 112(1)m 192 fnt82 58 42(My)m 368(thanks)s 909(to)s +1101(Mark)s 1563(Summer\207eld)s 2598(for)s 2868(help)s 3241(with)s +3627(Perl)s 3978(and)s 4302(Pod.)s +grestore + +grestore + +grestore + +pgsave restore +showpage + +%%Page: 12 2 +%%BeginPageSetup +%%PageResources: font Times-Roman +%%+ font Times-Bold +%%+ font Times-Italic +%%+ font Helvetica +/pgsave save def +%%IncludeResource: font Times-Bold +/Times-Boldfnt84 vec2 /Times-Bold LoutRecode +/fnt84 { /Times-Boldfnt84 LoutFont } def +%%IncludeResource: font Times-Italic +/Times-Italicfnt83 vec2 /Times-Italic LoutRecode +/fnt83 { /Times-Italicfnt83 LoutFont } def +0.0500 dup scale 10 setlinewidth +%%EndPageSetup +gsave +0 0 translate +240 fnt82 0.0 0.0 0.0 setrgbcolor 11900 16840 0 16840 240 288 60 LoutGraphic +gsave +LoutPageSet +grestore +gsave +0 16840 translate +0.0000 rotate +9066 14006 0 14006 240 288 60 1417 -15423 LoutGr2 +0 LoutMargSet +grestore +240 fnt84 0 13840(12)m 240 fnt83 5981 13843(Chapter)m 6831(1.)s +7105(Computer)s 8128(Pr)s 10(o)k 2(gr)k 3(ams)k +220 fnt35 960 13207(s{abc}<ABC>)m 240 fnt82 480 12713(is)m 711(also)s +1171(allo)s 6(wed)k 2001(in)s 2266(Perl,)s 2778(b)s 4(ut)k +220 fnt35 3162 12710(prg2lout)m 240 fnt82 4031 12713(does)m 4543(not)s +4930(understand)s 6060(that)s 6499(the)s 6869(\207nishing)s 7781(character)s +8737(can)s 480 12425(change)m 1215(in)s 1459(this)s 1856(w)s 2(ay)k 15(,)k +2346(so)s 2613(in)s 2858(this)s 3255(e)s 3(xample)k +4119(it)s 4312(will)s 4739(k)s 2(eep)k 5244(scanning)s +6149(fore)s 6(v)k 3(er)k 9(,)k 6928(looking)s +7714(for)s 8053(the)s 8403(second)s 220 fnt35 480 12134(})m +240 fnt82 604 12137(character)m 9(,)k 1576(which)s 2218(is)s +2428(disastrous.)s 0 11640(Further)m 763(w)s 2(ork)k 1314(may)s +1780(eliminate)s 2724(some)s 3285(of)s 3556(these)s 4103(problems.)s +480 11266(The)m 953(Pod)s 1429(language)s 2394(is)s 2650(used)s +3192(by)s 3531(Perl)s 4015(programmers)s 5386(for)s 5769(creating)s +6636(documentation,)s 8210(and)s 8660(may)s 0 10978(be)m 313(found)s +961(within)s 1660(Perl)s 2131(programs)s 3116(or)s 3406(standing)s +4301(alone.)s 5015(Lout)s 5558(supports)s 6451(both)s 6965(arrangements)s +8335(without)s 0 10690(an)m 3(y)k 418(special)s 1157(action)s +1819(by)s 2134(the)s 2503(user)s 13(.)k 3073(At)s +3393(the)s 3762(be)s 3(ginning)k 4792(of)s 5084(the)s +220 fnt35 5453 10687(per)m -3(l)k 240 fnt82 5888 10690(setup)m +6467(line,)s 6953(the)s 7322(follo)s 6(wing)k 8320(line)s +8756(has)s 0 10402(been)m 509(placed:)s 220 fnt35 480 9901(@SysInclude { pod })m +240 fnt82 0 9403(Thus,)m 576(asking)s 1244(for)s 1571(Perl)s +2000(al)s 2(w)k 2(ays)k 2700(gi)s 6(v)k 3(es)k +3237(you)s 3641(Pod)s 4062(as)s 4301(well.)s 4866(If)s +5085(you)s 5490(are)s 5826(using)s 6388(your)s 6876(o)s 6(wn)k +7330(setup)s 7877(\207les)s 8316(for)s 8643(both)s 0 9115(languages,)m +1068(it)s 1265(is)s 1480(probably)s 2390(better)s 2998(to)s +3242(break)s 3839(this)s 4240(connection)s 5352(by)s 5651(deleting)s +6479(this)s 6880(line)s 7299(from)s 7828(your)s 8332(cop)s 2(y)k +8855(of)s 0 8827(the)m 220 fnt35 348 8824(per)m -3(l)k +240 fnt82 762 8827(setup)m 1320(\207le)s 1681(and)s 2085(placing)s +220 fnt35 480 8326(@Include { m)m 3(ypod })k 480 8038(@Include { m)m 3(yper)k -3(l })k +240 fnt82 0 7540(at)m 232(the)s 580(start)s 1050(of)s +1321(your)s 1820(document)s 2824(in)s 3067(the)s 3415(usual)s +3975(w)s 2(ay)k 15(.)k 480 7166(Because)m 1341(Pod)s +1781(is)s 2000(a)s 2174(documentation)s 3662(language)s 4591(rather)s +5215(than)s 5693(a)s 5868(programming)s 7231(language,)s 8211(the)s +8568(setup)s 0 6878(\207le)m 376(options)s 1148(listed)s 1739(in)s +1998(Section)s 2787(1.4)s 3157(are)s 3520(mostly)s 4241(of)s +4527(no)s 4836(rele)s 6(v)k 6(ance.)k 5919(So)s +6241(for)s 6594(Pod)s 7041(only)s 7537(these)s 8100(ha)s 4(v)k 3(e)k +8617(been)s 0 6590(discarded)m 987(and)s 1405(replaced)s 2285(by)s +2593(a)s 2772(completely)s 3902(dif)s 6(ferent)k 4791(set)s +5129(of)s 5414(options,)s 6239(controlling)s 7355(such)s 7864(things)s +8514(as)s 8778(the)s 0 6302(size)m 448(of)s 741(headings)s +1664(and)s 2090(the)s 2460(g)s 1(aps)k 2970(between)s +3846(list)s 4219(items,)s 4864(which)s 5528(you)s 5964(can)s +6375(\207nd)s 6828(documented)s 8077(in)s 8342(the)s 220 fnt35 +8712 6299(pod)m 240 fnt82 0 6014(setup)m 558(\207le.)s 480 5640(The)m +955(only)s 1483(kno)s 6(wn)k 2234(problem)s 3139(with)s +3669(Pod)s 4147(formatting)s 5256(is)s 5513(that)s 5979(the)s +220 fnt35 6375 5637(E<>)m 240 fnt82 6874 5640(constructs)m 7942(enclosing)s +8960(a)s 0 5352(character)m 963(number)s 1783(or)s 2072(a)s +2267(`non-numeric)s 3650(HTML)s 4415(entity')s 5100(\(to)s 5447(quote)s +6065(the)s 6442(author)s 7142(of)s 7443(Pod\))s 7973(will)s +8429(appear)s 0 5064(v)m 3(erbatim)k 906(rather)s 1522(than)s +1991(being)s 2576(replaced)s 3443(by)s 3737(the)s 4085(characters)s +5103(the)s 3(y)k 5566(represent.)s +grestore + +grestore + +grestore + +pgsave restore +showpage + +%%Trailer +%%DocumentNeededResources: font Courier +%%+ font Helvetica +%%+ font Symbol +%%+ font Times-Roman +%%+ font Times-Italic +%%+ font Times-Bold +%%+ font Times-Italic +%%DocumentSuppliedResources: procset LoutStartUp +%%+ procset LoutTabPrependGraphic +%%+ procset LoutTblPrependGraphic +%%+ procset LoutFigPrependGraphic +%%+ procset LoutGraphPrependGraphic +%%+ procset LoutFigPrependGraphic +%%+ procset LoutBasicSetup +%%+ encoding vec2 +%%Pages: 2 +%%EOF |