diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/README | 4 | ||||
-rw-r--r-- | include/book | 6 | ||||
-rw-r--r-- | include/bookf | 12 | ||||
-rw-r--r-- | include/bsf | 104 | ||||
-rw-r--r-- | include/ccommand | 113 | ||||
-rw-r--r-- | include/diag | 4 | ||||
-rw-r--r-- | include/diagf | 289 | ||||
-rw-r--r-- | include/diagf.lpg | 339 | ||||
-rw-r--r-- | include/doc | 6 | ||||
-rw-r--r-- | include/docf | 13 | ||||
-rw-r--r-- | include/dsf | 27 | ||||
-rw-r--r-- | include/eqf | 3 | ||||
-rw-r--r-- | include/graphf | 44 | ||||
-rw-r--r-- | include/graphf.lpg | 11 | ||||
-rw-r--r-- | include/java | 109 | ||||
-rw-r--r-- | include/javaf | 390 | ||||
-rw-r--r-- | include/langdefs | 37 | ||||
-rw-r--r-- | include/old.diag.lpg | 2899 | ||||
-rw-r--r-- | include/picture | 6 | ||||
-rw-r--r-- | include/picturef | 6 | ||||
-rw-r--r-- | include/pythonf | 5 | ||||
-rw-r--r-- | include/report | 8 | ||||
-rw-r--r-- | include/reportf | 14 | ||||
-rw-r--r-- | include/slides | 8 | ||||
-rw-r--r-- | include/slidesf | 21 | ||||
-rw-r--r-- | include/tblf | 68 | ||||
-rw-r--r-- | include/tblf.lpg | 41 |
27 files changed, 4297 insertions, 290 deletions
diff --git a/include/README b/include/README index 2eb1841..ce43384 100644 --- a/include/README +++ b/include/README @@ -40,6 +40,7 @@ Source files (containing Lout and PostScript source code for the packages) -------------------------------------------------------------------------- bsf The BasicSetup package + ccommand Definition of the @ColourCommand symbol bsf.lpg A PostScript prepend file needed by BasicSetup dsf The DocumentSetup package docf The OrdinarySetup package @@ -51,7 +52,6 @@ Source files (containing Lout and PostScript source code for the packages) tabf The Tab table formatting package (OBSOLETE) tabf.lpg A PostScript prepend file needed by tabf (OBSOLETE) tblf The Tbl table formatting package - tblf.lpg A PostScript prepend file needed by tblf eqf The Eq equation formatting package figf The Fig advanced graphics package (OBSOLETE) figf.lpg A PostScript prepend file needed by figf (OBSOLETE) @@ -83,4 +83,4 @@ Miscellaneous Jeffrey H. Kingston -8 April 2000 +21 October 2001 diff --git a/include/book b/include/book index 89177be..ec4d5c1 100644 --- a/include/book +++ b/include/book @@ -40,11 +40,13 @@ @Use { @BasicSetup # @InitialFont { Times Base 12p } # initial font # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}} + # @InitialOutdent { 2f @OrIfPlain 4s } # initial outdent # @InitialSpace { lout } # initial space style # @InitialLanguage { English } # initial language # @InitialColour { black } # initial colour # @OptimizePages { No } # optimize page breaks? # @HeadingFont { Bold } # font for @Heading + # @FixedWidthFont { Courier Base -1p } # font for @F # @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs # @ParaIndent { 2.00f @OrIfPlain 5s } # first-line indent for @PP # @DisplayGap { 1.00v @OrIfPlain 1f } # gap above, below displays @@ -60,6 +62,7 @@ # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags # @NumberSeparator { . } # separates nums like 2.3.7 # @CrossLinkFormat { @Body } # format of cross links + # @ExternalLinkFormat { @Body } # format of external links } @@ -143,6 +146,7 @@ # @RefListSortKey { @Tag } # sorting key # @MakeIndex { No } # make index? Yes or No @MakeIndex { Yes } # make index? Yes or No + # @IndexText { @Null } # index initial text # @IndexFont { } # index entries font # @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexColumnNumber { 2 } # index columns (1 to 10) @@ -151,6 +155,7 @@ # @IndexCtdWord { continued } # "ctd." in current lang. # @IndexCtdFormat { @Body @I (@CtdWord) } # format of ctd. # @MakeIndexA { No } # make index A? Yes or No + # @IndexAText { @Null } # index A initial text # @IndexAFont { } # index A entries font # @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexAColumnNumber { 2 } # index A columns (1 to 10) @@ -159,6 +164,7 @@ # @IndexACtdWord { continued } # "ctd." in current lang. # @IndexACtdFormat { @Body @I (@CtdWord) } # format of ctd. # @MakeIndexB { No } # make index B? Yes or No + # @IndexBText { @Null } # index B initial text # @IndexBFont { } # index B entries font # @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexBColumnNumber { 2 } # index B columns (1 to 10) diff --git a/include/bookf b/include/bookf index 70cf313..1bd6136 100644 --- a/include/bookf +++ b/include/bookf @@ -322,6 +322,7 @@ def @BookSetup named @AtAfter { dft } named @InitialFont { @InitialFont } named @InitialBreak { @InitialBreak } + named @InitialOutdent { @InitialOutdent } named @InitialSpace { @InitialSpace } named @InitialLanguage { @InitialLanguage } named @PageOrientation { @PageOrientation } @@ -330,6 +331,9 @@ def @BookSetup named @FirstPageNumber { @FirstPageNumber } named @IntroFirstPageNumber { @IntroFirstPageNumber } named @OptimizePages { @OptimizePages } + named @IndexText { @IndexText } + named @IndexAText { @IndexAText } + named @IndexBText { @IndexBText } { def @Before { @@ -469,6 +473,7 @@ def @BookSetup headingfont { @ChapterHeadingFont } headingbreak { @ChapterHeadingBreak } headingformat { @Num @ChapterHeadingFormat @Body } + headingtext { @IndexText } incontents { @IndexInContents } pnprefix { @IndexPrefix } inrunners { Yes } @@ -501,6 +506,7 @@ def @BookSetup headingfont { @ChapterHeadingFont } headingbreak { @ChapterHeadingBreak } headingformat { @Num @ChapterHeadingFormat @Body } + headingtext { @IndexAText } incontents { @IndexAInContents } pnprefix { @IndexAPrefix } inrunners { Yes } @@ -533,6 +539,7 @@ def @BookSetup headingfont { @ChapterHeadingFont } headingbreak { @ChapterHeadingBreak } headingformat { @Num @ChapterHeadingFormat @Body } + headingtext { @IndexAText } incontents { @IndexBInContents } pnprefix { @IndexBPrefix } inrunners { Yes } @@ -651,8 +658,9 @@ def @BookSetup } } - @InitialFont @Font @InitialBreak @Break @InitialLanguage @Language - @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour + @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break + @InitialLanguage @Language @InitialSpace @Space + { @ColourCommand @InitialColour } @SetColour { @SeparateIntroNumbering @Case { diff --git a/include/bsf b/include/bsf index 1440b82..8158c22 100644 --- a/include/bsf +++ b/include/bsf @@ -36,55 +36,13 @@ def @OrIfPlain } } - ########################################################################### - # # - # @Colour, @Color # - # # - ########################################################################### +########################################################################### +# # +# @ColourCommand, @Colour, @Color # +# # +########################################################################### - def @ColourCommand right col - { - def @ColourCoords - { - col @Case { - darkblue @Yield { 0.0 0.0 0.5 } - blue @Yield { 0.0 0.0 1.0 } - lightblue @Yield { 0.5 0.5 1.0 } - darkgreen @Yield { 0.0 0.5 0.0 } - green @Yield { 0.0 1.0 0.0 } - lightgreen @Yield { 0.5 1.0 0.5 } - darkred @Yield { 0.5 0.0 0.0 } - red @Yield { 1.0 0.0 0.0 } - lightred @Yield { 1.0 0.5 0.5 } - darkcyan @Yield { 0.0 0.5 0.5 } - cyan @Yield { 0.0 1.0 1.0 } - lightcyan @Yield { 0.5 1.0 1.0 } - darkmagenta @Yield { 0.5 0.0 0.5 } - magenta @Yield { 1.0 0.0 1.0 } - lightmagenta @Yield { 1.0 0.5 1.0 } - darkyellow @Yield { 0.5 0.5 0.0 } - yellow @Yield { 1.0 1.0 0.0 } - lightyellow @Yield { 1.0 1.0 0.5 } - darkgray @Yield { 0.2 0.2 0.2 } - gray @Yield { 0.5 0.5 0.5 } - lightgray @Yield { 0.8 0.8 0.8 } - darkgrey @Yield { 0.2 0.2 0.2 } - grey @Yield { 0.5 0.5 0.5 } - lightgrey @Yield { 0.8 0.8 0.8 } - black @Yield { 0.0 0.0 0.0 } - white @Yield { 1.0 1.0 1.0 } - } - } - - col @Case { - nochange @Yield { nochange } - else @Yield { @BackEnd @Case { - PostScript @Yield { @ColourCoords setrgbcolor } - PDF @Yield { @ColourCoords rg @ColourCoords RG } - PlainText @Yield "" - } } - } - } +@SysInclude { ccommand } def @Colour @Color left col right y { {@ColourCommand col} @SetColour y } @@ -157,8 +115,8 @@ def @OrIfPlain export - @InitialFont @InitialBreak @InitialSpace @InitialLanguage @InitialColour - @OptimizePages @HeadingFont + @InitialFont @InitialBreak @InitialOutdent @InitialSpace @InitialLanguage + @InitialColour @OptimizePages @HeadingFont @ParaGap @ParaIndent @DisplayGap @DisplayIndent @DefaultIndent @DisplayNumStyle @WideIndent @VeryWideIndent @ListGap @ListIndent @ListRightIndent @ListLabelWidth @@ -177,8 +135,9 @@ export @Date @Time @DateTimeFormat @DropCapTwo @DropCapThree @Centre @Right @NoDotSep @NoDotJoin @Join @Sep @DotSep @DotJoin @DashJoin @NumSep @OverStrike @Sup @Sub @FullWidthRule @LocalWidthRule - @Box @CurveBox @ShadowBox @BoundaryMarks @NumberMarker @NumberOf - @PageMarker @PageMark @NoLinkPageMark @PageOf @CrossLink + @Box @CurveBox @ShadowBox @BoundaryMarks + @NumberMarker @NumberOf @TitleMarker @TitleOf + @PageMarker @PageMark @NoLinkPageMark @PageOf @CrossLink @ExternalLink @BeginDisplayCounter @@ -303,11 +262,13 @@ def @BasicSetup named @InitialFont { Times Base 12p } # initial font named @InitialBreak { {adjust 1.20fx hyphen} @OrIfPlain {ragged 1fx nohyphen} } # initial break + named @InitialOutdent { 2f @OrIfPlain 4s } # initial outdent named @InitialSpace { lout } # initial space style named @InitialLanguage{ English } # initial language named @InitialColour { black } # initial colour named @OptimizePages { No } # optimize page breaks? named @HeadingFont { Bold } # font for @Heading + named @FixedWidthFont { Courier Base -1p } # font for @F named @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs named @ParaIndent { 2.0f @OrIfPlain 5s } # first-line indent for @PP named @DisplayGap { 1.0v @OrIfPlain 1f } # gap above, below displays @@ -326,6 +287,9 @@ def @BasicSetup import @BasicSetup named @CrossLinkFormat right @Body { @Body } # format for cross links + import @BasicSetup + named @ExternalLinkFormat + right @Body { @Body } # format for external links @Begin ########################################################################### @@ -341,7 +305,7 @@ def @BasicSetup def @B right x { Bold @Font x } def @BI right x { BoldSlope @Font x } def @S right x { smallcaps @Font x } - def @F right x { { Courier Base -1p } @Font x } + def @F right x { @FixedWidthFont @Font x } def @II right x @@ -1044,7 +1008,14 @@ def @BasicSetup ########################################################################## # # - # @NumberMarker, @NumberOf, @PageMarker, @PageMark, @PageOf, @CrossLink # + # @NumberMarker, @NumberOf, @TitleMarker, @TitleOf, # + # @PageMark, @PageOf, @CrossLink, @ExternalLink # + # # + # NB the default value ?? is desperately important for unsorted # + # reference lists numbered by first appearance (@NumberOf @Tag), # + # because it is the special sort key value that prevents merging, # + # hence allowing all the references to be printed even though # + # their sort keys are all ?? initially. # # # ########################################################################## @@ -1063,6 +1034,21 @@ def @BasicSetup } + export @Tag @Value + def @TitleMarker + named @Tag {} + named @Value { "??" } + { + @Null + } + + def @TitleOf + right tag + { + @TitleMarker&&tag @Open { @Value } + } + + export num rawnum @Tag def @PageMarker named @Tag {} @@ -1100,6 +1086,16 @@ def @BasicSetup } } + def @ExternalLink + left tag + named @Format right @Body { @ExternalLinkFormat @Body } + right obj + { + @HContract @VContract { + tag @URLLink @Format obj + } + } + ########################################################################### # # diff --git a/include/ccommand b/include/ccommand new file mode 100644 index 0000000..a1b8771 --- /dev/null +++ b/include/ccommand @@ -0,0 +1,113 @@ + +########################################################################### +# # +# @ColourCommand # +# # +# Jeff Kingston # +# 19 October 2001 # +# # +# @ColourCommand converts a colour expressed in a manner that the # +# ordinary user can comprehend into the PostScript or PDF command # +# needed to obtain that colour, suitable for passing to @SetColour # +# or including in the left parameter of @Graphic. # +# # +# This symbol is needed in various places so I've taken the coward's # +# way out and @SysIncluded it at those places. # +# # +# Examples of behaviour for the PostScript back end: # +# # +# Parameter Result # +# ------------------------------------------------------------ # +# black "0.0 0.0 0.0 setrgbcolor" # +# darkblue "0.0 0.0 0.5 setrgbcolor" # +# white "1.0 1.0 1.0 setrgbcolor" # +# none "" # +# nochange "" # +# "" "" # +# rgb <red> <blue> <green> "<red> <blue> <green> setrgbcolor" # +# cymk <c> <y> <m> <k> "<c> <y> <m> <k> setcymkcolor" # +# ------------------------------------------------------------ # +# # +# @ColourCommand also does the right thing for the PDF back end; # +# its result is always empty for the PlainText back end. # +# # +########################################################################### + +def @ColourCommand right @Body +{ + def @RGB right coords + { + @BackEnd @Case { + PostScript @Yield { coords "setrgbcolor" } + PDF @Yield { coords "rg" coords "RG" } + PlainText @Yield "" + } + } + + def @CMYK right coords + { + @BackEnd @Case { + PostScript @Yield { coords "setcmykcolor" } + PDF @Yield { coords "k" coords "K" } + PlainText @Yield "" + } + } + + def @RGBElse right alt + { + { "rgb" @Common @Body } @Case { + "rgb" @Yield @RGB { "rgb" @Rump @Body } + else @Yield alt + } + } + + def @CMYKElse right alt + { + { "cmyk" @Common @Body } @Case { + "cmyk" @Yield @CMYK { "cmyk" @Rump @Body } + else @Yield alt + } + } + + def @NoChangeElse right alt + { + @Body @Case { + { "nochange" "none" "" } @Yield "" + else @Yield alt + } + } + + def @RGBCoords + { + @Body @Case { + black @Yield { 0.0 0.0 0.0 } + darkblue @Yield { 0.0 0.0 0.5 } + blue @Yield { 0.0 0.0 1.0 } + lightblue @Yield { 0.5 0.5 1.0 } + darkgreen @Yield { 0.0 0.5 0.0 } + green @Yield { 0.0 1.0 0.0 } + lightgreen @Yield { 0.5 1.0 0.5 } + darkred @Yield { 0.5 0.0 0.0 } + red @Yield { 1.0 0.0 0.0 } + lightred @Yield { 1.0 0.5 0.5 } + darkcyan @Yield { 0.0 0.5 0.5 } + cyan @Yield { 0.0 1.0 1.0 } + lightcyan @Yield { 0.5 1.0 1.0 } + darkmagenta @Yield { 0.5 0.0 0.5 } + magenta @Yield { 1.0 0.0 1.0 } + lightmagenta @Yield { 1.0 0.5 1.0 } + darkyellow @Yield { 0.5 0.5 0.0 } + yellow @Yield { 1.0 1.0 0.0 } + lightyellow @Yield { 1.0 1.0 0.5 } + darkgray @Yield { 0.2 0.2 0.2 } + gray @Yield { 0.5 0.5 0.5 } + lightgray @Yield { 0.8 0.8 0.8 } + darkgrey @Yield { 0.2 0.2 0.2 } + grey @Yield { 0.5 0.5 0.5 } + lightgrey @Yield { 0.8 0.8 0.8 } + white @Yield { 1.0 1.0 1.0 } + } + } + + @RGBElse @CMYKElse @NoChangeElse @RGB @RGBCoords +} diff --git a/include/diag b/include/diag index 9289975..eb99116 100644 --- a/include/diag +++ b/include/diag @@ -33,7 +33,7 @@ # save { no } # maxlabels { 200 } # title { (none) } - # titleformat { Italic @Font @Title //0.7f ||0.35f @Body } + # titleformat { Slope @Font @Title //0.7f ||0.35f @Body } ############################################################################# # # @@ -383,6 +383,8 @@ # bias { 2.0f } # fbias { 2.0f } # tbias { 2.0f } + # hfrac { 0.5 } + # hbias { 0.0f } # radius { 1.0f } # xindent { 0.8f } # zindent { 0.8f } diff --git a/include/diagf b/include/diagf index 999c82e..ed9f0c9 100644 --- a/include/diagf +++ b/include/diagf @@ -27,7 +27,7 @@ def @DiagSetup named titleformat left @Title right @Body - { Italic @Font @Title //0.7f ||0.35f @Body } + { Slope @Font @Title //0.7f ||0.35f @Body } ########################################################################### # # @@ -489,6 +489,8 @@ def @DiagSetup named bias {} named fbias {} named tbias {} + named hfrac {} + named hbias {} named radius {} named xindent {} named zindent {} @@ -502,6 +504,8 @@ def @DiagSetup import @Geometry named bias { 2.0f } import @Geometry named fbias { 2.0f } import @Geometry named tbias { 2.0f } + import @Geometry named hfrac { 0.5 } + import @Geometry named hbias { 0.0f } import @Geometry named radius { 1.0f } import @Geometry named xindent { 0.8f } import @Geometry named zindent { 0.8f } @@ -644,6 +648,8 @@ def @DiagSetup @HVCurve @HVCurveArrow @VHCurve @VHCurveArrow @LVRLine @LVRArrow @RVLLine @RVLArrow @LVRCurve @LVRCurveArrow @RVLCurve @RVLCurveArrow + @HVHLine @HVHArrow @VHVLine @VHVArrow + @HVHCurve @HVHCurveArrow @VHVCurve @VHVCurveArrow @DWrapLine @DWrapArrow @UWrapLine @UWrapArrow @DWrapCurve @DWrapCurveArrow @UWrapCurve @UWrapCurveArrow @@ -920,6 +926,8 @@ def @DiagSetup named bias {} named fbias {} named tbias {} + named hfrac {} + named hbias {} named radius {} named xindent {} named zindent {} @@ -933,6 +941,8 @@ def @DiagSetup bias { bias } fbias { fbias } tbias { tbias } + hfrac { hfrac } + hbias { hbias } radius { radius } xindent { xindent } zindent { zindent } @@ -946,6 +956,8 @@ def @DiagSetup import @Geometry named bias { bias } import @Geometry named fbias { fbias } import @Geometry named tbias { tbias } + import @Geometry named hfrac { hfrac } + import @Geometry named hbias { hbias } import @Geometry named radius { radius } import @Geometry named xindent { xindent } import @Geometry named zindent { zindent } @@ -1126,6 +1138,17 @@ def @DiagSetup # # ####################################################################### +# include @ColourCommand symbol +@SysInclude { ccommand } + + def @PSAddPaint right col + { + col @Case { + { "none" "nopaint" } @Yield "{}" + else @Yield { "{" @ColourCommand col "fill }" } + } + } + # Like @Graphic, but affects the graphics state of right parameter def @InnerGraphic left ps @@ -1223,14 +1246,27 @@ def @DiagSetup precedence 33 associativity right left name + named restrict {} right x { - @BackEnd @Case { - PostScript @Yield { - { "("name") ldiagpushtagdict" - // "ldiagpopuptagdict" } @Graphic x - } - PDF @Yield {} + + def @PushCommand + { + "("name") ldiagpushtagdict" + } + + def @PopCommand + { + restrict @Case { + "" @Yield "ldiagpopuptagdict" + else @Yield { "[" restrict "] ldiagpopsometagdict" } + } + # "ldiagpopuptagdict" + } + + @BackEnd @Case { + PostScript @Yield { {@PushCommand // @PopCommand} @Graphic x } + PDF @Yield {} } } @@ -2481,7 +2517,7 @@ def @DiagSetup { "ldiagnodebegin [" @OutLine "]" outlinedashlength "[" outlinestyle "]" - outlinewidth "/ldiag"paint "ldiagnodeend" + outlinewidth @PSAddPaint paint "ldiagnodeend" "(IN) ldiagpushtagdict" // "ldiagpopuptagdict" @@ -2824,7 +2860,7 @@ def @DiagSetup { "ldiagnodebegin [" @OutLine "]" outlinedashlength "[" outlinestyle "]" - outlinewidth "/ldiag"paint "ldiagnodeend" + outlinewidth @PSAddPaint paint "ldiagnodeend" "(IN) ldiagpushtagdict" // "ldiagpopuptagdict" @@ -3167,7 +3203,7 @@ def @DiagSetup { "ldiagnodebegin [" @OutLine "]" outlinedashlength "[" outlinestyle "]" - outlinewidth "/ldiag"paint "ldiagnodeend" + outlinewidth @PSAddPaint paint "ldiagnodeend" "(IN) ldiagpushtagdict" // "ldiagpopuptagdict" @@ -3510,7 +3546,7 @@ def @DiagSetup { "ldiagnodebegin [" @OutLine "]" outlinedashlength "[" outlinestyle "]" - outlinewidth "/ldiag"paint "ldiagnodeend" + outlinewidth @PSAddPaint paint "ldiagnodeend" "(IN) ldiagpushtagdict" // "ldiagpopuptagdict" @@ -3874,6 +3910,8 @@ def @DiagSetup named bias {} named fbias {} named tbias {} + named hfrac {} + named hbias {} named radius {} named xindent {} named zindent {} @@ -3887,6 +3925,8 @@ def @DiagSetup bias { bias } fbias { fbias } tbias { tbias } + hfrac { hfrac } + hbias { hbias } radius { radius } xindent { xindent } zindent { zindent } @@ -3900,6 +3940,8 @@ def @DiagSetup import @Geometry named bias { bias } import @Geometry named fbias { fbias } import @Geometry named tbias { tbias } + import @Geometry named hfrac { hfrac } + import @Geometry named hbias { hbias } import @Geometry named radius { radius } import @Geometry named xindent { xindent } import @Geometry named zindent { zindent } @@ -4619,6 +4661,191 @@ def @DiagSetup } } + + import @Geometry + def @HVHLinePath # still to do + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength arrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent hfrac hbias "ldiaghvhlinepath" + # FRDIRN := {{from??CTR angleto to??CTR} quadcase + # 0 { 0d } 0-90 { 0d } 90 { 0d } 90-180 { 180d } + # 180 { 180d } 180-270 { 180d } 270 { 180d } 270-360 { 0d }} + # TODIRN := {FRDIRN + 180d} + # FROM :: from boundaryatangle FRDIRN ++ + # {arrow @FromArrowLength arrowlength} atangle FRDIRN + # FROM :< FRDIRN + # TO :: to boundaryatangle TODIRN ++ + # {arrow @ToArrowLength arrowlength} atangle TODIRN + # TO :< FRDIRN + # BIAS := abs { xcoord FROM - xcoord TO } * hfrac + hbias + # P1 :: FROM ++ BIAS atangle FRDIRN + # P2 :: { xcoord P1 ycoord TO } + # LMID :: { P1 ** 0.5 ++ P2 ** 0.5 } + # LMID :< P1 angleto P2 + # XINDENT := xindent min {FROM distance P1} + # ZINDENT := zindent min {P2 distance TO} + # LFROM :: FROM ++ {XINDENT atangle FRDIRN} + # LFROM :< FRDIRN + # LTO :: TO ++ {ZINDENT atangle TODIRN} + # LTO :< FRDIRN + # FROM LFROM P1 LMID P2 LTO TO + + } + PDF @Yield {} + } + } + + import @Geometry + def @HVHCurvePath # still to do + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength arrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent hfrac hbias radius "ldiaghvhcurvepath" + # FRDIRN := {{from??CTR angleto to??CTR} quadcase + # 0 { 0d } 0-90 { 0d } 90 { 0d } 90-180 { 180d } + # 180 { 180d } 180-270 { 180d } 270 { 180d } 270-360 { 0d }} + # TODIRN := {FRDIRN + 180d} + # FROM :: from boundaryatangle FRDIRN ++ + # {arrow @FromArrowLength arrowlength} atangle FRDIRN + # FROM :< FRDIRN + # TO :: to boundaryatangle TODIRN ++ + # {arrow @ToArrowLength arrowlength} atangle TODIRN + # TO :< FRDIRN + # BIAS := abs { xcoord FROM - xcoord TO } * hfrac + hbias + # XP1 := FROM ++ BIAS atangle FRDIRN + # XP2 := { xcoord XP1 ycoord TO } + # LMID :: { XP1 ** 0.5 ++ XP2 ** 0.5 } + # VERT := round { XP1 angleto XP2 } + # LMID :< VERT + # XINDENT := xindent min {FROM distance XP1} + # ZINDENT := zindent min {XP2 distance TO} + # LFROM :: FROM ++ {XINDENT atangle FRDIRN} + # LFROM :< FRDIRN + # LTO :: TO ++ {ZINDENT atangle TODIRN} + # LTO :< FRDIRN + # RADIUS := radius min { { XP1 distance XP2 } / 2 } + # XP1PRE := XP1 ++ { RADIUS atangle TODIRN } + # XP1POST := XP1 ++ { RADIUS atangle VERT } + # XP1CTR := XP1PRE ++ { RADIUS atangle VERT } + # P1 :: XP1CTR ++ { RADIUS atangle { XP1CTR angleto XP1 } } + # P1 :< XP1PRE angleto XP1POST + # XP2PRE := XP2 -- { RADIUS atangle VERT } + # XP2POST := XP2 ++ { RADIUS atangle FRDIRN } + # XP2CTR := XP2POST -- { RADIUS atangle VERT } + # P2 :: XP2CTR ++ { RADIUS atangle { XP2CTR angleto XP2 } } + # P2 :< XP2PRE angleto XP2POST + # if cond { {VERT - FRDIRN} = 90 } + # then { P1GO := "anticlockwise" P2GO := "clockwise" } + # else { P1GO := "clockwise" P2GO := "anticlockwise" } + # FROM LFROM + # XP1PRE [XP1CTR P1GO] P1 [XP1CTR P1GO] XP1POST + # LMID + # XP2PRE [XP2CTR P2GO] P2 [XP2CTR P2GO] XP2POST + # LTO TO + } + PDF @Yield {} + } + } + + import @Geometry + def @VHVLinePath # still to do + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength arrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent hfrac hbias "ldiagvhvlinepath" + # FROM :: from boundaryatangle 0d + # ++ {arrow @FromArrowLength arrowlength} atangle 0d + # FROM :< 0d + # TO :: to boundaryatangle 0d + # ++ {arrow @ToArrowLength arrowlength} atangle 0d + # TO :< 180d + # XRIGHT := {{xcoord FROM} max {xcoord TO}} + bias + # P1 :: { XRIGHT ycoord FROM } + # P2 :: { XRIGHT ycoord TO } + # VERT := P1 angleto P2 + # P1 :< P1 angleto {P1++{1f atangle 0d} ++{1f atangle VERT}} + # P2 :< P2 angleto {P2++{1f atangle 180d}++{1f atangle VERT}} + # LMID :: P1 ** 0.5 ++ P2 ** 0.5 + # LMID :< VERT + # XINDENT := xindent min {FROM distance P1} + # ZINDENT := zindent min {P2 distance TO} + # LFROM :: FROM ++ { XINDENT 0 } + # LFROM :< 0d + # LTO :: TO ++ { ZINDENT 0 } + # LTO :< 180d + # FROM LFROM P1 LMID P2 LTO TO + } + PDF @Yield {} + } + } + + import @Geometry + def @VHVCurvePath # still to do + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength arrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent hfrac hbias radius "ldiagvhvcurvepath" + # /FRDIRN [ { 0 dg } { 180 dg } { 180 dg } { 0 dg } + # { 0 dg } { 0 dg } { 180 dg } { 180 dg } + # from (CTR) ldiagdolabel to (CTR) ldiagdolabel + # ldiagangleto ldiagquadcase ] cvx def + # /TODIRN [ FRDIRN 180 dg add ] cvx def + # from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd + # 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + # FRDIRN /FROM@ANGLE ldiagangledef + # to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd + # 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef + # FRDIRN /TO@ANGLE ldiagangledef + # /BIAS [ FROM pop TO pop sub abs hfrac mul hbias add ] cvx def + # /XP1 [ FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd ] cvx def + # /XP2 [ XP1 pop TO exch pop ] cvx def + # XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + # /VERT [ XP1 XP2 ldiagangleto round ] cvx def + # VERT /LMID@ANGLE ldiagangledef + # /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + # /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + # FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + # FRDIRN /LFROM@ANGLE ldiagangledef + # TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef + # FRDIRN /LTO@ANGLE ldiagangledef + # /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def + # /XP1PRE [ XP1 0 0 RADIUS TODIRN 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 FRDIRN ldiagatangle ldiagpadd ] cvx def + # /XP2CTR [ 0 0 RADIUS VERT ldiagatangle XP2POST ldiagpsub ] cvx def + # XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef + # XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef + # VERT FRDIRN sub 90 eq + # { /P1GO [ anticlockwise ] cvx def /P2GO [ clockwise ] cvx def } + # { /P1GO [ clockwise ] cvx def /P2GO [ anticlockwise ] cvx def } + # ifelse + # FROM LFROM + # XP1PRE [XP1CTR P1GO] P1 [XP1CTR P1GO] XP1POST + # LMID + # XP2PRE [XP2CTR P2GO] P2 [XP2CTR P2GO] XP2POST + # LTO TO + } + PDF @Yield {} + } + } + import @Geometry def @DWrapLinePath { @@ -4886,6 +5113,10 @@ def @DiagSetup lvrcurve @Yield @LVRCurvePath rvlline @Yield @RVLLinePath rvlcurve @Yield @RVLCurvePath + hvhline @Yield @HVHLinePath + hvhcurve @Yield @HVHCurvePath + vhvline @Yield @VHVLinePath + vhvcurve @Yield @VHVCurvePath dwrapline @Yield @DWrapLinePath dwrapcurve @Yield @DWrapCurvePath uwrapline @Yield @UWrapLinePath @@ -4897,6 +5128,8 @@ def @DiagSetup bias { bias } fbias { fbias } tbias { tbias } + hfrac { hfrac } + hbias { hbias } radius { radius } xindent { xindent } zindent { zindent } @@ -4991,6 +5224,8 @@ def @DiagSetup named bias {} named fbias {} named tbias {} + named hfrac {} + named hbias {} named radius {} named xindent {} named zindent {} @@ -5004,6 +5239,8 @@ def @DiagSetup bias { bias } fbias { fbias } tbias { tbias } + hfrac { hfrac } + hbias { hbias } radius { radius } xindent { xindent } zindent { zindent } @@ -5019,6 +5256,8 @@ def @DiagSetup import @Geometry named bias { bias } import @Geometry named fbias { fbias } import @Geometry named tbias { tbias } + import @Geometry named hfrac { hfrac } + import @Geometry named hbias { hbias } import @Geometry named radius { radius } import @Geometry named xindent { xindent } import @Geometry named zindent { zindent } @@ -5144,6 +5383,8 @@ def @DiagSetup bias { bias } fbias { fbias } tbias { tbias } + hfrac { hfrac } + hbias { hbias } radius { radius } xindent { xindent } zindent { zindent } @@ -5155,6 +5396,8 @@ def @DiagSetup bias { bias } fbias { fbias } tbias { tbias } + hfrac { hfrac } + hbias { hbias } radius { radius } xindent { xindent } zindent { zindent } @@ -5279,6 +5522,15 @@ def @DiagSetup macro @RVLCurve { @Link path { rvlcurve } } macro @RVLCurveArrow { @Link path { rvlcurve } arrow { yes } } + macro @HVHLine { @Link path { hvhline } } + macro @HVHArrow { @Link path { hvhline } arrow { yes } } + macro @VHVLine { @Link path { vhvline } } + macro @VHVArrow { @Link path { vhvline } arrow { yes } } + macro @HVHCurve { @Link path { hvhcurve } } + macro @HVHCurveArrow { @Link path { hvhcurve } arrow { yes } } + macro @VHVCurve { @Link path { vhvcurve } } + macro @VHVCurveArrow { @Link path { vhvcurve } arrow { yes } } + macro @DWrapLine { @Link path { dwrapline} } macro @DWrapArrow { @Link path { dwrapline} arrow { yes } } macro @UWrapLine { @Link path { uwrapline} } @@ -5846,7 +6098,8 @@ def @DiagSetup named ar { no } right x { - {|i @HContract { |syntaxgap label:: @LabelMarks x |syntaxgap }} + {|i @HContract { |syntaxgap label:: restrict { "(WMK) (EMK)" } + @LabelMarks x |syntaxgap }} // @Line from { label"@WMK" } to { 0 ycoord label"@WMK" } arrow { al } // @Line from { label"@EMK" } to { xsize ycoord label"@EMK" } @@ -5860,7 +6113,8 @@ def @DiagSetup named ad { no } right x { - {/i @VContract { /syntaxgap label:: @LabelMarks x /syntaxgap }} + {/i @VContract { /syntaxgap label:: restrict { "(NMK) (SMK)" } + @LabelMarks x /syntaxgap }} || @Line from { label"@NMK" } to { xcoord label"@NMK" ysize } arrow { au } || @Line from { label"@SMK" } to { xcoord label"@SMK" 0 } @@ -5874,7 +6128,8 @@ def @DiagSetup named ar { no } right x { - {|i @HContract { |syntaxgap label:: @LabelMarks x |syntaxgap }} + {|i @HContract { |syntaxgap label:: restrict { "(WMK) (EMK)" } + @LabelMarks x |syntaxgap }} // @HVCurve from { label"@WMK" } to { 0 ycoord "AX@WMK" } arrow { al } bias { pssyntaxbias } radius { pssyntaxradius } // @HVCurve from { label"@EMK" } to { xsize ycoord "AX@WMK" } @@ -5888,7 +6143,8 @@ def @DiagSetup named ad { no } right x { - {/i @VContract { /syntaxgap label:: @LabelMarks x /syntaxgap }} + {/i @VContract { /syntaxgap label:: restrict { "(NMK) (SMK)" } + @LabelMarks x /syntaxgap }} || @VHCurve from { label"@NMK" } to { xcoord "AX@NMK" ysize } arrow { au } bias { pssyntaxbias } radius { pssyntaxradius } || @VHCurve from { label"@SMK" } to { xcoord "AX@SMK" 0 } @@ -6349,6 +6605,7 @@ def @DiagSetup @LRLine { @HContract @VContract { OX:: @LabelMarks { { |0.5rt BX:: @LabelMarks @GoReverse B |syntaxgap } + //syntaxgap ^//syntaxgap { |syntaxgap AX:: @LabelMarks A |syntaxgap } } } @@ -6440,7 +6697,7 @@ def @DiagSetup avstrut { yes } amargin { 0.2f } aoutline { box } - afont { Italic } + afont { Slope } bvalign { mark } bvstrut { yes } diff --git a/include/diagf.lpg b/include/diagf.lpg index 8b76f58..9f3b3d6 100644 --- a/include/diagf.lpg +++ b/include/diagf.lpg @@ -1,4 +1,4 @@ -%%BeginResource: procset LoutFigPrependGraphic +%%BeginResource: procset LoutDiagPrependGraphic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % PostScript @SysPrependGraphic file for @Diag Jeffrey H. Kingston % @@ -23,10 +23,10 @@ errordict begin $error /errorname get dup ldiagdict exch known { ldiagdict exch get } - { 50 string cvs } ifelse + { 100 string cvs } ifelse show ( Command: ) show - $error /command get 50 string cvs show + $error /command get 100 string cvs show } stopped {} if showpage stop } def @@ -55,12 +55,33 @@ end 3 1 roll pop pop } def +% mconcat strings: <string> <string> ldiagmconcat <string> +% returns concatenation, separated by @ if first is non-empty +% must be defined outside ldiagdict since used in ldiagpromotelabels +/ldiagmconcat +{ + 2 copy length exch length add 1 add string + dup 0 4 index putinterval + dup 3 index length (@) putinterval + dup 3 index length 1 add 3 index putinterval + 3 1 roll pop pop +} def + +% show string in format start ... end: <string> ldiagsends <string> +/ldiagsends +{ + dup length 20 string cvs (: ) ldiagconcat exch + dup 0 20 getinterval ( ... ) ldiagconcat + 3 -1 roll exch ldiagconcat + exch dup length 20 sub 20 getinterval ldiagconcat +} def + /ldiagdebugposy 432 def /ldiagdebugposx 72 def % <string> <int> ldiagdebugprint - % must be defined outside ldiagdict since used in arbitrary places -% print count or <int> stack entries, which ever is the smaller +% print <string> plus count or <int> stack entries, whichever is the smaller /ldiagdebugprint { exch @@ -81,7 +102,22 @@ end { /ldiagdebugposy ldiagdebugposy 12 sub store ldiagdebugposx 12 add ldiagdebugposy moveto - index 50 string cvs show + index + dup type (dicttype) eq + { + (begin dict) show + { + /ldiagdebugposy ldiagdebugposy 12 sub store + ldiagdebugposx 12 add ldiagdebugposy moveto + pop 100 string cvs show + } forall + /ldiagdebugposy ldiagdebugposy 12 sub store + ldiagdebugposx 12 add ldiagdebugposy moveto + (end dict) show + } + { + 100 string cvs show + } ifelse } for grestore } def @@ -191,37 +227,6 @@ ldiagdict begin { 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 @@ -893,6 +898,8 @@ ldiagdict begin % ldiagtoptagdict dict Find the top tag dictionary % ldiagpoptagdict - Pop and destroy the top tag dictionary % ldiagpopuptagdict - Pop top tag dict and promote its entries +% <array> ldiagpopsometagdict - Like popuptagdict but only those promote +% those labels listed in <array> % ldiagdebugtagdict - Debug print of dictionary stack % % They are distinguished from other dictionaries by containing /ldiagtagdict, @@ -940,24 +947,46 @@ ldiagdict begin % (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 + { exch dup length string cvs + 3 index exch ldiagmconcat + cvn exch 2 index 3 1 roll put } forall pop pop % (Leaving ldiagpopuptagdict) 0 ldiagdebugprint % ldiagdebugtagdict } def +% similar to ldiagpopuptagdict but only those inner labels that are +% present in <array> will be promoted +% <array> ldiagpopsometagdict - +/ldiagpopsometagdict +{ + ldiagtagdict + % (Entering ldiagpopsometagdict) 1 ldiagdebugprint + % ldiagdebugtagdict + ldiagtoptagdict + ldiagpoptagdict + ldiagtoptagdict + 4 -1 roll + { dup 3 index exch + get + exch 4 index + exch ldiagmconcat exch + 3 copy put + pop pop + } forall + pop 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 + { pop 100 string cvs ( ) exch ldiagconcat dup 0 ldiagdebugprint pop } @@ -1003,7 +1032,7 @@ ldiagdict begin { % (Entering ldiagshowpoints) 0 ldiagdebugprint ldiagtoptagdict - { 1 index 50 string cvs + { 1 index 100 string cvs (ldiagdebugpos) search { pop pop pop pop pop } { @@ -1035,7 +1064,7 @@ ldiagdict begin { % (Entering ldiagshowtags) 0 ldiagdebugprint ldiagtoptagdict - { 1 index 50 string cvs + { 1 index 100 string cvs % dup 0 ldiagdebugprint (ldiagdebugpos) search { pop pop pop pop pop } @@ -1057,7 +1086,7 @@ ldiagdict begin 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 + translate 40 rotate 0.2 cm 0.1 cm moveto 100 string cvs show grestore } ifelse } ifelse @@ -1073,7 +1102,7 @@ ldiagdict begin { % (Entering ldiagshowangles) 0 ldiagdebugprint ldiagtoptagdict - { 1 index 20 string cvs + { 1 index 100 string cvs % dup 0 ldiagdebugprint (ldiagdebugpos) search { pop pop pop pop pop } @@ -1485,7 +1514,8 @@ ldiagdict begin { exch false % (Leaving ldiagfindabel (not a name)) 3 ldiagdebugprint } - { dup 0 get 50 string cvs (@) ldiagconcat 2 index ldiagconcat dup where + { dup 0 get dup length string cvs (@) ldiagconcat + 2 index ldiagconcat dup where { exch get exch pop exch pop cvx exec true % (Leaving ldiagfindlabel with success) 100 ldiagdebugprint } @@ -2325,6 +2355,221 @@ ldiagdict begin % count ( stack size is) 1 ldiagdebugprint pop } def +% farr tarr { from } { to } xindent zindent hfrac hbias ldiaghvhlinepath - +/ldiaghvhlinepath % still to do +{ + % (entering ldiaghvhlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /hbias exch def + /hfrac exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /FRDIRN [ { 0 dg } { 180 dg } { 180 dg } { 0 dg } + { 0 dg } { 0 dg } { 180 dg } { 180 dg } + from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto ldiagquadcase ] cvx def + /TODIRN [ FRDIRN 180 dg add ] cvx def + from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + FRDIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef + FRDIRN /TO@ANGLE ldiagangledef + /BIAS [ FROM pop TO pop sub abs hfrac mul hbias add ] cvx def + FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd /P1 ldiagpointdef + P1 pop TO exch pop /P2 ldiagpointdef + P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + P1 P2 ldiagangleto /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FRDIRN /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef + FRDIRN /LTO@ANGLE ldiagangledef + FROM LFROM P1 LMID P2 LTO TO + + % (leaving ldiaghvhlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + + +% farr tarr { from } { to } xindent zindent hfrac hbias radius ldiaghvhcurvepath - +/ldiaghvhcurvepath % still to do +{ + % (entering ldiaghvhcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /hbias exch def + /hfrac exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /FRDIRN [ { 0 dg } { 180 dg } { 180 dg } { 0 dg } + { 0 dg } { 0 dg } { 180 dg } { 180 dg } + from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto ldiagquadcase ] cvx def + /TODIRN [ FRDIRN 180 dg add ] cvx def + + from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + FRDIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef + + FRDIRN /TO@ANGLE ldiagangledef + /BIAS [ FROM pop TO pop sub abs hfrac mul hbias add ] cvx def + /XP1 [ FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd ] cvx def + /XP2 [ XP1 pop TO exch pop ] cvx def + XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + /VERT [ XP1 XP2 ldiagangleto round ] cvx def + VERT /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FRDIRN /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef + FRDIRN /LTO@ANGLE ldiagangledef + /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RADIUS TODIRN 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 FRDIRN ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ 0 0 RADIUS VERT ldiagatangle XP2POST ldiagpsub ] cvx def + XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef + XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef + VERT FRDIRN sub 90 eq + { /P1GO [ anticlockwise ] cvx def /P2GO [ clockwise ] cvx def } + { /P1GO [ clockwise ] cvx def /P2GO [ anticlockwise ] cvx def } + ifelse + FROM LFROM + XP1PRE [XP1CTR P1GO] P1 [XP1CTR P1GO] XP1POST + LMID + XP2PRE [XP2CTR P2GO] P2 [XP2CTR P2GO] XP2POST + LTO TO + + % (leaving ldiaghvhcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent hfrac hbias ldiagvhvlinepath - +/ldiagvhvlinepath % still to do +{ + % (entering ldiagvhvlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /hbias exch def + /hfrac exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /FRDIRN [ { 90 dg } { 270 dg } { 270 dg } { 0 dg } + { 90 dg } { 270 dg } { 270 dg } { 90 dg } + from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto ldiagquadcase ] cvx def + /TODIRN [ FRDIRN 180 dg sub ] cvx def + from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + FRDIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef + FRDIRN /TO@ANGLE ldiagangledef + /BIAS [ FROM exch pop TO exch pop sub abs hfrac mul hbias ft add ] cvx def + FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd /P1 ldiagpointdef + TO pop P1 exch pop /P2 ldiagpointdef + P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + P1 P2 ldiagangleto /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FRDIRN /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef + FRDIRN /LTO@ANGLE ldiagangledef + FROM LFROM P1 LMID P2 LTO TO + + % (leaving ldiagvhvlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + + +% farr tarr { from } { to } xindent zindent hfrac hbias radius ldiagvhvcurvepath - +/ldiagvhvcurvepath % still to do +{ + % (entering ldiagvhvcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /hbias exch def + /hfrac exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /FRDIRN [ { 90 dg } { 270 dg } { 270 dg } { 0 dg } + { 90 dg } { 270 dg } { 270 dg } { 90 dg } + from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto ldiagquadcase ] cvx def + /TODIRN [ FRDIRN 180 dg sub ] cvx def + from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + FRDIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef + FRDIRN /TO@ANGLE ldiagangledef + /BIAS [ FROM exch pop TO exch pop sub abs hfrac mul hbias add ] cvx def + /XP1 [ FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd ] cvx def + /XP2 [ TO pop XP1 exch pop ] cvx def + XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + /VERT [ XP1 XP2 ldiagangleto round ] cvx def + VERT /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FRDIRN /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef + FRDIRN /LTO@ANGLE ldiagangledef + /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RADIUS TODIRN 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 FRDIRN ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ 0 0 RADIUS VERT ldiagatangle XP2POST ldiagpsub ] cvx def + XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef + XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef + FRDIRN VERT sub 90 eq + { /P1GO [ clockwise ] cvx def /P2GO [ anticlockwise ] cvx def } + { /P1GO [ anticlockwise ] cvx def /P2GO [ clockwise ] cvx def } + ifelse + FROM LFROM + XP1PRE [XP1CTR P1GO] P1 [XP1CTR P1GO] XP1POST + LMID + XP2PRE [XP2CTR P2GO] P2 [XP2CTR P2GO] XP2POST + LTO TO + + + % (leaving ldiagvhvcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + % farr tarr { from } { to } xindent zindent bias fbias tbias ldiagdwraplinepath - /ldiagdwraplinepath { diff --git a/include/doc b/include/doc index feb50d4..202580b 100644 --- a/include/doc +++ b/include/doc @@ -41,11 +41,13 @@ @Use { @BasicSetup # @InitialFont { Times Base 12p } # initial font # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}} + # @InitialOutdent { 2f @OrIfPlain 4s } # initial outdent # @InitialSpace { lout } # initial space style # @InitialLanguage { English } # initial language # @InitialColour { black } # initial colour # @OptimizePages { No } # optimize page breaks? # @HeadingFont { Bold } # font for @Heading + # @FixedWidthFont { Courier Base -1p } # font for @F # @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs # @ParaIndent { 2.00f @OrIfPlain 5s } # first-line indent for @PP # @DisplayGap { 1.00v @OrIfPlain 1f } # gap above, below displays @@ -61,6 +63,7 @@ # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags # @NumberSeparator { . } # separates nums like 2.3.7 # @CrossLinkFormat { @Body } # format of cross links + # @ExternalLinkFormat { @Body } # format of external links } @@ -143,6 +146,7 @@ # @RefListLabelWidth { @ListLabelWidth } # Labels column width # @RefListSortKey { @Tag } # sorting key # @MakeIndex { No } # make index? Yes or No + # @IndexText { @Null } # index initial text # @IndexFont { } # index entries font # @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexColumnNumber { 2 } # index columns (1 to 10) @@ -151,6 +155,7 @@ # @IndexCtdWord { continued } # "ctd." in current lang. # @IndexCtdFormat { @Body @I (@CtdWord) } # format of ctd. # @MakeIndexA { No } # make index A? Yes or No + # @IndexAText { @Null } # index A initial text # @IndexAFont { } # index A entries font # @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexAColumnNumber { 2 } # index A columns (1 to 10) @@ -159,6 +164,7 @@ # @IndexACtdWord { continued } # "ctd." in current lang. # @IndexACtdFormat { @Body @I (@CtdWord) } # format of ctd. # @MakeIndexB { No } # make index B? Yes or No + # @IndexBText { @Null } # index B initial text # @IndexBFont { } # index B entries font # @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexBColumnNumber { 2 } # index B columns (1 to 10) diff --git a/include/docf b/include/docf index dd9f0e6..cfc9d19 100644 --- a/include/docf +++ b/include/docf @@ -217,6 +217,7 @@ def @OrdinarySetup def @Document named @InitialFont { @InitialFont } named @InitialBreak { @InitialBreak } + named @InitialOutdent { @InitialOutdent } named @InitialSpace { @InitialSpace } named @InitialLanguage { @InitialLanguage } named @PageOrientation { @PageOrientation } @@ -225,6 +226,9 @@ def @OrdinarySetup named @FirstPageNumber { @FirstPageNumber } named @OptimizePages { @OptimizePages } named @Unpaginated { No } + named @IndexText { @IndexText } + named @IndexAText { @IndexAText } + named @IndexBText { @IndexBText } { def @ReferencesPart named @Tag {} @@ -273,6 +277,7 @@ def @OrdinarySetup headingfont { @IndexHeadingFont } headingbreak { @IndexHeadingBreak } headingformat { @IndexHeadingFormat @Body } + headingtext { @IndexText } incontents { @IndexInContents } pnprefix { @IndexPrefix } inrunners { Yes } @@ -309,6 +314,7 @@ def @OrdinarySetup headingfont { @IndexAHeadingFont } headingbreak { @IndexAHeadingBreak } headingformat { @IndexAHeadingFormat @Body } + headingtext { @IndexAText } incontents { @IndexAInContents } pnprefix { @IndexAPrefix } inrunners { Yes } @@ -345,6 +351,7 @@ def @OrdinarySetup headingfont { @IndexBHeadingFont } headingbreak { @IndexBHeadingBreak } headingformat { @IndexBHeadingFormat @Body } + headingtext { @IndexBText } incontents { @IndexBInContents } pnprefix { @IndexBPrefix } inrunners { Yes } @@ -380,8 +387,9 @@ def @OrdinarySetup // NonStart @Runner } - @InitialFont @Font @InitialBreak @Break @InitialLanguage @Language - @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour + @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break + @InitialLanguage @Language @InitialSpace @Space + { @ColourCommand @InitialColour } @SetColour { Yes @BeginAllCounters {} Yes @BeginDisplayCounter {} @@ -770,6 +778,7 @@ def @OrdinarySetup } + //1.1f // Start @Runner // @Body // NonStart @Runner diff --git a/include/dsf b/include/dsf index 803fcc3..bc6954e 100644 --- a/include/dsf +++ b/include/dsf @@ -210,6 +210,7 @@ def @DocumentSetup named @Address {} named @Annote {} named @Author {} + named @CiteOrder {} named @Day {} named @Edition {} named @HowPublished {} @@ -236,6 +237,7 @@ def @DocumentSetup { @Tag } # sorting key named @MakeIndex { No } # make index? Yes or No + named @IndexText { @Null } # initial index text named @IndexFont { } # index entries font named @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # index entries break named @IndexColumnNumber { 2 } # index columns (1 to 10) @@ -247,6 +249,7 @@ def @DocumentSetup right @CtdWord { @Body @I (@CtdWord) } # (ctd.) format named @MakeIndexA { No } # make index A? Yes or No + named @IndexAText { @Null } # initial index text named @IndexAFont { } # index A entries font named @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # index A entries break named @IndexAColumnNumber { 2 } # index A columns (1 to 10) @@ -258,6 +261,7 @@ def @DocumentSetup right @CtdWord { @Body @I (@CtdWord) } # (ctd.) format named @MakeIndexB { No } # make index B? Yes or No + named @IndexBText { @Null } # initial index text named @IndexBFont { } # index B entries font named @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # index B entries break named @IndexBColumnNumber { 2 } # index B columns (1 to 10) @@ -3160,6 +3164,13 @@ def @DocumentSetup @Address { @Reference&&tag @Open { @Address } } @Annote { @Reference&&tag @Open { @Annote } } @Author { @Reference&&tag @Open { @Author } } + + @CiteOrder { {@NumberOf tag} @Case { + "??" @Yield "??" + else @Yield { "1000" @Plus @NumberOf tag } + } + } + @Day { @Reference&&tag @Open { @Day } } @Edition { @Reference&&tag @Open { @Edition } } @HowPublished { @Reference&&tag @Open { @HowPublished } } @@ -3172,7 +3183,8 @@ def @DocumentSetup @Label { label @Case { "" @Yield {@Reference&&tag @Open {@Label}} else @Yield label - } } + } + } @Month { @Reference&&tag @Open { @Month } } @Note { @Reference&&tag @Open { @Note } } @@ -4136,8 +4148,8 @@ def @DocumentSetup def @IndexASection into { @IndexAPlace&&following } right etc { - // @IndexAList // etc - // @BypassIndexAList // etc + // @IndexABreak @Break @IndexAList // etc + // @IndexABreak @Break @BypassIndexAList // etc } def @DoIndexA into { @IndexAList&&following } @@ -4249,8 +4261,8 @@ def @DocumentSetup def @IndexBSection into { @IndexBPlace&&following } right etc { - // @IndexBList // etc - // @BypassIndexBList // etc + // @IndexBBreak @Break @IndexBList // etc + // @IndexBBreak @Break @BypassIndexBList // etc } def @DoIndexB into { @IndexBList&&following } @@ -4370,6 +4382,7 @@ def @DocumentSetup named headingbreak {} # its heading break named headingformat # its heading format left @Num right @Body {} + named headingtext { @Null } # heading text named incontents { No } # entry in table of contents required named contentsindent { 0f } # only if type is Major named word {} @@ -4505,6 +4518,7 @@ def @DocumentSetup headingfont @Font headingbreak @Break @Protect {@LongNum headingformat title} // @PageMark tag + @DP headingtext } { Major MajorIntro ExtraMajor ExtraMajorIntro } @Yield { @@ -4513,6 +4527,7 @@ def @DocumentSetup headingfont @Font headingbreak @Break { @LongNum headingformat title } // @PageMark tag + @DP headingtext } } @@ -4521,6 +4536,7 @@ def @DocumentSetup headingfont @Font headingbreak @Break { bypassnumber headingformat title } // @PageMark tag + @DP headingtext } } } @@ -4553,6 +4569,7 @@ def @DocumentSetup // @IfMajor { @FootNoteThrough @Do @BeginFootNoteCounter } // @Run @StartIfMajor // @ContentsStuff + // @TitleMarker @Tag { tag } @Value { title } // intheorems @BeginAllCounters @ShortNum // indisplays @BeginDisplayCounter @ShortNum // infigures @BeginFigureCounter @ShortNum diff --git a/include/eqf b/include/eqf index 68a902b..6f9113c 100644 --- a/include/eqf +++ b/include/eqf @@ -1689,7 +1689,8 @@ def @Eq macro cmatrix { matrix atleft { blceil } atright { brceil } } macro amatrix { matrix atleft { blangle } atright { brangle } } - Slope @Font { separate @SpaceGap } @Space 1f @ZUnit 1f @YUnit @Body + { Slope xheight2mark } @Font { separate @SpaceGap } @Space + 1f @ZUnit 1f @YUnit @Body @End @Eq diff --git a/include/graphf b/include/graphf index dfd69df..6a5edeb 100644 --- a/include/graphf +++ b/include/graphf @@ -711,8 +711,7 @@ def @Graph named ylog named none { "0" } { none } named points named none { "none" } { none } named pairs named none { "none" } { none } - named colour named none { "none" } { none } - named color named none { "none" } { none } + named colour color named none { "none" } { none } named paint named none { "none" } { none } named xmin named none { "false" } { none } named xmax named none { "false" } { none } @@ -818,8 +817,7 @@ def @Graph def @Data named points named none { "none" } { points } named pairs named none { "none" } { pairs } - named colour named none { "none" } { colour } - named color named none { "none" } { color } + named colour color named none { "none" } { colour } named paint named none { "none" } { paint } named dashlength { dashlength } named linewidth { linewidth } @@ -941,44 +939,14 @@ def @Graph { dataformat @Case { xandy @Yield xandy + swapxandy @Yield swapxandy yonly @Yield yonly xonly @Yield xonly } } - def @Col - { - { colour @Case { "none" @Yield color else @Yield colour } } @Case { - none @Yield { } - nochange @Yield { } - darkblue @Yield { 0.0 0.0 0.5 setrgbcolor } - blue @Yield { 0.0 0.0 1.0 setrgbcolor } - lightblue @Yield { 0.5 0.5 1.0 setrgbcolor } - darkgreen @Yield { 0.0 0.5 0.0 setrgbcolor } - green @Yield { 0.0 1.0 0.0 setrgbcolor } - lightgreen @Yield { 0.5 1.0 0.5 setrgbcolor } - darkred @Yield { 0.5 0.0 0.0 setrgbcolor } - red @Yield { 1.0 0.0 0.0 setrgbcolor } - lightred @Yield { 1.0 0.5 0.5 setrgbcolor } - darkcyan @Yield { 0.0 0.5 0.5 setrgbcolor } - cyan @Yield { 0.0 1.0 1.0 setrgbcolor } - lightcyan @Yield { 0.5 1.0 1.0 setrgbcolor } - darkmagenta @Yield { 0.5 0.0 0.5 setrgbcolor } - magenta @Yield { 1.0 0.0 1.0 setrgbcolor } - lightmagenta @Yield { 1.0 0.5 1.0 setrgbcolor } - darkyellow @Yield { 0.5 0.5 0.0 setrgbcolor } - yellow @Yield { 1.0 1.0 0.0 setrgbcolor } - lightyellow @Yield { 1.0 1.0 0.5 setrgbcolor } - darkgray @Yield { 0.2 0.2 0.2 setrgbcolor } - gray @Yield { 0.5 0.5 0.5 setrgbcolor } - lightgray @Yield { 0.7 0.7 0.7 setrgbcolor } - darkgrey @Yield { 0.2 0.2 0.2 setrgbcolor } - grey @Yield { 0.5 0.5 0.5 setrgbcolor } - lightgrey @Yield { 0.7 0.7 0.7 setrgbcolor } - black @Yield { 0.0 0.0 0.0 setrgbcolor } - white @Yield { 1.0 1.0 1.0 setrgbcolor } - } - } +# include @ColourCommand symbol +@SysInclude { ccommand } def @Paint { @@ -992,7 +960,7 @@ def @Graph "{" @Points "}" "{" @Pairs "}" "{ /dashlength" dashlength "def" - " /linewidth" linewidth "def" @Col + " /linewidth" linewidth "def" @ColourCommand colour " /symbolsize" symbolsize "def }" "{" @Paint "}" "]" diff --git a/include/graphf.lpg b/include/graphf.lpg index 60447f0..ff95259 100644 --- a/include/graphf.lpg +++ b/include/graphf.lpg @@ -4,6 +4,7 @@ % PostScript @SysPrependGraphic file for @Graph (Version 1.0) % % % % Version 1.0 by Jeffrey H. Kingston, December 1993. % +% swapxandy added September 2001 by JHK. % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -357,6 +358,16 @@ lgraphdict begin % [ data ] xandy [ data ] /xandy {} def +% swapxandy: no interpolation of x or y values +% [ data ] swapxandy [ data ] +/swapxandy +{ dup /tmp exch def + length [ exch 2 exch 2 exch + { dup tmp exch 1 sub get exch 2 sub tmp exch get + } for + ] +} def + % expstringwidth: calculate width of string containing optional exponent % <string> expstringwidth <width> diff --git a/include/java b/include/java new file mode 100644 index 0000000..f406d39 --- /dev/null +++ b/include/java @@ -0,0 +1,109 @@ +############################################################################### +# # +# Lout setup file for Java program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 6 April 2001 # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { javaf } + + +############################################################################### +# # +# @Use clause # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@Use { @JavaSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # style { fixed } # fixed, varying, or symbol + + # the following options apply when style is "fixed" + + # fixedfont { Courier } # font family + # fixedsize { -1.0p } # font size + # fixedline { 1.0vx } # line-space + # fixedtabin { 8 } # tab interval + # fixedtabout { 8s } # tab width + + # fixedidentifiers { Base } # identifier face + # fixedkeywords { Base } # keyword face + # fixedoperators { Base } # operator face + # fixednumbers { Base } # number face + # fixedstrings { Base } # string face + # fixedcomments { Base } # comment face + # fixedlinenumbers { Base } # line numbers face + + # fixedidentifiersformat { @Body } # identifiers format + # fixedkeywordsformat { @Body } # keywords format + # fixedoperatorsformat { @Body } # operators format + # fixednumbersformat { @Body } # numbers format + # fixedstringsformat { @Body } # strings format + # fixedcommentsformat { @Body } # comments format + # fixedlinenumbersformat { @Body } # line numbers format + + # the following options apply when style is "varying" + + # varyingfont { } # font family + # varyingsize { 1.0f } # font size + # varyingline { 1.0vx } # line-space + # varyingtabin { 8 } # tab interval + # varyingtabout { 3f } # tab width + + # varyingidentifiers { Slope } # identifier face + # varyingkeywords { Bold } # keyword face + # varyingoperators { Base } # operator face + # varyingnumbers { Base } # number face + # varyingstrings { Slope } # string face + # varyingcomments { Base } # comment face + # varyinglinenumbers { Base } # line numbers face + + # varyingidentifiersformat { @Body } # identifiers format + # varyingkeywordsformat { @Body } # keywords format + # varyingoperatorsformat { @Body } # operators format + # varyingnumbersformat { @Body } # numbers format + # varyingstringsformat { @Body } # strings format + # varyingcommentsformat { @Body } # comments format + # varyinglinenumbersformat { @Body } # line numbers format + + # the following options apply when style is "symbol" + + # symbolfont { } # font family + # symbolsize { 1.0f } # font size + # symbolline { 1.0vx } # line-space + # symboltabin { 8 } # tab interval + # symboltabout { 3f } # tab width + + # symbolidentifiers { Slope } # identifier face + # symbolkeywords { Bold } # keyword face + # symboloperators { Base } # operator face + # symbolnumbers { Base } # number face + # symbolstrings { Slope } # string face + # symbolcomments { Base } # comment face + # symbollinenumbers { Base } # line numbers face + + # symbolidentifiersformat { @Body } # identifiers format + # symbolkeywordsformat { @Body } # keywords format + # symboloperatorsformat { @Body } # operators format + # symbolnumbersformat { @Body } # numbers format + # symbolstringsformat { @Body } # strings format + # symbolcommentsformat { @Body } # comments format + # symbollinenumbersformat { @Body } # line numbers format +} diff --git a/include/javaf b/include/javaf new file mode 100644 index 0000000..466a099 --- /dev/null +++ b/include/javaf @@ -0,0 +1,390 @@ + +############################################################################### +# # +# Lout @JavaSetup package for formatting Java programs # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 6 April 2001 # +# # +# This package uses a filtered body parameter to convert program source # +# code into Lout source. The filter program is prg2lout, which is # +# distributed with Lout and should be compiled and installed wherever # +# Lout itself is. # +# # +############################################################################### + +export @Java +def @JavaSetup + named pipe { } # pipe through this first + named numbered { No } # want lines numbered? + named style + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { fixed } # print style + + # the following options apply when style is "fixed" + named fixedfont { Courier }# font family + named fixedsize { -1.0p } # font size + named fixedline { 1.0vx } # line-space + named fixedtabin { 8 } # tab interval + named fixedtabout { 8s } # tab width + + named fixedidentifiers { Base } # identifier face + named fixedkeywords { Base } # keyword face + named fixedoperators { Base } # operator face + named fixednumbers { Base } # number face + named fixedstrings { Base } # string face + named fixedcomments { Base } # comment face + named fixedlinenumbers { Base } # line numbers face + + named fixedidentifiersformat right @Body { @Body } # identifier format + named fixedkeywordsformat right @Body { @Body } # keyword format + named fixedoperatorsformat right @Body { @Body } # operators format + named fixednumbersformat right @Body { @Body } # number format + named fixedstringsformat right @Body { @Body } # string format + named fixedcommentsformat right @Body { @Body } # comment format + named fixedlinenumbersformat right @Body { @Body } # line nums format + + # the following options apply when style is "varying" + named varyingfont { } # font family + named varyingsize { 1.0f } # font size + named varyingline { 1.0vx } # line-space + named varyingtabin { 8 } # tab interval + named varyingtabout { 3f } # tab width + + named varyingidentifiers { Slope } # identifier face + named varyingkeywords { Bold } # keyword face + named varyingoperators { Base } # operator face + named varyingnumbers { Base } # number face + named varyingstrings { Slope } # string face + named varyingcomments { Base } # comment face + named varyinglinenumbers { Base } # line numbers face + + named varyingidentifiersformat right @Body { @Body } # identifier format + named varyingkeywordsformat right @Body { @Body } # keyword format + named varyingoperatorsformat right @Body { @Body } # operators format + named varyingnumbersformat right @Body { @Body } # number format + named varyingstringsformat right @Body { @Body } # string format + named varyingcommentsformat right @Body { @Body } # comment format + named varyinglinenumbersformat right @Body { @Body } # line nums format + + # the following options apply when style is "symbol" + named symbolfont { } # font family + named symbolsize { 1.0f } # font size + named symbolline { 1.0vx } # line-space + named symboltabin { 8 } # tab interval + named symboltabout { 3f } # tab width + + named symbolidentifiers { Slope } # identifier face + named symbolkeywords { Bold } # keyword face + named symboloperators { Base } # operator face + named symbolnumbers { Base } # number face + named symbolstrings { Slope } # string face + named symbolcomments { Base } # comment face + named symbollinenumbers { Base } # line numbers face + + named symbolidentifiersformat right @Body { @Body } # identifier format + named symbolkeywordsformat right @Body { @Body } # keyword format + named symboloperatorsformat right @Body { @Body } # operators format + named symbolnumbersformat right @Body { @Body } # number format + named symbolstringsformat right @Body { @Body } # string format + named symbolcommentsformat right @Body { @Body } # comment format + named symbollinenumbersformat right @Body { @Body } # line nums format + +@Begin + + export + + @PI @PK @PO @PN @PS @PC @PL @PA @PM @PD + @A "$>" + + def @Java + named style { style } # style + named numbered { numbered } # want numbered lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named tabin { dft } # tab interval + named tabout { dft } # tab width + named identifiers { dft } # ident. font + named keywords { dft } # keyword font + named operators { dft } # operator font + named numbers { dft } # number font + named strings { dft } # string font + named comments { dft } # comment font + named linenumbers { dft } # line numbers font + body @Body # filtered, see below + @Begin + + def @Test # returns x unless x is dft + left x + named iffixed {} + named ifvarying {} + named ifsymbol {} + { + x @Case { + dft @Yield { + style @Case { + fixed @Yield { iffixed } + varying @Yield { ifvarying } + symbol @Yield { ifsymbol } + } + } + else @Yield x + } + } + + + def @Else # returns x, or y if x is dft + left x + right y + { + x @Case { + dft @Yield y + else @Yield x + } + } + + + def @InitTab + { + tabin @Test + iffixed { fixedtabin } + ifvarying { varyingtabin } + ifsymbol { symboltabin } + } + + + def @InitTabWidth + { + tabout @Test + iffixed { fixedtabout } + ifvarying { varyingtabout } + ifsymbol { symboltabout } + } + + + def @Filter + { + def wantnumbered + { + numbered @Case { + { No no } @Yield "" + { Yes yes } @Yield "-L" + else @Yield { "-L"numbered } + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lJava" wantnumbered -i{@FilterIn} + -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lJava" wantnumbered -o{@FilterOut} + -e{@FilterErr} -t{@InitTab} -T{@InitTabWidth} + } + } + } + + + def @InitFontFamily + { + font @Test + iffixed { fixedfont } + ifvarying { varyingfont } + ifsymbol { symbolfont } + } + + + def @InitSize + { + size @Test + iffixed { fixedsize } + ifvarying { varyingsize } + ifsymbol { symbolsize } + } + + + def @InitLine + { + line @Test + iffixed { fixedline } + ifvarying { varyingline } + ifsymbol { symbolline } + } + + + def @PI # for formatting identifiers + right x + { + style @Case { + fixed @Yield fixedidentifiersformat { + { identifiers @Else fixedidentifiers } @Font x + } + varying @Yield varyingidentifiersformat { + { identifiers @Else varyingidentifiers } @Font x + } + symbol @Yield symbolidentifiersformat { + { identifiers @Else symbolidentifiers } @Font x + } + } + } + + + def @PK # for formatting keywords + right x + { + style @Case { + fixed @Yield fixedkeywordsformat { + { keywords @Else fixedkeywords } @Font x + } + varying @Yield varyingkeywordsformat { + { keywords @Else varyingkeywords } @Font x + } + symbol @Yield symbolkeywordsformat { + { keywords @Else symbolkeywords } @Font x + } + } + } + + + def @PO # for formatting operators + right x + { + style @Case { + fixed @Yield fixedoperatorsformat { + { operators @Else fixedoperators } @Font x + } + varying @Yield varyingoperatorsformat { + { operators @Else varyingoperators } @Font x + } + symbol @Yield symboloperatorsformat { + { operators @Else symboloperators } @Font x + } + } + } + + + def @PN # for formatting numbers + right x + { + style @Case { + fixed @Yield fixednumbersformat { + { numbers @Else fixednumbers } @Font x + } + varying @Yield varyingnumbersformat { + { numbers @Else varyingnumbers } @Font x + } + symbol @Yield symbolnumbersformat { + { numbers @Else symbolnumbers } @Font x + } + } + } + + + def @PS # for formatting strings + right x + { + style @Case { + fixed @Yield fixedstringsformat { + { strings @Else fixedstrings } @Font x + } + varying @Yield varyingstringsformat { + { strings @Else varyingstrings } @Font x + } + symbol @Yield symbolstringsformat { + { strings @Else symbolstrings } @Font x + } + } + } + + + def @PC # for formatting comments + right x + { + style @Case { + fixed @Yield fixedcommentsformat { + { comments @Else fixedcomments } @Font x + } + varying @Yield varyingcommentsformat { + { comments @Else varyingcomments } @Font x + } + symbol @Yield symbolcommentsformat { + { comments @Else symbolcomments } @Font x + } + } + } + + + def @PL # for formatting line numbers + right x + { + style @Case { + fixed @Yield fixedlinenumbersformat { + { linenumbers @Else fixedlinenumbers } @Font x + } + varying @Yield varyinglinenumbersformat { + { linenumbers @Else varyinglinenumbers } @Font x + } + symbol @Yield symbollinenumbersformat { + { linenumbers @Else symbollinenumbers } @Font x + } + } + } + + + def @PA # for formatting asterisks + { + @PO @BackEnd @Case { + PlainText @Yield "*" + else @Yield { "0.5w" @VShift "*" } + } + } + + + def @PM # for formatting minus signs + { + @PO @BackEnd @Case { + PlainText @Yield "-" + else @Yield style @Case { + fixed @Yield "-" + else @Yield { { Symbol Base } @Font @Char "minus" } + } + } + } + + + def @PD # for formatting dots, if wanted larger + { + @PO @BackEnd @Case { + PlainText @Yield "." + else @Yield { "1.4f" @Font "+0.04f" @VShift "." &"0.05f" } + } + } + + + def @A # get characters from the Adobe Symbol font + left sym + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + { @InitFontFamily Base @InitSize } @Font + { @InitLine lines nohyphen } @Break @Body + + @End @Java + +@End @JavaSetup diff --git a/include/langdefs b/include/langdefs index d23f4fd..95af454 100644 --- a/include/langdefs +++ b/include/langdefs @@ -1,17 +1,20 @@ -langdef Czech Cesky Cestina { czech . : ! ? .) ?) !) .' !' ?' } -langdef Danish Dansk { danish . : ! ? .) ?) !) .' !' ?' } -langdef Dutch Nederlands { dutch . : ! ? .) ?) !) .' !' ?' } -langdef English { english . : ! ? .) ?) !) .' !' ?' } -langdef EnglishUK { engluk . : ! ? .) ?) !) .' !' ?' } -langdef Finnish Suomi { finnish . : ! ? .) ?) !) .' !' ?' } -langdef French Francais "Fran\347ais" { french } -langdef German Deutsch { german . : ! ? .) ?) !) .' !' ?' } -langdef Hungarian Magyar { - . : ! ? .) ?) !) .' !' ?' } -langdef Italian Italiano { italian . : ! ? .) ?) !) .' !' ?' } -langdef Norwegian Norsk { norweg . : ! ? .) ?) !) .' !' ?' } -langdef Polish Polski { polish . : ! ? .) ?) !) .' !' ?' } -langdef Portuguese "Português" { portugal . : ! ? .) ?) !) .' !' ?' } -langdef Russian "\362\325\323\323\313\311\312" { russian . : ! ? .) ?) !) .' !' ?' } -langdef Slovenian Slovenia Slovenija { slovenia . : ! ? .) ?) !) .' !' ?' } -langdef Spanish "Espa\361ol" { spanish . : ! ? .) ?) !) .' !' ?' } -langdef Swedish Svenska { swedish . : ! ? .) ?) !) .' !' ?' } +langdef Croatian Hrvatski hr { croatian . : ! ? .) ?) !) .' !' ?' } +langdef Czech Cesky Cestina cs { czech . : ! ? .) ?) !) .' !' ?' } +langdef Danish Dansk da { danish . : ! ? .) ?) !) .' !' ?' } +langdef Dutch Nederlands nl { dutch . : ! ? .) ?) !) .' !' ?' } +langdef English en { english . : ! ? .) ?) !) .' !' ?' } +langdef EnglishUK "en-GB" { engluk . : ! ? .) ?) !) .' !' ?' } +langdef Finnish Suomi fi { finnish } +langdef French Francais "Fran\347ais" fr { french } +langdef German Deutsch de { german } +langdef Hungarian Magyar hu { magyar . : ! ? .) ?) !) .' !' ?' } +langdef Italian Italiano it { italian } +langdef Norwegian Norsk no { norweg . : ! ? .) ?) !) .' !' ?' } +langdef Polish Polski pl { polish . : ! ? .) ?) !) .' !' ?' } +langdef Portuguese "Português" pt { portugal . : ! ? .) ?) !) .' !' ?' } +langdef Russian "\362\325\323\323\313\311\312" ru { russian . : ! ? .) ?) !) .' !' ?' } +langdef Slovak Slovensky Slovencina sk { slovak . : ! ? .) ?) !) .' !' ?' } +langdef Slovenian Slovenia Slovenija sl { slovenia . : ! ? .) ?) !) .' !' ?' } +langdef Spanish "Espa\361ol" es { spanish } +langdef Swedish Svenska sv { swedish . : ! ? .) ?) !) .' !' ?' } +langdef UpperSorbian hornjoserbsce serbsce wen { uppersorbian . : ! ? .) ?) !) .' !' ?' } diff --git a/include/old.diag.lpg b/include/old.diag.lpg new file mode 100644 index 0000000..05a067f --- /dev/null +++ b/include/old.diag.lpg @@ -0,0 +1,2899 @@ +%%BeginResource: procset LoutDiagPrependGraphic +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Diag Jeffrey H. Kingston % +% Version 2.0 (includes CIRCUM label) September 1996 % +% % +% To assist in avoiding name clashes, the names of all symbols % +% defined here begin with "ldiag". However, this is not feasible % +% with user-defined labels and some labels used by users. % +% % +% <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 } + { 100 string cvs } ifelse + show + ( Command: ) show + $error /command get 100 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 + +% show string in format start ... end: <string> ldiagsends <string> +/ldiagsends +{ + dup length 20 string cvs (: ) ldiagconcat exch + dup 0 20 getinterval ( ... ) ldiagconcat + 3 -1 roll exch ldiagconcat + exch dup length 20 sub 20 getinterval ldiagconcat +} def + +/ldiagdebugposy 432 def +/ldiagdebugposx 72 def + +% <string> <int> ldiagdebugprint - +% must be defined outside ldiagdict since used in arbitrary places +% print <string> plus count or <int> stack entries, whichever is the smaller +/ldiagdebugprint +{ + exch + gsave + initgraphics + ldiagdebugposy 72 lt + { /ldiagdebugposx ldiagdebugposx 144 add store + /ldiagdebugposy 432 store + } + { + /ldiagdebugposy ldiagdebugposy 12 sub store + } ifelse + ldiagdebugposx ldiagdebugposy moveto + /Times-Roman findfont 10 scalefont setfont + 0 setgray show + count 1 sub 2 copy lt { pop } { exch pop } ifelse 1 sub + 0 exch 1 exch + { + /ldiagdebugposy ldiagdebugposy 12 sub store + ldiagdebugposx 12 add ldiagdebugposy moveto + index 100 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 + +/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 100 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 100 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 100 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 100 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 100 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 100 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 100 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 hfrac hbias ldiaghvhlinepath - +/ldiaghvhlinepath % still to do +{ + % (entering ldiaghvhlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /hbias exch def + /hfrac exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /FRDIRN [ { 0 dg } { 180 dg } { 180 dg } { 0 dg } + { 0 dg } { 0 dg } { 180 dg } { 180 dg } + from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto ldiagquadcase ] cvx def + /TODIRN [ FRDIRN 180 dg add ] cvx def + from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + FRDIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef + FRDIRN /TO@ANGLE ldiagangledef + /BIAS [ FROM pop TO pop sub abs hfrac mul hbias add ] cvx def + FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd /P1 ldiagpointdef + P1 pop TO exch pop /P2 ldiagpointdef + P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + P1 P2 ldiagangleto /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FRDIRN /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef + FRDIRN /LTO@ANGLE ldiagangledef + FROM LFROM P1 LMID P2 LTO TO + + % (leaving ldiaghvhlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + + +% farr tarr { from } { to } xindent zindent hfrac hbias radius ldiaghvhcurvepath - +/ldiaghvhcurvepath % still to do +{ + % (entering ldiaghvhcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /hbias exch def + /hfrac exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /FRDIRN [ { 0 dg } { 180 dg } { 180 dg } { 0 dg } + { 0 dg } { 0 dg } { 180 dg } { 180 dg } + from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto ldiagquadcase ] cvx def + /TODIRN [ FRDIRN 180 dg add ] cvx def + + from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + FRDIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef + + FRDIRN /TO@ANGLE ldiagangledef + /BIAS [ FROM pop TO pop sub abs hfrac mul hbias add ] cvx def + /XP1 [ FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd ] cvx def + /XP2 [ XP1 pop TO exch pop ] cvx def + XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + /VERT [ XP1 XP2 ldiagangleto round ] cvx def + VERT /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FRDIRN /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef + FRDIRN /LTO@ANGLE ldiagangledef + /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RADIUS TODIRN 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 FRDIRN ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ 0 0 RADIUS VERT ldiagatangle XP2POST ldiagpsub ] cvx def + XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef + XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef + VERT FRDIRN sub 90 eq + { /P1GO [ anticlockwise ] cvx def /P2GO [ clockwise ] cvx def } + { /P1GO [ clockwise ] cvx def /P2GO [ anticlockwise ] cvx def } + ifelse + FROM LFROM + XP1PRE [XP1CTR P1GO] P1 [XP1CTR P1GO] XP1POST + LMID + XP2PRE [XP2CTR P2GO] P2 [XP2CTR P2GO] XP2POST + LTO TO + + % (leaving ldiaghvhcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent hfrac hbias ldiagvhvlinepath - +/ldiagvhvlinepath % still to do +{ + % (entering ldiagvhvlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /hbias exch def + /hfrac exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /FRDIRN [ { 90 dg } { 270 dg } { 270 dg } { 0 dg } + { 90 dg } { 270 dg } { 270 dg } { 90 dg } + from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto ldiagquadcase ] cvx def + /TODIRN [ FRDIRN 180 dg sub ] cvx def + from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + FRDIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef + FRDIRN /TO@ANGLE ldiagangledef + /BIAS [ FROM exch pop TO exch pop sub abs hfrac mul hbias ft add ] cvx def + FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd /P1 ldiagpointdef + TO pop P1 exch pop /P2 ldiagpointdef + P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + P1 P2 ldiagangleto /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FRDIRN /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef + FRDIRN /LTO@ANGLE ldiagangledef + FROM LFROM P1 LMID P2 LTO TO + + % (leaving ldiagvhvlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + + +% farr tarr { from } { to } xindent zindent hfrac hbias radius ldiagvhvcurvepath - +/ldiagvhvcurvepath % still to do +{ + % (entering ldiagvhvcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /hbias exch def + /hfrac exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /FRDIRN [ { 90 dg } { 270 dg } { 270 dg } { 0 dg } + { 90 dg } { 270 dg } { 270 dg } { 90 dg } + from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto ldiagquadcase ] cvx def + /TODIRN [ FRDIRN 180 dg sub ] cvx def + from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef + FRDIRN /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef + FRDIRN /TO@ANGLE ldiagangledef + /BIAS [ FROM exch pop TO exch pop sub abs hfrac mul hbias add ] cvx def + /XP1 [ FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd ] cvx def + /XP2 [ TO pop XP1 exch pop ] cvx def + XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + /VERT [ XP1 XP2 ldiagangleto round ] cvx def + VERT /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef + FRDIRN /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef + FRDIRN /LTO@ANGLE ldiagangledef + /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RADIUS TODIRN 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 FRDIRN ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ 0 0 RADIUS VERT ldiagatangle XP2POST ldiagpsub ] cvx def + XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef + XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef + FRDIRN VERT sub 90 eq + { /P1GO [ clockwise ] cvx def /P2GO [ anticlockwise ] cvx def } + { /P1GO [ anticlockwise ] cvx def /P2GO [ clockwise ] cvx def } + ifelse + FROM LFROM + XP1PRE [XP1CTR P1GO] P1 [XP1CTR P1GO] XP1POST + LMID + XP2PRE [XP2CTR P2GO] P2 [XP2CTR P2GO] XP2POST + LTO TO + + + % (leaving ldiagvhvcurvepath) 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 diff --git a/include/picture b/include/picture index 6ce6885..6f85770 100644 --- a/include/picture +++ b/include/picture @@ -41,11 +41,13 @@ @Use { @BasicSetup # @InitialFont { Times Base 12p } # initial font # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}} + # @InitialOutdent { 2f @OrIfPlain 4s } # initial outdent # @InitialSpace { lout } # initial space style # @InitialLanguage { English } # initial language # @InitialColour { black } # initial colour # @OptimizePages { No } # optimize page breaks? # @HeadingFont { Bold } # font for @Heading + # @FixedWidthFont { Courier Base -1p } # font for @F # @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs # @ParaIndent { 2.00f @OrIfPlain 5s } # first-line indent for @PP # @DisplayGap { 1.00v @OrIfPlain 1f } # gap above, below displays @@ -61,6 +63,7 @@ # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags # @NumberSeparator { . } # separates nums like 2.3.7 # @CrossLinkFormat { @Body } # format of cross links + # @ExternalLinkFormat { @Body } # format of external links } @@ -142,6 +145,7 @@ # @RefListLabelWidth { @ListLabelWidth } # Labels column width # @RefListSortKey { @Tag } # sorting key # @MakeIndex { No } # make index? Yes or No + # @IndexText { @Null } # index initial text # @IndexFont { } # index entries font # @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexColumnNumber { 2 } # index columns (1 to 10) @@ -150,6 +154,7 @@ # @IndexCtdWord { continued } # "ctd." in current lang. # @IndexCtdFormat { @Body @I (@CtdWord) } # format of ctd. # @MakeIndexA { No } # make index A? Yes or No + # @IndexAText { @Null } # index A initial text # @IndexAFont { } # index A entries font # @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexAColumnNumber { 2 } # index A columns (1 to 10) @@ -158,6 +163,7 @@ # @IndexACtdWord { continued } # "ctd." in current lang. # @IndexACtdFormat { @Body @I (@CtdWord) } # format of ctd. # @MakeIndexB { No } # make index B? Yes or No + # @IndexBText { @Null } # index B initial text # @IndexBFont { } # index B entries font # @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexBColumnNumber { 2 } # index B columns (1 to 10) diff --git a/include/picturef b/include/picturef index fd9177d..6987079 100644 --- a/include/picturef +++ b/include/picturef @@ -24,13 +24,15 @@ def @IllustrationSetup def @Illustration named @InitialFont { @InitialFont } named @InitialBreak { @InitialBreak } + named @InitialOutdent { @InitialOutdent } named @InitialSpace { @InitialSpace } named @InitialLanguage { @InitialLanguage } named @InitialColour { @InitialColour } right x { - @InitialFont @Font @InitialBreak @Break @InitialLanguage @Language - @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour + @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break + @InitialLanguage @Language @InitialSpace @Space + { @ColourCommand @InitialColour } @SetColour @OneCol @OneRow x } diff --git a/include/pythonf b/include/pythonf index 642cfb3..5f2c2ff 100644 --- a/include/pythonf +++ b/include/pythonf @@ -287,9 +287,12 @@ def @PythonSetup } + export "'''" def @PS # for formatting strings - right x + body x { + def "'''" { "'''" } + style @Case { fixed @Yield fixedstringsformat { { strings @Else fixedstrings } @Font x diff --git a/include/report b/include/report index 4bc31ca..a33257b 100644 --- a/include/report +++ b/include/report @@ -46,11 +46,13 @@ @Use { @BasicSetup # @InitialFont { Times Base 12p } # initial font # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}} + # @InitialOutdent { 2f @OrIfPlain 4s } # initial outdent # @InitialSpace { lout } # initial space style # @InitialLanguage { English } # initial language # @InitialColour { black } # initial colour # @OptimizePages { No } # optimize page breaks? # @HeadingFont { Bold } # font for @Heading + # @FixedWidthFont { Courier Base -1p } # font for @F # @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs # @ParaIndent { 2.00f @OrIfPlain 5s } # first-line indent for @PP # @DisplayGap { 1.00v @OrIfPlain 1f } # gap above, below displays @@ -66,6 +68,7 @@ # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags # @NumberSeparator { . } # separates nums like 2.3.7 # @CrossLinkFormat { @Body } # format of cross links + # @ExternalLinkFormat { @Body } # format of external links } @@ -147,6 +150,7 @@ # @RefListLabelWidth { @ListLabelWidth } # Labels column width # @RefListSortKey { @Tag } # sorting key # @MakeIndex { No } # make index? Yes or No + # @IndexText { @Null } # index initial text # @IndexFont { } # index entries font # @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexColumnNumber { 2 } # index columns (1 to 10) @@ -155,6 +159,7 @@ # @IndexCtdWord { continued } # "ctd." in current lang. # @IndexCtdFormat { @Body @I (@CtdWord) } # format of ctd. # @MakeIndexA { No } # make index A? Yes or No + # @IndexAText { @Null } # index A initial text # @IndexAFont { } # index A entries font # @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexAColumnNumber { 2 } # index A columns (1 to 10) @@ -163,6 +168,7 @@ # @IndexACtdWord { continued } # "ctd." in current lang. # @IndexACtdFormat { @Body @I (@CtdWord) } # format of ctd. # @MakeIndexB { No } # make index B? Yes or No + # @IndexBText { @Null } # index B initial text # @IndexBFont { } # index B entries font # @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexBColumnNumber { 2 } # index B columns (1 to 10) @@ -270,7 +276,7 @@ # @AboveTitleGap { 1i } # space above title # @TitleFont { Bold } # title font # @TitleBreak { clines 1.4vx } # title break - # @AuthorFont { Italic } # author font + # @AuthorFont { Slope } # author font # @AuthorBreak { clines } # author break # @InstitutionFont { } # institution font # @InstitutionBreak { clines } # institution break diff --git a/include/reportf b/include/reportf index ce37b01..6136e4e 100644 --- a/include/reportf +++ b/include/reportf @@ -19,7 +19,7 @@ def @ReportSetup named @AboveTitleGap { 1i } named @TitleFont { Bold } named @TitleBreak { clines 1.4vx } - named @AuthorFont { Italic } + named @AuthorFont { Slope } named @AuthorBreak { clines } named @InstitutionFont { } named @InstitutionBreak { clines } @@ -259,6 +259,7 @@ def @ReportSetup named @AtEnd { dft } named @InitialFont { @InitialFont } named @InitialBreak { @InitialBreak } + named @InitialOutdent { @InitialOutdent } named @InitialSpace { @InitialSpace } named @InitialLanguage { @InitialLanguage } named @PageOrientation { @PageOrientation } @@ -269,6 +270,9 @@ def @ReportSetup named @AbstractDisplay { @AbstractDisplay } named @AbstractTitle { @AbstractTitle } named @Abstract {} + named @IndexText { @IndexText } + named @IndexAText { @IndexAText } + named @IndexBText { @IndexBText } { def @Cntr right x @@ -379,6 +383,7 @@ def @ReportSetup headingfont { @IndexHeadingFont } headingbreak { @IndexHeadingBreak } headingformat { @IndexHeadingFormat @Body } + headingtext { @IndexText } incontents { @IndexInContents } prefix { @IndexPrefix } inrunners { Yes } @@ -415,6 +420,7 @@ def @ReportSetup headingfont { @IndexAHeadingFont } headingbreak { @IndexAHeadingBreak } headingformat { @IndexAHeadingFormat @Body } + headingtext { @IndexAText } incontents { @IndexAInContents } prefix { @IndexAPrefix } inrunners { Yes } @@ -451,6 +457,7 @@ def @ReportSetup headingfont { @IndexBHeadingFont } headingbreak { @IndexBHeadingBreak } headingformat { @IndexBHeadingFormat @Body } + headingtext { @IndexBText } incontents { @IndexBInContents } prefix { @IndexBPrefix } inrunners { Yes } @@ -524,8 +531,9 @@ def @ReportSetup // @MakeIndex @Do @IndexPart } - @InitialFont @Font @InitialBreak @Break @InitialLanguage @Language - @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour + @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break + @InitialLanguage @Language @InitialSpace @Space + { @ColourCommand @InitialColour } @SetColour { @CoverSheet @Case { diff --git a/include/slides b/include/slides index 7f9f677..8bbd22d 100644 --- a/include/slides +++ b/include/slides @@ -42,12 +42,14 @@ # @InitialFont { Times Base 12p } # initial font @InitialFont { Times Base 20p } # initial font # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}} - @InitialBreak { ragged 1.20fx nohyphen} # initial break + @InitialBreak { ragged 1.2fx nohyphen } # initial break + # @InitialOutdent { 2f @OrIfPlain 4s } # initial outdent # @InitialSpace { lout } # initial space style # @InitialLanguage { English } # initial language # @InitialColour { black } # initial colour # @OptimizePages { No } # optimize page breaks? # @HeadingFont { Bold } # font for @Heading + # @FixedWidthFont { Courier Base -1p } # font for @F # @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs # @ParaIndent { 2.00f @OrIfPlain 5s } # first-line indent for @PP # @DisplayGap { 1.00v @OrIfPlain 1f } # gap above, below displays @@ -63,6 +65,7 @@ # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags # @NumberSeparator { . } # separates nums like 2.3.7 # @CrossLinkFormat { @Body } # format of cross links + # @ExternalLinkFormat { @Body } # format of external links } @@ -145,6 +148,7 @@ # @RefListLabelWidth { @ListLabelWidth } # Labels column width # @RefListSortKey { @Tag } # sorting key # @MakeIndex { No } # make index? Yes or No + # @IndexText { @Null } # index initial text # @IndexFont { } # index entries font # @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexColumnNumber { 2 } # index columns (1 to 10) @@ -153,6 +157,7 @@ # @IndexCtdWord { continued } # "ctd." in current lang. # @IndexCtdFormat { @Body @I (@CtdWord) } # format of ctd. # @MakeIndexA { No } # make index A? Yes or No + # @IndexAText { @Null } # index A initial text # @IndexAFont { } # index A entries font # @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexAColumnNumber { 2 } # index A columns (1 to 10) @@ -161,6 +166,7 @@ # @IndexACtdWord { continued } # "ctd." in current lang. # @IndexACtdFormat { @Body @I (@CtdWord) } # format of ctd. # @MakeIndexB { No } # make index B? Yes or No + # @IndexBText { @Null } # index B initial text # @IndexBFont { } # index B entries font # @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break # @IndexBColumnNumber { 2 } # index B columns (1 to 10) diff --git a/include/slidesf b/include/slidesf index e39f804..3823ccd 100644 --- a/include/slidesf +++ b/include/slidesf @@ -77,17 +77,17 @@ def @OverheadSetup ####################################################################### export num - def @LectureList named @Tag {} right num + def @LectureList named @Tag {} named num {} { @Galley - //1.1b @LectureList @Next num + //1.1b @LectureList num { @Next num } } export num - def @OverheadsList named @Tag {} right num + def @OverheadsList named @Tag {} named num {} { @Galley - //1.1b @OverheadsList @Next num + //1.1b @OverheadsList num { @Next num } } export num @@ -121,6 +121,7 @@ def @OverheadSetup named @DateLine { @DateLine } named @InitialFont { @InitialFont } named @InitialBreak { @InitialBreak } + named @InitialOutdent { @InitialOutdent } named @InitialSpace { @InitialSpace } named @InitialLanguage { @InitialLanguage } named @PageOrientation { @PageOrientation } @@ -185,13 +186,14 @@ def @OverheadSetup else @Yield @Null } // Start @Runner @MajorTitle { @GetTitle } - //1.1b @OverheadsList @FirstOverheadNumber - //1.1b @LectureList @FirstLectureNumber + //1.1b @OverheadsList num { @FirstOverheadNumber } + //1.1b @LectureList num { @FirstLectureNumber } //1.1b @ReferencesPart } - @InitialFont @Font @InitialBreak @Break @InitialLanguage @Language - @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour + @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break + @InitialLanguage @Language @InitialSpace @Space + { @ColourCommand @InitialColour } @SetColour { @SaveTitle { @InitialLanguage @Language { @RunningTitle @Dft @Title } @@ -278,6 +280,8 @@ def @OverheadSetup named @BypassNumber { dft } body @Body { + def @SaveTitle { @Title } + def @EndOverheadsPlace { @Galley } def @EndOverheads force into { @EndOverheadsPlace&&preceding } @@ -330,6 +334,7 @@ def @OverheadSetup prefix { @LectureNum } majornum { @LectureNum } majortitle { @GetTitle } + minortitle { @SaveTitle } intheorems { @OverheadNumInTheorems } indisplays { OverheadNumInDisplays } infigures { @OverheadNumInFigures } diff --git a/include/tblf b/include/tblf index 9770d63..18b16ef 100644 --- a/include/tblf +++ b/include/tblf @@ -4,13 +4,14 @@ # Lout @Tbl package for tables # # # # Version 1.0 (22 November 1998) # +# Version 1.1 (21 October 2001: improvements to handling of colour) # # Jeffrey H. Kingston # # # # Based on the @Tab package (Jeffrey H. Kingston, September 1991). # # # ############################################################################### -@SysPrependGraphic { tblf.lpg } +# obsoloete now @SysPrependGraphic { tblf.lpg } export @OrIfPlain def @TOIP { @@ -1179,61 +1180,35 @@ def @TblSetup @OneRow { /0io x /0io } } - def @PDFColourCommand right col - { - def @ColourCoords - { - col @Case { - nochange @Yield { nochange } - darkblue @Yield { 0.0 0.0 0.5 } - blue @Yield { 0.0 0.0 1.0 } - lightblue @Yield { 0.5 0.5 1.0 } - darkgreen @Yield { 0.0 0.5 0.0 } - green @Yield { 0.0 1.0 0.0 } - lightgreen @Yield { 0.5 1.0 0.5 } - darkred @Yield { 0.5 0.0 0.0 } - red @Yield { 1.0 0.0 0.0 } - lightred @Yield { 1.0 0.5 0.5 } - darkcyan @Yield { 0.0 0.5 0.5 } - cyan @Yield { 0.0 1.0 1.0 } - lightcyan @Yield { 0.5 1.0 1.0 } - darkmagenta @Yield { 0.5 0.0 0.5 } - magenta @Yield { 1.0 0.0 1.0 } - lightmagenta @Yield { 1.0 0.5 1.0 } - darkyellow @Yield { 0.5 0.5 0.0 } - yellow @Yield { 1.0 1.0 0.0 } - lightyellow @Yield { 1.0 1.0 0.5 } - darkgray @Yield { 0.2 0.2 0.2 } - gray @Yield { 0.5 0.5 0.5 } - lightgray @Yield { 0.8 0.8 0.8 } - darkgrey @Yield { 0.2 0.2 0.2 } - grey @Yield { 0.5 0.5 0.5 } - lightgrey @Yield { 0.8 0.8 0.8 } - black @Yield { 0.0 0.0 0.0 } - white @Yield { 1.0 1.0 1.0 } - } - } +# include @ColourCommand symbol +@SysInclude { ccommand } - @ColourCoords "rg" @ColourCoords "RG" + def @PDFBox + { + "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h" } def @PDFAddPaint right col { col @Case { none @Yield "" - nochange @Yield "q f Q" - else @Yield { "q" @PDFColourCommand col "f Q" } + else @Yield { "q" @ColourCommand col "f Q" } + } + } + + def @PSAddPaint right col + { + col @Case { + none @Yield "" + else @Yield { @ColourCommand col "fill" } } } def @FillBox left col right x { @BackEnd @Case { - PostScript @Yield {{"LoutBox ltbl"col} @Graphic x} - PDF @Yield {{ - "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h" - @PDFAddPaint col "S" - } @Graphic x} + PostScript @Yield { {"LoutBox" @PSAddPaint col } @Graphic x } + PDF @Yield { { @PDFBox @PDFAddPaint col "S" } @Graphic x } PlainText @Yield { rpc @PlainGraphic x } } } @@ -1241,11 +1216,8 @@ def @TblSetup def @PaintBox left col right x { @BackEnd @Case { - PostScript @Yield {{"LoutBox ltbl"col} @Graphic x} - PDF @Yield {{ - "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h" - @PDFAddPaint col "S" - } @Graphic x} + PostScript @Yield { {"LoutBox" @PSAddPaint col } @Graphic x } + PDF @Yield { { @PDFBox @PDFAddPaint col "S" } @Graphic x } PlainText @Yield { x } } } diff --git a/include/tblf.lpg b/include/tblf.lpg deleted file mode 100644 index a31c30f..0000000 --- a/include/tblf.lpg +++ /dev/null @@ -1,41 +0,0 @@ -%%BeginResource: procset LoutTblPrependGraphic -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% 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 |