diff options
Diffstat (limited to 'include')
79 files changed, 52111 insertions, 0 deletions
diff --git a/include/include/README b/include/include/README new file mode 100644 index 0000000..86de180 --- /dev/null +++ b/include/include/README @@ -0,0 +1,113 @@ +Directory lout/include + +This directory contains Lout source files for the standard packages. +The following listing classifies them into types of files. Ordinary +users only need to know about setup files, not source files. + +Setup files (containing mainly lists of options settable by the user) +--------------------------------------------------------------------- + + Setup files for basic document types (choose one): + + doc OrdinarySetup package + report ReportSetup package + book BookSetup package + slides OverheadsSetup package + picture IllustrationSetup package + + Setup files for special-purpose packages (choose any combination): + + diag Diag diagram drawing package + math Math, a mathematics formatting package + graph Graph graph drawing package + latin2 Latin2 (Eastern European characters) package + pie Pie pie graph drawing package + russian Russian language package + tbl Tbl table formatting package + xrgb @Xrgb symbol (extra named colours) + + Setup files for program formatting packages (choose any combination): + + blue Blue + cprint C and C++ + eiffel Eiffel + haskell Haskell + java Java + javascript JavaScript + modula Modula-2 (quick hack, does not use prg2lout) + np Nonpareil + pas Pascal (quick hack, does not use prg2lout) + perl Perl + Pod + pod Pod + python Python + rsl RSL + ruby Ruby + tcl Tcl + +Source files containing Lout and PostScript source code for the packages +------------------------------------------------------------------------ + + bsf BasicSetup package + bsf.lpg A PostScript prepend file needed by BasicSetup + dsf DocumentSetup package + docf OrdinarySetup package + reportf ReportSetup package + bookf BookSetup package + slidesf OverheadsSetup package + picturef IllustrationSetup package + + diagf Diag diagram drawing package + diagf.etc A file included by diagf + diagf.lpg A PostScript prepend file needed by diagf + mathf Math, a mathematics formatting package + graphf Graph graph drawing package + graphf.etc A file included by graphf + graphf.lpg A PostScript prepend file needed by graphf + pief Pie diagram drawing package + pief.lpg A PostScript prepend file needed by pief + russian.fd Russian font definitions file (placeholder file) + tblf Tbl table formatting package + + bluef Blue + cprintf C and C++ + eiffelf Eiffel + haskellf Haskell + javaf Java + javascriptf JavaScript + modulaf Modula-2 + npf Nonpareil + pasf Pascal + perlf Perl + podf Pod + pythonf Python + rslf RSL + rubyf Ruby + tclf Tcl + +Obsolete source files retained for backward compatibility +--------------------------------------------------------- + + eq Eq equation formatting package (obsolete, use math) + eqf Eq equation formatting package + tab Tab table formatting package (obsolete, use tbl) + tabf Tab table formatting package + tabf.lpg A PostScript prepend file needed by tabf + fig Fig advanced graphics package (obsolete, use diag) + figf Fig advanced graphics package + figf.lpg A PostScript prepend file needed by figf + old_graph Old setup file for Graph package + old_graphf Old version of Graph package + +Miscellaneous source files +-------------------------- + + langdefs Standard language definitions file + lengths Helper definitions: @PSLengths and @LoutLengths + coltex Helper definitions: @ColourCommand and @TextureCommand + mydefs Empty file for if the user doesn't have a mydefs + ts The ToySetup package (an expert users' intro. example) + init A Lout source file used during installation (lout -x) + + +Jeffrey H. Kingston +26 June 2013 diff --git a/include/include/blue b/include/include/blue new file mode 100644 index 0000000..284e189 --- /dev/null +++ b/include/include/blue @@ -0,0 +1,118 @@ +############################################################################### +# # +# Lout setup file for Blue program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 10 April 2000 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { bluef } + + +############################################################################### +# # +# @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 { @BlueSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # numberedblanks { Yes } # No or Yes + # style { varying @OrIfPlain 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # spacing mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/bluef b/include/include/bluef new file mode 100644 index 0000000..31af593 --- /dev/null +++ b/include/include/bluef @@ -0,0 +1,446 @@ + +############################################################################### +# # +# Lout @BlueSetup package for formatting Blue programs # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 10 April 2000 # +# # +# 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @Blue +def @BlueSetup + named pipe { } # pipe through this + named numbered { No } # numbered lines? + named blanknumbered { Yes } # blanks numbered? + named style + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { varying @OrIfPlain 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 @Blue + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lBlue" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lBlue" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @Blue + +@End @BlueSetup diff --git a/include/include/book b/include/include/book new file mode 100644 index 0000000..37f5cdb --- /dev/null +++ b/include/include/book @@ -0,0 +1,542 @@ +############################################################################### +# # +# Lout setup file for books # +# # +# Jeffrey H. Kingston # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude commands for standard packages. # +# # +############################################################################### + + @SysInclude { langdefs } # language definitions + @SysInclude { bsf } # BasicSetup package + @SysInclude { dsf } # DocumentSetup package + @SysInclude { bookf } # BookSetup extension + + +############################################################################### +# # +# @Include command for reading personal definitions from current directory. # +# # +############################################################################### + + @Include { mydefs } + +############################################################################### +# # +# The @BasicSetup @Use clause - basics, lists, paragraphs, displays. # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@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 + # @InitialBackgroundColour { white } # initial background 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 + # @DisplayIndent { 2.00f @OrIfPlain 5s } # @IndentedDisplay indent + # @DefaultIndent { 0.5rt } # @Display indent + # @DisplayNumStyle { (num) } # style of display numbers + # @WideIndent { 4.00f @OrIfPlain 10s } # @WideTaggedList indent + # @VeryWideIndent { 8.00f @OrIfPlain 20s } # @VeryWideTaggedList indent + # @ListOuterGap { 1.00v @OrIfPlain 1f } # gap before, after lists + # @ListGap { 1.00v @OrIfPlain 1f } # gap between list items + # @ListIndent { 0s } # indent of list items + # @ListRightIndent { 0s } # right indent of list items + # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags + # @ListLabelRight { No } # right-adjust list labels + # @ListLabelRightGap { 2s } # gap when right-adjusting + # @ListFont { } # font of list items + # @ListBreak { } # break style of list items + # @NumberSeparator { . } # separates nums like 2.3.7 + # @CrossLinkFormat { @Body } # format of cross links + # @ExternalLinkFormat { @Body } # format of external links +} + + +############################################################################### +# # +# The @DocumentSetup @Use clause - page layout plus figures, tables, etc. # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@Use { @DocumentSetup + # @PageType { A4 @OrIfPlain Other} # page type (width, height) + # @PageWidth { 80s } # page width if type Other + # @PageHeight { 66f } # page height if type Other + # @PageOrientation { Portrait } # Portrait, Landscape, etc. + # @PageBackground { } # background of each page + # @TopMargin { 2.5c @OrIfPlain 6f } # top margin of all pages + # @FootMargin { 2.5c @OrIfPlain 6f } # bottom margin of all pages + # @OddLeftMargin { 2.5c @OrIfPlain 10s } # left margin of odd pages + # @OddRightMargin { 2.5c @OrIfPlain 10s } # right margin of odd pages + # @EvenLeftMargin { 2.5c @OrIfPlain 10s } # left margin of even pages + # @EvenRightMargin { 2.5c @OrIfPlain 10s } # right margin of even pages + # @OddLeftBodyMargin { 0c } # extra margin for page body + # @OddRightBodyMargin { 0c } # extra margin for page body + # @EvenLeftBodyMargin { 0c } # extra margin for page body + # @EvenRightBodyMargin{ 0c } # extra margin for page body + # @PageBoxType { None } # None Box CurveBox ShadowBox + # @PageBoxMargin { 1.00c } # page box margin + # @PageBoxLineWidth { } # page box line thickness + # @PageBoxPaint { none } # page box paint + # @PageBoxShadow { 0.60c } # shadow margin if ShadowBox + # @PageEnclose { @Body } # enclose every page in this + # @ColumnNumber { 1 } # number of columns (1 to 10) + # @ColumnGap { 1.00c @OrIfPlain 6s } # column gap + + # @FigureLocation { PageTop } # default figure location + # @FigureFormat { @CC @Body } # default figure format + # @FigureWord { figure } # "Figure" word else anything + # @FigureNumbers { Arabic } # method of numbering figures + # @FigureCaptionPos { Below } # Above or Below + # @FigureCaptionFont { -2p } # figure caption font + # @FigureCaptionBreak { adjust hyphen 1.2fx } # figure caption break + # @FigureCaptionFormat{ {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeFigureContents { No } # list of figures at start + + # @TableLocation { PageTop } # default table location + # @TableFormat { @CC @Body } # default table format + # @TableWord { table } # "Table" word else anything + # @TableNumbers { Arabic } # method of numbering tables + # @TableCaptionPos { Below } # Above or Below + # @TableCaptionFont { -2p } # table caption font + # @TableCaptionBreak { adjust hyphen 1.2fx } # table caption break + # @TableCaptionFormat { {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeTableContents { No } # list of tables at start + + # @FloaterLocation { PageTop } # default floater location + # @FloaterFormat { @CC @Body } # default floater format + # @FloaterWord { floater } # "Floater" word else anything + # @FloaterNumbers { Arabic } # method of numbering floaters + # @FloaterCaptionPos { Below } # Above or Below + # @FloaterCaptionFont { -2p } # floater caption font + # @FloaterCaptionBreak{ adjust hyphen 1.2fx } # floater caption break + # @FloaterCaptionFormat{ {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeFloaterContents{ No } # list of floaters at start + + # @MakeContents { No } # make contents? Yes or No + @MakeContents { Yes } # make contents? Yes or No + # @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry + # @ContentsGapAbove { 0.80v @OrIfPlain 1f } # extra gap above major entry + # @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry + # @ContentsFont { Bold } # font for major entry + # @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above `part' entry + # @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below `part' entry + # @ContentsFormat { number @DotSep title } # contents entry format + # @ContentsLeader { .. } # leader symbol in contents + # @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders + # @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width + + # @MakeReferences { Yes } # make references? Yes or No + # @RefCiteStyle { [cite] } # citation style + # @RefCiteLabels { @RefNum } # citation items + # @RefNumbers { Arabic } # reference numbers + # @RefListFormat { Labels } # NoLabels, Labels, etc. + # @RefListLabels { [@RefNum] } # ref list label format + # @RefListTitle { references } # title of reference list + # @ChapRefListTitle { references } # title of chapter ref list + # @RefListIndent { 0s } # indent to left of labels + # @RefListRightIndent { 0s } # indent to right of items + # @RefListGap { @ListGap } # gap between ref list items + # @RefListFont { } # font used in reference list + # @RefListBreak { } # break style of ref list + # @RefListLabelWidth { @ListLabelWidth } # Labels column width + # @RefListSortKey { @Tag } # sorting key + + # @MakeGlossary { No } # make glossary? Yes or No + # @GlossaryText { @Null } # glossary initial text + # @GlossaryFont { } # glossary entries font + # @GlossaryBreak { } # glossary entries break + # @GlossaryFormat { +3p @Font @S @Name # glossary entries format + # @Right @I { @Word&&page @PageNum } + # @DP @RawIndentedDisplay @Body } + # @GlossaryGap { @DisplayGap } # gap between glossary entries + # @GlossaryColumnNumber{ 2 } # glossary columns (1 to 10) + # @GlossaryColumnGap { 1.00c @OrIfPlain 6s } # glossary column gap + # @InGlossaryFont { smallcaps } # font for @InGlossary + # @InGlossaryFormat { @Body } # format for @InGlossary + + # @MakeIndex { No } # make index? Yes or No + # @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 + # @IndexFormat { @Body } # @Index format + # @SubIndexFormat { {1f @Wide}@Body } # @SubIndex format + # @SubSubIndexFormat { {2f @Wide}@Body } # @SubSubIndex format + # @IndexTypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexTypeMain { @B @PageNum } # Main pagenum format + # @IndexTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexRangeFormat { @From--@To } # index page range format + # @IndexColumnNumber { 2 } # index columns (1 to 10) + # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap + # @IndexCtd { Yes } # include (ctd.) lines + # @IndexCtdWord { continued } # "ctd." in current lang. + # @IndexCtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexSpacerAbove { 2v } # space above index spacer + # @IndexSpacerBelow { 1v } # space below index spacer + # @IndexSpacerFont { +3p } # font of index spacer + # @IndexSpacerFormat { @Body } # format of index spacer + + # @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 + # @IndexAFormat { @Body } # @IndexA format + # @SubIndexAFormat { {1f @Wide}@Body } # @SubIndexA format + # @SubSubIndexAFormat { {2f @Wide}@Body } # @SubSubIndexA format + # @IndexATypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexATypeMain { @B @PageNum } # Main pagenum format + # @IndexATypeSpecial { @I @PageNum } # Special pagenum format + # @IndexARangeFormat { @From--@To } # index page range format + # @IndexAColumnNumber { 2 } # index A columns (1 to 10) + # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap + # @IndexACtd { Yes } # include (ctd.) lines + # @IndexACtdWord { continued } # "ctd." in current lang. + # @IndexACtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexASpacerAbove { 2v } # space above index A spacer + # @IndexASpacerBelow { 1v } # space below index A spacer + # @IndexASpacerFont { +3p } # font of index A spacer + # @IndexASpacerFormat { @Body } # format of index A spacer + + # @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 + # @IndexBFormat { @Body } # @IndexB format + # @SubIndexBFormat { {1f @Wide}@Body } # @SubIndexB format + # @SubSubIndexBFormat { {2f @Wide}@Body } # @SubSubIndexB format + # @IndexBTypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexBTypeMain { @B @PageNum } # Main pagenum format + # @IndexBTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexBRangeFormat { @From--@To } # index page range format + # @IndexBColumnNumber { 2 } # index B columns (1 to 10) + # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap + # @IndexBCtd { Yes } # include (ctd.) lines + # @IndexBCtdWord { continued } # "ctd." in current lang. + # @IndexBCtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexBSpacerAbove { 2v } # space above index B spacer + # @IndexBSpacerBelow { 1v } # space below index B spacer + # @IndexBSpacerFont { +3p } # font of index B spacer + # @IndexBSpacerFormat { @Body } # format of index B spacer + + # @MakeColophon { No } # make colophon? Yes or No + # @ColophonFont { } # font for colophon + # @ColophonBreak { } # break style for colophon + # @ColophonColumnNumber { 1 } # colophon columns (1 to 10) + # @ColophonColumnGap { 1.00c @OrIfPlain 6s } # colophon column gap + + # @TopGap { 0.75c @OrIfPlain 2f } # gap between figures + # @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text + + # @FootNoteNumbers { Arabic } # footnote numbers + # @FootNoteThrough { No } # numbered through chapter? + # @FootNoteLocation { ColFoot } # where the footnote appears + # @FootNoteFont { 0.80f } # font for footnotes + # @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes + # @FootNoteFormat { { number &0.05f } @Insert body } # footnote format + # @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line + # @FootAboveGap { @DisplayGap } # gap above footnote line + # @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes + # @MarginNoteFont { 0.80f } # font of margin notes + # @MarginNoteBreak { ragged 1.10fx } # break style of margin notes + # @MarginNoteHGap { 0.5c } # horizontal gap to notes + # @MarginNoteVGap { @DisplayGap } # min vertical gap between + # @MarginNoteWidth { 1.50c } # width of margin notes + # @EndNoteNumbers { Arabic } # endnote numbers + # @EndNoteFont { 0.80f } # font of endnotes + # @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes + # @EndNoteFormat { { number &0.05f } @Insert body } # endnote format + # @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes + + # @TheoremWord { theorem } # "Theorem" word, etc. + # @TheoremTitleFormat { (title) } # only if title present + # @TheoremFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @DefinitionWord { definition } # "Definition" word, etc. + # @DefinitionTitleFormat { (title) } # only if title present + # @DefinitionFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ClaimWord { claim } # "Claim" word, etc. + # @ClaimTitleFormat { (title) } # only if title present + # @ClaimFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @PropositionWord { proposition } # "Proposition" word, etc. + # @PropositionTitleFormat { (title) } # only if title present + # @PropositionFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @LemmaWord { lemma } # "Lemma" word, etc. + # @LemmaTitleFormat { (title) } # only if title present + # @LemmaFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @CorollaryWord { corollary } # "Corollary" word, etc. + # @CorollaryTitleFormat { (title) } # only if title present + # @CorollaryFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ExampleWord { example } # "Example" word, etc. + # @ExampleTitleFormat { (title) } # only if title present + # @ExampleFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ProofWord { proof } # "Proof" word, etc. + + # @PageHeaders { Simple } # None Simple Titles NoTitles + @PageHeaders { Titles } # None Simple Titles NoTitles + # @PageNumbers { Arabic } # page numbers + # @FirstPageNumber { 1 } # number of first page + # @IntroPageNumbers { Roman } # intro page numbers + # @IntroFirstPageNumber{ 1 } # number of first intro page + # @StructPageNums { No } # make structured page numbers + # @PageNumberFormat { number } # format of all page numbers + + # @OddTop { @Centre{- @PageNum -} } # Simple page headers + # @OddFoot { @Null } + # @EvenTop { @Centre{- @PageNum -} } + # @EvenFoot { @Null } + # @StartOddTop { @Null } + # @StartOddFoot { @Null } + # @StartEvenTop { @Null } + # @StartEvenFoot { @Null } + # @IntroOddTop { @Null } + # @IntroOddFoot { @Centre @PageNum } + # @IntroEvenTop { @Null } + # @IntroEvenFoot { @Centre @PageNum } + # @IntroStartOddTop { @Null } + # @IntroStartOddFoot { @Null } + # @IntroStartEvenTop { @Null } + # @IntroStartEvenFoot { @Null } + + # Titles, NoTitles headers + # @RunningOddTop { @I {@MinorNum @DotSep @MinorTitle} @Right @B @PageNum } + # @RunningOddFoot { @Null } + # @RunningEvenTop { @B @PageNum @Right @I {@MajorNum @DotSep @MajorTitle} } + # @RunningEvenFoot { @Null } + # @RunningStartOddTop { @Null } + # @RunningStartOddFoot { @Centre { Bold 0.8f } @Font @PageNum } + # @RunningStartEvenTop { @Null } + # @RunningStartEvenFoot { @Centre { Bold 0.8f } @Font @PageNum } + # @RunningIntroOddTop { @Null } + # @RunningIntroOddFoot { @Right @PageNum } + # @RunningIntroEvenTop { @Null } + # @RunningIntroEvenFoot { @PageNum } + # @RunningIntroStartOddTop { @Null } + # @RunningIntroStartOddFoot { @Null } + # @RunningIntroStartEvenTop { @Null } + # @RunningIntroStartEvenFoot { @Null } +} + + +############################################################################### +# # +# The @BookSetup @Use clause - options specific to books. # +# # +############################################################################### + +@Use { @BookSetup + # @TitlePageFont { Helvetica Base} # title page font (not size) + # @SeparateIntroNumbering { Yes } # separate intro page numbers + # @PrefaceAfterContents { No } # Yes or No + # @ChapterStartPages { Any } # Any, Odd, Even, SamePage + # @ReferencesBeforeAppendices { No } # references before appendices + # @PrefaceWord { preface } # word for "Preface" + # @ContentsWord { contents } # word for "Contents" + # @FigureListWord { figurelist } # word for "List of Figures" + # @TableListWord { tablelist } # word for "List of Tables" + # @FloaterListWord { floaterlist } # word for "List of Floaters" + # @IntroductionWord { introduction } # word for "Introduction" + # @AbbreviationsWord { abbreviations } # word for "Abbreviations" + # @ChapterWord { chapter } # word for "Chapter" + # @AppendixWord { appendix } # word for "Appendix" + # @GlossaryWord { glossary } # word for "Glossary" + # @IndexWord { index } # word for "Index" + # @IndexAWord { index } # word for "Index" (A) + # @IndexBWord { index } # word for "Index" (B) + # @ColophonWord { colophon } # word for "Colophon" + # @SubPrefaceNumbers { None } # kind of sub-preface numbers + # @FirstSubPrefaceNumber { 1 } # first sub-preface number (Arabic) + # @SubIntroductionNumbers { None } # kind of sub-introduction numbers + # @FirstSubIntroductionNumber { 1 } # first sub-introduction number + # @ChapterNumbers { Arabic } # kind of chapter numbers + # @FirstChapterNumber { 1 } # first chapter number (Arabic) + # @SectionNumbers { Arabic } # kind of section numbers + # @FirstSectionNumber { 1 } # first section number (Arabic) + # @SubSectionNumbers { Arabic } # kind of subsection numbers + # @FirstSubSectionNumber { 1 } # first subsect number (Arabic) + # @SubSubSectionNumbers { Arabic } # kind of sub-subs. numbers + # @FirstSubSubSectionNumber { 1 } # first sub-sub number (Arabic) + # @AppendixNumbers { UCAlpha } # kind of appendix numbers + # @FirstAppendixNumber { 1 } # first appendix num (Arabic) + # @SubAppendixNumbers { Arabic } # kind of subappendix numbers + # @FirstSubAppendixNumber { 1 } # first sub-app num (Arabic) + # @SubSubAppendixNumbers { Arabic } # kind of sub-subapp. numbers + # @FirstSubSubAppendixNumber { 1 } # first sub-sub num (Arabic) + # @PartHeadingFont { Helvetica Base 2.50f } # part head font + # @PartHeadingBreak { clines 1.2fx nohyphen } # part head break + # @PartHeadingFormat { @CD number @DP @CD title } # part head format + # @ChapterHeadingFont { Bold 2.00f } # chapter head font + # @ChapterHeadingBreak { ragged 1.2fx nohyphen } # chapter head break + # @ChapterHeadingFormat { number @DotSep title } # format of chap. head + # @SubPrefaceHeadingFont { Bold } # sub-preface head font + # @SubPrefaceHeadingBreak { ragged 1.2fx nohyphen } # sub-preface head break + # @SubPrefaceHeadingFormat { number @DotSep title } # format of s.-p. head + # @SubIntroductionHeadingFont { Bold } # sub-intro head font + # @SubIntroductionHeadingBreak { ragged 1.2fx nohyphen} # sub-intro head break + # @SubIntroductionHeadingFormat { number @DotSep title} # format of sub-intro. hd + # @SectionHeadingFont { Bold } # section head font + # @SectionHeadingBreak { ragged 1.2fx nohyphen } # section head break + # @SectionHeadingFormat { number @DotSep title } # section head fmt + # @SubSectionHeadingFont { Bold } # subs. head font + # @SubSectionHeadingBreak { ragged 1.2fx nohyphen } # subs. head break + # @SubSectionHeadingFormat { number @DotSep title } # subs. head fmt + # @SubSubSectionHeadingFont { Slope } # sub-subs. head font + # @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen } # sub-subs. head break + # @SubSubSectionHeadingFormat { number @DotSep title } # sub-subs. head fmt + # @AppendixHeadingFont { Bold 2.00f } # appendix head font + # @AppendixHeadingBreak { ragged 1.2fx nohyphen } # appendix head break + # @AppendixHeadingFormat { number @DotSep title } # appendix head fmt + # @SubAppendixHeadingFont { Bold } # subapp. head font + # @SubAppendixHeadingBreak { ragged 1.2fx nohyphen } # subapp. head break + # @SubAppendixHeadingFormat { number @DotSep title } # subapp. head fmt + # @SubSubAppendixHeadingFont { Slope } # sub-suba. head font + # @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen } # sub-suba. head break + # @SubSubAppendixHeadingFormat{ number @DotSep title } # sub-suba. head fmt + # @AbovePartGap { 4.00f } # gap above part title + # @AboveChapterGap { 3.00f } # above major titles + # @SubPrefaceGap { 2.0v @OrIfPlain 3f } # between sub-prefaces + # @SubIntroductionGap { 2.0v @OrIfPlain 3f } # between sub-intros + # @SectionGap { 2.0v @OrIfPlain 3f } # between sections + # @SubSectionGap { 1.5v @OrIfPlain 2f } # between subsects + # @SubSubSectionGap { 1.5v @OrIfPlain 2f } # between sub-subs. + # @SubAppendixGap { 2.0v @OrIfPlain 3f } # between subappendices + # @SubSubAppendixGap { 1.5v @OrIfPlain 2f } # between sub-subapps + # @PrefaceInContents { Yes } # add preface to contents + # @SubPrefaceInContents { No } # add sub-preface to contents + # @AbbreviationsInContents { Yes } # add abbreviations to contents + # @IntroductionInContents { Yes } # add introduction to contents + # @SubIntroductionInContents { No } # add sub-intro to contents + # @PartInContents { Yes } # add parts to contents + # @ChapterInContents { Yes } # add chapters to contents + # @SectionInContents { Yes } # add sections to contents + # @SubSectionInContents { Yes } # add subsections to contents + # @SubSubSectionInContents { No } # add sub-subsects to contents + # @AppendixInContents { Yes } # add appendices to contents + # @SubAppendixInContents { Yes } # add subappendices to contents + # @SubSubAppendixInContents { No } # add sub-subapps to contents + # @ReferencesInContents { Yes } # add ref. section to contents + # @GlossaryInContents { Yes } # add glossary to contents + # @IndexInContents { Yes } # add index to contents + # @IndexAInContents { Yes } # add index A to contents + # @IndexBInContents { Yes } # add index B to contents + # @ColophonInContents { Yes } # add colophon to contents + # @PrefaceContentsIndent { 0f } # indent in contents of preface + # @SubPrefaceContentsIndent { 3f } # indent in contents of sub-preface + # @AbbreviationsContentsIndent{ 0f } # indent in contents of abbreviations + # @IntroductionContentsIndent { 0f } # indent in contents of introduction + # @SubIntroductionContentsIndent { 3f } # indent in contents of sub-intro + # @PartContentsIndent { 0.5rt } # indent in contents of part (dft is ctr) + # @ChapterContentsIndent { 0f } # indent in contents of chapter + # @SectionContentsIndent { 3f } # indent in contents of section + # @SubSectionContentsIndent { 6f } # indent in contents of subsection + # @SubSubSectionContentsIndent{ 9f } # indent in contents of sub-subsection + # @AppendixContentsIndent { 0f } # indent in contents of appendix + # @SubAppendixContentsIndent { 3f } # indent in contents of sub-appendix + # @SubSubAppendixContentsIndent { 6f } # indent in contents of sub-subappendix + # @ReferencesContentsIndent { 0f } # indent in contents of references + # @GlossaryContentsIndent { 0f } # indent in contents of gloassary + # @IndexContentsIndent { 0f } # indent in contents of index + # @IndexAContentsIndent { 0f } # indent in contents of index A + # @IndexBContentsIndent { 0f } # indent in contents of index B + # @ColophonContentsIndent { 0f } # indent in contents of colophon + # @SubPrefaceNumInTheorems { No } # theorem num has sub-preface num + # @SubIntroductionNumInTheorems { No } # theorem num has sub-intro num + # @ChapterNumInTheorems { Yes } # theorem num has chapter num + # @SectionNumInTheorems { No } # theorem num has section num + # @SubSectionNumInTheorems { No } # theorem num has subsect num + # @SubSubSectionNumInTheorems { No } # theorem num has sub-ss. num + # @AppendixNumInTheorems { Yes } # theorem num has appendix num + # @SubAppendixNumInTheorems { No } # theorem num has sub-app num + # @SubSubAppendixNumInTheorems{ No } # theorem num has sub-sa. num + # @SubPrefaceNumInDisplays { No } # display num has sub-preface num + # @SubIntroductionNumInDisplays { No } # display num has sub-intro num + # @ChapterNumInDisplays { Yes } # display num has chapter num + # @SectionNumInDisplays { Yes } # display num has section num + # @SubSectionNumInDisplays { No } # display num has subsect num + # @SubSubSectionNumInDisplays { No } # display num has sub-ss. num + # @AppendixNumInDisplays { Yes } # display num has appendix num + # @SubAppendixNumInDisplays { Yes } # display num has sub-app num + # @SubSubAppendixNumInDisplays{ No } # display num has sub-sa. num + # @SubPrefaceNumInFigures { No } # figure num has sub-preface num + # @SubIntroductionumInFigures { No } # figure num has sub-intro num + # @ChapterNumInFigures { Yes } # figure num has chapter num + # @SectionNumInFigures { No } # figure num has section num + # @SubSectionNumInFigures { No } # figure num has subsect num + # @SubSubSectionNumInFigures { No } # figure num has sub-ss. num + # @AppendixNumInFigures { Yes } # figure num has appendix num + # @SubAppendixNumInFigures { No } # figure num has sub-app num + # @SubSubAppendixNumInFigures { No } # figure num has sub-sa. num + # @SubPrefaceNumInTables { No } # table num has sub-preface num + # @SubIntroductionumInTables { No } # table num has sub-intro num + # @ChapterNumInTables { Yes } # table num has chapter num + # @SectionNumInTables { No } # table num has section num + # @SubSectionNumInTables { No } # table num has subsect num + # @SubSubSectionNumInTables { No } # table num has sub-ss. num + # @AppendixNumInTables { Yes } # table num has appendix num + # @SubAppendixNumInTables { No } # table num has sub-app num + # @SubSubAppendixNumInTables { No } # table num has sub-sa. num + # @SubPrefaceNumInFloaters { No } # floater num has sub-preface num + # @SubIntroductionumInFloaters{ No } # floater num has sub-intro num + # @ChapterNumInFloaters { Yes } # floater num has chapter num + # @SectionNumInFloaters { No } # floater num has section num + # @SubSectionNumInFloaters { No } # floater num has subsect num + # @SubSubSectionNumInFloaters { No } # floater num has sub-ss. num + # @AppendixNumInFloaters { Yes } # floater num has appendix num + # @SubAppendixNumInFloaters { No } # floater num has sub-app num + # @SubSubAppendixNumInFloaters{ No } # floater num has sub-sa. num + # @SubPrefaceNumInRunners { No } # runners have sub-preface num + # @SubIntroductionNumInRunners { No } # runners have sub-intro num + # @SectionNumInRunners { Yes } # runners have section num + # @SubSectionNumInRunners { No } # runners have subsect num + # @SubSubSectionNumInRunners { No } # runners have sub-ss. num + # @SubAppendixNumInRunners { Yes } # runners have sub-app num + # @SubSubAppendixNumInRunners { No } # runners have sub-sa. num + # @PrefacePrefix { } # for structured page nums + # @ContentsPrefix { } # for structured page nums + # @FigureContentsPrefix { } # for structured page nums + # @TableContentsPrefix { } # for structured page nums + # @FloaterContentsPrefix { } # for structured page nums + # @AbbreviationsPrefix { } # for structured page nums + # @IntroductionPrefix { } # for structured page nums + # @ChapterPrefix { } # for structured page nums + # @AppendixPrefix { } # for structured page nums + # @ReferencesPrefix { } # for structured page nums + # @GlossaryPrefix { } # for structured page nums + # @IndexPrefix { } # for structured page nums + # @IndexAPrefix { } # for structured page nums + # @IndexBPrefix { } # for structured page nums + # @ColophonPrefix { } # for structured page nums +} + + +############################################################################### +# # +# @Database (and @SysDatabase) clauses go here. # +# # +############################################################################### + +@SysDatabase @FontDef { fontdefs } # font definitions +@SysDatabase @RefStyle { refstyle } # reference printing styles diff --git a/include/include/bookf b/include/include/bookf new file mode 100644 index 0000000..3c2b21f --- /dev/null +++ b/include/include/bookf @@ -0,0 +1,1645 @@ + +########################################################################### +# # +# @BookSetup extension to @DocumentSetup. # +# # +# Jeffrey H. Kingston # +# # +# This package extends DocumentSetup with definitions for books. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +########################################################################### + +extend @BasicSetup @DocumentSetup +export @Book @Preface @Abbreviations @Introduction @Chapter @Appendix @Colophon +def @BookSetup + named @TitlePageFont { Helvetica Base } + named @SeparateIntroNumbering { Yes } + named @PrefaceAfterContents { No } + named @ChapterStartPages { Any } + named @ReferencesBeforeAppendices { No } + + named @PrefaceWord { preface } + named @ContentsWord { contents } + named @FigureListWord { figurelist } + named @TableListWord { tablelist } + named @FloaterListWord { floaterlist } + named @IntroductionWord { introduction } + named @AbbreviationsWord { abbreviations } + named @ChapterWord { chapter } + named @AppendixWord { appendix } + named @GlossaryWord { glossary } + named @IndexWord { index } + named @IndexAWord { index } + named @IndexBWord { index } + named @ColophonWord { colophon } + + named @SubPrefaceNumbers { None } + named @FirstSubPrefaceNumber { 1 } + named @SubIntroductionNumbers { None } + named @FirstSubIntroductionNumber { 1 } + named @ChapterNumbers { Arabic } + named @FirstChapterNumber { 1 } + named @SectionNumbers { Arabic } + named @FirstSectionNumber { 1 } + named @SubSectionNumbers { Arabic } + named @FirstSubSectionNumber { 1 } + named @SubSubSectionNumbers { Arabic } + named @FirstSubSubSectionNumber { 1 } + named @AppendixNumbers { UCAlpha } + named @FirstAppendixNumber { 1 } + named @SubAppendixNumbers { Arabic } + named @FirstSubAppendixNumber { 1 } + named @SubSubAppendixNumbers { Arabic } + named @FirstSubSubAppendixNumber { 1 } + + named @PartHeadingFont { Helvetica Base 2.50f } + named @PartHeadingBreak { clines 1.2fx nohyphen } + named @PartHeadingFormat + left number right title { @CD number @DP @CD title } + + named @ChapterHeadingFont { Bold 2.00f } + named @ChapterHeadingBreak { ragged 1.2fx nohyphen } + named @ChapterHeadingFormat + left number right title { number @DotSep title } + + named @SubPrefaceHeadingFont { Bold } + named @SubPrefaceHeadingBreak { ragged 1.2fx nohyphen } + named @SubPrefaceHeadingFormat + left number right title { number @DotSep title } + + named @SubIntroductionHeadingFont { Bold } + named @SubIntroductionHeadingBreak { ragged 1.2fx nohyphen } + named @SubIntroductionHeadingFormat + left number right title { number @DotSep title } + + named @SectionHeadingFont { Bold } + named @SectionHeadingBreak { ragged 1.2fx nohyphen } + named @SectionHeadingFormat + left number right title { number @DotSep title } + + named @SubSectionHeadingFont { Bold } + named @SubSectionHeadingBreak { ragged 1.2fx nohyphen } + named @SubSectionHeadingFormat + left number right title { number @DotSep title } + + named @SubSubSectionHeadingFont { Slope } + named @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen } + named @SubSubSectionHeadingFormat + left number right title { number @DotSep title } + + named @AppendixHeadingFont { Bold 2.00f } + named @AppendixHeadingBreak { ragged 1.2fx nohyphen } + named @AppendixHeadingFormat + left number right title { number @DotSep title } + + named @SubAppendixHeadingFont { Bold } + named @SubAppendixHeadingBreak { ragged 1.2fx nohyphen } + named @SubAppendixHeadingFormat + left number right title { number @DotSep title } + + named @SubSubAppendixHeadingFont { Slope } + named @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen } + named @SubSubAppendixHeadingFormat + left number right title { number @DotSep title } + + named @AbovePartGap { 4.00f } + named @AboveChapterGap { 3.00f } + named @SubPrefaceGap { 2.0v @OrIfPlain 3f } + named @SubIntroductionGap { 2.0v @OrIfPlain 3f } + named @SectionGap { 2.0v @OrIfPlain 3f } + named @SubSectionGap { 1.5v @OrIfPlain 2f } + named @SubSubSectionGap { 1.5v @OrIfPlain 2f } + named @SubAppendixGap { 2.0v @OrIfPlain 3f } + named @SubSubAppendixGap { 1.5v @OrIfPlain 2f } + + named @PrefaceInContents { Yes } + named @SubPrefaceInContents { No } + named @AbbreviationsInContents { Yes } + named @IntroductionInContents { Yes } + named @SubIntroductionInContents { No } + named @PartInContents { Yes } + named @ChapterInContents { Yes } + named @SectionInContents { Yes } + named @SubSectionInContents { Yes } + named @SubSubSectionInContents { No } + named @AppendixInContents { Yes } + named @SubAppendixInContents { Yes } + named @SubSubAppendixInContents { No } + named @ReferencesInContents { Yes } + named @GlossaryInContents { Yes } + named @IndexInContents { Yes } + named @IndexAInContents { Yes } + named @IndexBInContents { Yes } + named @ColophonInContents { Yes } + + named @PrefaceContentsIndent { 0f } + named @SubPrefaceContentsIndent { 3f } + named @AbbreviationsContentsIndent { 0f } + named @IntroductionContentsIndent { 0f } + named @SubIntroductionContentsIndent{ 3f } + named @PartContentsIndent { 0.5rt } + named @ChapterContentsIndent { 0f } + named @SectionContentsIndent { 3f } + named @SubSectionContentsIndent { 6f } + named @SubSubSectionContentsIndent { 9f } + named @AppendixContentsIndent { 0f } + named @SubAppendixContentsIndent { 3f } + named @SubSubAppendixContentsIndent { 6f } + named @ReferencesContentsIndent { 0f } + named @GlossaryContentsIndent { 0f } + named @IndexContentsIndent { 0f } + named @IndexAContentsIndent { 0f } + named @IndexBContentsIndent { 0f } + named @ColophonContentsIndent { 0f } + + named @SubPrefaceNumInTheorems { No } + named @SubIntroductionNumInTheorems { No } + named @ChapterNumInTheorems { Yes } + named @SectionNumInTheorems { No } + named @SubSectionNumInTheorems { No } + named @SubSubSectionNumInTheorems { No } + named @AppendixNumInTheorems { Yes } + named @SubAppendixNumInTheorems { No } + named @SubSubAppendixNumInTheorems { No } + + named @SubPrefaceNumInDisplays { No } + named @SubIntroductionNumInDisplays { No } + named @ChapterNumInDisplays { Yes } + named @SectionNumInDisplays { Yes } + named @SubSectionNumInDisplays { No } + named @SubSubSectionNumInDisplays { No } + named @AppendixNumInDisplays { Yes } + named @SubAppendixNumInDisplays { Yes } + named @SubSubAppendixNumInDisplays { No } + + named @SubPrefaceNumInFigures { No } + named @SubIntroductionNumInFigures { No } + named @ChapterNumInFigures { Yes } + named @SectionNumInFigures { No } + named @SubSectionNumInFigures { No } + named @SubSubSectionNumInFigures { No } + named @AppendixNumInFigures { Yes } + named @SubAppendixNumInFigures { No } + named @SubSubAppendixNumInFigures { No } + + named @SubPrefaceNumInTables { No } + named @SubIntroductionNumInTables { No } + named @ChapterNumInTables { Yes } + named @SectionNumInTables { No } + named @SubSectionNumInTables { No } + named @SubSubSectionNumInTables { No } + named @AppendixNumInTables { Yes } + named @SubAppendixNumInTables { No } + named @SubSubAppendixNumInTables { No } + + named @SubPrefaceNumInFloaters { No } + named @SubIntroductionNumInFloaters { No } + named @ChapterNumInFloaters { Yes } + named @SectionNumInFloaters { No } + named @SubSectionNumInFloaters { No } + named @SubSubSectionNumInFloaters { No } + named @AppendixNumInFloaters { Yes } + named @SubAppendixNumInFloaters { No } + named @SubSubAppendixNumInFloaters { No } + + named @SubPrefaceNumInRunners { No } + named @SubIntroductionNumInRunners { No } + named @SectionNumInRunners { Yes } + named @SubSectionNumInRunners { No } + named @SubSubSectionNumInRunners { No } + named @SubAppendixNumInRunners { Yes } + named @SubSubAppendixNumInRunners { No } + + named @PrefacePrefix { } + named @ContentsPrefix { } + named @FigureContentsPrefix { } + named @TableContentsPrefix { } + named @FloaterContentsPrefix { } + named @AbbreviationsPrefix { } + named @IntroductionPrefix { } + named @ChapterPrefix { } + named @AppendixPrefix { } + named @ReferencesPrefix { } + named @GlossaryPrefix { } + named @IndexPrefix { } + named @IndexAPrefix { } + named @IndexBPrefix { } + named @ColophonPrefix { } + +@Begin + + ####################################################################### + # # + # Lists of chapters, sections, sub(-sub)sections, and appendices. # + # # + ####################################################################### + + export num + def @ChapterList named @Tag {} right num + { + @Galley + // @ChapterList @Next num + } + + export num + def @SubPrefaceList named @Tag {} right num + { + @Galley + //@SubPrefaceGap @SubPrefaceList @Next num + } + + export num + def @SubIntroductionList named @Tag {} right num + { + @Galley + //@SubIntroductionGap @SubIntroductionList @Next num + } + + export num + def @SectionList named @Tag {} right num + { + @Galley + //@SectionGap @SectionList @Next num + } + + export num + def @SubSectionList named @Tag {} right num + { + @Galley + //@SubSectionGap @SubSectionList @Next num + } + + export num + def @SubSubSectionList named @Tag {} right num + { + @Galley + //@SubSubSectionGap @SubSubSectionList @Next num + } + + export num + def @AppendixList named @Tag {} right num + { + @Galley + // @AppendixList @Next num + } + + export num + def @SubAppendixList named @Tag {} right num + { + @Galley + //@SubAppendixGap @SubAppendixList @Next num + } + + export num + def @SubSubAppendixList named @Tag {} right num + { + @Galley + //@SubSubAppendixGap @SubSubAppendixList @Next num + } + + def @PrefacePlace { @Galley } + def @AbbreviationsPlace { @Galley } + def @IntroductionPlace { @Galley } + + + ####################################################################### + # # + # @Full - this sends text to a full-width place on a new page, even # + # if @ChapterStartPages is SamePage. # + # # + ####################################################################### + + def @Full right x + { + def @Any force into { @FullPlace&&following } right x { x } + def @Odd force into { @OddFullPlace&&following } right x { x } + def @Even force into { @EvenFullPlace&&following } right x { x } + + @ChapterStartPages @Case { + { Any SamePage } @Yield @Any x + Odd @Yield @Odd x + Even @Yield @Even x + } + } + + + ####################################################################### + # # + # @ChapterFull - this sends text to a full-width place on a new # + # page, unless @ChapterStartPages is SamePage, in which case it # + # doesn't send the text anywhere. # + # # + ####################################################################### + + def @ChapterFull right x + { + def @Any force into { @FullPlace&&following } right x { x } + def @Odd force into { @OddFullPlace&&following } right x { x } + def @Even force into { @EvenFullPlace&&following } right x { x } + + @ChapterStartPages @Case { + Any @Yield @Any x + Odd @Yield @Odd x + Even @Yield @Even x + SamePage @Yield x + } + } + + + ####################################################################### + # # + # @IntroFull - this sends text to a full-width intro place. # + # # + ####################################################################### + + def @IntroFull right x + { + def @Any force into { @IntroFullPlace&&following } right x { x } + def @Odd force into { @IntroOddFullPlace&&following } right x { x } + def @Even force into { @IntroEvenFullPlace&&following } right x { x } + + @ChapterStartPages @Case { + { Any SamePage } @Yield @Any x + Odd @Yield @Odd x + Even @Yield @Even x + } + } + + + ####################################################################### + # # + # @ChooseFull - this sends either to introfull or ordinary full # + # # + ####################################################################### + + def @ChooseFull right x + { + @SeparateIntroNumbering @Case { + No @Yield @Full x + Yes @Yield @IntroFull x + } + } + + + ####################################################################### + # # + # Book. # + # # + ####################################################################### + + def @Book + named @Tag {} + named @Title {} + named @Author {} + named @Edition {} + named @Publisher {} + named @BeforeTitlePage {} + named @OnTitlePage {} + named @AfterTitlePage {} + named @AtEnd { dft } + named @InitialFont { @InitialFont } + named @InitialBreak { @InitialBreak } + named @InitialOutdent { @InitialOutdent } + named @InitialSpace { @InitialSpace } + named @InitialLanguage { @InitialLanguage } + named @PageOrientation { @PageOrientation } + named @PageHeaders { @PageHeaders } + named @ColumnNumber { @ColumnNumber } + named @FirstPageNumber { @FirstPageNumber } + named @IntroFirstPageNumber { @IntroFirstPageNumber } + named @OptimizePages { @OptimizePages } + named @GlossaryText { @GlossaryText } + named @IndexText { @IndexText } + named @IndexAText { @IndexAText } + named @IndexBText { @IndexBText } + { + def @Before + { + @BeforeTitlePage @Case { + "" @Yield @Null + else @Yield @BeforeTitlePage + } + } + + def @On + { + @OnTitlePage @Case { + "" @Yield { + //1i |0.5rt 2.5f @Font {1.2fx clines} @Break @Title | + //2i |0.5rt clines @Break @Author | + //1i |0.5rt clines @Break @Edition | + //1rt @OneRow @Publisher + } + else @Yield @OnTitlePage + } + } + + def @After + { + @AfterTitlePage @Case { + "" @Yield @Null + else @Yield { @AfterTitlePage // None @Runner } + } + } + + def @ContentsPart + named @Tag {} + { + + @LargeScaleStructure + tag { @Tag } + type { ExtraMajorIntro } + initiallanguage { @InitialLanguage } + title { contents @WordVal @ContentsWord } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + incontents { No } + pnprefix { @ContentsPrefix } + inrunners { Yes } + majortitle { contents @WordVal @ContentsWord } + sendheader { @ChooseFull @Body } + innergap { @SectionGap } + @ContentsSection + } + + def @FigureContentsPart + named @Tag {} + { + @LargeScaleStructure + tag { @Tag } + type { ExtraMajorIntro } + initiallanguage { @InitialLanguage } + title { figurelist @WordVal @FigureListWord } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + incontents { No } + pnprefix { @FigureContentsPrefix } + inrunners { Yes } + majortitle { figurelist @WordVal @FigureListWord } + sendheader { @ChooseFull @Body } + innergap { @SectionGap } + @FigureContentsSection + } + + def @TableContentsPart + named @Tag {} + { + @LargeScaleStructure + tag { @Tag } + type { ExtraMajorIntro } + initiallanguage { @InitialLanguage } + title { tablelist @WordVal @TableListWord } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + incontents { No } + pnprefix { @TableContentsPrefix } + inrunners { Yes } + majortitle { tablelist @WordVal @TableListWord } + sendheader { @ChooseFull @Body } + innergap { @SectionGap } + @TableContentsSection + } + + def @FloaterContentsPart + named @Tag {} + { + @LargeScaleStructure + tag { @Tag } + type { ExtraMajorIntro } + initiallanguage { @InitialLanguage } + title { floaterlist @WordVal @FloaterListWord } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + incontents { No } + pnprefix { @FloaterContentsPrefix } + inrunners { Yes } + majortitle { floaterlist @WordVal @FloaterListWord } + sendheader { @ChooseFull @Body } + innergap { @SectionGap } + @FloaterContentsSection + } + + def @ReferencesPart + named @Tag {} + { + @LargeScaleStructure + tag { @Tag } + type { ExtraMajor } + initiallanguage { @InitialLanguage } + title { @RefHeading @RefListTitle } + majortitle { @RefHeading @RefListTitle } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + incontents { @ReferencesInContents } + contentsindent { @ReferencesContentsIndent } + pnprefix { @ReferencesPrefix } + inrunners { Yes } + sendheader { @ChapterFull @Body } + innergap { @SectionGap } + @ReferencesSection + + } + + def @GlossaryPart + named @Tag {} + { + def @Run + { + NonStart @Runner + @MajorNum {} + @MajorTitle { glossary @WordVal @GlossaryWord } + @MinorNum {} + @MinorTitle { glossary @WordVal @GlossaryWord } + @Owner { @Tag } + @Prefix { @GlossaryPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { glossary @WordVal @GlossaryWord } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + headingtext { @GlossaryText } + incontents { @GlossaryInContents } + contentsindent { @GlossaryContentsIndent } + pnprefix { @GlossaryPrefix } + inrunners { Yes } + sendheader { @Full @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @GlossarySection @Run + } + + def @IndexPart + named @Tag {} + { + def @Run + { + NonStart @Runner + @MajorNum {} + @MajorTitle { index @WordVal @IndexWord } + @MinorNum {} + @MinorTitle { index @WordVal @IndexWord } + @Owner { @Tag } + @Prefix { @IndexPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { index @WordVal @IndexWord } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + headingtext { @IndexText } + incontents { @IndexInContents } + contentsindent { @IndexContentsIndent } + pnprefix { @IndexPrefix } + inrunners { Yes } + sendheader { @Full @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @IndexSection @Run + } + + def @IndexAPart + named @Tag {} + { + def @RunA + { + NonStart @Runner + @MajorNum {} + @MajorTitle { index @WordVal @IndexAWord } + @MinorNum {} + @MinorTitle { index @WordVal @IndexAWord } + @Owner { @Tag } + @Prefix { @IndexAPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { index @WordVal @IndexAWord } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + headingtext { @IndexAText } + incontents { @IndexAInContents } + contentsindent { @IndexAContentsIndent } + pnprefix { @IndexAPrefix } + inrunners { Yes } + sendheader { @Full @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @IndexASection @RunA + } + + def @IndexBPart + named @Tag {} + { + def @RunB + { + NonStart @Runner + @MajorNum {} + @MajorTitle { index @WordVal @IndexBWord } + @MinorNum {} + @MinorTitle { index @WordVal @IndexBWord } + @Owner { @Tag } + @Prefix { @IndexBPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { index @WordVal @IndexBWord } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + headingtext { @IndexBText } + incontents { @IndexBInContents } + contentsindent { @IndexBContentsIndent } + pnprefix { @IndexBPrefix } + inrunners { Yes } + sendheader { @Full @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @IndexBSection @RunB + } + + def @ColophonPart + named @Tag {} + { + def @RunC + { + NonStart @Runner + @MajorNum {} + @MajorTitle { index @WordVal @ColophonWord } + @MinorNum {} + @MinorTitle { index @WordVal @ColophonWord } + @Owner { @Tag } + @Prefix { @ColophonPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { colophon @WordVal @ColophonWord } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + incontents { @ColophonInContents } + contentsindent { @ColophonContentsIndent } + pnprefix { @ColophonPrefix } + inrunners { Yes } + sendheader { @Full @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @ColophonSection @RunC + } + + def @BookIntro force into { @IntroColPlace&&preceding } + named @Optimize { @OptimizePages } + { + @NoLinkPageMark @Tag + // @Before + //1.1b @TitlePageFont @Font @On + //1.1b @After + // Start @Runner @Owner { @Tag } + //1.1b @PrefaceAfterContents @NoDo @PrefacePlace + // @MakeContents @Case { + { Yes Bypass } @Yield @ContentsPart + else @Yield @Null + } + // @MakeFigureContents @Case { + { Yes Bypass } @Yield @FigureContentsPart + else @Yield @Null + } + // @MakeTableContents @Case { + { Yes Bypass } @Yield @TableContentsPart + else @Yield @Null + } + // @MakeFloaterContents @Case { + { Yes Bypass } @Yield @FloaterContentsPart + else @Yield @Null + } + //1.1b @PrefaceAfterContents @Do @PrefacePlace + } + + def @BookBody force into { @ColPlace&&preceding } + named @Optimize { @OptimizePages } + { + # The first component of @BookBody must be indefinite, so that + # its flushing is delayed until we reach the body galleys, either + # @Introduction or @Chapter. If not, @BookBody will free up + # @PrefacePlace etc. too soon, producing a "no @PrefacePlace + # precedes this @PrefacePlace&&preceding" error message. + + @AbbreviationsPlace + // @IntroductionPlace + // @ChapterList @FirstChapterNumber + // @ReferencesBeforeAppendices @Do { + @MakeReferences @Do @ReferencesPart + } + // @AppendixList @FirstAppendixNumber + // @ReferencesBeforeAppendices @NoDo { + @MakeReferences @Do @ReferencesPart + } + // @MakeGlossary @Do @GlossaryPart + // @MakeIndexA @Do @IndexAPart + // @MakeIndexA @Case { + Bypass @Yield @BypassBeginIndexAPlace + else @Yield @Null + } + // @MakeIndexB @Do @IndexBPart + // @MakeIndexB @Case { + Bypass @Yield @BypassBeginIndexBPlace + else @Yield @Null + } + // @MakeIndex @Do @IndexPart + // @MakeIndex @Case { + Bypass @Yield @BypassBeginIndexPlace + else @Yield @Null + } + // @MakeColophon @Do @ColophonPart + } + + def @BookCombined force into { @ColPlace&&preceding } + named @Optimize { @OptimizePages } + { + @NoLinkPageMark @Tag + // @Before + //1.1b @TitlePageFont @Font @On + //1.1b @After + // Start @Runner @Owner { @Tag } + //1.1b @PrefaceAfterContents @NoDo @PrefacePlace + // @MakeContents @Case { + { Yes Bypass } @Yield @ContentsPart + else @Yield @Null + } + // @MakeFigureContents @Case { + { Yes Bypass } @Yield @FigureContentsPart + else @Yield @Null + } + // @MakeTableContents @Case { + { Yes Bypass } @Yield @TableContentsPart + else @Yield @Null + } + // @MakeFloaterContents @Case { + { Yes Bypass } @Yield @FloaterContentsPart + else @Yield @Null + } + //1.1b @PrefaceAfterContents @Do @PrefacePlace + // @AbbreviationsPlace + // @IntroductionPlace + // @ChapterList @FirstChapterNumber + // @ReferencesBeforeAppendices @Do { + @MakeReferences @Do @ReferencesPart + } + // @AppendixList @FirstAppendixNumber + // @ReferencesBeforeAppendices @NoDo { + @MakeReferences @Do @ReferencesPart + } + // @MakeGlossary @Do @GlossaryPart + // @MakeIndexA @Do @IndexAPart + // @MakeIndexA @Case { + Bypass @Yield @BypassBeginIndexAPlace + else @Yield @Null + } + // @MakeIndexB @Do @IndexBPart + // @MakeIndexB @Case { + Bypass @Yield @BypassBeginIndexBPlace + else @Yield @Null + } + // @MakeIndex @Do @IndexPart + // @MakeIndex @Case { + Bypass @Yield @BypassBeginIndexPlace + else @Yield @Null + } + // @MakeColophon @Do @ColophonPart + } + + @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break + @InitialLanguage @Language @InitialSpace @Space + { @ColourCommand @InitialColour } @SetColour + { + + @SeparateIntroNumbering @Case { + + No @Yield { + Yes @BeginAllCounters {} + // Yes @BeginDisplayCounter {} + // Yes @BeginFigureCounter {} + // Yes @BeginTableCounter {} + // Yes @BeginFloaterCounter {} + // @PageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @PageOrientation } + @FirstPageNumber + // @BookCombined + // NonStart @Runner @Owner { @Tag } + // @AtEnd @Case { + dft @Yield @Null + else @Yield + @EvenPage @Orient { @PageOrientation } @AtEnd + } + } + + Yes @Yield { + Yes @BeginAllCounters {} + // Yes @BeginDisplayCounter {} + // Yes @BeginFigureCounter {} + // Yes @BeginTableCounter {} + // Yes @BeginFloaterCounter {} + // @IntroPageList + @ColumnNumber { 1 } + @PageHeaders { @PageHeaders } + @Orient { @PageOrientation } + @IntroFirstPageNumber + # // NonStart @Runner @Owner { @Tag } + // None @Runner @Owner { @Tag } + // @PageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @PageOrientation } + extra { Yes } + @FirstPageNumber + // @BookIntro + // @BookBody + // NonStart @Runner @Owner { @Tag } + // @AtEnd @Case { + dft @Yield @Null + else @Yield + @EvenPage @Orient { @PageOrientation } @AtEnd + } + } + } + } + } + + + ####################################################################### + # # + # Preface. # + # # + ####################################################################### + + export @BeginSubPrefaces @EndSubPrefaces @SubPreface + def @Preface force into { @PrefacePlace&&preceding } + named @Tag {} + named @Title { preface @WordVal @PrefaceWord } + named @RunningTitle { dft } + named @InitialLanguage {} + body @Body + { + def @EndSubPrefacesPlace { @Galley } + + def @EndSubPrefaces force into { @EndSubPrefacesPlace&&preceding } + {} + + macro @BeginSubPrefaces + { //@SubPrefaceGap @SubPrefaceList @FirstSubPrefaceNumber + // @EndSubPrefacesPlace // + } + + def @SubPreface force into { @SubPrefaceList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @SubPrefaceShortNum + { + @SubPrefaceNumbers @Then { + @BypassNumber @Dft { + @SubPrefaceNumbers @Num + { @SectionList&&@Tag @Open { num } } + } + } + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubPrefaceHeadingFont } + headingbreak { @SubPrefaceHeadingBreak } + headingformat { @Num @SubPrefaceHeadingFormat @Body } + incontents { @SubPrefaceInContents } + contentsindent { @SubPrefaceContentsIndent } + numbers { @SubPrefaceNumbers } + attachnum { @SubPrefaceList&&preceding @Tagged @Tag } + retrievenum { @SubPrefaceList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @Null } + majornum { @Null } + majortitle { @Null } + intheorems { @SubPrefaceNumInTheorems } + indisplays { @SubPrefaceNumInDisplays } + infigures { @SubPrefaceNumInFigures } + intables { @SubPrefaceNumInTables } + infloaters { @SubPrefaceNumInFloaters } + inrunners { @SubPrefaceNumInRunners } + newpage { @NewPage } + @Body + } + + @LargeScaleStructure + tag { @Tag } + type { ExtraMajorIntro } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + incontents { @PrefaceInContents } + contentsindent { @PrefaceContentsIndent } + pnprefix { @PrefacePrefix } + sendheader { @ChooseFull @Body } + innergap { @SectionGap } + inrunners { Yes } + @Body + + } + + + ####################################################################### + # # + # Abbreviations. # + # # + ####################################################################### + + def @Abbreviations force into { @AbbreviationsPlace&&preceding } + named @Tag {} + named @Title { abbreviations @WordVal @AbbreviationsWord } + named @RunningTitle { dft } + named @InitialLanguage {} + body @Body + { + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + incontents { @AbbreviationsInContents } + contentsindent { @AbbreviationsContentsIndent } + pnprefix { @AbbreviationsPrefix } + sendheader { @Full @Body } + innergap { @SectionGap } + inrunners { Yes } + @Body + + } + + + ####################################################################### + # # + # Introduction. # + # # + ####################################################################### + + export @BeginSubIntroductions @EndSubIntroductions @SubIntroduction + def @Introduction force into { @IntroductionPlace&&preceding } + named @Tag {} + named @Title { introduction @WordVal @IntroductionWord } + named @RunningTitle { dft } + named @InitialLanguage {} + body @Body + { + + def @EndSubIntroductionsPlace { @Galley } + + def @EndSubIntroductions force into { @EndSubIntroductionsPlace&&preceding } + {} + + macro @BeginSubIntroductions + { //@SubIntroductionGap @SubIntroductionList @FirstSubIntroductionNumber + // @EndSubIntroductionsPlace // + } + + def @SubIntroduction force into { @SubIntroductionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @SubIntroductionShortNum + { + @SubIntroductionNumbers @Then { + @BypassNumber @Dft { + @SubIntroductionNumbers @Num + { @SectionList&&@Tag @Open { num } } + } + } + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubIntroductionHeadingFont } + headingbreak { @SubIntroductionHeadingBreak } + headingformat { @Num @SubIntroductionHeadingFormat @Body } + incontents { @SubIntroductionInContents } + contentsindent { @SubIntroductionContentsIndent } + numbers { @SubIntroductionNumbers } + attachnum { @SubIntroductionList&&preceding @Tagged @Tag } + retrievenum { @SubIntroductionList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @Null } + majornum { @Null } + majortitle { @Null } + intheorems { @SubIntroductionNumInTheorems } + indisplays { @SubIntroductionNumInDisplays } + infigures { @SubIntroductionNumInFigures } + intables { @SubIntroductionNumInTables } + infloaters { @SubIntroductionNumInFloaters } + inrunners { @SubIntroductionNumInRunners } + newpage { @NewPage } + @Body + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + incontents { @IntroductionInContents } + contentsindent { @IntroductionContentsIndent } + pnprefix { @IntroductionPrefix } + sendheader { @Full @Body } + innergap { @SectionGap } + inrunners { Yes } + @Body + } + + + ####################################################################### + # # + # Chapters containing sections and subsections. # + # # + ####################################################################### + + export @BeginSections @EndSections @Section + def @Chapter force into { @ChapterList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage {} + named @PartNumber {} + named @PartTitle {} + named @PartText {} + named @BypassNumber { dft } + named @BypassWord { dft } + body @Body + { + + def @EndSectionsPlace { @Galley } + + def @EndSections force into { @EndSectionsPlace&&preceding } + {} + + macro @BeginSections + { //@SectionGap @SectionList @FirstSectionNumber + // @EndSectionsPlace // + } + + def @ChapterShortNum + { + @ChapterNumbers @Then { + @BypassNumber @Dft { + @ChapterNumbers @Num @ChapterList&&@Tag @Open { num } + } + } + } + + def @MajorNum + { + @ChapterNumbers @Then @InitialLanguage @Language { + # chapter @WordVal @ChapterWord @ChapterShortNum + @BypassWord @Dft {chapter @WordVal @ChapterWord} @ChapterShortNum + } + } + + def @MajorTitle + { + @InitialLanguage @Language { + @RunningTitle @Dft @Title + } + } + + export @BeginSubSections @EndSubSections @SubSection + def @Section force into { @SectionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @EndSubSectionsPlace { @Galley } + + def @EndSubSections force into { @EndSubSectionsPlace&&preceding } + {} + + macro @BeginSubSections + { //@SubSectionGap @SubSectionList @FirstSubSectionNumber + // @EndSubSectionsPlace // + } + + def @SectionShortNum + { + @SectionNumbers @Then { + @BypassNumber @Dft { + @ChapterShortNum @Join @SectionNumbers @Num + { @SectionList&&@Tag @Open { num } } + } + } + } + + export @BeginSubSubSections @EndSubSubSections @SubSubSection + def @SubSection force into { @SubSectionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @EndSubSubSectionsPlace { @Galley } + + def @EndSubSubSections force into + { @EndSubSubSectionsPlace&&preceding } + {} + + macro @BeginSubSubSections + { //@SubSubSectionGap @SubSubSectionList @FirstSubSubSectionNumber + // @EndSubSubSectionsPlace // + } + + def @SubSectionShortNum + { + @SubSectionNumbers @Then { + @BypassNumber @Dft { + @SectionShortNum @Join @SubSectionNumbers @Num + { @SubSectionList&&@Tag @Open { num } } + } + } + } + + def @SubSubSection force into { @SubSubSectionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubSubSectionHeadingFont } + headingbreak { @SubSubSectionHeadingBreak } + headingformat { @Num @SubSubSectionHeadingFormat @Body } + incontents { @SubSubSectionInContents } + contentsindent { @SubSubSectionContentsIndent } + numbers { @SubSubSectionNumbers } + attachnum { @SubSubSectionList&&preceding @Tagged @Tag } + retrievenum { @SubSubSectionList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @SubSectionShortNum } + majornum { @MajorNum } + majortitle { @MajorTitle } + intheorems { @SubSubSectionNumInTheorems } + indisplays { @SubSubSectionNumInDisplays } + infigures { @SubSubSectionNumInFigures } + intables { @SubSubSectionNumInTables } + infloaters { @SubSubSectionNumInFloaters } + inrunners { @SubSubSectionNumInRunners } + newpage { @NewPage } + @Body + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubSectionHeadingFont } + headingbreak { @SubSectionHeadingBreak } + headingformat { @Num @SubSectionHeadingFormat @Body } + incontents { @SubSectionInContents } + contentsindent { @SubSectionContentsIndent } + numbers { @SubSectionNumbers } + attachnum { @SubSectionList&&preceding @Tagged @Tag } + retrievenum { @SubSectionList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @SectionShortNum } + majornum { @MajorNum } + majortitle { @MajorTitle } + intheorems { @SubSectionNumInTheorems } + indisplays { @SubSectionNumInDisplays } + infigures { @SubSectionNumInFigures } + intables { @SubSectionNumInTables } + infloaters { @SubSectionNumInFloaters } + inrunners { @SubSectionNumInRunners } + newpage { @NewPage } + @Body + + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SectionHeadingFont } + headingbreak { @SectionHeadingBreak } + headingformat { @Num @SectionHeadingFormat @Body } + incontents { @SectionInContents } + contentsindent { @SectionContentsIndent } + numbers { @SectionNumbers } + attachnum { @SectionList&&preceding @Tagged @Tag } + retrievenum { @SectionList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @ChapterShortNum } + majornum { @MajorNum } + majortitle { @MajorTitle } + intheorems { @SectionNumInTheorems } + indisplays { @SectionNumInDisplays } + infigures { @SectionNumInFigures } + intables { @SectionNumInTables } + infloaters { @SectionNumInFloaters } + inrunners { @SectionNumInRunners } + newpage { @NewPage } + @Body + + } + + def @Part + named @Tag {} + { + @LargeScaleStructure + type { VeryMajor } + initiallanguage { @InitialLanguage } + title { @PartTitle } + aboveheadinggap { @AbovePartGap } + headingfont { @PartHeadingFont } + headingbreak { @PartHeadingBreak } + headingformat { @Num @PartHeadingFormat @Body } + bypassnumber { @PartNumber } + incontents { @PartInContents } + contentsindent { @PartContentsIndent } + sendheader { @Full @Body } + inrunners { Yes } + tag { @Tag } + @PartText + } + + @PartNumber @Case { + "" @Yield { + @PartTitle @Case { + "" @Yield @Null + else @Yield @Part + } + } + else @Yield @Part + } + // + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + aboveheadinggap { @AboveChapterGap } + headingfont { @ChapterHeadingFont } + headingbreak { @ChapterHeadingBreak } + headingformat { @Num @ChapterHeadingFormat @Body } + incontents { @ChapterInContents } + contentsindent { @ChapterContentsIndent } + # word { chapter @WordVal @ChapterWord } + word { @BypassWord @Dft { chapter @WordVal @ChapterWord } } + numbers { @ChapterNumbers } + attachnum { @ChapterList&&preceding @Tagged @Tag } + retrievenum { @ChapterList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + pnprefix { @ChapterPrefix } + intheorems { @ChapterNumInTheorems } + indisplays { @ChapterNumInDisplays } + infigures { @ChapterNumInFigures } + intables { @ChapterNumInTables } + infloaters { @ChapterNumInFloaters } + sendheader { @ChapterFull @Body } + innergap { @SectionGap } + inrunners { Yes } + @Body + + } + + + ####################################################################### + # # + # Appendices. # + # # + ####################################################################### + + export @BeginSubAppendices @EndSubAppendices @SubAppendix + def @Appendix force into { @AppendixList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage {} + named @PartNumber {} + named @PartTitle {} + named @PartText {} + named @BypassNumber { dft } + body @Body + { + + def @EndSubAppendicesPlace { @Galley } + + def @EndSubAppendices force into { @EndSubAppendicesPlace&&preceding } + {} + + macro @BeginSubAppendices + { //@SubAppendixGap @SubAppendixList @FirstSubAppendixNumber + // @EndSubAppendicesPlace // + } + + def @AppendixShortNum + { + @AppendixNumbers @Then { + @BypassNumber @Dft { + @AppendixNumbers @Num @AppendixList&&@Tag @Open { num } + } + } + } + + def @MajorNum + { + @AppendixNumbers @Then @InitialLanguage @Language { + appendix @WordVal @AppendixWord @AppendixShortNum + } + } + + def @MajorTitle + { + @InitialLanguage @Language { + @RunningTitle @Dft @Title + } + } + + export @BeginSubSubAppendices @EndSubSubAppendices @SubSubAppendix + def @SubAppendix force into { @SubAppendixList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @EndSubSubAppendicesPlace { @Galley } + + def @EndSubSubAppendices force into { @EndSubSubAppendicesPlace&&preceding } + {} + + macro @BeginSubSubAppendices + { //@SubSubAppendixGap @SubSubAppendixList @FirstSubSubAppendixNumber + // @EndSubSubAppendicesPlace // + } + + def @SubAppendixShortNum + { + @SubAppendixNumbers @Then { + @BypassNumber @Dft { + @AppendixShortNum @Join @SubAppendixNumbers @Num + { @SubAppendixList&&@Tag @Open { num } } + } + } + } + + def @SubSubAppendix force into { @SubSubAppendixList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubSubAppendixHeadingFont } + headingbreak { @SubSubAppendixHeadingBreak } + headingformat { @Num @SubSubAppendixHeadingFormat @Body } + incontents { @SubSubAppendixInContents } + contentsindent { @SubSubAppendixContentsIndent } + numbers { @SubSubAppendixNumbers } + attachnum { @SubSubAppendixList&&preceding @Tagged @Tag } + retrievenum { @SubSubAppendixList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @SubAppendixShortNum } + majornum { @MajorNum } + majortitle { @MajorTitle } + intheorems { @SubSubAppendixNumInTheorems } + indisplays { @SubSubAppendixNumInDisplays } + infigures { @SubSubAppendixNumInFigures } + intables { @SubSubAppendixNumInTables } + infloaters { @SubSubAppendixNumInFloaters } + inrunners { @SubSubAppendixNumInRunners } + newpage { @NewPage } + @Body + + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubAppendixHeadingFont } + headingbreak { @SubAppendixHeadingBreak } + headingformat { @Num @SubAppendixHeadingFormat @Body } + incontents { @SubAppendixInContents } + contentsindent { @SubAppendixContentsIndent } + numbers { @SubAppendixNumbers } + attachnum { @SubAppendixList&&preceding @Tagged @Tag } + retrievenum { @SubAppendixList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @AppendixShortNum } + majornum { @MajorNum } + majortitle { @MajorTitle } + intheorems { @SubAppendixNumInTheorems } + indisplays { @SubAppendixNumInDisplays } + infigures { @SubAppendixNumInFigures } + intables { @SubAppendixNumInTables } + infloaters { @SubAppendixNumInFloaters } + inrunners { @SubAppendixNumInRunners } + newpage { @NewPage } + @Body + + } + + def @Part + named @Tag {} + { + @LargeScaleStructure + type { VeryMajor } + initiallanguage { @InitialLanguage } + title { @PartTitle } + aboveheadinggap { @AbovePartGap } + headingfont { @PartHeadingFont } + headingbreak { @PartHeadingBreak } + headingformat { @Num @PartHeadingFormat @Body } + bypassnumber { @PartNumber } + incontents { @PartInContents } + contentsindent { @PartContentsIndent } + sendheader { @Full @Body } + inrunners { Yes } + tag { @Tag } + @PartText + } + + @PartNumber @Case { + "" @Yield { + @PartTitle @Case { + "" @Yield @Null + else @Yield @Part + } + } + else @Yield @Part + } + // + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + aboveheadinggap { @AboveChapterGap } + headingfont { @AppendixHeadingFont } + headingbreak { @AppendixHeadingBreak } + headingformat { @Num @AppendixHeadingFormat @Body } + incontents { @AppendixInContents } + contentsindent { @AppendixContentsIndent } + word { appendix @WordVal @AppendixWord } + numbers { @AppendixNumbers } + attachnum { @AppendixList&&preceding @Tagged @Tag } + retrievenum { @AppendixList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + pnprefix { @AppendixPrefix } + intheorems { @AppendixNumInTheorems } + indisplays { @AppendixNumInDisplays } + infigures { @AppendixNumInFigures } + intables { @AppendixNumInTables } + infloaters { @AppendixNumInFloaters } + sendheader { @ChapterFull @Body } + innergap { @SubAppendixGap } + inrunners { Yes } + @Body + + } + + + ####################################################################### + # # + # Colophon. # + # # + ####################################################################### + + def @Colophon into { @ColophonList&&preceding } + named @Tag {} + named @InitialLanguage {} + body @Body + { + + @InitialLanguage @Language @Body + + } + + +@End @BookSetup diff --git a/include/include/bsf b/include/include/bsf new file mode 100644 index 0000000..6c8959e --- /dev/null +++ b/include/include/bsf @@ -0,0 +1,1929 @@ + +############################################################################### +# # +# Lout @BasicSetup package # +# # +# Jeffrey H. Kingston # +# # +# This package contains basic symbols used widely throughout many # +# documents, for font changes, particular characters, standard words in # +# the current language, date and time, paragraphs, lists, colours, # +# rules, and boxes. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +@SysInclude { lengths } # @PSLengths +@SysInclude { coltex } # @ColourCommand and @TextureCommand +@SysPrependGraphic { bsf.lpg } # rules, boxes, margin note setup + + +############################################################################### +# # +# The following symbols are defined outside @BasicSetup so that # +# they can be invoked when setting its parameters in the @Use clause. # +# # +############################################################################### + +def @OrIfPlain + precedence 80 + left x + right y +{ + @BackEnd @Case { + PlainText @Yield y + else @Yield x + } +} + + +def @ZeroSize right x +{ + @HContract @VContract { ^/0io |0io @OneCol @OneRow x |0io /0io } +} + + +########################################################################### +# # +# @Place: places an object at an arbitrary point on the page. # +# # +########################################################################### + +# +# VT: the expressions in the braces will work for PostScript but not for PDF +# they should be modified in the way the "named c { " cm" }" blocks were modified above +# but since the point of @Place is to output a matrix (?), I have not implemented this +# +def @Place + import @PSLengths named x + named "+" precedence 96 associativity left left a right b { a b "add" } + named "-" precedence 96 associativity left left a right b { a b "sub" } + named "/" precedence 97 associativity left left a right b { a b "div" } + named "*" precedence 98 associativity left left a right b { a b "mul" } + { 0 } + import @PSLengths named y + named "+" precedence 96 associativity left left a right b { a b "add" } + named "-" precedence 96 associativity left left a right b { a b "sub" } + named "/" precedence 97 associativity left left a right b { a b "div" } + named "*" precedence 98 associativity left left a right b { a b "mul" } + { 0 } + right val +{ + @ZeroSize { + @BackEnd @Case { + PlainText @Yield "" + PostScript @Yield { + { "LoutPageDict begin matr setmatrix" x y "translate end gsave" + // "grestore" } @Graphic val + } + else @Yield { { "% @Place UNIMPLEMENTED" } @Graphic val # VT: PDF currently has no output + } + } + } +} + + +########################################################################### +# # +# @Colour, @Color # +# # +########################################################################### + +def @Colour @Color left col right y { {@ColourCommand col} @SetColour y } + + +########################################################################### +# # +# @ColouredUnderline, @ColoredUnderline # +# # +########################################################################### + +def @ColouredUnderline @ColoredUnderline left col right y { + {@ColourCommand col} @SetUnderlineColour @Underline y +} + + +########################################################################### +# # +# @Texture # +# # +########################################################################### + +def @Texture + left type + named scale { 1 } + named hscale { 1 } + named vscale { 1 } + import @PSLengths named angle { 0d } + import @PSLengths named hshift { 0i } + import @PSLengths named vshift { 0i } + import @PSLengths named width { "dft" } + import @PSLengths named height { "dft" } + import @PSLengths named gap { "dft" } + import @PSLengths named radius { "dft" } + import @PSLengths named linewidth { "dft" } + named font { "dft" } + import @PSLengths named size { "dft" } + named value { "dft" } + right x +{ + { type @TextureCommand + scale { scale } + hscale { hscale } + vscale { vscale } + angle { angle } + hshift { hshift } + vshift { vshift } + width { width } + height { height } + gap { gap } + radius { radius } + linewidth { linewidth } + font { font } + size { size } + value { value } + } @SetTexture x +} + + +############################################################################### +# # +# Symbols exported by @BasicSetup. # +# # +############################################################################### + +export + + @InitialFont @InitialBreak @InitialOutdent @InitialSpace @InitialLanguage + @InitialColour @InitialBackgroundColour @OptimizePages @HeadingFont + @ParaGap @ParaIndent @DisplayGap @DisplayIndent @DefaultIndent + @DisplayNumStyle @WideIndent @VeryWideIndent + @ListGap @ListIndent @ListRightIndent + @ListLabelWidth @ListLabelRight @ListLabelRightGap @ListFont @ListBreak + @NumberSeparator + + @Pipe @PipeVerbatim @PipeRawVerbatim + + @Word @Roman @UCRoman @Alpha @UCAlpha @FnBullets @FnSymbols + @Months @ShortMonths @WeekDays @ShortWeekDays + @TwelveHours @ShortHours @MeriDiems @ShortMeriDiems + + @Sym @Ding @R @I @B @BI @S @F @II + "~" "~~" "``" "''" ",," "--" "---" "..." + + @Bullet @ParSym @SectSym @Dagger @DaggerDbl @CDot @Sterling @Yen @Florin + @Star @Degree @Minute @Second @Multiply @Divide @Lozenge @Register + @CopyRight @TradeMark @Euro + + @Date @Time @DateTimeFormat @DropCapTwo @DropCapThree @Centre @Right + @NoDotSep @NoDotJoin @Join @Sep @DotSep @ColonSep @DotJoin @DashJoin + @NumSep @VStrut @ZeroWidth @ZeroHeight @OverStrike @Sup @Sub @HClip @VClip + @FullWidthRule @LocalWidthRule @Box @CurveBox @ShadowBox @BoundaryMarks + @DocInfo @NumberMarker @NumberOf @TitleMarker @TitleOf + @PageMarker @PageMark @NoLinkPageMark @PageOf @PageParityOf + @CrossLink @ExternalLink + + @BeginDisplayCounter + + @Heading "^" "&-" @If @Not @And @Or @True + @PP @LP @LLP @DP @LOP @NP @CNP + + @BeginAlignedDisplays + @EndAlignedDisplays + + @Display + @LeftDisplay + @IndentedDisplay + @QuotedDisplay + @CentredDisplay + @RightDisplay + @AlignedDisplay + @LeftAlignedDisplay + @IndentedAlignedDisplay + @QuotedAlignedDisplay + @CentredAlignedDisplay + @RightAlignedDisplay + @NumberedDisplay + @LeftNumberedDisplay + @IndentedNumberedDisplay + @QuotedNumberedDisplay + @CentredNumberedDisplay + @RightNumberedDisplay + @AlignedNumberedDisplay + @LeftAlignedNumberedDisplay + @IndentedAlignedNumberedDisplay + @QuotedAlignedNumberedDisplay + @CentredAlignedNumberedDisplay + @RightAlignedNumberedDisplay + + @RawDisplay + @RawLeftDisplay + @RawIndentedDisplay + @RawQuotedDisplay + @RawCentredDisplay + @RawRightDisplay + @RawAlignedDisplay + @RawLeftAlignedDisplay + @RawIndentedAlignedDisplay + @RawQuotedAlignedDisplay + @RawCentredAlignedDisplay + @RawRightAlignedDisplay + @RawNumberedDisplay + @RawLeftNumberedDisplay + @RawIndentedNumberedDisplay + @RawQuotedNumberedDisplay + @RawCentredNumberedDisplay + @RawRightNumberedDisplay + @RawAlignedNumberedDisplay + @RawLeftAlignedNumberedDisplay + @RawIndentedAlignedNumberedDisplay + @RawQuotedAlignedNumberedDisplay + @RawCentredAlignedNumberedDisplay + @RawRightAlignedNumberedDisplay + + @ListItem + @ParagraphItem + @ListInterruptItem + @ListNewPage + @DropListItem + @TagItem + @DropTagItem + + @EndList + @RawEndList + + @RawList + @RawLeftList + @RawIndentedList + @RawQuotedList + @RawCentredList @RawCenteredList + @RawNumberedList + @RawParenNumberedList + @RawRomanList + @RawParenRomanList + @RawUCRomanList + @RawParenUCRomanList + @RawAlphaList + @RawParenAlphaList + @RawUCAlphaList + @RawParenUCAlphaList + @RawBulletList + @RawStarList + @RawDashList + @RawTaggedList + @RawWideTaggedList + @RawVeryWideTaggedList + + @List + @LeftList + @IndentedList + @QuotedList + @CentredList @CenteredList + @NumberedList + @ParenNumberedList + @RomanList + @ParenRomanList + @UCRomanList + @ParenUCRomanList + @AlphaList + @ParenAlphaList + @UCAlphaList + @ParenUCAlphaList + @BulletList + @StarList + @DashList + @TaggedList + @WideTaggedList + @VeryWideTaggedList + + +############################################################################### +# # +# The @BasicSetup package. # +# # +############################################################################### + +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 @InitialBackgroundColour { white } # initial background 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 + named @DisplayIndent { 2.0f @OrIfPlain 5s } # @IndentedDisplay indent + named @DefaultIndent { 0.5rt } # @Display indent + named @DisplayNumStyle + right num { (num) } # display number style + named @WideIndent { 4.0f @OrIfPlain 10s } # @WideTaggedList indent + named @VeryWideIndent { 8.0f @OrIfPlain 20s } # @VeryWideTaggedList indent + named @ListOuterGap { 1.0v @OrIfPlain 1f } # gap before, after list + named @ListGap { 1.0v @OrIfPlain 1f } # gap between list items + named @ListIndent { 0s } # indent of list items + named @ListRightIndent{ 0s } # right indent of list items + named @ListLabelWidth { 2.0f @OrIfPlain 5s } # width allowed for list tags + named @ListLabelRight { No } # right align label + named @ListLabelRightGap { 2s } # right align gap + named @ListFont { } # font style of list item + named @ListBreak { } # break style of list item + named @NumberSeparator{ . } # separates numbers like 2.3.7 + import @BasicSetup + named @CrossLinkFormat + right @Body { @Body } # format for cross links + import @BasicSetup + named @ExternalLinkFormat + right @Body { @Body } # format for external links +@Begin + + ########################################################################### + # # + # x @Dft y # + # # + # This returns x unless its value is "dft", in which case it returns y. # + # Useful for defaulting the value of one parameter to another. # + # # + ########################################################################### + + def @Dft + left x + right y + { + x @Case { + dft @Yield y + else @Yield x + } + } + + + ########################################################################### + # # + # @Pipe, @PipeVerbatim, and @PipeRawVerbatim # + # # + ########################################################################### + + def @Pipe + left command + right x + { + def @Filter { "cat" @FilterIn "|" command ">" @FilterOut } + + x + } + + def @PipeVerbatim + left command + right x + { + def @Filter { + "(echo @Verbatim @Begin ; (cat" @FilterIn "|" command "); echo @End @Verbatim ) >" @FilterOut } + + x + } + + def @PipeRawVerbatim + left command + right x + { + def @Filter { + "(echo @RawVerbatim @Begin ; (cat" @FilterIn "|" command "); echo @End @RawVerbatim ) >" @FilterOut } + + x + } + + + ########################################################################### + # # + # @Sym, @Ding font symbols, and miscellaneous special characters. # + # # + ########################################################################### + + def @Sym right x { { Symbol Base } @Font @Char x } + def @Ding right x { { Dingbats Base } @Font @Char x } + + def @R right x { Base @Font x } + def @I right x { Slope @Font x } + 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 { @FixedWidthFont @Font x } + + def @II + right x + { + { @CurrFace @Case { + Bold @Yield BoldSlope + else @Yield Slope + } } @Font x + } + + def "~" left x right y { x &1su y } + def "~~" left x right y { x &2s y } + + def "``" { @Char "quotedblleft" @OrIfPlain "``" } + def "''" { @Char "quotedblright" @OrIfPlain "''" } + def ",," { @Char "quotedblbase" @OrIfPlain ",," } + def "--" { @Char "endash" @OrIfPlain "--" } + def "---" { @Char "emdash" @OrIfPlain "---"} + def "..." { @Char "ellipsis" @OrIfPlain "..."} + def @Bullet { @Char "bullet" @OrIfPlain "o" } + def @ParSym { @Char "paragraph" @OrIfPlain "P" } + def @SectSym { @Char "section" @OrIfPlain "$" } + def @Dagger { @Char "dagger" @OrIfPlain "+" } + def @DaggerDbl { @Char "daggerdbl" @OrIfPlain "++" } + def @CDot { @Char "periodcentered" @OrIfPlain "." } + def @Sterling { @Char "sterling" @OrIfPlain "&" } + def @Yen { @Char "yen" @OrIfPlain "Y" } + def @Florin { @Char "florin" @OrIfPlain "f" } + + def @Star { @Sym "asteriskmath" @OrIfPlain "*" } + def @Degree { @Sym "degree" @OrIfPlain "o" } + def @Minute { @Sym "minute" @OrIfPlain "'" } + def @Second { @Sym "second" @OrIfPlain "''" } + def @Multiply { @Sym "multiply" @OrIfPlain "x" } + def @Divide { @Sym "divide" @OrIfPlain "/" } + def @Lozenge { @Sym "lozenge" @OrIfPlain "O" } + def @Register { @Sym "registersans" @OrIfPlain "R" } + def @CopyRight { @Sym "copyrightsans" @OrIfPlain "C" } + def @TradeMark { @Sym "trademarksans" @OrIfPlain "TM" } + + def @Euro + { + @BackEnd @Case { + + PostScript @Yield { + 0.65w @VShift @VContract @HContract + "xsize ysize ysize 0.07 mul louteuro" @Graphic { + 0.7f @High 0.735f @Wide + } + } + + PDF @Yield { EUR } + + PlainText @Yield { EUR } + } + } + + + ########################################################################### + # # + # Symbols stored in the "standard" database # + # # + # @Word language-spacific words such as Chapter, etc. # + # @Roman lower case Roman numerals i, ii, ... , cc # + # @UCRoman upper case Roman numerals I, II, ... , CC # + # @Alpha lower case Roman alphabet a, b, ... , z # + # @UCAlpha upper case Roman alphabet A, B, ... , Z # + # @FnBullets bullets as footnote markers # + # @FnSymbols traditional footnote symbols asterisk, dagger, etc. # + # @Months months of the year: January, ... , December # + # @ShortMonths months of the year, abbreviated: Jan, ..., Dec # + # @WeekDays days of the week: Sunday, ... , Saturday # + # @ShortWeekDays days of the week, abbreviated: Sun, ... , Sat # + # @TwelveHours hours, from 1 to 12 # + # @ShortHours hours, from 0 to 23 # + # @DateTimeFormat format of results of @Date and @Time # + # # + ########################################################################### + + def @Word left @Tag right @Val { @Val } + def @Roman left @Tag right @Val { @Val } + def @UCRoman left @Tag right @Val { @Val } + def @Alpha left @Tag right @Val { @Val } + def @UCAlpha left @Tag right @Val { @Val } + def @FnBullets left @Tag right @Val { @Val } + def @FnSymbols left @Tag right @Val { @Val } + def @Months left @Tag right @Val { @Val } + def @ShortMonths left @Tag right @Val { @Val } + def @WeekDays left @Tag right @Val { @Val } + def @ShortWeekDays left @Tag right @Val { @Val } + def @TwelveHours left @Tag right @Val { @Val } + def @ShortHours left @Tag right @Val { @Val } + def @MeriDiems left @Tag right @Val { @Val } + def @ShortMeriDiems left @Tag right @Val { @Val } + + export @Value + def @DateTimeFormat left @Tag + named @Value + named @Year {} + named @ShortYear {} + named @Month {} + named @ShortMonth {} + named @MonthNum {} + named @Day {} + named @ShortDay {} + named @DayNum {} + named @MeriDiem {} + named @ShortMeriDiem {} + named @Hour {} + named @TwelveHour {} + named @ShortHour {} + named @Minute {} + named @Second {} + {} + {} + + @SysDatabase @Word @Roman @UCRoman @Alpha @UCAlpha @FnBullets @FnSymbols + @Months @ShortMonths @WeekDays @ShortWeekDays @TwelveHours + @ShortHours @MeriDiems @ShortMeriDiems @DateTimeFormat + { standard } + + + ########################################################################### + # # + # @Date and @Time: the date and time now. # + # # + ########################################################################### + + def @Date + named @Format + named @Year { @Moment&&now @Open { {@Century}@Year }} + named @ShortYear { @Moment&&now @Open { @Year }} + named @Month { @Moment&&now @Open { @Months&&@Month }} + named @ShortMonth { @Moment&&now @Open { @ShortMonths&&@Month }} + named @MonthNum { @Moment&&now @Open { @Month }} + named @Day { @Moment&&now @Open { @WeekDays&&@WeekDay }} + named @ShortDay { @Moment&&now @Open { @ShortWeekDays&&@WeekDay}} + named @DayNum { @Moment&&now @Open { @Day }} + named @MeriDiem { @Moment&&now @Open { @MeriDiems&&@Hour }} + named @ShortMeriDiem{ @Moment&&now @Open { @ShortMeriDiems&&@Hour }} + named @Hour { @Moment&&now @Open { @Hour }} + named @TwelveHour { @Moment&&now @Open { @TwelveHours&&@Hour }} + named @ShortHour { @Moment&&now @Open { @ShortHours&&@Hour }} + named @Minute { @Moment&&now @Open { @Minute }} + named @Second { @Moment&&now @Open { @Second }} + { + @DateTimeFormat&&date @Open { @Value + @Year { @Year } + @ShortYear { @ShortYear } + @Month { @Month } + @ShortMonth { @ShortMonth } + @MonthNum { @MonthNum } + @Day { @Day } + @ShortDay { @ShortDay } + @DayNum { @DayNum } + @MeriDiem { @MeriDiem } + @ShortMeriDiem { @ShortMeriDiem } + @Hour { @Hour } + @TwelveHour { @TwelveHour } + @ShortHour { @ShortHour } + @Minute { @Minute } + @Second { @Second } + } + } + { @Format } + + def @Time + named @Format + named @Year { @Moment&&now @Open { {@Century}@Year }} + named @ShortYear { @Moment&&now @Open { @Year }} + named @Month { @Moment&&now @Open { @Months&&@Month }} + named @ShortMonth { @Moment&&now @Open { @ShortMonths&&@Month }} + named @MonthNum { @Moment&&now @Open { @Month }} + named @Day { @Moment&&now @Open { @WeekDays&&@WeekDay }} + named @ShortDay { @Moment&&now @Open { @ShortWeekDays&&@WeekDay}} + named @DayNum { @Moment&&now @Open { @Day }} + named @MeriDiem { @Moment&&now @Open { @MeriDiems&&@Hour }} + named @ShortMeriDiem{ @Moment&&now @Open { @ShortMeriDiems&&@Hour }} + named @Hour { @Moment&&now @Open { @Hour }} + named @TwelveHour { @Moment&&now @Open { @TwelveHours&&@Hour }} + named @ShortHour { @Moment&&now @Open { @ShortHours&&@Hour }} + named @Minute { @Moment&&now @Open { @Minute }} + named @Second { @Moment&&now @Open { @Second }} + { + @DateTimeFormat&&time @Open { @Value + @Year { @Year } + @ShortYear { @ShortYear } + @Month { @Month } + @ShortMonth { @ShortMonth } + @MonthNum { @MonthNum } + @Day { @Day } + @ShortDay { @ShortDay } + @DayNum { @DayNum } + @MeriDiem { @MeriDiem } + @ShortMeriDiem { @ShortMeriDiem } + @Hour { @Hour } + @TwelveHour { @TwelveHour } + @ShortHour { @ShortHour } + @Minute { @Minute } + @Second { @Second } + } + } + { @Format } + + + ########################################################################### + # # + # @DropCapTwo and @DropCapThree # + # # + ########################################################################### + + def @DropCapTwo + left y + named height { 1.5v } + right x + { + def @ParPlace { @Galley } + def @EndParPlace { @Galley } + + def @LineList + { + @PAdjust @ParPlace + //1vx @LineList + } + + def @ParGalley horizontally into { @ParPlace&&preceding } + right x + { + x + } + + def @EndPar force into { @EndParPlace&&following } { @Null } + + def @Cap + { + -0.25f @VShift 1.0w @VShift { + -90d @Rotate height @Wide @Scale 90d @Rotate y + } + } + + |1s @PAdjust @ParPlace + /1vo @Cap @ParGalley {x & @EndPar &1rt } | @PAdjust @ParPlace + //1vx @LineList + // @EndParPlace + } + + def @DropCapThree + left y + named height { 2.5v } + right x + { + def @ParPlace { @Galley } + def @EndParPlace { @Galley } + + def @LineList + { + @PAdjust @ParPlace + //1vx @LineList + } + + def @ParGalley force horizontally into { @ParPlace&&preceding } + right x + { + x + } + + def @EndPar force into { @EndParPlace&&following } { @Null } + + def @Cap + { + -0.25f @VShift 1.0w @VShift { + -90d @Rotate height @Wide @Scale 90d @Rotate y + } + } + + |1s @PAdjust @ParPlace + /1vo @ParGalley { x & @EndPar &1rt } | @PAdjust @ParPlace + /1vo @Cap | @PAdjust @ParPlace + //1vx @LineList + // @EndParPlace + } + + + ########################################################################### + # # + # @Centre, @Center, @Right, @NoDotSep, @NoDotJoin, @DotSep, # + # @ColonSep, @DotJoin, @DashJoin, @NumSep # + # # + ########################################################################### + + macro @Centre @Center { |0.5rt @HContract } + + def @Right + precedence 50 + left x + right y + { x |1.0rt @OneCol { 2f @Wide {} | y } } + + def @NoDotSep left x right y + { + x @Case { + {} @Yield y + else @Yield { + y @Case { + {} @Yield x + else @Yield { x |2s y } + } + } + } + } + + def @NoDotJoin left x right y + { + x @Case { + {} @Yield y + else @Yield { + y @Case { + {} @Yield x + else @Yield { x{y} } + } + } + } + } + + def @DotSep left x right y + { + x @Case { + {} @Yield y + else @Yield { + y @Case { + {} @Yield x + else @Yield { x. |2s y } + } + } + } + } + + def @ColonSep left x right y + { + x @Case { + {} @Yield y + else @Yield { + y @Case { + {} @Yield x + else @Yield { x: |2s y } + } + } + } + } + + def @DotJoin left x right y + { + x @Case { + {} @Yield y + else @Yield { + y @Case { + {} @Yield x + else @Yield { x.y } + } + } + } + } + + def @DashJoin left x right y + { + x @Case { + {} @Yield y + else @Yield { + y @Case { + {} @Yield x + else @Yield { x--y } + } + } + } + } + + def @NumSep left x right y + { + x @Case { + {} @Yield y + else @Yield { + y @Case { + {} @Yield x + else @Yield { + @CurrLang @Case { + Hungarian @Yield { y. x } + else @Yield { x y } + } + } + } + } + } + } + + + ########################################################################### + # # + # @VStrut, @ZeroWidth, @ZeroHeight # + # # + ########################################################################### + + + def @VStrut + named above { 0.5f } + named below { 0.5f } + right x + { + x &0iu @VContract { above @High ^/ below @High } + } + + + def @ZeroWidth right x { @HContract { |0io x |0io } } + + def @ZeroHeight right x { @VContract { /0io x /0io } } + + + ########################################################################### + # # + # @OverStrike, @Sup and @Sub # + # # + ########################################################################### + + def @OverStrike left x right y + { + @OneRow { @HContract @VContract x /0io @HContract @VContract y } + } + + def @Sup + left x + named gap { 0.40fk } + right y + { + @HContract @VContract + { + | 0.7f @Font y ^/gap x + } + } + + def @Sub + left x + named gap { 0.40fk } + right y + { + @HContract @VContract + { + x /gap | 0.7f @Font y + } + } + + + ########################################################################### + # # + # @HClip and @VClip # + # # + ########################################################################### + + def @HClip + named shift { 0.0 } + right x + { + { "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto 0 ysize lineto" + "closepath clip gsave" // "grestore" } @Graphic + { + |{{shift}"rt"} @ZeroWidth {{shift}"w"} @HShift x | + } + } + + def @VClip + named shift { 0.0 } + right x + { + { "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto 0 ysize lineto" + "closepath clip gsave" // "grestore" } @Graphic + { + /{{shift}"rt"} @ZeroHeight {{shift}"w"} @VShift x / + } + } + + + ########################################################################### + # # + # @AddPaint, @StrokeCommand # + # # + ########################################################################### + + def @AddPaint + left col + right texture + { + col @Case { + none @Yield "" + nochange @Yield { + @BackEnd @Case { + PostScript @Yield { "gsave" texture "fill grestore" } + PDF @Yield { "q f Q" } + PlainText @Yield { "" } + } + } + else @Yield { + @BackEnd @Case { + PostScript @Yield {"gsave" @ColourCommand col texture "fill grestore"} + PDF @Yield { "q" @ColourCommand col "f Q" } + PlainText @Yield { "" } + } + } + } + } + + def @StrokeCommand right linewidth + { + @BackEnd @Case { + PostScript @Yield { + linewidth @Case { + "" @Yield { "stroke" } + none @Yield { } + else @Yield { linewidth "setlinewidth stroke" } + } + } + PDF @Yield { + linewidth @Case { + "" @Yield { "S" } + none @Yield { } + else @Yield { linewidth "w S" } + } + } + else @Yield "" + } + } + + + + ########################################################################### + # # + # @FullWidthRule, @Box, @CurveBox, and @ShadowBox # + # # + ########################################################################### + + def @FullWidthRule + import @PSLengths named linewidth {} + { + @BackEnd @Case { + + PostScript @Yield @HExpand { + { "LoutRule" @StrokeCommand linewidth } @Graphic { 0.5p @High } + } + + PDF @Yield @HExpand { + { "0 0 m __xsize 0 l" @StrokeCommand linewidth } @Graphic { 0.5p @High } + } + + PlainText @Yield { "-" @PlainGraphic 1f @High } + } + } + + def @LocalWidthRule + import @PSLengths named linewidth {} + { + @BackEnd @Case { + + PostScript @Yield { + { "LoutRule" @StrokeCommand linewidth } @Graphic { 0.5p @High } + } + + PDF @Yield { + { "0 0 m __xsize 0 l" @StrokeCommand linewidth } @Graphic { 0.5p @High } + } + + PlainText @Yield { "-" @PlainGraphic 1f @High } + } + } + + def @Box + named margin { 0.3f } + import @PSLengths named linewidth {} + named paint { none } + import @TextureImport named texture {} + right x + { + @BackEnd @Case { + + PostScript @Yield @VContract @HContract 0c @HShift { + {"LoutBox" paint @AddPaint texture @StrokeCommand linewidth } + @Graphic + { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } + } + + PDF @Yield @VContract @HContract 0c @HShift { + { "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h" + paint @AddPaint texture @StrokeCommand linewidth } @Graphic + { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } + } + + PlainText @Yield @VContract @HContract 0c @HShift { + ^/margin ^|margin 0c @HShift @OneRow x |margin /margin + } + } + } + + def @CurveBox + named margin { 0.3f } + import @PSLengths named linewidth {} + named paint { none } + import @TextureImport named texture {} + right x + { + def @PDFStuff + { + "__xmark 0 m" + "__sub(__xsize, __xmark) 0 l" + "__sub(__xsize, __div(__mul(11, __xmark), 24)) 0" + "__xsize __div(__mul(11, __xmark), 24)" + "__xsize __xmark c" + "__xsize __sub(__ysize, __xmark) l" + "__xsize __sub(__ysize, __div(__mul(11, __xmark), 24))" + "__sub(__xsize, __div(__mul(11, __xmark), 24)) __ysize" + "__sub(__xsize, __xmark) __ysize c" + "__xmark __ysize l" + "__div(__mul(11, __xmark), 24) __ysize" + "0 __sub(__ysize, __div(__mul(11, __xmark), 24))" + "0 __sub(__ysize, __xmark) c" + "0 __xmark l" + "0 __div(__mul(11, __xmark), 24)" + "__div(__mul(11, __xmark), 24) 0" + "__xmark 0 c" + "h" + paint @AddPaint texture @StrokeCommand linewidth + } + + @VContract @HContract 0c @HShift @BackEnd @Case { + + PostScript @Yield { + {"LoutCurveBox" paint @AddPaint texture @StrokeCommand linewidth } + @Graphic + { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } + } + + PlainText @Yield { + ^/margin ^|margin 0c @HShift @OneRow x |margin /margin + } + + PDF @Yield { + @PDFStuff @Graphic + { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } + } + } + } + + def @ShadowBox + named margin { 0.3f } + import @PSLengths named linewidth {} + named paint { none } + import @TextureImport named texture {} + named shadow { 0.2f } + right x + { + @VContract @HContract 0c @HShift @BackEnd @Case { + + PostScript @Yield { + "LoutShadowBox fill" @Graphic + { ^/shadow ^|shadow 0c @HShift + @Box + margin {margin} + paint {paint} + texture { texture } + linewidth {linewidth} x + |shadow /shadow + } + } + + PlainText @Yield { + ^/shadow ^|shadow 0c @HShift + @Box + margin { margin } + paint { paint } + texture { texture } + linewidth {linewidth} x + |shadow /shadow + } + + PDF @Yield { + { + "__mul(__xmark, 2) 0 m __xsize 0 l" + "__xsize __sub(__ysize, __mul(__xmark, 2)) l" + "__sub(__xsize, __xmark) __sub(__ysize, __mul(__xmark, 2)) l" + "__sub(__xsize, __xmark) __xmark l" + "__mul(__xmark, 2) __xmark l h f" + } + @Graphic + { ^/shadow ^|shadow 0c @HShift + @Box + margin { margin } + paint { paint } + texture { texture } + linewidth { linewidth } x + |shadow /shadow + } + } + } + } + + + ########################################################################### + # # + # @BoundaryMarks # + # # + ########################################################################### + + def @BoundaryMarks + import @PSLengths named linewidth { 0.2p } + import @PSLengths named length { 0.5c } + import @PSLengths named gap { 0.5c } + import @PSLengths named lout { 0c } + import @PSLengths named rout { 0c } + import @PSLengths named uout { 0c } + import @PSLengths named dout { 0c } + { + def @UpStroke { "0" gap "rmoveto" "0" length "rlineto" } + def @DownStroke { "0" gap "neg" "rmoveto" "0" length "neg rlineto" } + def @LeftStroke { gap "neg" "0" "rmoveto" length "neg" "0 rlineto" } + def @RightStroke { gap "0" "rmoveto" length "0 rlineto" } + + def @LLSpot { lout "neg" dout "neg" moveto } + def @LRSpot { xsize rout "add" dout "neg" moveto } + def @ULSpot { lout "neg" ysize uout "add" moveto } + def @URSpot { xsize rout "add" ysize uout "add" moveto } + + def @PDFStuff { + "__sub(-"gap", "lout") __sub(0, "dout") m " + "__sub(__sub(-"gap", "lout"), "length") __sub(0, "dout") l" + "__sub(0, "lout") __sub(-"gap", "dout") m " + "__sub(0, "lout") __sub(__sub(-"gap", "dout"), "length") l" + "__add(__xsize,"rout") __sub(-"gap", "dout") m " + "__add(__xsize,"rout") __sub(__sub(-"gap", "dout"), "length") l" + "__add(__add(__xsize,"rout"),"gap") __sub(0, "dout") m " + "__add(__add(__add(__xsize,"rout"),"gap"),"length") __sub(0, "dout") l" + " __sub(__sub(0, "lout"), "gap") __add(__ysize, "uout") m " + "__sub(__sub(__sub(0, "lout"), "gap"), "length") __add(__ysize, "uout") l" + "__sub(0, "lout") __add(__add(__ysize, "uout"), "gap") m " + "__sub(0, "lout") __add(__add(__add(__ysize, "uout"), "gap"), "length") l" + " __add(__add(__xsize, "rout"), "gap") __add(__ysize, "uout") m " + "__add(__add(__add(__xsize, "rout"), "gap"), "length") __add(__ysize, "uout") l" + "__add(__xsize, "rout") __add(__add(__ysize, "uout"), "gap") m " + "__add(__xsize, "rout") __add(__add(__add(__ysize, "uout"), "gap"), "length") l" + + linewidth "w S" + } + + @BackEnd @Case { + + PostScript @Yield { + { + @LLSpot @LeftStroke + @LLSpot @DownStroke + @LRSpot @DownStroke + @LRSpot @RightStroke + @ULSpot @LeftStroke + @ULSpot @UpStroke + @URSpot @RightStroke + @URSpot @UpStroke + + linewidth "setlinewidth stroke" + } @Graphic {} + } + + PlainText @Yield "" + + PDF @Yield { @PDFStuff @Graphic {} } + } + } + + ########################################################################## + # # + # @DocInfo # + # # + ########################################################################## + + def @DocInfo + named author {} + named title {} + named keywords {} + { + { @BackEnd @Case { + PostScript @Yield + { + "[" author @Case { + "" @Yield "" + else @Yield { "/Author ("author")" } } + title @Case { + "" @Yield "" + else @Yield { "/Title ("title")" } } + keywords @Case { + "" @Yield "" + else @Yield { "/Keywords ("keywords")" } } + "/DOCINFO pdfmark" + } + else @Yield @Null + } } @Graphic { } + } + + + ########################################################################## + # # + # @NumberMarker, @NumberOf, @TitleMarker, @TitleOf, # + # @PageMark, @PageOf, @PageparityOf, @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. # + # # + ########################################################################## + + export @Tag @Value + def @NumberMarker + named @Tag {} + named @Value { "??" } + { + @Null + } + + def @NumberOf + right tag + { + @NumberMarker&&tag @Open { @Value } + } + + + export @Tag @Value + def @TitleMarker + named @Tag {} + named @Value { "??" } + { + @Null + } + + def @TitleOf + right tag + { + @TitleMarker&&tag @Open { @Value } + } + + + export @Tag num rawnum parity + def @PageMarker + named @Tag {} + named num {} + named rawnum {} + named parity {} + { + @PageLabel num + } + + def @PageMark + right tag + { + tag @LinkDest @Null & @PageMarker&&preceding @Tagged tag + } + + def @NoLinkPageMark + right tag + { + @PageMarker&&preceding @Tagged tag + } + + def @PageOf + right tag + { + @PageMarker&&tag @Open { num } + } + + def @PageParityOf + right tag + { + @PageMarker&&tag @Open { parity } + } + + def @CrossLink + left tag + named @Format right @Body { @CrossLinkFormat @Body } + right obj + { + @HContract @VContract { + tag @LinkSource @Format obj + } + } + + def @ExternalLink + left tag + named @Format right @Body { @ExternalLinkFormat @Body } + right obj + { + @HContract @VContract { + tag @URLLink @Format obj + } + } + + + ########################################################################### + # # + # @Join and @Sep # + # # + # Join two objects together with @NumberSeparator, unless one is # + # empty in which case just return the other. # + # # + ########################################################################### + + def @Join left x right y + { + x @Case { + {} @Yield y + else @Yield { + y @Case { + {} @Yield x + else @Yield { x{@NumberSeparator}y } + } + } + } + } + + def @Sep left x right y + { + x @Case { + {} @Yield y + else @Yield { + y @Case { + {} @Yield x + else @Yield { x{@NumberSeparator} |2s y } + } + } + } + } + + + ########################################################################### + # # + # Miscellaneous. # + # # + ########################################################################### + + def @Heading right x { ragged @Break @HeadingFont @Font x } + def "^" { {} ^& {} } + def "&-" left x right y { x &0ch y } + + + ########################################################################### + # # + # @If @Not @And @Or @True # + # # + # Used in databases to make optional fields format nicely. # + # # + ########################################################################### + + def @If + precedence 97 + left x + right y + { + y @Case { + {} @Yield @Null + else @Yield { @Null{x} } + } + } + + def @Not + precedence 100 + right y + { + y @Case { + {} @Yield "*" + else @Yield "" + } + } + + def @And + precedence 99 + left x + right y + { + x @Case { + {} @Yield {} + else @Yield y + } + } + + def @Or + precedence 98 + left x + right y + { + x @Case { + {} @Yield y + else @Yield x + } + } + + def @True { "*" } + + + ########################################################################### + # # + # Paragraphs. # + # # + ########################################################################### + + macro @PP { //@ParaGap @ParaIndent @Wide &{0i} } + macro @LP { //{@ParaGap} } + macro @LLP { //{1vx} } + macro @DP { //{@DisplayGap} } + macro @LOP { //{@ListOuterGap} } + macro @NP { //{1.1b} } + macro @CNP { // 3.2v @High //0io //{} } + + + ########################################################################### + # # + # Beginning and ending of aligned displays. # + # # + ########################################################################### + + def @APlace { @Galley } + def @EndAlignedPlace { @Galley } + def @AlignedPlace { @Galley } + + def @BAligned into { @APlace&&preceding } + { + def @AlignedList { @AlignedPlace /1.1b @AlignedList } + + //1.1b @AlignedList + // @EndAlignedPlace + } + + macro @BAD @BeginAlignedDisplays { // @APlace | @BAligned } + def @EAD @EndAlignedDisplays force into { @EndAlignedPlace&&preceding } {} + + + ########################################################################### + # # + # New code for numbered displays that will cross section boundaries # + # # + ########################################################################### + + export @Tag val display_val + def @NumDispCounterMarker + named @Tag {} + named val {} + named display_val {} + { + @Null + } + + def @NumDispNum right tag + { + @NumDispCounterMarker&&tag @Open { @Next val } + } + + def @NumDispCounterIncrement + named @BypassNumber { "dft" } + right tag + { + def @DisplayNumber + { + @BypassNumber @Dft { @NumDispNum tag } + } + + @NumDispCounterMarker&&preceding @Tagged tag + # @NumDispCounterMarker val { @NumDispNum tag } + # @NumberMarker @Tag { tag } @Value { @NumDispNum tag } + @NumDispCounterMarker val { @NumDispNum tag } display_val { @DisplayNumber } + @NumberMarker @Tag { tag } @Value { @DisplayNumber } + } + + def @NN + { + @NumDispCounterMarker&&preceding @Open { @DisplayNumStyle display_val } + } + + def @Do + left x + right y + { + x @Case { + { No None } @Yield @Null + else @Yield y + } + } + + def @BeginDisplayCounter + left condition + right prefix + { + condition @Do @NumDispCounterMarker val { prefix @Join 0 } + } + + + ########################################################################### + # # + # Galleys that carry displays to their places. # + # # + ########################################################################### + + def @DispPlace { @Galley } + + def @Disp into { @DispPlace&&preceding } + right x + { + x + } + + def @NDisp into { @DispPlace&&preceding } + named @Tag {} + named @BypassNumber { "dft" } + right x + { + @OneRow { + # @NumDispCounterIncrement @Tag + @NumDispCounterIncrement @BypassNumber { @BypassNumber } @Tag + @PageMark @Tag + ^// + @OneRow x + } + } + + def @ADisp into { @AlignedPlace&&preceding } + right x + { + x + } + + def @ANDisp into { @AlignedPlace&&preceding } + named @Tag {} + named @BypassNumber { "dft" } + right x + { + @OneRow { + # @NumDispCounterIncrement @Tag + @NumDispCounterIncrement @BypassNumber { @BypassNumber } @Tag + @PageMark @Tag + ^/ + @OneRow x + } + } + + + ########################################################################### + # # + # Displays and raw displays. # + # # + ########################################################################### + + macro @G { |@DefaultIndent } + macro @LG { | } + macro @IG { |@DisplayIndent } + macro @CG { |0.5rt } + macro @RG { |1.0rt } + macro @QR { @DisplayIndent @Wide { |1rt @NN } } + macro @DX { @DispPlace } + macro @DY { @Disp } + macro @AX { @APlace } + macro @AY { @ADisp } + macro @NY { @NDisp } + macro @MY { @ANDisp } + + macro @D @Display { @DP @G @DX | @DP // @DY } + macro @LD @LeftDisplay { @DP @LG @DX | @DP // @DY } + macro @ID @IndentedDisplay { @DP @IG @DX | @DP // @DY } + macro @QD @QuotedDisplay { @DP @IG @DX @IG @DP // @DY } + macro @CD @CentredDisplay + @CenteredDisplay { @DP @CG @DX | @DP // @DY } + macro @RightDisplay { @DP @RG @DX | @DP // @DY } + + + macro @AD @AlignedDisplay { @DP @G @AX | @DP // @AY } + macro @LAD @LeftAlignedDisplay { @DP @LG @AX | @DP // @AY } + macro @IAD @IndentedAlignedDisplay { @DP @IG @AX | @DP // @AY } + macro @QAD @QuotedAlignedDisplay { @DP @IG @AX @IG @DP // @AY } + macro @CAD @CentredAlignedDisplay + @CenteredAlignedDisplay { @DP @CG @AX | @DP // @AY } + macro @RightAlignedDisplay { @DP @RG @AX | @DP // @AY } + + macro @ND @NumberedDisplay { @DP @G @DX |1rt @NN @DP // @NY } + macro @LND @LeftNumberedDisplay { @DP @LG @DX |1rt @NN @DP // @NY } + macro @IND @IndentedNumberedDisplay { @DP @IG @DX |1rt @NN @DP // @NY } + macro @QND @QuotedNumberedDisplay { @DP @IG @DX |1rt @QR @DP // @NY } + macro @CND @CentredNumberedDisplay + @CenteredNumberedDisplay { @DP @CG @DX |1rt @NN @DP // @NY } + macro @RightNumberedDisplay { @DP @RG @DX |1rt @NN @DP // @NY } + + macro @AND @AlignedNumberedDisplay { @DP @G @AX |1rt @NN @DP // @MY } + macro @LAND @LeftAlignedNumberedDisplay { @DP @LG @AX |1rt @NN @DP // @MY } + macro @IAND @IndentedAlignedNumberedDisplay{ @DP @IG @AX |1rt @NN @DP // @MY } + macro @QAND @QuotedAlignedNumberedDisplay { @DP @IG @AX |1rt @QR @DP // @MY } + macro @CAND @CentredAlignedNumberedDisplay + @CenteredAlignedNumberedDisplay{ @DP @CG @AX |1rt @NN @DP // @MY } + macro @RightAlignedNumberedDisplay { @DP @RG @AX |1rt @NN @DP // @MY } + + + macro @RD @RawDisplay { @G @DX | // @DY } + macro @RLD @RawLeftDisplay { @LG @DX | // @DY } + macro @RID @RawIndentedDisplay { @IG @DX | // @DY } + macro @RQD @RawQuotedDisplay { @IG @DX @IG | // @DY } + macro @RCD @RawCentredDisplay + @RawCenteredDisplay { @CG @DX | | // @DY } + macro @RRD @RawRightDisplay { @RG @DX | // @DY } + + + macro @RAD @RawAlignedDisplay { @G @AX | // @AY } + macro @RLAD @RawLeftAlignedDisplay { @LG @AX | // @AY } + macro @RIAD @RawIndentedAlignedDisplay { @IG @AX | // @AY } + macro @RQAD @RawQuotedAlignedDisplay { @IG @AX @IG | // @AY } + macro @RCAD @RawCentredAlignedDisplay + @RawCenteredAlignedDisplay { @CG @AX | // @AY } + macro @RRAD @RawRightAlignedDisplay { @RG @AX | // @AY } + + macro @RND @RawNumberedDisplay { @G @DX |1rt @NN // @NY } + macro @RLND @RawLeftNumberedDisplay { @LG @DX |1rt @NN // @NY } + macro @RIND @RawIndentedNumberedDisplay { @IG @DX |1rt @NN // @NY } + macro @RQND @RawQuotedNumberedDisplay { @IG @DX |1rt @QR // @NY } + macro @RCND @RawCentredNumberedDisplay + @RawCenteredNumberedDisplay { @CG @DX |1rt @NN // @NY } + macro @RRND @RawRightNumberedDisplay { @RG @DX |1rt @NN // @NY } + + macro @RAND @RawAlignedNumberedDisplay { @G @AX |1rt @NN // @MY } + macro @RLAND @RawLeftAlignedNumberedDisplay { @LG @AX |1rt @NN // @MY } + macro @RIAND @RawIndentedAlignedNumberedDisplay { @IG @AX |1rt @NN // @MY } + macro @RQAND @RawQuotedAlignedNumberedDisplay { @IG @AX |1rt @QR // @MY } + macro @RCAND @RawCentredAlignedNumberedDisplay + @RawCenteredAlignedNumberedDisplay { @CG @AX |1rt @NN // @MY } + macro @RRAND @RawRightAlignedNumberedDisplay{ @RG @AX |1rt @NN // @MY } + + + ########################################################################### + # # + # Lists and raw lists. # + # # + ########################################################################### + + + def @ItemPlace { @Galley } + def @ParagraphItemPlace { @Galley } + def @InterruptItemPlace { @Galley } + def @NewPageItemPlace { @Galley } + def @TagPlace { @Galley } + def @EndListPlace { @Galley } + + def @RawList + named style right num { num } + named type right num { num } + named gap { @ListGap } + named indent { @ListIndent } + named itemindent { 0c } + named rightindent { @ListRightIndent } + named labelwidth { @ListLabelWidth } + named labelright { @ListLabelRight } + named labelrightgap { @ListLabelRightGap } + named start { 1 } + named font { @ListFont } + named break { @ListBreak } + named colnum { 1 } + named colgap { 1.0c } + named colheight { 5.0c } + { + def @MakeList right num + { + def @NormalItem + { + def @Align right x + { + labelright @Case { + { Yes yes } @Yield { labelwidth @Wide { |1rt @OneCol { x |labelrightgap } } } + else @Yield x + } + } + + |indent + labelwidth @Wide { + # @NumberMarker @Value {style num} {style num} &0io + # @NumberMarker @Value {num} {style type num} &0io + @NumberMarker @Value {type num} {@Align style type num} &0io + } + |itemindent break @Break font @Font @ItemPlace |rightindent + //gap @MakeList @NotRevealed @Next num + } + + def @ParagraphItem + { + @NumberMarker @Value {num} {style type num} &0io + |indent break @Break font @Font @ParagraphItemPlace |rightindent + //gap @MakeList @NotRevealed @Next num + } + + def @InterruptItem + { + @InterruptItemPlace + //gap @MakeList @NotRevealed num + } + + def @NewPageItem + { + @NewPageItemPlace + //1.1b @MakeList @NotRevealed num + } + + @OneOf + { + @NormalItem + @ParagraphItem + @InterruptItem + @NewPageItem + } + } + + def @ListGalleyPlace { @Galley } + + def @ListGalley into { @ListGalleyPlace&&preceding } + { + @MakeList start // @EndListPlace + } + + def @ColPieceTwo + { + colheight @High 500c @Wide @ListGalleyPlace ||colgap + colheight @High 500c @Wide @ListGalleyPlace @NotRevealed + } + + def @ColPieceThree + { + colheight @High 500c @Wide @ListGalleyPlace ||colgap + colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap + colheight @High 500c @Wide @ListGalleyPlace @NotRevealed + } + + def @ColPieceFour + { + colheight @High 500c @Wide @ListGalleyPlace ||colgap + colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap + colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap + colheight @High 500c @Wide @ListGalleyPlace @NotRevealed + } + + def @ColPieceFive + { + colheight @High 500c @Wide @ListGalleyPlace ||colgap + colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap + colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap + colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap + colheight @High 500c @Wide @ListGalleyPlace @NotRevealed + } + + colnum @Case + { + 1 @Yield @ListGalleyPlace + 2 @Yield @ColPieceTwo + 3 @Yield @ColPieceThree + 4 @Yield @ColPieceFour + 5 @Yield @ColPieceFive + else @Yield @ListGalleyPlace + } + // + @ListGalley + } + + def listitem into { @ItemPlace&&preceding } + named @Tag {} + right x + { + @NumberMarker&&preceding @Tagged @Tag + // x + // @PageMark @Tag # weird placement, but @PageMark is definite now + } + + def paragraphitem + named @Tag {} + named style right tag { @ParaIndent @Wide & tag. &2s } + right x + { + + def sendparagraphitem into { @ParagraphItemPlace&&preceding } + named tag { @Tag } + { + @NumberMarker&&preceding @Tagged @Tag + // { style @NumberMarker&&@Tag @Open { @Value } } @Insert x + // @PageMark @Tag + } + + sendparagraphitem + } + + def droplistitem into { @ItemPlace&&preceding } + named @Tag {} + right x + { + @NumberMarker&&preceding @Tagged @Tag + // @PageMark @Tag + //1vx x + } + + def tagitem into { @ItemPlace&&preceding } + named tag {} + right x + { + def sendtag into { @TagPlace&&preceding } { tag } + + sendtag // x + } + + def droptagitem into { @ItemPlace&&preceding } + named tag {} + right x + { + def sendtag into { @TagPlace&&preceding } { tag } + + sendtag // //1vxu x + } + + def endlist force into { @EndListPlace&&preceding } {} + + def listnewpage into { @NewPageItemPlace&&preceding } {} + + def listinterruptitem into { @InterruptItemPlace&&preceding } + right x + { + x + } + + + macro @LI @ListItem { // listitem } + macro @PI @ParagraphItem { // paragraphitem } + macro @LII @ListInterruptItem { // listinterruptitem } + macro @LNP @ListNewPage { // listnewpage } + macro @DLI @DropListItem { // droplistitem } + macro @TI @TagItem { // tagitem tag } + macro @DTI @DropTagItem { // droptagitem tag } + macro @REL @RawEndList { // & endlist // } + macro @EL @EndList { // & endlist @LOP } + + + macro @RLL @RawLeftList { @RawList style {} + labelwidth { 0c } } + macro @RIL @RawIndentedList { @RawList style {} } + macro @RQL @RawQuotedList { @RawList style {} + rightindent {@DisplayIndent}} + macro @RCL @RawCentredList { @RawList style {} + labelwidth {0c} + itemindent {0.5rt} } + macro @RawCenteredList { @RawCentredList } + macro @RNL @RawNumberedList { @RawList style { num. } } + macro @RPNL @RawParenNumberedList { @RawList style { (num) } } + macro @RRL @RawRomanList { @RawList type { @Roman&&num } + style { num. } } + macro @RPRL @RawParenRomanList { @RawList type { @Roman&&num } + style { (num) } } + macro @RUCRL @RawUCRomanList { @RawList type { @UCRoman&&num } + style { num. } } + macro @RPUCRL @RawParenUCRomanList { @RawList type { @UCRoman&&num } + style { (num) } } + macro @RAL @RawAlphaList { @RawList type { @Alpha&&num } + style { num. } } + macro @RPAL @RawParenAlphaList { @RawList type { @Alpha&&num } + style { (num) } } + macro @RUCAL @RawUCAlphaList { @RawList type { @UCAlpha&&num } + style { num. } } + macro @RPUCAL @RawParenUCAlphaList { @RawList type { @UCAlpha&&num } + style { (num) } } + macro @RBL @RawBulletList { @RawList style { @Bullet } } + macro @RSL @RawStarList { @RawList style { @Star } } + macro @RDL @RawDashList { @RawList style { -- } } + macro @RTL @RawTaggedList { @RawList type { @TagPlace } } + macro @RWTL @RawWideTaggedList { @RawList type { @TagPlace } + labelwidth { @WideIndent } } + macro @RVWTL @RawVeryWideTaggedList{ @RawList type { @TagPlace } + labelwidth { @VeryWideIndent } } + + + macro @L @List { @LOP @RawList } + macro @LL @LeftList { @LOP @RawLeftList } + macro @IL @IndentedList { @LOP @RawIndentedList } + macro @QL @QuotedList { @LOP @RawQuotedList } + macro @CL @CentredList { @LOP @RawCentredList } + macro @CenteredList { @LOP @RawCenteredList } + macro @NL @NumberedList { @LOP @RawNumberedList } + macro @PNL @ParenNumberedList { @LOP @RawParenNumberedList } + macro @RL @RomanList { @LOP @RawRomanList } + macro @PRL @ParenRomanList { @LOP @RawParenRomanList } + macro @UCRL @UCRomanList { @LOP @RawUCRomanList } + macro @PUCRL @ParenUCRomanList { @LOP @RawParenUCRomanList } + macro @AL @AlphaList { @LOP @RawAlphaList } + macro @PAL @ParenAlphaList { @LOP @RawParenAlphaList } + macro @UCAL @UCAlphaList { @LOP @RawUCAlphaList } + macro @PUCAL @ParenUCAlphaList { @LOP @RawParenUCAlphaList } + macro @BL @BulletList { @LOP @RawBulletList } + macro @SL @StarList { @LOP @RawStarList } + macro @DL @DashList { @LOP @RawDashList } + macro @TL @TaggedList { @LOP @RawTaggedList } + macro @WTL @WideTaggedList { @LOP @RawWideTaggedList } + macro @VWTL @VeryWideTaggedList { @LOP @RawVeryWideTaggedList } + +@End @BasicSetup diff --git a/include/include/bsf.lpg b/include/include/bsf.lpg new file mode 100644 index 0000000..94a3ba8 --- /dev/null +++ b/include/include/bsf.lpg @@ -0,0 +1,147 @@ +%%BeginResource: procset LoutBasicSetup +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @BasicSetup % +% % +% This file has been placed in the public domain by its author, % +% Jeffrey H. Kingston % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% width height linethickness louteuro - +% draw a Euro symbol of this width and height with this line thickness +/louteuro { + 20 dict begin + /eurothick exch def + /euroheight exch def + /eurowidth exch def + /eurostrokewidth euroheight 0.8 mul def + /eurostep eurothick 60 cos mul 60 sin div def + /eurotheta 40 def + + % llx lly width thickness louteurobox - + % draw angled box starting at (llx, lly) with given width and thickness + /louteurobox + { + /euroboxthick exch def + /euroboxwidth exch def + newpath moveto euroboxwidth 0 rlineto + eurostep euroboxthick rlineto + euroboxwidth neg 0 rlineto closepath fill + } def + + % lower cross stroke + 0 euroheight 2 div eurothick 1.5 mul sub + eurostrokewidth eurothick louteurobox + + % upper cross stroke + 0 euroheight 2 div eurothick 0.5 mul add + eurostrokewidth eurostep 2 mul add eurothick louteurobox + + % circular part + /eurohctr eurowidth euroheight 2 div eurotheta cos mul sub def + /eurovctr euroheight 2 div def + newpath + eurohctr eurovctr eurovctr eurotheta 350 eurotheta sub arc + eurohctr eurovctr eurovctr eurothick sub 365 eurotheta sub eurotheta arcn + closepath fill + end +} def + +% path for @FullWidthRule symbol +/LoutRule +{ 0 0 moveto xsize 0 lineto +} def + +% path for @Box symbol +/LoutBox +{ 0 0 moveto xsize 0 lineto + xsize ysize lineto 0 ysize lineto + closepath +} def + +% path for @CurveBox symbol +/LoutCurveBox +{ xmark 0 moveto + xsize xmark sub xmark xmark 270 360 arc + xsize xmark sub ysize xmark sub xmark 0 90 arc + xmark ysize xmark sub xmark 90 180 arc + xmark xmark xmark 180 270 arc + closepath +} def + +% path for @ShadowBox symbol +/LoutShadowBox +{ xmark 2 mul 0 moveto xsize 0 lineto + xsize ysize xmark 2 mul sub lineto + xsize xmark sub ysize xmark 2 mul sub lineto + xsize xmark sub xmark lineto + xmark 2 mul xmark lineto + closepath +} def + +% set up dictionary containing margin note data: parity LoutMargSet - +/LoutMargSet +{ /LoutMargDict 12 dict def + LoutMargDict begin + /parity exch def + /matr matrix currentmatrix def + /rightx xsize def + /lefty ysize def % highest allowable point for top of next left note + /righty ysize def % highest allowable point for top of next right note + /max { 2 copy gt { pop } { exch pop } ifelse } def + /min { 2 copy lt { pop } { exch pop } ifelse } def + end +} def + +%translate coordinate system for marginal notes: type LoutMargShift - +% where type 0 is left margin, 1 is right margin, 2 is outer, 3 is inner +/LoutMargShift +{ LoutMargDict begin + + % y coordinate of top of note, in margin coords, before vertical adjust + 0 ysize transform matr itransform exch pop + + % decide whether left or right margin based on type and parity + exch [ 0 1 parity 1 parity sub ] exch get 0 eq + { + % left margin: adjust top of note downwards if overlaps previous note + lefty min + + % bottom of note is new lefty position and also translate position + ysize sub dup /lefty exch def + + % want right edge of note at coordinate zero + xsize neg exch + } + { + % right margin: adjust top of note downwards if overlaps previous note + righty min + + % bottom of note is new righty position and also translate position + ysize sub dup /righty exch def + + % want left edge of note at coordinate rightx + rightx exch + } ifelse + + % stack now contains coord of bottom left corner in margin coordinates + matr setmatrix translate + end +} def + +% create LoutPageDict with left, right, foot, top for @Place symbol users +/LoutPageSet +{ + /LoutPageDict 5 dict def + LoutPageDict begin + /matr matrix currentmatrix def + /left 0 def + /right xsize def + /foot 0 def + /top ysize def + end + +} def + +%%EndResource diff --git a/include/include/coltex b/include/include/coltex new file mode 100644 index 0000000..079b759 --- /dev/null +++ b/include/include/coltex @@ -0,0 +1,434 @@ + +########################################################################### +# # +# coltex # +# # +# Jeffrey H. Kingston # +# 30 October 2002 # +# # +# Include file providing @ColourCommand and @TextureCommand symbols. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +########################################################################### + +@SysInclude { lengths } # @PSLengths (needed for @TextureCommand) + + +########################################################################### +# # +# @ColourCommand # +# # +# Jeff Kingston # +# 19 October 2001 # +# Updated for compatibility with textures 28 October 2002. # +# # +# @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 LoutSetRGBColor" # +# darkblue "0.0 0.0 0.5 LoutSetRGBColor" # +# white "1.0 1.0 1.0 LoutSetRGBColor" # +# none "" # +# nochange "" # +# "" "" # +# rgb <red> <blue> <green> "<red> <blue> <green> LoutSetRGBColor" # +# cmyk <c> <m> <y> <k> "<c> <m> <y> <k> LoutSetCMYKColor" # +# ------------------------------------------------------------ # +# # +# See the Expert's Guide for the use of LoutSetRGBColor and # +# LoutSetCMYKColor rather than setrgbcolor and setcmykcolor. # +# # +# @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 "LoutSetRGBColor" } + PDF @Yield { coords "rg" coords "RG" } + PlainText @Yield "" + } + } + + def @CMYK right coords + { + @BackEnd @Case { + PostScript @Yield { coords "LoutSetCMYKColor" } + 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 +} + + +########################################################################### +# # +# @TextureCommand # +# # +# @TextureCommand converts a texture expressed in a manner that the # +# ordinary user can comprehend into the PostScript texture dictionary # +# needed to obtain that texture, suitable for passing to @SetTexture # +# or including in the left parameter of @Graphic. # +# # +########################################################################### + +def @TextureCommand + left type + named scale { 1 } + named hscale { 1 } + named vscale { 1 } + import @PSLengths named angle { 0d } + import @PSLengths named hshift { 0i } + import @PSLengths named vshift { 0i } + import @PSLengths named width { "dft" } + import @PSLengths named height { "dft" } + import @PSLengths named gap { "dft" } + import @PSLengths named radius { "dft" } + import @PSLengths named linewidth { "dft" } + named font { "dft" } + import @PSLengths named size { "dft" } + named value { "dft" } +{ + def @Dft left x right y + { + y @Case { + "dft" @Yield x + else @Yield y + } + } + + def @SolidTexture + { + "null LoutSetTexture" + } + + def @StripedTexture + { + def @Width { "1 pt" @Dft width } + def @Gap { "1 pt" @Dft gap } + + scale hscale vscale angle hshift vshift + "2" + "[ 0 0" @Width @Gap "add dup ]" + @Width @Gap "add dup" + "{" + "pop 0 0 moveto" + @Width @Gap "add 0 lineto" + "0" @Width "rlineto" + "0" @Width "lineto" + "closepath fill" + "}" + "LoutMakeTexture LoutSetTexture" + } + + def @GridTexture + { + def @Width { "1 pt" @Dft width } + def @Gap { "1 pt" @Dft gap } + + scale hscale vscale angle hshift vshift + "2" + "[ 0 0" @Width @Gap "add dup ]" + @Width @Gap "add dup" + "{" + "pop 0 0 moveto" + @Width @Gap "add 0 lineto" + "0" @Width "rlineto" + @Gap "neg 0 rlineto" + "0" @Gap "rlineto" + @Width "neg 0 rlineto" + "closepath fill" + "}" + "LoutMakeTexture LoutSetTexture" + } + + def @DottedTexture + { + def @Radius { "0.5 pt" @Dft radius } + def @Gap { "2 pt" @Dft gap } + + scale hscale vscale angle hshift vshift + "2" + "[ 0 0" @Gap "dup ]" + @Gap "dup" + "{" + "pop" @Gap "2 div dup" @Radius "0 360 arc fill" + "}" + "LoutMakeTexture LoutSetTexture" + } + + def @ChessboardTexture + { + def @Width { "2 pt" @Dft width } + + scale hscale vscale angle hshift vshift + "2" + "[ 0 0" @Width "2 mul dup ]" + @Width "2 mul dup" + "{" + "pop 0 0 moveto" + @Width "0 rlineto" + "0" @Width "rlineto" + @Width "neg 0 rlineto" + closepath + @Width @Width "moveto" + @Width "0 rlineto" + "0" @Width "rlineto" + @Width "neg 0 rlineto" + "closepath fill" + "}" + "LoutMakeTexture LoutSetTexture" + } + + def @BrickworkTexture + { + def @Width { "6 pt" @Dft width } + def @Height { "2 pt" @Dft height } + def @Linewidth { "0.5 pt" @Dft linewidth } + + scale hscale vscale angle hshift vshift + "2" + "[ 0 0" @Width @Height "2 mul ]" + @Width @Height "2 mul" + "{" + "pop 0 0 moveto" @Width "0 rlineto" + "0" @Height "moveto" @Width "0 rlineto" + "0" @Height "2 mul moveto" @Width "0 rlineto" + "0 0 moveto 0" @Height "rlineto" + @Width "0 moveto 0" @Height "rlineto" + @Width "2 div" @Height "moveto 0" @Height "rlineto" + "[] 0 setdash" @Linewidth "setlinewidth stroke" + "}" + "LoutMakeTexture LoutSetTexture" + } + + def @HoneycombTexture + { + def @R { "2.0 pt" @Dft radius } + def @Linewidth { "0.5 pt" @Dft linewidth } + + def @X { @R "0.5 mul" } + def @Y { @R "0.886 mul" } + def @NegX { @X "neg" } + def @NegY { @Y "neg" } + def @NegR { @R "neg" } + def @BoxWidth { @R @X "add 2 mul" } + def @BoxHeight { @Y "2 mul" } + + scale hscale vscale angle hshift vshift + "2" + "[ 0 0" @BoxWidth @BoxHeight "]" + @BoxWidth @BoxHeight + "{" + "pop" + @X "0 moveto" + @R "0 rlineto" + @X @Y "rlineto" + @R "0 rlineto" + @NegR "0 rlineto" + @NegX @Y "rlineto" + @NegR "0 rlineto" + @NegX @NegY "rlineto" + "closepath" + "[] 0 setdash" @Linewidth "setlinewidth stroke" + "}" + "LoutMakeTexture LoutSetTexture" + } + + def @TriangularTexture + { + def @R { "4.0 pt" @Dft radius } + def @Linewidth { "0.5 pt" @Dft linewidth } + + def @X { @R "0.5 mul" } + def @Y { @R "0.886 mul" } + def @BoxWidth { @R } + def @BoxHeight { @Y "2 mul" } + + scale hscale vscale angle hshift vshift + "2" + "[ 0 0" @BoxWidth @BoxHeight "]" + @BoxWidth @BoxHeight + "{" + "pop" + "0 0 moveto" + @R "0 lineto" + "0" @Y "2 mul lineto" + @R "0 rlineto" + "closepath" + "0" @Y "moveto" + @R "0 rlineto" + "[] 0 setdash" @Linewidth "setlinewidth stroke" + "}" + "LoutMakeTexture LoutSetTexture" + } + + def @StringTexture + { + def @Width { "12 pt" @Dft width } + def @Height { "12 pt" @Dft height } + def @Font { "Times-Roman" @Dft font } + def @Size { "10 pt" @Dft size } + def @Value { "*" @Dft value } + + scale hscale vscale angle hshift vshift + "2" + "[ 0 0" @Width @Height "]" + @Width @Height + "{" + "pop /"@Font "findfont" @Size "scalefont setfont" + "("@Value") dup false 0 0 moveto charpath flattenpath" + "pathbbox pop pop neg exch neg exch moveto show" + + "}" + "LoutMakeTexture LoutSetTexture" + } + + type @Case + { + "solid" @Yield @SolidTexture + "striped" @Yield @StripedTexture + "grid" @Yield @GridTexture + "dotted" @Yield @DottedTexture + "chessboard" @Yield @ChessboardTexture + "brickwork" @Yield @BrickworkTexture + "honeycomb" @Yield @HoneycombTexture + "triangular" @Yield @TriangularTexture + "string" @Yield @StringTexture + else @Yield type + } +} + +########################################################################### +# # +# @TextureImport # +# # +# Used as an import for texture options. # +# # +# We cleverly replace @Texture by nothing inside those options, # +# and replace the known types by themselves plus @TextureCommand. # +# This allows the user to type # +# # +# texture { striped } # +# texture { striped @Texture } # +# texture { striped angle { 45d } } # +# texture { striped @Texture angle { 45d } } # +# # +# and it all winds up being a call to @TextureCommand. # +# # +########################################################################### + +export + + solid + striped + grid + dotted + chessboard + brickwork + honeycomb + triangular + string + @Texture + +def @TextureImport +{ + macro solid { "solid" @TextureCommand } + macro striped { "striped" @TextureCommand } + macro grid { "grid" @TextureCommand } + macro dotted { "dotted" @TextureCommand } + macro chessboard { "chessboard" @TextureCommand } + macro brickwork { "brickwork" @TextureCommand } + macro honeycomb { "honeycomb" @TextureCommand } + macro triangular { "triangular" @TextureCommand } + macro string { "string" @TextureCommand } + + macro @Texture { } +} diff --git a/include/include/cprint b/include/include/cprint new file mode 100644 index 0000000..95eb57f --- /dev/null +++ b/include/include/cprint @@ -0,0 +1,118 @@ +############################################################################### +# # +# Lout setup file for C and C++ program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 10 April 2000 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { cprintf } + + +############################################################################### +# # +# @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 { @CPSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # blanknumbered { Yes } # No, NoPrint, or Yes + # 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # varying mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/cprintf b/include/include/cprintf new file mode 100644 index 0000000..4c2b77e --- /dev/null +++ b/include/include/cprintf @@ -0,0 +1,446 @@ + +############################################################################### +# # +# Lout @CPSetup package for formatting C and C++ programs # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 10 April 2000 # +# # +# 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @CP +def @CPSetup + named pipe { } # pipe through this + named numbered { No } # numbered lines? + named blanknumbered { Yes } # blanks 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 @CP + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lC" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lC" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @CP + +@End @CPSetup diff --git a/include/include/diag b/include/include/diag new file mode 100644 index 0000000..fd0fe4a --- /dev/null +++ b/include/include/diag @@ -0,0 +1,669 @@ +############################################################################### +# # +# Lout setup file for diagram printing # +# # +# Jeffrey H. Kingston # +# 5 February 1999 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# The @SysInclude { diagf } line # +# # +# This line causes Lout to read the definitions for diagrams, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { diagf } + + +############################################################################### +# # +# The @DiagSetup @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 { @DiagSetup + # save { no } + # maxlabels { 200 } + # title { (none) } + # titleformat { Slope @Font @Title //0.7f ||0.35f @Body } + + ############################################################################# + # # + # Node options # + # # + ############################################################################# + + # outline { box } + # margin { 0.6f } + # shadow { 0.4f } + # sides { 3 } + # angle { "dup 180 exch div" } # 180d / sides + # translate { } + # outlinestyle { solid } + # outlinedashlength { 0.2f } + # outlinewidth { thin } + # outlinecolour { nochange } + # paint { none } + # texture { solid } + # font { } + # break { } + # format { @Body } + # valign { ctr } + # vsize { } + # vindent { ctr } + # vstrut { no } + # vmargin { } + # topmargin { } + # footmargin { } + # halign { ctr } + # hsize { } + # hindent { ctr } + # hstrut { no } + # hmargin { } + # leftmargin { } + # rightmargin { } + # nodelabel { } + # nodelabelmargin { 0.2f } + # nodelabelfont { "-2p" } + # nodelabelbreak { ragged nohyphen } + # nodelabelformat { @Body } + # nodelabelpos { } + # nodelabelangle { horizontal } + # nodelabelprox { outside } + # nodelabelctr { no } + # nodelabeladjust { 0 0 } + # alabel { } + # alabelmargin { } + # alabelfont { } + # alabelbreak { } + # alabelformat { } + # alabelpos { NE } + # alabelangle { } + # alabelprox { } + # alabelctr { } + # alabeladjust { } + # blabel { } + # blabelmargin { } + # blabelfont { } + # blabelbreak { } + # blabelformat { } + # blabelpos { NW } + # blabelangle { } + # blabelprox { } + # blabelctr { } + # blabeladjust { } + # clabel { } + # clabelmargin { } + # clabelfont { } + # clabelbreak { } + # clabelformat { } + # clabelpos { SW } + # clabelangle { } + # clabelprox { } + # clabelctr { } + # clabeladjust { } + # dlabel { } + # dlabelmargin { } + # dlabelfont { } + # dlabelbreak { } + # dlabelformat { } + # dlabelpos { SE } + # dlabelangle { } + # dlabelprox { } + # dlabelctr { } + # dlabeladjust { } + + ############################################################################# + # # + # @ANode options # + # # + ############################################################################# + + # aoutline { box } + # amargin { 0.6f } + # ashadow { 0.4f } + # asides { 3 } + # aangle { "dup 180 exch div" } # 180d / sides + # atranslate { } + # aoutlinestyle { solid } + # aoutlinedashlength { 0.2f } + # aoutlinewidth { thin } + # aoutlinecolour { nochange } + # apaint { none } + # atexture { solid } + # afont { } + # abreak { } + # aformat { @Body } + # avalign { ctr } + # avsize { } + # avindent { ctr } + # avstrut { no } + # avmargin { } + # atopmargin { } + # afootmargin { } + # ahalign { ctr } + # ahsize { } + # ahindent { ctr } + # ahstrut { no } + # ahmargin { } + # aleftmargin { } + # arightmargin { } + # anodelabel { } + # anodelabelmargin { 0.2f } + # anodelabelfont { "-2p" } + # anodelabelbreak { ragged nohyphen } + # anodelabelformat { @Body } + # anodelabelpos { } + # anodelabelangle { horizontal } + # anodelabelprox { outside } + # anodelabelctr { no } + # anodelabeladjust { 0 0 } + # aalabel { } + # aalabelmargin { } + # aalabelfont { } + # aalabelbreak { } + # aalabelformat { } + # aalabelpos { NE } + # aalabelangle { } + # aalabelprox { } + # aalabelctr { } + # aalabeladjust { } + # ablabel { } + # ablabelmargin { } + # ablabelfont { } + # ablabelbreak { } + # ablabelformat { } + # ablabelpos { NW } + # ablabelangle { } + # ablabelprox { } + # ablabelctr { } + # ablabeladjust { } + # aclabel { } + # aclabelmargin { } + # aclabelfont { } + # aclabelbreak { } + # aclabelformat { } + # aclabelpos { SW } + # aclabelangle { } + # aclabelprox { } + # aclabelctr { } + # aclabeladjust { } + # adlabel { } + # adlabelmargin { } + # adlabelfont { } + # adlabelbreak { } + # adlabelformat { } + # adlabelpos { SE } + # adlabelangle { } + # adlabelprox { } + # adlabelctr { } + # adlabeladjust { } + + ############################################################################# + # # + # @BNode options # + # # + ############################################################################# + + # boutline { box } + # bmargin { 0.6f } + # bshadow { 0.4f } + # bsides { 3 } + # bangle { "dup 180 exch div" } # 180d / sides + # btranslate { } + # boutlinestyle { solid } + # boutlinedashlength { 0.2f } + # boutlinewidth { thin } + # boutlinecolour { nochange } + # bpaint { none } + # btexture { solid } + # bfont { } + # bbreak { } + # bformat { @Body } + # bvalign { ctr } + # bvsize { } + # bvindent { ctr } + # bvstrut { no } + # bvmargin { } + # btopmargin { } + # bfootmargin { } + # bhalign { ctr } + # bhsize { } + # bhindent { ctr } + # bhstrut { no } + # bhmargin { } + # bleftmargin { } + # brightmargin { } + # bnodelabel { } + # bnodelabelmargin { 0.2f } + # bnodelabelfont { "-2p" } + # bnodelabelbreak { ragged nohyphen } + # bnodelabelformat { @Body } + # bnodelabelpos { } + # bnodelabelangle { horizontal } + # bnodelabelprox { outside } + # bnodelabelctr { no } + # bnodelabeladjust { 0 0 } + # balabel { } + # balabelmargin { } + # balabelfont { } + # balabelbreak { } + # balabelformat { } + # balabelpos { NE } + # balabelangle { } + # balabelprox { } + # balabelctr { } + # balabeladjust { } + # bblabel { } + # bblabelmargin { } + # bblabelfont { } + # bblabelbreak { } + # bblabelformat { } + # bblabelpos { NW } + # bblabelangle { } + # bblabelprox { } + # bblabelctr { } + # bblabeladjust { } + # bclabel { } + # bclabelmargin { } + # bclabelfont { } + # bclabelbreak { } + # bclabelformat { } + # bclabelpos { SW } + # bclabelangle { } + # bclabelprox { } + # bclabelctr { } + # bclabeladjust { } + # bdlabel { } + # bdlabelmargin { } + # bdlabelfont { } + # bdlabelbreak { } + # bdlabelformat { } + # bdlabelpos { SE } + # bdlabelangle { } + # bdlabelprox { } + # bdlabelctr { } + # bdlabeladjust { } + + ############################################################################# + # # + # @CNode options # + # # + ############################################################################# + + # coutline { box } + # cmargin { 0.6f } + # cshadow { 0.4f } + # csides { 3 } + # cangle { "dup 180 exch div" } # 180d / sides + # ctranslate { } + # coutlinestyle { solid } + # coutlinedashlength { 0.2f } + # coutlinewidth { thin } + # coutlinecolour { nochange } + # cpaint { none } + # ctexture { solid } + # cfont { } + # cbreak { } + # cformat { @Body } + # cvalign { ctr } + # cvsize { } + # cvindent { ctr } + # cvstrut { no } + # cvmargin { } + # ctopmargin { } + # cfootmargin { } + # chalign { ctr } + # chsize { } + # chindent { ctr } + # chstrut { no } + # chmargin { } + # cleftmargin { } + # crightmargin { } + # cnodelabel { } + # cnodelabelmargin { 0.2f } + # cnodelabelfont { "-2p" } + # cnodelabelbreak { ragged nohyphen } + # cnodelabelformat { @Body } + # cnodelabelpos { } + # cnodelabelangle { horizontal } + # cnodelabelprox { outside } + # cnodelabelctr { no } + # cnodelabeladjust { 0 0 } + # calabel { } + # calabelmargin { } + # calabelfont { } + # calabelbreak { } + # calabelformat { } + # calabelpos { NE } + # calabelangle { } + # calabelprox { } + # calabelctr { } + # calabeladjust { } + # cblabel { } + # cblabelmargin { } + # cblabelfont { } + # cblabelbreak { } + # cblabelformat { } + # cblabelpos { NW } + # cblabelangle { } + # cblabelprox { } + # cblabelctr { } + # cblabeladjust { } + # cclabel { } + # cclabelmargin { } + # cclabelfont { } + # cclabelbreak { } + # cclabelformat { } + # cclabelpos { SW } + # cclabelangle { } + # cclabelprox { } + # cclabelctr { } + # cclabeladjust { } + # cdlabel { } + # cdlabelmargin { } + # cdlabelfont { } + # cdlabelbreak { } + # cdlabelformat { } + # cdlabelpos { SE } + # cdlabelangle { } + # cdlabelprox { } + # cdlabelctr { } + # cdlabeladjust { } + + ############################################################################# + # # + # @DNode options # + # # + ############################################################################# + + # doutline { box } + # dmargin { 0.6f } + # dshadow { 0.4f } + # dsides { 3 } + # dangle { "dup 180 exch div" } # 180d / sides + # dtranslate { } + # doutlinestyle { solid } + # doutlinedashlength { 0.2f } + # doutlinewidth { thin } + # doutlinecolour { nochange } + # dpaint { none } + # dtexture { solid } + # dfont { } + # dbreak { } + # dformat { @Body } + # dvalign { ctr } + # dvsize { } + # dvindent { ctr } + # dvstrut { no } + # dvmargin { } + # dtopmargin { } + # dfootmargin { } + # dhalign { ctr } + # dhsize { } + # dhindent { ctr } + # dhstrut { no } + # dhmargin { } + # dleftmargin { } + # drightmargin { } + # dnodelabel { } + # dnodelabelmargin { 0.2f } + # dnodelabelfont { "-2p" } + # dnodelabelbreak { ragged nohyphen } + # dnodelabelformat { @Body } + # dnodelabelpos { } + # dnodelabelangle { horizontal } + # dnodelabelprox { outside } + # dnodelabelctr { no } + # dnodelabeladjust { 0 0 } + # dalabel { } + # dalabelmargin { } + # dalabelfont { } + # dalabelbreak { } + # dalabelformat { } + # dalabelpos { NE } + # dalabelangle { } + # dalabelprox { } + # dalabelctr { } + # dalabeladjust { } + # dblabel { } + # dblabelmargin { } + # dblabelfont { } + # dblabelbreak { } + # dblabelformat { } + # dblabelpos { NW } + # dblabelangle { } + # dblabelprox { } + # dblabelctr { } + # dblabeladjust { } + # dclabel { } + # dclabelmargin { } + # dclabelfont { } + # dclabelbreak { } + # dclabelformat { } + # dclabelpos { SW } + # dclabelangle { } + # dclabelprox { } + # dclabelctr { } + # dclabeladjust { } + # ddlabel { } + # ddlabelmargin { } + # ddlabelfont { } + # ddlabelbreak { } + # ddlabelformat { } + # ddlabelpos { SE } + # ddlabelangle { } + # ddlabelprox { } + # ddlabelctr { } + # ddlabeladjust { } + + ############################################################################# + # # + # @ENode options # + # # + ############################################################################# + + # eoutline { box } + # emargin { 0.6f } + # eshadow { 0.4f } + # esides { 3 } + # eangle { "dup 180 exch div" } # 180d / sides + # etranslate { } + # eoutlinestyle { solid } + # eoutlinedashlength { 0.2f } + # eoutlinewidth { thin } + # eoutlinecolour { nochange } + # epaint { none } + # etexture { solid } + # efont { } + # ebreak { } + # eformat { @Body } + # evalign { ctr } + # evsize { } + # evindent { ctr } + # evstrut { no } + # evmargin { } + # etopmargin { } + # efootmargin { } + # ehalign { ctr } + # ehsize { } + # ehindent { ctr } + # ehstrut { no } + # ehmargin { } + # eleftmargin { } + # erightmargin { } + # enodelabel { } + # enodelabelmargin { 0.2f } + # enodelabelfont { "-2p" } + # enodelabelbreak { ragged nohyphen } + # enodelabelformat { @Body } + # enodelabelpos { } + # enodelabelangle { horizontal } + # enodelabelprox { outside } + # enodelabelctr { no } + # enodelabeladjust { 0 0 } + # ealabel { } + # ealabelmargin { } + # ealabelfont { } + # ealabelbreak { } + # ealabelformat { } + # ealabelpos { NE } + # ealabelangle { } + # ealabelprox { } + # ealabelctr { } + # ealabeladjust { } + # eblabel { } + # eblabelmargin { } + # eblabelfont { } + # eblabelbreak { } + # eblabelformat { } + # eblabelpos { NW } + # eblabelangle { } + # eblabelprox { } + # eblabelctr { } + # eblabeladjust { } + # eclabel { } + # eclabelmargin { } + # eclabelfont { } + # eclabelbreak { } + # eclabelformat { } + # eclabelpos { SW } + # eclabelangle { } + # eclabelprox { } + # eclabelctr { } + # eclabeladjust { } + # edlabel { } + # edlabelmargin { } + # edlabelfont { } + # edlabelbreak { } + # edlabelformat { } + # edlabelpos { SE } + # edlabelangle { } + # edlabelprox { } + # edlabelctr { } + # edlabeladjust { } + + ############################################################################# + # # + # Link options # + # # + ############################################################################# + + # path { line } + # from { 0, 0 } + # to { 1, 1 } + # bias { 2.0f } + # fbias { 2.0f } + # tbias { 2.0f } + # hfrac { 0.5 } + # hbias { 0.0f } + # radius { 1.0f } + # xindent { 0.8f } + # zindent { 0.8f } + # frompt { 0 0 } + # topt { 0 0 } + # pathstyle { solid } + # pathdashlength { 0.2f } + # pathwidth { thin } + # pathcolour { nochange } + # pathgap { thin } + # arrow { no } + # arrowstyle { solid } + # arrowwidth { 0.3f } + # arrowlength { 0.5f } + # backarrowstyle { solid } + # backarrowwidth { 0.3f } + # backarrowlength { 0.5f } + # linklabel { } + # linklabelmargin { 0.2f } + # linklabelfont { "-2p" } + # linklabelbreak { ragged nohyphen } + # linklabelformat { @Body } + # linklabelpos { } + # linklabelangle { horizontal } + # linklabelprox { above } + # linklabelctr { no } + # linklabeladjust { 0 0 } + # xlabel { } + # xlabelmargin { } + # xlabelfont { } + # xlabelbreak { } + # xlabelformat { } + # xlabelpos { LFROM } + # xlabelangle { } + # xlabelprox { } + # xlabelctr { } + # xlabeladjust { } + # ylabel { } + # ylabelmargin { } + # ylabelfont { } + # ylabelbreak { } + # ylabelformat { } + # ylabelpos { LMID } + # ylabelangle { } + # ylabelprox { } + # ylabelctr { yes } + # ylabeladjust { } + # zlabel { } + # zlabelmargin { } + # zlabelfont { } + # zlabelbreak { } + # zlabelformat { } + # zlabelpos { LTO } + # zlabelangle { } + # zlabelprox { } + # zlabelctr { } + # zlabeladjust { } + # fromlabel { } + # fromlabelmargin { 0f } + # fromlabelfont { "-2p" } + # fromlabelbreak { ragged nohyphen } + # fromlabelformat { @Body } + # fromlabelpos { FROM } + # fromlabelangle { antiparallel } + # fromlabelprox { W } + # fromlabelctr { no } + # fromlabeladjust { 0 0 } + # tolabel { } + # tolabelmargin { 0f } + # tolabelfont { "-2p" } + # tolabelbreak { ragged nohyphen } + # tolabelformat { @Body } + # tolabelpos { TO } + # tolabelangle { parallel } + # tolabelprox { W } + # tolabelctr { no } + # tolabeladjust { 0 0 } + + ############################################################################# + # # + # Tree options # + # # + ############################################################################# + + # treehsep { 0.5f } + # treevsep { 0.5f } + # treehindent { ctr } + # treevindent { ctr } + + ############################################################################# + # # + # Syntax diagram options # + # # + ############################################################################# + + # syntaxgap { 0.35f } + # syntaxbias { 1.0f } + # syntaxradius { 0.3f } + +} diff --git a/include/include/diagf b/include/include/diagf new file mode 100644 index 0000000..f58b37d --- /dev/null +++ b/include/include/diagf @@ -0,0 +1,8217 @@ + +############################################################################### +# # +# Lout @Diag package for drawing diagrams # +# Version 1.1 (February 2000) # +# Jeffrey H. Kingston # +# # +# Version 1.0 (July 1996) # +# Based on Version 2.0 of the @Fig package (Jeffrey H. Kingston, Dec 1992). # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +@SysInclude { diagf.etc } # @Geometry +@SysInclude { coltex } # @ColourCommand and @TextureCommand +@SysPrependGraphic { diagf.lpg } + + +############################################################################### +# # +# @DiagSetup symbol # +# # +############################################################################### + +export @Diag @SyntaxDiag +def @DiagSetup + named save { no } + named maxlabels { 200 } + named title { "--titledft--" } + named titleformat + left @Title + right @Body + { Slope @Font @Title //0.7f ||0.35f @Body } + + ########################################################################### + # # + # @Node options of @DiagSetup # + # # + ########################################################################### + + import @Geometry named outline + named margin {} + named shadow {} + named sides {} + named angle {} + { box } + named margin { 0.6f } + import @Geometry named shadow { 0.4f } + import @Geometry named sides { 3 } + import @Geometry named angle { "dup 180 exch div" } + named translate { } + named outlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { solid } + import @Geometry named outlinedashlength { 0.2f } + import @Geometry named outlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { thin } + named outlinecolour outlinecolor { nochange } + named paint { none } + import @TextureImport named texture { solid } + named font { } + named break { } + named format right @Body { @Body } + + named valign { ctr } + named vsize { } + named vindent { ctr } + named vstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named vmargin { } + named topmargin { } + named footmargin { } + + named halign { ctr } + named hsize { } + named hindent { ctr } + named hstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named hmargin { } + named leftmargin { } + named rightmargin { } + + named nodelabel { } + named nodelabelmargin { 0.2f } + named nodelabelfont { -2p } + named nodelabelbreak { ragged nohyphen } + named nodelabelformat right @Body { @Body } + import @Geometry named nodelabelpos { } + import @Geometry named nodelabelangle { horizontal } + named nodelabelprox { outside } + named nodelabelctr { no } + import @Geometry named nodelabeladjust { 0 0 } + + named alabel { } + named alabelmargin { } + named alabelfont { } + named alabelbreak { } + named alabelformat right @Body { } + import @Geometry named alabelpos { NE } + import @Geometry named alabelangle { } + named alabelprox { } + named alabelctr { } + import @Geometry named alabeladjust { } + + named blabel { } + named blabelmargin { } + named blabelfont { } + named blabelbreak { } + named blabelformat right @Body { } + import @Geometry named blabelpos { NW } + import @Geometry named blabelangle { } + named blabelprox { } + named blabelctr { } + import @Geometry named blabeladjust { } + + named clabel { } + named clabelmargin { } + named clabelfont { } + named clabelbreak { } + named clabelformat right @Body { } + import @Geometry named clabelpos { SW } + import @Geometry named clabelangle { } + named clabelprox { } + named clabelctr { } + import @Geometry named clabeladjust { } + + named dlabel { } + named dlabelmargin { } + named dlabelfont { } + named dlabelbreak { } + named dlabelformat right @Body { } + import @Geometry named dlabelpos { SE } + import @Geometry named dlabelangle { } + named dlabelprox { } + named dlabelctr { } + import @Geometry named dlabeladjust { } + + ########################################################################### + # # + # @ANode options of @DiagSetup # + # # + ########################################################################### + + import @Geometry named aoutline + named margin {} + named shadow {} + named sides {} + named angle {} + { box } + named amargin { 0.6f } + import @Geometry named ashadow { 0.4f } + import @Geometry named asides { 3 } + import @Geometry named aangle { "dup 180 exch div" } + named atranslate { } + named aoutlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { solid } + import @Geometry named aoutlinedashlength { 0.2f } + import @Geometry named aoutlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { thin } + named aoutlinecolour aoutlinecolor { nochange } + named apaint { none } + import @TextureImport named atexture{ solid } + named afont { } + named abreak { } + named aformat right @Body { @Body } + + named avalign { ctr } + named avsize { } + named avindent { ctr } + named avstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named avmargin { } + named atopmargin { } + named afootmargin { } + + named ahalign { ctr } + named ahsize { } + named ahindent { ctr } + named ahstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named ahmargin { } + named aleftmargin { } + named arightmargin { } + + named anodelabel { } + named anodelabelmargin { 0.2f } + named anodelabelfont { -2p } + named anodelabelbreak { ragged nohyphen } + named anodelabelformat right @Body { @Body } + import @Geometry named anodelabelpos{ } + import @Geometry named anodelabelangle { horizontal } + named anodelabelprox { outside } + named anodelabelctr { no } + import @Geometry named anodelabeladjust { 0 0 } + + named aalabel { } + named aalabelmargin { } + named aalabelfont { } + named aalabelbreak { } + named aalabelformat right @Body { } + import @Geometry named aalabelpos { NE } + import @Geometry named aalabelangle { } + named aalabelprox { } + named aalabelctr { } + import @Geometry named aalabeladjust{ } + + named ablabel { } + named ablabelmargin { } + named ablabelfont { } + named ablabelbreak { } + named ablabelformat right @Body { } + import @Geometry named ablabelpos { NW } + import @Geometry named ablabelangle { } + named ablabelprox { } + named ablabelctr { } + import @Geometry named ablabeladjust{ } + + named aclabel { } + named aclabelmargin { } + named aclabelfont { } + named aclabelbreak { } + named aclabelformat right @Body { } + import @Geometry named aclabelpos { SW } + import @Geometry named aclabelangle { } + named aclabelprox { } + named aclabelctr { } + import @Geometry named aclabeladjust{ } + + named adlabel { } + named adlabelmargin { } + named adlabelfont { } + named adlabelbreak { } + named adlabelformat right @Body { } + import @Geometry named adlabelpos { SE } + import @Geometry named adlabelangle { } + named adlabelprox { } + named adlabelctr { } + import @Geometry named adlabeladjust{ } + + ########################################################################### + # # + # @BNode options of @DiagSetup # + # # + ########################################################################### + + import @Geometry named boutline + named margin {} + named shadow {} + named sides {} + named angle {} + { box } + named bmargin { 0.6f } + import @Geometry named bshadow { 0.4f } + import @Geometry named bsides { 3 } + import @Geometry named bangle { "dup 180 exch div" } + named btranslate { } + named boutlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { solid } + import @Geometry named boutlinedashlength { 0.2f } + import @Geometry named boutlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { thin } + named boutlinecolour boutlinecolor { nochange } + named bpaint { none } + import @TextureImport named btexture{ solid } + named bfont { } + named bbreak { } + named bformat right @Body { @Body } + + named bvalign { ctr } + named bvsize { } + named bvindent { ctr } + named bvstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named bvmargin { } + named btopmargin { } + named bfootmargin { } + + named bhalign { ctr } + named bhsize { } + named bhindent { ctr } + named bhstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named bhmargin { } + named bleftmargin { } + named brightmargin { } + + named bnodelabel { } + named bnodelabelmargin { 0.2f } + named bnodelabelfont { -2p } + named bnodelabelbreak { ragged nohyphen } + named bnodelabelformat right @Body { @Body } + import @Geometry named bnodelabelpos{ } + import @Geometry named bnodelabelangle { horizontal } + named bnodelabelprox { outside } + named bnodelabelctr { no } + import @Geometry named bnodelabeladjust { 0 0 } + + named balabel { } + named balabelmargin { } + named balabelfont { } + named balabelbreak { } + named balabelformat right @Body { } + import @Geometry named balabelpos { NE } + named balabelprox { } + import @Geometry named balabelangle { } + named balabelctr { } + import @Geometry named balabeladjust{ } + + named bblabel { } + named bblabelmargin { } + named bblabelfont { } + named bblabelbreak { } + named bblabelformat right @Body { } + import @Geometry named bblabelpos { NW } + named bblabelprox { } + import @Geometry named bblabelangle { } + named bblabelctr { } + import @Geometry named bblabeladjust{ } + + named bclabel { } + named bclabelmargin { } + named bclabelfont { } + named bclabelbreak { } + named bclabelformat right @Body { } + import @Geometry named bclabelpos { SW } + named bclabelprox { } + import @Geometry named bclabelangle { } + named bclabelctr { } + import @Geometry named bclabeladjust{ } + + named bdlabel { } + named bdlabelmargin { } + named bdlabelfont { } + named bdlabelbreak { } + named bdlabelformat right @Body { } + import @Geometry named bdlabelpos { SE } + named bdlabelprox { } + import @Geometry named bdlabelangle { } + named bdlabelctr { } + import @Geometry named bdlabeladjust{ } + + ########################################################################### + # # + # @CNode options of @DiagSetup # + # # + ########################################################################### + + import @Geometry named coutline + named margin {} + named shadow {} + named sides {} + named angle {} + { box } + named cmargin { 0.6f } + import @Geometry named cshadow { 0.4f } + import @Geometry named csides { 3 } + import @Geometry named cangle { "dup 180 exch div" } + named ctranslate { } + named coutlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { solid } + import @Geometry named coutlinedashlength { 0.2f } + import @Geometry named coutlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { thin } + named coutlinecolour coutlinecolor { nochange } + named cpaint { none } + import @TextureImport named ctexture{ solid } + named cfont { } + named cbreak { } + named cformat right @Body { @Body } + + named cvalign { ctr } + named cvsize { } + named cvindent { ctr } + named cvstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named cvmargin { } + named ctopmargin { } + named cfootmargin { } + + named chalign { ctr } + named chsize { } + named chindent { ctr } + named chstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named chmargin { } + named cleftmargin { } + named crightmargin { } + + named cnodelabel { } + named cnodelabelmargin { 0.2f } + named cnodelabelfont { -2p } + named cnodelabelbreak { ragged nohyphen } + named cnodelabelformat right @Body { @Body } + import @Geometry named cnodelabelpos{ } + import @Geometry named cnodelabelangle { horizontal } + named cnodelabelprox { outside } + named cnodelabelctr { no } + import @Geometry named cnodelabeladjust { 0 0 } + + named calabel { } + named calabelmargin { } + named calabelfont { } + named calabelbreak { } + named calabelformat right @Body { } + import @Geometry named calabelpos { NE } + import @Geometry named calabelangle { } + named calabelprox { } + named calabelctr { } + import @Geometry named calabeladjust{ } + + named cblabel { } + named cblabelmargin { } + named cblabelfont { } + named cblabelbreak { } + named cblabelformat right @Body { } + import @Geometry named cblabelpos { NW } + import @Geometry named cblabelangle { } + named cblabelprox { } + named cblabelctr { } + import @Geometry named cblabeladjust{ } + + named cclabel { } + named cclabelmargin { } + named cclabelfont { } + named cclabelbreak { } + named cclabelformat right @Body { } + import @Geometry named cclabelpos { SW } + import @Geometry named cclabelangle { } + named cclabelprox { } + named cclabelctr { } + import @Geometry named cclabeladjust{ } + + named cdlabel { } + named cdlabelmargin { } + named cdlabelfont { } + named cdlabelbreak { } + named cdlabelformat right @Body { } + import @Geometry named cdlabelpos { SE } + import @Geometry named cdlabelangle { } + named cdlabelprox { } + named cdlabelctr { } + import @Geometry named cdlabeladjust{ } + + ########################################################################### + # # + # @DNode options of @DiagSetup # + # # + ########################################################################### + + import @Geometry named doutline + named margin {} + named shadow {} + named sides {} + named angle {} + { box } + named dmargin { 0.6f } + import @Geometry named dshadow { 0.4f } + import @Geometry named dsides { 3 } + import @Geometry named dangle { "dup 180 exch div" } + named dtranslate { } + named doutlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { solid } + import @Geometry named doutlinedashlength { 0.2f } + import @Geometry named doutlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { thin } + named doutlinecolour doutlinecolor { nochange } + named dpaint { none } + import @TextureImport named dtexture{ solid } + named dfont { } + named dbreak { } + named dformat right @Body { @Body } + + named dvalign { ctr } + named dvsize { } + named dvindent { ctr } + named dvstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named dvmargin { } + named dtopmargin { } + named dfootmargin { } + + named dhalign { ctr } + named dhsize { } + named dhindent { ctr } + named dhstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named dhmargin { } + named dleftmargin { } + named drightmargin { } + + named dnodelabel { } + named dnodelabelmargin { 0.2f } + named dnodelabelfont { -2p } + named dnodelabelbreak { ragged nohyphen } + named dnodelabelformat right @Body { @Body } + import @Geometry named dnodelabelpos{ } + import @Geometry named dnodelabelangle { horizontal } + named dnodelabelprox { outside } + named dnodelabelctr { no } + import @Geometry named dnodelabeladjust { 0 0 } + + named dalabel { } + named dalabelmargin { } + named dalabelfont { } + named dalabelbreak { } + named dalabelformat right @Body { } + import @Geometry named dalabelpos { NE } + import @Geometry named dalabelangle { } + named dalabelprox { } + named dalabelctr { } + import @Geometry named dalabeladjust{ } + + named dblabel { } + named dblabelmargin { } + named dblabelfont { } + named dblabelbreak { } + named dblabelformat right @Body { } + import @Geometry named dblabelpos { NW } + import @Geometry named dblabelangle { } + named dblabelprox { } + named dblabelctr { } + import @Geometry named dblabeladjust{ } + + named dclabel { } + named dclabelmargin { } + named dclabelfont { } + named dclabelbreak { } + named dclabelformat right @Body { } + import @Geometry named dclabelpos { SW } + import @Geometry named dclabelangle { } + named dclabelprox { } + named dclabelctr { } + import @Geometry named dclabeladjust{ } + + named ddlabel { } + named ddlabelmargin { } + named ddlabelfont { } + named ddlabelbreak { } + named ddlabelformat right @Body { } + import @Geometry named ddlabelpos { SE } + import @Geometry named ddlabelangle { } + named ddlabelprox { } + named ddlabelctr { } + import @Geometry named ddlabeladjust{ } + + ########################################################################### + # # + # @ENode options of @DiagSetup # + # # + ########################################################################### + + import @Geometry named eoutline + named margin {} + named shadow {} + named sides {} + named angle {} + { box } + named emargin { 0.6f } + import @Geometry named eshadow { 0.4f } + import @Geometry named esides { 3 } + import @Geometry named eangle { "dup 180 exch div" } + named etranslate { } + named eoutlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { solid } + import @Geometry named eoutlinedashlength { 0.2f } + import @Geometry named eoutlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { thin } + named eoutlinecolour eoutlinecolor { nochange } + named epaint { none } + import @TextureImport named etexture{ solid } + named efont { } + named ebreak { } + named eformat right @Body { @Body } + + named evalign { ctr } + named evsize { } + named evindent { ctr } + named evstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named evmargin { } + named etopmargin { } + named efootmargin { } + + named ehalign { ctr } + named ehsize { } + named ehindent { ctr } + named ehstrut + named no { 0.0f } + named yes { 1.0f } + { no } + named ehmargin { } + named eleftmargin { } + named erightmargin { } + + named enodelabel { } + named enodelabelmargin { 0.2f } + named enodelabelfont { -2p } + named enodelabelbreak { ragged nohyphen } + named enodelabelformat right @Body { @Body } + import @Geometry named enodelabelpos{ } + import @Geometry named enodelabelangle { horizontal } + named enodelabelprox { outside } + named enodelabelctr { no } + import @Geometry named enodelabeladjust { 0 0 } + + named ealabel { } + named ealabelmargin { } + named ealabelfont { } + named ealabelbreak { } + named ealabelformat right @Body { } + import @Geometry named ealabelpos { NE } + import @Geometry named ealabelangle { } + named ealabelprox { } + named ealabelctr { } + import @Geometry named ealabeladjust{ } + + named eblabel { } + named eblabelmargin { } + named eblabelfont { } + named eblabelbreak { } + named eblabelformat right @Body { } + import @Geometry named eblabelpos { NW } + import @Geometry named eblabelangle { } + named eblabelprox { } + named eblabelctr { } + import @Geometry named eblabeladjust{ } + + named eclabel { } + named eclabelmargin { } + named eclabelfont { } + named eclabelbreak { } + named eclabelformat right @Body { } + import @Geometry named eclabelpos { SW } + import @Geometry named eclabelangle { } + named eclabelprox { } + named eclabelctr { } + import @Geometry named eclabeladjust{ } + + named edlabel { } + named edlabelmargin { } + named edlabelfont { } + named edlabelbreak { } + named edlabelformat right @Body { } + import @Geometry named edlabelpos { SE } + import @Geometry named edlabelangle { } + named edlabelprox { } + named edlabelctr { } + import @Geometry named edlabeladjust{ } + + ########################################################################### + # # + # @Link options of @DiagSetup # + # # + ########################################################################### + + import @Geometry named path + named from {} + named to {} + named bias {} + named fbias {} + named tbias {} + named hfrac {} + named hbias {} + named radius {} + named xindent {} + named zindent {} + named frompt {} + named topt {} + named arrow {} + named arrowlength {} + named backarrowlength {} + { line } + import @Geometry named from { 0,0 } + import @Geometry named to { 1,1 } + 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 } + import @Geometry named frompt { 0 0 } + import @Geometry named topt { 0 0 } + named pathstyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { solid } + import @Geometry named pathdashlength { 0.2f } + import @Geometry named pathwidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { thin } + named pathcolour pathcolor { nochange } + import @Geometry named pathgap + named thin { 0.08 ft } + named medium { 0.16 ft } + named thick { 0.24 ft } + { thin } + named arrow { no } + named arrowstyle { solid } + named arrowwidth { 0.3f } + named arrowlength { 0.5f } + named backarrowstyle { solid } + named backarrowwidth { 0.3f } + named backarrowlength { 0.5f } + + named linklabel { } + named linklabelmargin { 0.2f } + named linklabelfont { -2p } + named linklabelbreak { ragged nohyphen } + named linklabelformat right @Body { @Body } + import @Geometry named linklabelpos { } + import @Geometry named linklabelangle { horizontal } + named linklabelprox { above } + named linklabelctr { no } + import @Geometry named linklabeladjust { 0 0 } + + named xlabel { } + named xlabelmargin { } + named xlabelfont { } + named xlabelbreak { } + named xlabelformat right @Body { } + import @Geometry named xlabelpos { LFROM } + import @Geometry named xlabelangle { } + named xlabelprox { } + named xlabelctr { } + import @Geometry named xlabeladjust { } + + named ylabel { } + named ylabelmargin { } + named ylabelfont { } + named ylabelbreak { } + named ylabelformat right @Body { } + import @Geometry named ylabelpos { LMID } + import @Geometry named ylabelangle { } + named ylabelprox { } + named ylabelctr { yes } + import @Geometry named ylabeladjust { } + + named zlabel { } + named zlabelmargin { } + named zlabelfont { } + named zlabelbreak { } + named zlabelformat right @Body { } + import @Geometry named zlabelpos { LTO } + import @Geometry named zlabelangle { } + named zlabelprox { } + named zlabelctr { } + import @Geometry named zlabeladjust { } + + named fromlabel { } + named fromlabelmargin { 0f } + named fromlabelfont { } + named fromlabelbreak { ragged nohyphen } + named fromlabelformat right @Body { @Body } + import @Geometry named fromlabelpos { FROM } + import @Geometry named fromlabelangle { antiparallel } + named fromlabelprox { W } + named fromlabelctr { no } + import @Geometry named fromlabeladjust { 0 0 } + + named tolabel { } + named tolabelmargin { 0f } + named tolabelfont { } + named tolabelbreak { ragged nohyphen } + named tolabelformat right @Body { @Body } + import @Geometry named tolabelpos { TO } + import @Geometry named tolabelangle { parallel } + named tolabelprox { W } + named tolabelctr { no } + import @Geometry named tolabeladjust { 0 0 } + + ########################################################################### + # # + # Tree and syntax diagram options of @DiagSetup # + # # + ########################################################################### + + named treehsep { 0.5f } + named treevsep { 0.5f } + named treehindent + named left { 0.0rt } + named ctr { 0.5rt } + named right { 1.0rt } + { ctr } + named treevindent + named top { 0.0rt } + named ctr { 0.5rt } + named foot { 1.0rt } + { ctr } + + named syntaxgap { 0.35f } + named syntaxbias { 1.0f } + named syntaxradius { 0.3f } +{ + + + ########################################################################### + # # + # @Diag symbol # + # # + ########################################################################### + + export "::" @ShowPoints @ShowTags @ShowDirections @CatchTags @Transform + + @Node @ANode @BNode @CNode @DNode @ENode + @Box @CurveBox @ShadowBox @Square @Diamond @Polygon + @Isosceles @Ellipse @Circle + @ArrowHead @SolidArrowHead @SolidWithBarArrowHead @OpenArrowHead + @HalfOpenArrowHead @SolidCurvedArrowHead @OpenCurvedArrowHead + @HalfOpenCurvedArrowHead @CircleArrowHead @BoxArrowHead + @ManyArrowHead + + @Link + @Line @DoubleLine @Arrow @DoubleArrow @Curve @CurveArrow + @ACurve @ACurveArrow @CCurve @CCurveArrow + @Bezier @BezierArrow + @HVLine @HVArrow @VHLine @VHArrow + @HVCurve @HVCurveArrow @VHCurve @VHCurveArrow + @LVRLine @LVRArrow @RVLLine @RVLArrow + @DHULine @DHUArrow @UHDLine @UHDArrow + @LVRCurve @LVRCurveArrow @RVLCurve @RVLCurveArrow + @DHUCurve @DHUCurveArrow @UHDCurve @UHDCurveArrow + @HVHLine @HVHArrow @VHVLine @VHVArrow + @HVHCurve @HVHCurveArrow @VHVCurve @VHVCurveArrow + @DWrapLine @DWrapArrow @UWrapLine @UWrapArrow + @DWrapCurve @DWrapCurveArrow @UWrapCurve @UWrapCurveArrow + + @Tree @HTree + + @StartRight @StartUp @StartLeft @StartDown + @StartRightRight @StartRightRightRight @StartRightDown + @Skip @XCell @ACell @BCell @CCell @DCell @ECell + @Sequence @OneOrBoth @Select @Optional @OptionalDiverted @Diverted + @Loop @LoopOpposite @Repeat @RepeatOpposite @RepeatDiverted + + def @Diag + named save { save } + named maxlabels { maxlabels } + named title { title } + named titleformat + left @Title + right @Body + { @Title titleformat @Body } + + ####################################################################### + # # + # @Node options of @Diag # + # # + ####################################################################### + + import @Geometry named outline + named margin {} + named shadow {} + named sides {} + named angle {} + { outline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named margin { margin } + import @Geometry named shadow { shadow } + import @Geometry named sides { sides } + import @Geometry named angle { angle } + named translate { translate } + named nodetag { } + named outlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { outlinestyle } + import @Geometry named outlinedashlength{ outlinedashlength } + import @Geometry named outlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { outlinewidth } + named outlinecolour outlinecolor { outlinecolour } + named paint { paint } + import @TextureImport named texture { texture } + named font { font } + named break { break } + named format right @Body { format @Body } + named valign { valign } + named vsize { vsize } + named vindent { vindent } + named vstrut + named no { 0.0f } + named yes { 1.0f } + { vstrut } + named vmargin { vmargin } + named topmargin { topmargin } + named footmargin { footmargin } + named halign { halign } + named hsize { hsize } + named hindent { hindent } + named hstrut + named no { 0.0f } + named yes { 1.0f } + { hstrut } + named hmargin { hmargin } + named leftmargin { leftmargin } + named rightmargin { rightmargin } + + ####################################################################### + # # + # @ANode options of @Diag # + # # + ####################################################################### + + import @Geometry named aoutline + named margin {} + named shadow {} + named sides {} + named angle {} + { aoutline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named amargin { amargin } + import @Geometry named ashadow { ashadow } + import @Geometry named asides { asides } + import @Geometry named aangle { aangle } + named atranslate { atranslate } + named anodetag { } + named aoutlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { aoutlinestyle } + import @Geometry named aoutlinedashlength{ aoutlinedashlength } + import @Geometry named aoutlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { aoutlinewidth } + named aoutlinecolour aoutlinecolor { aoutlinecolour } + named apaint { apaint } + import @TextureImport named atexture { atexture } + named afont { afont } + named abreak { abreak } + named aformat right @Body { aformat @Body } + named avalign { avalign } + named avsize { avsize } + named avindent { avindent } + named avstrut + named no { 0.0f } + named yes { 1.0f } + { avstrut } + named avmargin { avmargin } + named atopmargin { atopmargin } + named afootmargin { afootmargin } + named ahalign { ahalign } + named ahsize { ahsize } + named ahindent { ahindent } + named ahstrut + named no { 0.0f } + named yes { 1.0f } + { ahstrut } + named ahmargin { ahmargin } + named aleftmargin { aleftmargin } + named arightmargin { arightmargin } + + ####################################################################### + # # + # @BNode options of @Diag # + # # + ####################################################################### + + import @Geometry named boutline + named margin {} + named shadow {} + named sides {} + named angle {} + { boutline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named bmargin { bmargin } + import @Geometry named bshadow { bshadow } + import @Geometry named bsides { bsides } + import @Geometry named bangle { bangle } + named btranslate { btranslate } + named bnodetag { } + named boutlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { boutlinestyle } + import @Geometry named boutlinedashlength{ boutlinedashlength } + import @Geometry named boutlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { boutlinewidth } + named boutlinecolour boutlinecolor { boutlinecolour } + named bpaint { bpaint } + import @TextureImport named btexture { btexture } + named bfont { bfont } + named bbreak { bbreak } + named bformat right @Body { bformat @Body } + named bvalign { bvalign } + named bvsize { bvsize } + named bvindent { bvindent } + named bvstrut + named no { 0.0f } + named yes { 1.0f } + { bvstrut } + named bvmargin { bvmargin } + named btopmargin { btopmargin } + named bfootmargin { bfootmargin } + named bhalign { bhalign } + named bhsize { bhsize } + named bhindent { bhindent } + named bhstrut + named no { 0.0f } + named yes { 1.0f } + { bhstrut } + named bhmargin { bhmargin } + named bleftmargin { bleftmargin } + named brightmargin { brightmargin } + + ####################################################################### + # # + # @CNode options of @Diag # + # # + ####################################################################### + + import @Geometry named coutline + named margin {} + named shadow {} + named sides {} + named angle {} + { coutline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named cmargin { cmargin } + import @Geometry named cshadow { cshadow } + import @Geometry named csides { csides } + import @Geometry named cangle { cangle } + named ctranslate { ctranslate } + named cnodetag { } + named coutlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { coutlinestyle } + import @Geometry named coutlinedashlength{ coutlinedashlength } + import @Geometry named coutlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { coutlinewidth } + named coutlinecolour coutlinecolor { coutlinecolour } + named cpaint { cpaint } + import @TextureImport named ctexture { ctexture } + named cfont { cfont } + named cbreak { cbreak } + named cformat right @Body { cformat @Body } + named cvalign { cvalign } + named cvsize { cvsize } + named cvindent { cvindent } + named cvstrut + named no { 0.0f } + named yes { 1.0f } + { cvstrut } + named cvmargin { cvmargin } + named ctopmargin { ctopmargin } + named cfootmargin { cfootmargin } + named chalign { chalign } + named chsize { chsize } + named chindent { chindent } + named chstrut + named no { 0.0f } + named yes { 1.0f } + { chstrut } + named chmargin { chmargin } + named cleftmargin { cleftmargin } + named crightmargin { crightmargin } + + ####################################################################### + # # + # @DNode options of @Diag # + # # + ####################################################################### + + import @Geometry named doutline + named margin {} + named shadow {} + named sides {} + named angle {} + { doutline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named dmargin { dmargin } + import @Geometry named dshadow { dshadow } + import @Geometry named dsides { dsides } + import @Geometry named dangle { dangle } + named dtranslate { dtranslate } + named dnodetag { } + named doutlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { doutlinestyle } + import @Geometry named doutlinedashlength{ doutlinedashlength } + import @Geometry named doutlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { doutlinewidth } + named doutlinecolour doutlinecolor { doutlinecolour } + named dpaint { dpaint } + import @TextureImport named dtexture { dtexture } + named dfont { dfont } + named dbreak { dbreak } + named dformat right @Body { dformat @Body } + named dvalign { dvalign } + named dvsize { dvsize } + named dvindent { dvindent } + named dvstrut + named no { 0.0f } + named yes { 1.0f } + { dvstrut } + named dvmargin { dvmargin } + named dtopmargin { dtopmargin } + named dfootmargin { dfootmargin } + named dhalign { dhalign } + named dhsize { dhsize } + named dhindent { dhindent } + named dhstrut + named no { 0.0f } + named yes { 1.0f } + { dhstrut } + named dhmargin { dhmargin } + named dleftmargin { dleftmargin } + named drightmargin { drightmargin } + + ####################################################################### + # # + # @ENode options of @Diag # + # # + ####################################################################### + + import @Geometry named eoutline + named margin {} + named shadow {} + named sides {} + named angle {} + { eoutline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named emargin { emargin } + import @Geometry named eshadow { eshadow } + import @Geometry named esides { esides } + import @Geometry named eangle { eangle } + named etranslate { etranslate } + named enodetag { } + named eoutlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { eoutlinestyle } + import @Geometry named eoutlinedashlength{ eoutlinedashlength } + import @Geometry named eoutlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { eoutlinewidth } + named eoutlinecolour eoutlinecolor { eoutlinecolour } + named epaint { epaint } + import @TextureImport named etexture { etexture } + named efont { efont } + named ebreak { ebreak } + named eformat right @Body { eformat @Body } + named evalign { evalign } + named evsize { evsize } + named evindent { evindent } + named evstrut + named no { 0.0f } + named yes { 1.0f } + { evstrut } + named evmargin { evmargin } + named etopmargin { etopmargin } + named efootmargin { efootmargin } + named ehalign { ehalign } + named ehsize { ehsize } + named ehindent { ehindent } + named ehstrut + named no { 0.0f } + named yes { 1.0f } + { ehstrut } + named ehmargin { ehmargin } + named eleftmargin { eleftmargin } + named erightmargin { erightmargin } + + ####################################################################### + # # + # @Link options of @Diag # + # # + ####################################################################### + + import @Geometry named path + named from {} + named to {} + named bias {} + named fbias {} + named tbias {} + named hfrac {} + named hbias {} + named radius {} + named xindent {} + named zindent {} + named frompt {} + named topt {} + named arrow {} + named arrowlength {} + named backarrowlength {} + { path + from { from } + to { to } + bias { bias } + fbias { fbias } + tbias { tbias } + hfrac { hfrac } + hbias { hbias } + radius { radius } + xindent { xindent } + zindent { zindent } + frompt { frompt } + topt { topt } + arrow { arrow } + arrowlength { arrowlength } + backarrowlength{ backarrowlength } + } + import @Geometry named from { from } + import @Geometry named to { to } + 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 } + import @Geometry named frompt { frompt } + import @Geometry named topt { topt } + named pathstyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { pathstyle } + import @Geometry named pathdashlength { pathdashlength } + import @Geometry named pathwidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { pathwidth } + named pathcolour pathcolor { pathcolour } + import @Geometry named pathgap + named thin { 0.08 ft } + named medium { 0.16 ft } + named thick { 0.24 ft } + { pathgap } + named arrow { arrow } + named arrowstyle { arrowstyle } + named arrowwidth { arrowwidth } + named arrowlength { arrowlength } + named backarrowstyle { backarrowstyle } + named backarrowwidth { backarrowwidth } + named backarrowlength { backarrowlength } + + named nodelabel { nodelabel } + named nodelabelmargin { nodelabelmargin } + named nodelabelfont { nodelabelfont } + named nodelabelbreak { nodelabelbreak } + named nodelabelformat right @Body { nodelabelformat @Body } + import @Geometry named nodelabelpos { nodelabelpos } + named nodelabelprox { nodelabelprox } + import @Geometry named nodelabelangle { nodelabelangle } + named nodelabelctr { nodelabelctr } + import @Geometry named nodelabeladjust { nodelabeladjust } + + named alabel { alabel } + named alabelmargin { alabelmargin } + named alabelfont { alabelfont } + named alabelbreak { alabelbreak } + named alabelformat right @Body { alabelformat @Body } + import @Geometry named alabelpos { alabelpos } + named alabelprox { alabelprox } + import @Geometry named alabelangle { alabelangle } + named alabelctr { alabelctr } + import @Geometry named alabeladjust { alabeladjust } + + named blabel { blabel } + named blabelmargin { blabelmargin } + named blabelfont { blabelfont } + named blabelbreak { blabelbreak } + named blabelformat right @Body { blabelformat @Body } + import @Geometry named blabelpos { blabelpos } + named blabelprox { blabelprox } + import @Geometry named blabelangle { blabelangle } + named blabelctr { blabelctr } + import @Geometry named blabeladjust { blabeladjust } + + named clabel { clabel } + named clabelmargin { clabelmargin } + named clabelfont { clabelfont } + named clabelbreak { clabelbreak } + named clabelformat right @Body { clabelformat @Body } + import @Geometry named clabelpos { clabelpos } + named clabelprox { clabelprox } + import @Geometry named clabelangle { clabelangle } + named clabelctr { clabelctr } + import @Geometry named clabeladjust { clabeladjust } + + named dlabel { dlabel } + named dlabelmargin { dlabelmargin } + named dlabelfont { dlabelfont } + named dlabelbreak { dlabelbreak } + named dlabelformat right @Body { dlabelformat @Body } + import @Geometry named dlabelpos { dlabelpos } + named dlabelprox { dlabelprox } + import @Geometry named dlabelangle { dlabelangle } + named dlabelctr { dlabelctr } + import @Geometry named dlabeladjust { dlabeladjust } + + named fromlabel { fromlabel } + named fromlabelmargin { fromlabelmargin } + named fromlabelfont { fromlabelfont } + named fromlabelbreak { fromlabelbreak } + named fromlabelformat right @Body { fromlabelformat @Body } + import @Geometry named fromlabelpos { fromlabelpos } + named fromlabelprox { fromlabelprox } + import @Geometry named fromlabelangle { fromlabelangle } + named fromlabelctr { fromlabelctr } + import @Geometry named fromlabeladjust { fromlabeladjust } + + named linklabel { linklabel } + named linklabelmargin { linklabelmargin } + named linklabelfont { linklabelfont } + named linklabelbreak { linklabelbreak } + named linklabelformat right @Body { linklabelformat @Body } + import @Geometry named linklabelpos { linklabelpos } + named linklabelprox { linklabelprox } + import @Geometry named linklabelangle { linklabelangle } + named linklabelctr { linklabelctr } + import @Geometry named linklabeladjust { linklabeladjust } + + named xlabel { xlabel } + named xlabelmargin { xlabelmargin } + named xlabelfont { xlabelfont } + named xlabelbreak { xlabelbreak } + named xlabelformat right @Body { xlabelformat @Body } + import @Geometry named xlabelpos { xlabelpos } + named xlabelprox { xlabelprox } + import @Geometry named xlabelangle { xlabelangle } + named xlabelctr { xlabelctr } + import @Geometry named xlabeladjust { xlabeladjust } + + named ylabel { ylabel } + named ylabelmargin { ylabelmargin } + named ylabelfont { ylabelfont } + named ylabelbreak { ylabelbreak } + named ylabelformat right @Body { ylabelformat @Body } + import @Geometry named ylabelpos { ylabelpos } + named ylabelprox { ylabelprox } + import @Geometry named ylabelangle { ylabelangle } + named ylabelctr { ylabelctr } + import @Geometry named ylabeladjust { ylabeladjust } + + named zlabel { zlabel } + named zlabelmargin { zlabelmargin } + named zlabelfont { zlabelfont } + named zlabelbreak { zlabelbreak } + named zlabelformat right @Body { zlabelformat @Body } + import @Geometry named zlabelpos { zlabelpos } + named zlabelprox { zlabelprox } + import @Geometry named zlabelangle { zlabelangle } + named zlabelctr { zlabelctr } + import @Geometry named zlabeladjust { zlabeladjust } + + named tolabel { tolabel } + named tolabelmargin { tolabelmargin } + named tolabelfont { tolabelfont } + named tolabelbreak { tolabelbreak } + named tolabelformat right @Body { tolabelformat @Body } + import @Geometry named tolabelpos { tolabelpos } + named tolabelprox { tolabelprox } + import @Geometry named tolabelangle { tolabelangle } + named tolabelctr { tolabelctr } + import @Geometry named tolabeladjust { tolabeladjust } + + ####################################################################### + # # + # Tree and syntax diagram options of @Diag # + # # + ####################################################################### + + named treehsep { treehsep } + named treevsep { treevsep } + named treehindent + named left { 0.0rt } + named ctr { 0.5rt } + named right { 1.0rt } + { treehindent } + named treevindent + named top { 0.0rt } + named ctr { 0.5rt } + named foot { 1.0rt } + { treevindent } + named syntaxgap { syntaxgap } + named syntaxbias { syntaxbias } + named syntaxradius { syntaxradius } + body @Body + @Begin + + + ####################################################################### + # # + # Miscellaneous helper definitions # + # # + ####################################################################### + + def @PSAddPaint left col right tex + { + col @Case { + { "no" "none" "nopaint" } @Yield "{}" + else @Yield { "{" @ColourCommand col tex "fill }" } + } + } + + # Like @Graphic, but affects the graphics state of right parameter + def @InnerGraphic + left ps + right x + { + @BackEnd @Case { + PostScript @Yield { + { ps gsave // grestore } @Graphic x + } + PDF @Yield { + { ps q // Q } @Graphic x + } + } + } + + def @BoxLabels right x + { + @BackEnd @Case { + PostScript @Yield { + "[ ldiagbox ] pop" @Graphic x + } + PDF @Yield {} + } + } + + def @IfNonEmpty + left x + right y + { + x @Case { + "" @Yield @Null + else @Yield y + } + } + + def @Else + precedence 20 + associativity right + left x + right y + { + x @Case { + "" @Yield y + else @Yield x + } + } + + def @ShowTags + right x + { + @BackEnd @Case { + PostScript @Yield { + { + "() ldiagpushtagdict" + // "ldiagshowtags ldiagpopuptagdict" + } @Graphic x + } + PDF @Yield {} + } + } + + def @ShowPoints + right x + { + @BackEnd @Case { + PostScript @Yield { + { + "() ldiagpushtagdict" + // "ldiagshowpoints ldiagpopuptagdict" + } @Graphic x + } + PDF @Yield {} + } + } + + def @ShowDirections + right x + { + @BackEnd @Case { + PostScript @Yield { + { "() ldiagpushtagdict" + // "ldiagshowangles ldiagpopuptagdict" } @Graphic x + } + PDF @Yield {} + } + } + + def @ShowMarks right x + { + { "xmark -0.5 cm moveto xmark ysize 0.5 cm add lineto stroke" } @Graphic x + } + + + def "::" + precedence 33 + associativity right + left name + named restrict {} + right x + { + + 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 {} + } + } + + def @CatchTags + precedence 33 + associativity right + right x + { + @BackEnd @Case { + PostScript @Yield { + { + "() ldiagpushtagdict" + // "ldiagpoptagdict" + } + @Graphic x + } + PDF @Yield {} + } + } + + def @ZeroWidth right x + { + @HContract @VContract { + ^|0io @HContract @VContract x |0io + } + } + + def @ZeroSize right x + { + @HContract @VContract { + ^/0io ^|0io @HContract @VContract x |0io /0io + } + } + + def @FromArrowLength + left arrow + right arrowlength + { + @BackEnd @Case { + PostScript @Yield { + arrow @Case { + { no yes forward } @Yield 0 + { back both } @Yield {"("arrowlength") ldiagdecodelength"} + } + } + PDF @Yield {} + } + } + + def @ToArrowLength + left arrow + right arrowlength + { + @BackEnd @Case { + PostScript @Yield { + arrow @Case { + { no back } @Yield 0 + { yes forward both } @Yield {"("arrowlength") ldiagdecodelength"} + } + } + PDF @Yield {} + } + } + + def @AddMargins + named mtop {} + named mfoot {} + named mleft {} + named mright {} + right x + { + + @HContract @VContract { + ^|mleft |mright + ^/mtop | x | + /mfoot | | + } + } + + def @Transform + precedence 32 + import @Geometry named translate +# named to precedence 10 left x right y { x y "ldiagpsub" } + named to precedence 10 left x right y { + @BackEnd @Case { + PostScript @Yield { x y "ldiagpsub" } + PDF @Yield {""} + } + } + {} + import @Geometry named rotate { 0d } + named scale { 1 1 } + right x + { + @BackEnd @Case { + + PostScript @Yield { + { rotate "rotate" scale "scale newpath clip" } + @InnerGraphic + { + @ZeroSize x + } + // + # { rotate "rotate" scale "scale" translate "translate" } + { translate "translate" rotate "rotate" scale "scale" } + @InnerGraphic + { + @ZeroSize x + } + } + + PDF @Yield { # presume that "rotate", "scale" and "translate" are not matrices + { "__cos("rotate") __sin("rotate") __sub(0, __sin("rotate")) __cos("rotate") 0 0 cm" + "__pick(1, "scale") 0 0 __pick(2, "scale") 0 0 cm n W" } + @InnerGraphic + { + @ZeroSize x + } + // + # { rotate "rotate" scale "scale" translate "translate" } + { "1 0 0 1 "translate" cm" + "__cos("rotate") __sin("rotate") __sub(0, __sin("rotate")) __cos("rotate") 0 0 cm" + "__pick(1, "scale") 0 0 __pick(2, "scale") 0 0 cm" } + @InnerGraphic + { + @ZeroSize x + } + } + + } + } + + + ####################################################################### + # # + # @DoLabel definition for drawing one label # + # # + ####################################################################### + + def @DoLabel + named which {} + named labeltag { LABEL } + named label {} + named labelmargin {} + named labelfont {} + named labelbreak {} + named labelformat right @Body {} + named labelpos {} + named labelprox {} + named labelangle {} + named labelctr {} + named labeladjust {} + { + + import @Geometry + def alignedangle + { + labelpos??"ANGLE" quadcase + 0 { labelpos??"ANGLE" } + 0-90 { labelpos??"ANGLE" } + 90 { labelpos??"ANGLE" } + 90-180 { labelpos??"ANGLE" + 180d } + 180 { labelpos??"ANGLE" + 180d } + 180-270 { labelpos??"ANGLE" + 180d } + 270 { labelpos??"ANGLE" + 180d } + 270-360 { labelpos??"ANGLE" } + } + + import @Geometry + def perpalignedangle + { + labelpos??"ANGLE" quadcase + 0 { labelpos??"ANGLE" - 90d } + 0-90 { labelpos??"ANGLE" - 90d } + 90 { labelpos??"ANGLE" - 90d } + 90-180 { labelpos??"ANGLE" - 90d } + 180 { labelpos??"ANGLE" + 90d } + 180-270 { labelpos??"ANGLE" + 90d } + 270 { labelpos??"ANGLE" + 90d } + 270-360 { labelpos??"ANGLE" + 90d } + + } + + import @Geometry + def finalangle + { + labelangle @Case { + + "horizontal" @Yield { 0d } + "aligned" @Yield { alignedangle } + "perpendicular" @Yield { perpalignedangle } + "parallel" @Yield { labelpos??"ANGLE" } + "antiparallel" @Yield { labelpos??"ANGLE" + 180d } + else @Yield labelangle + } + } + + import @Geometry + def @AlignedAboveProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (SW) } + 90 { (SW) } + 90-180 { (SE) } + 180 { (SE) } + 180-270 { (SE) } + 270 { (SE) } + 270-360 { (SW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (SE) } + 90 { (SE) } + 90-180 { (SW) } + 180 { (SW) } + 180-270 { (SW) } + 270 { (SW) } + 270-360 { (SE) } + } + else @Yield (S) + } + } + + import @Geometry + def @AlignedBelowProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (NW) } + 0-90 { (NW) } + 90 { (NW) } + 90-180 { (NE) } + 180 { (NE) } + 180-270 { (NE) } + 270 { (NE) } + 270-360 { (NW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (NE) } + 0-90 { (NE) } + 90 { (NE) } + 90-180 { (NW) } + 180 { (NW) } + 180-270 { (NW) } + 270 { (NW) } + 270-360 { (NE) } + } + else @Yield (N) + } + } + + import @Geometry + def @AlignedLeftProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (SW) } + 90 { (SW) } + 90-180 { (NE) } + 180 { (SE) } + 180-270 { (SE) } + 270 { (SE) } + 270-360 { (NW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (SE) } + 90 { (SE) } + 90-180 { (NW) } + 180 { (SW) } + 180-270 { (SW) } + 270 { (SW) } + 270-360 { (NE) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (S) } + 0-90 { (S) } + 90 { (S) } + 90-180 { (N) } + 180 { (S) } + 180-270 { (S) } + 270 { (S) } + 270-360 { (N) } + } + } + } + + import @Geometry + def @AlignedRightProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (NW) } + 90 { (NW) } + 90-180 { (SE) } + 180 { (SE) } + 180-270 { (NE) } + 270 { (NE) } + 270-360 { (SW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (NE) } + 90 { (NE) } + 90-180 { (SW) } + 180 { (SW) } + 180-270 { (NW) } + 270 { (NW) } + 270-360 { (SE) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (S) } + 0-90 { (N) } + 90 { (N) } + 90-180 { (S) } + 180 { (S) } + 180-270 { (N) } + 270 { (N) } + 270-360 { (S) } + } + } + } + + import @Geometry + def @AlignedInsideProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (SW) } + 90 { (SW) } + 90-180 { (NE) } + 180 { (NE) } + 180-270 { (NE) } + 270 { (NE) } + 270-360 { (SW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (SE) } + 90 { (SE) } + 90-180 { (NW) } + 180 { (NW) } + 180-270 { (NW) } + 270 { (NW) } + 270-360 { (SE) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (S) } + 0-90 { (S) } + 90 { (S) } + 90-180 { (N) } + 180 { (N) } + 180-270 { (N) } + 270 { (N) } + 270-360 { (S) } + } + } + } + + import @Geometry + def @AlignedOutsideProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (NW) } + 0-90 { (NW) } + 90 { (NW) } + 90-180 { (SE) } + 180 { (SE) } + 180-270 { (SE) } + 270 { (SE) } + 270-360 { (NW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (NE) } + 0-90 { (NE) } + 90 { (NE) } + 90-180 { (SW) } + 180 { (SW) } + 180-270 { (SW) } + 270 { (SW) } + 270-360 { (NE) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (N) } + 0-90 { (N) } + 90 { (N) } + 90-180 { (S) } + 180 { (S) } + 180-270 { (S) } + 270 { (S) } + 270-360 { (N) } + } + } + } + + + import @Geometry + def @PerpendicularAboveProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (SE) } + 90 { (SE) } + 90-180 { (SW) } + 180 { (NE) } + 180-270 { (NE) } + 270 { (NE) } + 270-360 { (NW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (NE) } + 0-90 { (NE) } + 90 { (NE) } + 90-180 { (NW) } + 180 { (SE) } + 180-270 { (SE) } + 270 { (SE) } + 270-360 { (SW) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (E) } + 0-90 { (E) } + 90 { (E) } + 90-180 { (W) } + 180 { (E) } + 180-270 { (E) } + 270 { (E) } + 270-360 { (W) } + } + } + } + + import @Geometry + def @PerpendicularBelowProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (SW) } + 90 { (SW) } + 90-180 { (SE) } + 180 { (NW) } + 180-270 { (NW) } + 270 { (NW) } + 270-360 { (NE) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (NW) } + 0-90 { (NW) } + 90 { (NW) } + 90-180 { (NE) } + 180 { (SW) } + 180-270 { (SW) } + 270 { (SW) } + 270-360 { (SE) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (W) } + 0-90 { (W) } + 90 { (W) } + 90-180 { (E) } + 180 { (W) } + 180-270 { (W) } + 270 { (W) } + 270-360 { (E) } + } + } + } + + import @Geometry + def @PerpendicularLeftProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (SE) } + 90 { (SE) } + 90-180 { (SE) } + 180 { (NE) } + 180-270 { (NE) } + 270 { (NE) } + 270-360 { (NE) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (NE) } + 0-90 { (NE) } + 90 { (NE) } + 90-180 { (NE) } + 180 { (SE) } + 180-270 { (SE) } + 270 { (SE) } + 270-360 { (SE) } + } + else @Yield (E) + } + } + + import @Geometry + def @PerpendicularRightProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (SW) } + 90 { (SW) } + 90-180 { (SW) } + 180 { (NW) } + 180-270 { (NW) } + 270 { (NW) } + 270-360 { (NW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (NW) } + 0-90 { (NW) } + 90 { (NW) } + 90-180 { (NW) } + 180 { (SW) } + 180-270 { (SW) } + 270 { (SW) } + 270-360 { (SW) } + } + else @Yield (W) + } + } + + import @Geometry + def @PerpendicularInsideProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (SE) } + 90 { (SE) } + 90-180 { (SE) } + 180 { (NW) } + 180-270 { (NW) } + 270 { (NW) } + 270-360 { (NW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (NE) } + 0-90 { (NE) } + 90 { (NE) } + 90-180 { (NE) } + 180 { (SW) } + 180-270 { (SW) } + 270 { (SW) } + 270-360 { (SW) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (E) } + 0-90 { (E) } + 90 { (E) } + 90-180 { (E) } + 180 { (W) } + 180-270 { (W) } + 270 { (W) } + 270-360 { (W) } + } + } + } + + import @Geometry + def @PerpendicularOutsideProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (SW) } + 90 { (SW) } + 90-180 { (SW) } + 180 { (NE) } + 180-270 { (NE) } + 270 { (NE) } + 270-360 { (NE) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (NW) } + 0-90 { (NW) } + 90 { (NW) } + 90-180 { (NW) } + 180 { (SE) } + 180-270 { (SE) } + 270 { (SE) } + 270-360 { (SE) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (W) } + 0-90 { (W) } + 90 { (W) } + 90-180 { (W) } + 180 { (E) } + 180-270 { (E) } + 270 { (E) } + 270-360 { (E) } + } + } + } + + + import @Geometry + def @OtherAboveProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (SE) } + 90 { (SW) } + 90-180 { (SW) } + 180 { (SE) } + 180-270 { (SE) } + 270 { (NW) } + 270-360 { (SW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (SE) } + 90 { (NW) } + 90-180 { (SW) } + 180 { (SW) } + 180-270 { (SE) } + 270 { (SW) } + 270-360 { (SW) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (S) } + 0-90 { (SE) } + 90 { (W) } + 90-180 { (SW) } + 180 { (S) } + 180-270 { (SE) } + 270 { (W) } + 270-360 { (SW) } + } + } + } + + import @Geometry + def @OtherBelowProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (NW) } + 0-90 { (NW) } + 90 { (SW) } + 90-180 { (NE) } + 180 { (NE) } + 180-270 { (NW) } + 270 { (NW) } + 270-360 { (NE) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (NE) } + 0-90 { (NW) } + 90 { (NW) } + 90-180 { (NE) } + 180 { (NW) } + 180-270 { (NW) } + 270 { (SW) } + 270-360 { (NE) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (N) } + 0-90 { (NW) } + 90 { (W) } + 90-180 { (NE) } + 180 { (N) } + 180-270 { (NW) } + 270 { (W) } + 270-360 { (NE) } + } + } + } + + import @Geometry + def @OtherLeftProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (SE) } + 90 { (SE) } + 90-180 { (NE) } + 180 { (SE) } + 180-270 { (SE) } + 270 { (NE) } + 270-360 { (NE) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (SE) } + 90 { (NE) } + 90-180 { (NE) } + 180 { (SW) } + 180-270 { (SE) } + 270 { (SE) } + 270-360 { (NE) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (S) } + 0-90 { (SE) } + 90 { (E) } + 90-180 { (NE) } + 180 { (S) } + 180-270 { (SE) } + 270 { (E) } + 270-360 { (NE) } + } + } + } + + import @Geometry + def @OtherRightProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (NW) } + 90 { (SW) } + 90-180 { (SW) } + 180 { (SE) } + 180-270 { (NW) } + 270 { (NW) } + 270-360 { (SW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (NW) } + 90 { (NW) } + 90-180 { (SW) } + 180 { (SW) } + 180-270 { (NW) } + 270 { (SW) } + 270-360 { (SW) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (S) } + 0-90 { (NW) } + 90 { (W) } + 90-180 { (SW) } + 180 { (S) } + 180-270 { (NW) } + 270 { (W) } + 270-360 { (SW) } + } + } + } + + import @Geometry + def @OtherInsideProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (SW) } + 0-90 { (SE) } + 90 { (SE) } + 90-180 { (NE) } + 180 { (NE) } + 180-270 { (NW) } + 270 { (NW) } + 270-360 { (SW) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (SE) } + 0-90 { (SE) } + 90 { (NE) } + 90-180 { (NE) } + 180 { (NW) } + 180-270 { (NW) } + 270 { (SW) } + 270-360 { (SW) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (S) } + 0-90 { (SE) } + 90 { (E) } + 90-180 { (NE) } + 180 { (N) } + 180-270 { (NW) } + 270 { (W) } + 270-360 { (SW) } + } + } + } + + import @Geometry + def @OtherOutsideProximity + { + which @Case { + { x f } @Yield { labelpos??ANGLE quadcase + 0 { (NW) } + 0-90 { (NW) } + 90 { (SW) } + 90-180 { (SW) } + 180 { (SE) } + 180-270 { (SE) } + 270 { (NE) } + 270-360 { (NE) } + } + { z t } @Yield { labelpos??ANGLE quadcase + 0 { (NE) } + 0-90 { (NW) } + 90 { (NW) } + 90-180 { (SW) } + 180 { (SW) } + 180-270 { (SE) } + 270 { (SE) } + 270-360 { (NE) } + } + else @Yield { labelpos??ANGLE quadcase + 0 { (N) } + 0-90 { (NW) } + 90 { (W) } + 90-180 { (SW) } + 180 { (S) } + 180-270 { (SE) } + 270 { (E) } + 270-360 { (NE) } + } + } + } + + + import @Geometry + def @AboveProximity + { + labelangle @Case { + "aligned" @Yield @AlignedAboveProximity + "perpendicular" @Yield @PerpendicularAboveProximity + else @Yield @OtherAboveProximity + } + } + + import @Geometry + def @BelowProximity + { + labelangle @Case { + "aligned" @Yield @AlignedBelowProximity + "perpendicular" @Yield @PerpendicularBelowProximity + else @Yield @OtherBelowProximity + } + } + + import @Geometry + def @LeftProximity + { + labelangle @Case { + "aligned" @Yield @AlignedLeftProximity + "perpendicular" @Yield @PerpendicularLeftProximity + else @Yield @OtherLeftProximity + } + } + + import @Geometry + def @RightProximity + { + labelangle @Case { + "aligned" @Yield @AlignedRightProximity + "perpendicular" @Yield @PerpendicularRightProximity + else @Yield @OtherRightProximity + } + } + + import @Geometry + def @InsideProximity + { + labelangle @Case { + "aligned" @Yield @AlignedInsideProximity + "perpendicular" @Yield @PerpendicularInsideProximity + else @Yield @OtherInsideProximity + } + } + + import @Geometry + def @OutsideProximity + { + labelangle @Case { + "aligned" @Yield @AlignedOutsideProximity + "perpendicular" @Yield @PerpendicularOutsideProximity + else @Yield @OtherOutsideProximity + } + } + + import @Geometry + def proximity + { + labelprox @Case { + above @Yield @AboveProximity + below @Yield @BelowProximity + left @Yield @LeftProximity + right @Yield @RightProximity + inside @Yield @InsideProximity + outside @Yield @OutsideProximity + else @Yield { "("labelprox")" } + } + } + + import @Geometry + def dorotate + left point + right angle + { + { {0 0} distance point } atangle { {0 0} angleto point + angle } + } + + import @Geometry + def translation + { + labelctr @Case { + { no No } @Yield { + labelpos -- labeltag?!?proximity + } + { yes Yes } @Yield { + #P0 := labelpos + #P1 := labeltag?!?proximity -- P0 + #P2 := labeltag??CTR -- P0 + #TH := labelpos??ANGLE + #P1A := P1 dorotate { 0 - TH } + #P2A := P2 dorotate { 0 - TH } + #PRA := { 0 - xcoord P2A 0 - ycoord P1A } + #PRA dorotate TH ++ P0 + XP1 := labeltag?!?proximity + XP2 := labeltag??CTR + XANG := labelpos??ANGLE + XTH := XANG - 90d - { XP1 angleto XP2 } + XDIST := { XP1 distance XP2 } * sin XTH + labelpos -- XP1 ++ XDIST atangle XANG + } + } + } + + @CatchTags @ZeroSize @Transform + translate { translation ++ labeladjust } + rotate { finalangle } + scale { 1 1 } + labeltag:: @BoxLabels @CatchTags @AddMargins + mtop { labelmargin } + mfoot { labelmargin } + mleft { labelmargin } + mright { labelmargin } + labelfont @Font labelbreak @Break labelformat label + } + + + ####################################################################### + # # + # @Node # + # # + ####################################################################### + + def @Node + import @Geometry named translate + named to precedence 10 left x right y { + @BackEnd @Case { + PostScript @Yield { x y "ldiagpsub" } + PDF @Yield {""} + } + } + {} + import @Geometry named rotate { 0d } + import @Geometry named outline + named margin {} + named shadow {} + named sides {} + named angle {} + { outline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named margin { margin } + import @Geometry named shadow { shadow } + import @Geometry named sides { sides } + import @Geometry named angle { angle } + named nodetag { nodetag } + named outlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { outlinestyle } + import @Geometry named outlinedashlength { outlinedashlength} + import @Geometry named outlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { outlinewidth } + named outlinecolour outlinecolor { outlinecolour } + named paint { paint } + import @TextureImport named texture { texture } + named font { font } + named break { break } + named format right @Body { format @Body } + named valign { valign } + named vsize { vsize } + named vindent { vindent } + named vstrut + named no { 0.0f } + named yes { 1.0f } + { vstrut } + named vmargin { vmargin } + named topmargin { topmargin } + named footmargin { footmargin } + + named halign { halign } + named hsize { hsize } + named hindent { hindent } + named hstrut + named no { 0.0f } + named yes { 1.0f } + { hstrut } + named hmargin { hmargin } + named leftmargin { leftmargin } + named rightmargin { rightmargin } + + named nodelabel { nodelabel } + named nodelabelmargin { nodelabelmargin } + named nodelabelfont { nodelabelfont } + named nodelabelbreak { nodelabelbreak } + named nodelabelformat right @Body { nodelabelformat @Body } + import @Geometry named nodelabelpos { nodelabelpos } + named nodelabelprox { nodelabelprox } + import @Geometry named nodelabelangle { nodelabelangle } + named nodelabelctr { nodelabelctr } + import @Geometry named nodelabeladjust { nodelabeladjust } + + named alabel { alabel } + named alabelmargin { alabelmargin } + named alabelfont { alabelfont } + named alabelbreak { alabelbreak } + named alabelformat right @Body { alabelformat @Body } + import @Geometry named alabelpos { alabelpos } + named alabelprox { alabelprox } + import @Geometry named alabelangle { alabelangle } + named alabelctr { alabelctr } + import @Geometry named alabeladjust { alabeladjust } + + named blabel { blabel } + named blabelmargin { blabelmargin } + named blabelfont { blabelfont } + named blabelbreak { blabelbreak } + named blabelformat right @Body { blabelformat @Body } + import @Geometry named blabelpos { blabelpos } + named blabelprox { blabelprox } + import @Geometry named blabelangle { blabelangle } + named blabelctr { blabelctr } + import @Geometry named blabeladjust { blabeladjust } + + named clabel { clabel } + named clabelmargin { clabelmargin } + named clabelfont { clabelfont } + named clabelbreak { clabelbreak } + named clabelformat right @Body { clabelformat @Body } + import @Geometry named clabelpos { clabelpos } + named clabelprox { clabelprox } + import @Geometry named clabelangle { clabelangle } + named clabelctr { clabelctr } + import @Geometry named clabeladjust { clabeladjust } + + named dlabel { dlabel } + named dlabelmargin { dlabelmargin } + named dlabelfont { dlabelfont } + named dlabelbreak { dlabelbreak } + named dlabelformat right @Body { dlabelformat @Body } + import @Geometry named dlabelpos { dlabelpos } + named dlabelprox { dlabelprox } + import @Geometry named dlabelangle { dlabelangle } + named dlabelctr { dlabelctr } + import @Geometry named dlabeladjust { dlabeladjust } + + right @Body + { + + def @LabelPos + left x + right y + { + nodelabelpos @Case { + x @Yield y + else @Yield "" + } + } + + def @If + left cond + right x + { + cond @Case { + { yes Yes } @Yield x + else @Yield "" + } + } + + + def @Strut right x + { + def vs { 0.5w @VShift { vstrut @High } } + def hs { hstrut @Wide } + + @HContract @VContract { + @HContract @VContract x | vs / hs | + } + } + + def @Indent right x + { + x @Case { + { top left } @Yield 0.0rt + { ctr } @Yield 0.5rt + { foot right } @Yield 1.0rt + { mctr } @Yield 0.5bx + else @Yield x + } + } + + def @VSize right x + { + vsize @Case { + "" @Yield x + else @Yield { vsize @High { /{@Indent vindent} x / } } + } + } + + def @HSize right x + { + hsize @Case { + "" @Yield x + else @Yield { hsize @Wide { |{@Indent hindent} x | } } + } + } + + def @Align right x + { + x @Case { + { top left } @Yield 0.0w + { ctr } @Yield 0.5w + { foot right } @Yield 1.0w + { mark } @Yield "+0i" + else @Yield x + } + } + + def @ALabel + { + @DoLabel + which { "a" } + label { alabel @Else nodelabel } + labelmargin { alabelmargin @Else nodelabelmargin } + labelfont { alabelfont @Else nodelabelfont } + labelbreak { alabelbreak @Else nodelabelbreak } + labelformat { alabelformat @Body @Else nodelabelformat @Body} + labelpos { alabelpos @Else nodelabelpos } + labelprox { alabelprox @Else nodelabelprox } + labelangle { alabelangle @Else nodelabelangle } + labelctr { alabelctr @Else nodelabelctr } + labeladjust { alabeladjust @Else nodelabeladjust } + } + + def @BLabel + { + @DoLabel + which { "b" } + label { blabel @Else nodelabel } + labelmargin { blabelmargin @Else nodelabelmargin } + labelfont { blabelfont @Else nodelabelfont } + labelbreak { blabelbreak @Else nodelabelbreak } + labelformat { blabelformat @Body @Else nodelabelformat @Body} + labelpos { blabelpos @Else nodelabelpos } + labelprox { blabelprox @Else nodelabelprox } + labelangle { blabelangle @Else nodelabelangle } + labelctr { blabelctr @Else nodelabelctr } + labeladjust { blabeladjust @Else nodelabeladjust } + } + + def @CLabel + { + @DoLabel + which { "c" } + label { clabel @Else nodelabel } + labelmargin { clabelmargin @Else nodelabelmargin } + labelfont { clabelfont @Else nodelabelfont } + labelbreak { clabelbreak @Else nodelabelbreak } + labelformat { clabelformat @Body @Else nodelabelformat @Body} + labelpos { clabelpos @Else nodelabelpos } + labelprox { clabelprox @Else nodelabelprox } + labelangle { clabelangle @Else nodelabelangle } + labelctr { clabelctr @Else nodelabelctr } + labeladjust { clabeladjust @Else nodelabeladjust } + } + + def @DLabel + { + @DoLabel + which { "d" } + label { dlabel @Else nodelabel } + labelmargin { dlabelmargin @Else nodelabelmargin } + labelfont { dlabelfont @Else nodelabelfont } + labelbreak { dlabelbreak @Else nodelabelbreak } + labelformat { dlabelformat @Body @Else nodelabelformat @Body} + labelpos { dlabelpos @Else nodelabelpos } + labelprox { dlabelprox @Else nodelabelprox } + labelangle { dlabelangle @Else nodelabelangle } + labelctr { dlabelctr @Else nodelabelctr } + labeladjust { dlabeladjust @Else nodelabeladjust } + } + + import @Geometry + def @OutLine + { + @BackEnd @Case { + PostScript @Yield { + outline @Case { + box @Yield { "ldiagbox" } + curvebox @Yield { "("margin") ldiagcurvebox" } + shadowbox @Yield { shadow "ldiagshadow ldiagbox" } + square @Yield { "ldiagsquare" } + diamond @Yield { "ldiagdiamond" } + polygon @Yield { sides angle "ldiagpolygon" } + isosceles @Yield { "ldiagisosceles" } + ellipse @Yield { "ldiagellipse" } + circle @Yield { "ldiagcircle" } + else @Yield { + outline + margin { "("margin") ldiagdecodelength" } + shadow { shadow } + sides { sides } + angle { angle } + } + } + } + PDF @Yield {} + } + } + + def @Value + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + { + "ldiagnodebegin [" @OutLine "]" outlinedashlength + "[" outlinestyle "]" outlinewidth + "{" @ColourCommand outlinecolour "}" + paint @PSAddPaint texture "ldiagnodeend" + "(IN) ldiagpushtagdict" + // + "ldiagpopuptagdict" + } + @Graphic + { + {@Align valign} @VShift {@Align halign} @HShift + @AddMargins + mtop { topmargin @Else vmargin @Else margin } + mfoot { footmargin @Else vmargin @Else margin } + mleft { leftmargin @Else hmargin @Else margin } + mright { rightmargin @Else hmargin @Else margin } + @HSize @VSize @HContract @VContract + font @Font break @Break format @Strut @Body + } + / {alabel @Else nodelabel} @IfNonEmpty @ALabel + / {blabel @Else nodelabel} @IfNonEmpty @BLabel + / {clabel @Else nodelabel} @IfNonEmpty @CLabel + / {dlabel @Else nodelabel} @IfNonEmpty @DLabel + } + } + PDF @Yield {} + } + } + + def @TValue + { + nodetag @Case { + "" @Yield @Value + else @Yield { nodetag:: @Value } + } + } + + translate @Case { + "" @Yield @TValue + else @Yield { + @Null & # so that preceding space gets chewed up + @Transform translate { translate } rotate { rotate } @TValue + } + } + } + + + ####################################################################### + # # + # @ANode # + # # + ####################################################################### + + def @ANode + import @Geometry named translate + named to precedence 10 left x right y { + @BackEnd @Case { + PostScript @Yield { x y "ldiagpsub" } + PDF @Yield {""} + } + } + {} + import @Geometry named rotate { 0d } + import @Geometry named outline + named margin {} + named shadow {} + named sides {} + named angle {} + { aoutline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named margin { amargin } + import @Geometry named shadow { ashadow } + import @Geometry named sides { asides } + import @Geometry named angle { aangle } + named nodetag { anodetag } + named outlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { aoutlinestyle } + import @Geometry named outlinedashlength { aoutlinedashlength} + import @Geometry named outlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { aoutlinewidth } + named outlinecolour outlinecolor { aoutlinecolour } + named paint { apaint } + import @TextureImport named texture { atexture } + named font { afont } + named break { abreak } + named format right @Body { aformat @Body } + named valign { avalign } + named vsize { avsize } + named vindent { avindent } + named vstrut + named no { 0.0f } + named yes { 1.0f } + { avstrut } + named vmargin { avmargin } + named topmargin { atopmargin } + named footmargin { afootmargin } + + named halign { ahalign } + named hsize { ahsize } + named hindent { ahindent } + named hstrut + named no { 0.0f } + named yes { 1.0f } + { ahstrut } + named hmargin { ahmargin } + named leftmargin { aleftmargin } + named rightmargin { arightmargin } + + named nodelabel { anodelabel } + named nodelabelmargin { anodelabelmargin } + named nodelabelfont { anodelabelfont } + named nodelabelbreak { anodelabelbreak } + named nodelabelformat right @Body { anodelabelformat @Body } + import @Geometry named nodelabelpos { anodelabelpos } + named nodelabelprox { anodelabelprox } + import @Geometry named nodelabelangle { anodelabelangle } + named nodelabelctr { anodelabelctr } + import @Geometry named nodelabeladjust { anodelabeladjust } + + named alabel { aalabel } + named alabelmargin { aalabelmargin } + named alabelfont { aalabelfont } + named alabelbreak { aalabelbreak } + named alabelformat right @Body { aalabelformat @Body } + import @Geometry named alabelpos { aalabelpos } + named alabelprox { aalabelprox } + import @Geometry named alabelangle { aalabelangle } + named alabelctr { aalabelctr } + import @Geometry named alabeladjust { aalabeladjust } + + named blabel { ablabel } + named blabelmargin { ablabelmargin } + named blabelfont { ablabelfont } + named blabelbreak { ablabelbreak } + named blabelformat right @Body { ablabelformat @Body } + import @Geometry named blabelpos { ablabelpos } + named blabelprox { ablabelprox } + import @Geometry named blabelangle { ablabelangle } + named blabelctr { ablabelctr } + import @Geometry named blabeladjust { ablabeladjust } + + named clabel { aclabel } + named clabelmargin { aclabelmargin } + named clabelfont { aclabelfont } + named clabelbreak { aclabelbreak } + named clabelformat right @Body { aclabelformat @Body } + import @Geometry named clabelpos { aclabelpos } + named clabelprox { aclabelprox } + import @Geometry named clabelangle { aclabelangle } + named clabelctr { aclabelctr } + import @Geometry named clabeladjust { aclabeladjust } + + named dlabel { adlabel } + named dlabelmargin { adlabelmargin } + named dlabelfont { adlabelfont } + named dlabelbreak { adlabelbreak } + named dlabelformat right @Body { adlabelformat @Body } + import @Geometry named dlabelpos { adlabelpos } + named dlabelprox { adlabelprox } + import @Geometry named dlabelangle { adlabelangle } + named dlabelctr { adlabelctr } + import @Geometry named dlabeladjust { adlabeladjust } + + right @Body + { + + def @LabelPos + left x + right y + { + nodelabelpos @Case { + x @Yield y + else @Yield "" + } + } + + def @If + left cond + right x + { + cond @Case { + { yes Yes } @Yield x + else @Yield "" + } + } + + + def @Strut right x + { + def vs { 0.5w @VShift { vstrut @High } } + def hs { hstrut @Wide } + + @HContract @VContract { + @HContract @VContract x | vs / hs | + } + } + + def @Indent right x + { + x @Case { + { top left } @Yield 0.0rt + { ctr } @Yield 0.5rt + { foot right } @Yield 1.0rt + { mctr } @Yield 0.5bx + else @Yield x + } + } + + def @VSize right x + { + vsize @Case { + "" @Yield x + else @Yield { vsize @High { /{@Indent vindent} x / } } + } + } + + def @HSize right x + { + hsize @Case { + "" @Yield x + else @Yield { hsize @Wide { |{@Indent hindent} x | } } + } + } + + def @Align right x + { + x @Case { + { top left } @Yield 0.0w + { ctr } @Yield 0.5w + { foot right } @Yield 1.0w + { mark } @Yield "+0i" + else @Yield x + } + } + + def @ALabel + { + @DoLabel + which { "a" } + label { alabel @Else nodelabel } + labelmargin { alabelmargin @Else nodelabelmargin } + labelfont { alabelfont @Else nodelabelfont } + labelbreak { alabelbreak @Else nodelabelbreak } + labelformat { alabelformat @Body @Else nodelabelformat @Body} + labelpos { alabelpos @Else nodelabelpos } + labelprox { alabelprox @Else nodelabelprox } + labelangle { alabelangle @Else nodelabelangle } + labelctr { alabelctr @Else nodelabelctr } + labeladjust { alabeladjust @Else nodelabeladjust } + } + + def @BLabel + { + @DoLabel + which { "b" } + label { blabel @Else nodelabel } + labelmargin { blabelmargin @Else nodelabelmargin } + labelfont { blabelfont @Else nodelabelfont } + labelbreak { blabelbreak @Else nodelabelbreak } + labelformat { blabelformat @Body @Else nodelabelformat @Body} + labelpos { blabelpos @Else nodelabelpos } + labelprox { blabelprox @Else nodelabelprox } + labelangle { blabelangle @Else nodelabelangle } + labelctr { blabelctr @Else nodelabelctr } + labeladjust { blabeladjust @Else nodelabeladjust } + } + + def @CLabel + { + @DoLabel + which { "c" } + label { clabel @Else nodelabel } + labelmargin { clabelmargin @Else nodelabelmargin } + labelfont { clabelfont @Else nodelabelfont } + labelbreak { clabelbreak @Else nodelabelbreak } + labelformat { clabelformat @Body @Else nodelabelformat @Body} + labelpos { clabelpos @Else nodelabelpos } + labelprox { clabelprox @Else nodelabelprox } + labelangle { clabelangle @Else nodelabelangle } + labelctr { clabelctr @Else nodelabelctr } + labeladjust { clabeladjust @Else nodelabeladjust } + } + + def @DLabel + { + @DoLabel + which { "d" } + label { dlabel @Else nodelabel } + labelmargin { dlabelmargin @Else nodelabelmargin } + labelfont { dlabelfont @Else nodelabelfont } + labelbreak { dlabelbreak @Else nodelabelbreak } + labelformat { dlabelformat @Body @Else nodelabelformat @Body} + labelpos { dlabelpos @Else nodelabelpos } + labelprox { dlabelprox @Else nodelabelprox } + labelangle { dlabelangle @Else nodelabelangle } + labelctr { dlabelctr @Else nodelabelctr } + labeladjust { dlabeladjust @Else nodelabeladjust } + } + + import @Geometry + def @OutLine + { + @BackEnd @Case { + PostScript @Yield { + outline @Case { + box @Yield { "ldiagbox" } + curvebox @Yield { "("margin") ldiagcurvebox" } + shadowbox @Yield { shadow "ldiagshadow ldiagbox" } + square @Yield { "ldiagsquare" } + diamond @Yield { "ldiagdiamond" } + polygon @Yield { sides angle "ldiagpolygon" } + isosceles @Yield { "ldiagisosceles" } + ellipse @Yield { "ldiagellipse" } + circle @Yield { "ldiagcircle" } + else @Yield { + outline + margin { "("margin") ldiagdecodelength" } + shadow { shadow } + sides { sides } + angle { angle } + } + } + } + PDF @Yield {} + } + } + + def @Value + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + { + "ldiagnodebegin [" @OutLine "]" outlinedashlength + "[" outlinestyle "]" outlinewidth + "{" @ColourCommand outlinecolour "}" + paint @PSAddPaint texture "ldiagnodeend" + "(IN) ldiagpushtagdict" + // + "ldiagpopuptagdict" + } + @Graphic + { + {@Align valign} @VShift {@Align halign} @HShift + @AddMargins + mtop { topmargin @Else vmargin @Else margin } + mfoot { footmargin @Else vmargin @Else margin } + mleft { leftmargin @Else hmargin @Else margin } + mright { rightmargin @Else hmargin @Else margin } + @HSize @VSize @HContract @VContract + font @Font break @Break format @Strut @Body + } + / {alabel @Else nodelabel} @IfNonEmpty @ALabel + / {blabel @Else nodelabel} @IfNonEmpty @BLabel + / {clabel @Else nodelabel} @IfNonEmpty @CLabel + / {dlabel @Else nodelabel} @IfNonEmpty @DLabel + } + } + PDF @Yield {} + } + } + + def @TValue + { + nodetag @Case { + "" @Yield @Value + else @Yield { nodetag:: @Value } + } + } + + translate @Case { + "" @Yield @TValue + else @Yield { + @Null & # so that preceding space gets chewed up + @Transform translate { translate } rotate { rotate } @TValue + } + } + } + + + ####################################################################### + # # + # @BNode # + # # + ####################################################################### + + def @BNode + import @Geometry named translate + named to precedence 10 left x right y { + @BackEnd @Case { + PostScript @Yield { x y "ldiagpsub" } + PDF @Yield {""} + } + } + {} + import @Geometry named rotate { 0d } + import @Geometry named outline + named margin {} + named shadow {} + named sides {} + named angle {} + { boutline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named margin { bmargin } + import @Geometry named shadow { bshadow } + import @Geometry named sides { bsides } + import @Geometry named angle { bangle } + named nodetag { bnodetag } + named outlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { boutlinestyle } + import @Geometry named outlinedashlength { boutlinedashlength} + import @Geometry named outlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { boutlinewidth } + named outlinecolour outlinecolor { boutlinecolour } + named paint { bpaint } + import @TextureImport named texture { btexture } + named font { bfont } + named break { bbreak } + named format right @Body { bformat @Body } + named valign { bvalign } + named vsize { bvsize } + named vindent { bvindent } + named vstrut + named no { 0.0f } + named yes { 1.0f } + { bvstrut } + named vmargin { bvmargin } + named topmargin { btopmargin } + named footmargin { bfootmargin } + + named halign { bhalign } + named hsize { bhsize } + named hindent { bhindent } + named hstrut + named no { 0.0f } + named yes { 1.0f } + { bhstrut } + named hmargin { bhmargin } + named leftmargin { bleftmargin } + named rightmargin { brightmargin } + + named nodelabel { bnodelabel } + named nodelabelmargin { bnodelabelmargin } + named nodelabelfont { bnodelabelfont } + named nodelabelbreak { bnodelabelbreak } + named nodelabelformat right @Body { bnodelabelformat @Body } + import @Geometry named nodelabelpos { bnodelabelpos } + named nodelabelprox { bnodelabelprox } + import @Geometry named nodelabelangle { bnodelabelangle } + named nodelabelctr { bnodelabelctr } + import @Geometry named nodelabeladjust { bnodelabeladjust } + + named alabel { balabel } + named alabelmargin { balabelmargin } + named alabelfont { balabelfont } + named alabelbreak { balabelbreak } + named alabelformat right @Body { balabelformat @Body } + import @Geometry named alabelpos { balabelpos } + named alabelprox { balabelprox } + import @Geometry named alabelangle { balabelangle } + named alabelctr { balabelctr } + import @Geometry named alabeladjust { balabeladjust } + + named blabel { bblabel } + named blabelmargin { bblabelmargin } + named blabelfont { bblabelfont } + named blabelbreak { bblabelbreak } + named blabelformat right @Body { bblabelformat @Body } + import @Geometry named blabelpos { bblabelpos } + named blabelprox { bblabelprox } + import @Geometry named blabelangle { bblabelangle } + named blabelctr { bblabelctr } + import @Geometry named blabeladjust { bblabeladjust } + + named clabel { bclabel } + named clabelmargin { bclabelmargin } + named clabelfont { bclabelfont } + named clabelbreak { bclabelbreak } + named clabelformat right @Body { bclabelformat @Body } + import @Geometry named clabelpos { bclabelpos } + named clabelprox { bclabelprox } + import @Geometry named clabelangle { bclabelangle } + named clabelctr { bclabelctr } + import @Geometry named clabeladjust { bclabeladjust } + + named dlabel { bdlabel } + named dlabelmargin { bdlabelmargin } + named dlabelfont { bdlabelfont } + named dlabelbreak { bdlabelbreak } + named dlabelformat right @Body { bdlabelformat @Body } + import @Geometry named dlabelpos { bdlabelpos } + named dlabelprox { bdlabelprox } + import @Geometry named dlabelangle { bdlabelangle } + named dlabelctr { bdlabelctr } + import @Geometry named dlabeladjust { bdlabeladjust } + + right @Body + { + + def @LabelPos + left x + right y + { + nodelabelpos @Case { + x @Yield y + else @Yield "" + } + } + + def @If + left cond + right x + { + cond @Case { + { yes Yes } @Yield x + else @Yield "" + } + } + + + def @Strut right x + { + def vs { 0.5w @VShift { vstrut @High } } + def hs { hstrut @Wide } + + @HContract @VContract { + @HContract @VContract x | vs / hs | + } + } + + def @Indent right x + { + x @Case { + { top left } @Yield 0.0rt + { ctr } @Yield 0.5rt + { foot right } @Yield 1.0rt + { mctr } @Yield 0.5bx + else @Yield x + } + } + + def @VSize right x + { + vsize @Case { + "" @Yield x + else @Yield { vsize @High { /{@Indent vindent} x / } } + } + } + + def @HSize right x + { + hsize @Case { + "" @Yield x + else @Yield { hsize @Wide { |{@Indent hindent} x | } } + } + } + + def @Align right x + { + x @Case { + { top left } @Yield 0.0w + { ctr } @Yield 0.5w + { foot right } @Yield 1.0w + { mark } @Yield "+0i" + else @Yield x + } + } + + def @ALabel + { + @DoLabel + which { "a" } + label { alabel @Else nodelabel } + labelmargin { alabelmargin @Else nodelabelmargin } + labelfont { alabelfont @Else nodelabelfont } + labelbreak { alabelbreak @Else nodelabelbreak } + labelformat { alabelformat @Body @Else nodelabelformat @Body} + labelpos { alabelpos @Else nodelabelpos } + labelprox { alabelprox @Else nodelabelprox } + labelangle { alabelangle @Else nodelabelangle } + labelctr { alabelctr @Else nodelabelctr } + labeladjust { alabeladjust @Else nodelabeladjust } + } + + def @BLabel + { + @DoLabel + which { "b" } + label { blabel @Else nodelabel } + labelmargin { blabelmargin @Else nodelabelmargin } + labelfont { blabelfont @Else nodelabelfont } + labelbreak { blabelbreak @Else nodelabelbreak } + labelformat { blabelformat @Body @Else nodelabelformat @Body} + labelpos { blabelpos @Else nodelabelpos } + labelprox { blabelprox @Else nodelabelprox } + labelangle { blabelangle @Else nodelabelangle } + labelctr { blabelctr @Else nodelabelctr } + labeladjust { blabeladjust @Else nodelabeladjust } + } + + def @CLabel + { + @DoLabel + which { "c" } + label { clabel @Else nodelabel } + labelmargin { clabelmargin @Else nodelabelmargin } + labelfont { clabelfont @Else nodelabelfont } + labelbreak { clabelbreak @Else nodelabelbreak } + labelformat { clabelformat @Body @Else nodelabelformat @Body} + labelpos { clabelpos @Else nodelabelpos } + labelprox { clabelprox @Else nodelabelprox } + labelangle { clabelangle @Else nodelabelangle } + labelctr { clabelctr @Else nodelabelctr } + labeladjust { clabeladjust @Else nodelabeladjust } + } + + def @DLabel + { + @DoLabel + which { "d" } + label { dlabel @Else nodelabel } + labelmargin { dlabelmargin @Else nodelabelmargin } + labelfont { dlabelfont @Else nodelabelfont } + labelbreak { dlabelbreak @Else nodelabelbreak } + labelformat { dlabelformat @Body @Else nodelabelformat @Body} + labelpos { dlabelpos @Else nodelabelpos } + labelprox { dlabelprox @Else nodelabelprox } + labelangle { dlabelangle @Else nodelabelangle } + labelctr { dlabelctr @Else nodelabelctr } + labeladjust { dlabeladjust @Else nodelabeladjust } + } + + import @Geometry + def @OutLine + { + @BackEnd @Case { + PostScript @Yield { + outline @Case { + box @Yield { "ldiagbox" } + curvebox @Yield { "("margin") ldiagcurvebox" } + shadowbox @Yield { shadow "ldiagshadow ldiagbox" } + square @Yield { "ldiagsquare" } + diamond @Yield { "ldiagdiamond" } + polygon @Yield { sides angle "ldiagpolygon" } + isosceles @Yield { "ldiagisosceles" } + ellipse @Yield { "ldiagellipse" } + circle @Yield { "ldiagcircle" } + else @Yield { + outline + margin { "("margin") ldiagdecodelength" } + shadow { shadow } + sides { sides } + angle { angle } + } + } + } + PDF @Yield {} + } + } + + def @Value + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + { + "ldiagnodebegin [" @OutLine "]" outlinedashlength + "[" outlinestyle "]" outlinewidth + "{" @ColourCommand outlinecolour "}" + paint @PSAddPaint texture "ldiagnodeend" + "(IN) ldiagpushtagdict" + // + "ldiagpopuptagdict" + } + @Graphic + { + {@Align valign} @VShift {@Align halign} @HShift + @AddMargins + mtop { topmargin @Else vmargin @Else margin } + mfoot { footmargin @Else vmargin @Else margin } + mleft { leftmargin @Else hmargin @Else margin } + mright { rightmargin @Else hmargin @Else margin } + @HSize @VSize @HContract @VContract + font @Font break @Break format @Strut @Body + } + / {alabel @Else nodelabel} @IfNonEmpty @ALabel + / {blabel @Else nodelabel} @IfNonEmpty @BLabel + / {clabel @Else nodelabel} @IfNonEmpty @CLabel + / {dlabel @Else nodelabel} @IfNonEmpty @DLabel + } + } + PDF @Yield {} + } + } + + def @TValue + { + nodetag @Case { + "" @Yield @Value + else @Yield { nodetag:: @Value } + } + } + + translate @Case { + "" @Yield @TValue + else @Yield { + @Null & # so that preceding space gets chewed up + @Transform translate { translate } rotate { rotate } @TValue + } + } + } + + + ####################################################################### + # # + # @CNode # + # # + ####################################################################### + + def @CNode + import @Geometry named translate + named to precedence 10 left x right y { + @BackEnd @Case { + PostScript @Yield { x y "ldiagpsub" } + PDF @Yield {""} + } + } + {} + import @Geometry named rotate { 0d } + import @Geometry named outline + named margin {} + named shadow {} + named sides {} + named angle {} + { coutline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named margin { cmargin } + import @Geometry named shadow { cshadow } + import @Geometry named sides { csides } + import @Geometry named angle { cangle } + named nodetag { cnodetag } + named outlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { coutlinestyle } + import @Geometry named outlinedashlength { coutlinedashlength} + import @Geometry named outlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { coutlinewidth } + named outlinecolour outlinecolor { coutlinecolour } + named paint { cpaint } + import @TextureImport named texture { ctexture } + named font { cfont } + named break { cbreak } + named format right @Body { cformat @Body } + named valign { cvalign } + named vsize { cvsize } + named vindent { cvindent } + named vstrut + named no { 0.0f } + named yes { 1.0f } + { cvstrut } + named vmargin { cvmargin } + named topmargin { ctopmargin } + named footmargin { cfootmargin } + + named halign { chalign } + named hsize { chsize } + named hindent { chindent } + named hstrut + named no { 0.0f } + named yes { 1.0f } + { chstrut } + named hmargin { chmargin } + named leftmargin { cleftmargin } + named rightmargin { crightmargin } + + named nodelabel { cnodelabel } + named nodelabelmargin { cnodelabelmargin } + named nodelabelfont { cnodelabelfont } + named nodelabelbreak { cnodelabelbreak } + named nodelabelformat right @Body { cnodelabelformat @Body } + import @Geometry named nodelabelpos { cnodelabelpos } + named nodelabelprox { cnodelabelprox } + import @Geometry named nodelabelangle { cnodelabelangle } + named nodelabelctr { cnodelabelctr } + import @Geometry named nodelabeladjust { cnodelabeladjust } + + named alabel { calabel } + named alabelmargin { calabelmargin } + named alabelfont { calabelfont } + named alabelbreak { calabelbreak } + named alabelformat right @Body { calabelformat @Body } + import @Geometry named alabelpos { calabelpos } + named alabelprox { calabelprox } + import @Geometry named alabelangle { calabelangle } + named alabelctr { calabelctr } + import @Geometry named alabeladjust { calabeladjust } + + named blabel { cblabel } + named blabelmargin { cblabelmargin } + named blabelfont { cblabelfont } + named blabelbreak { cblabelbreak } + named blabelformat right @Body { cblabelformat @Body } + import @Geometry named blabelpos { cblabelpos } + named blabelprox { cblabelprox } + import @Geometry named blabelangle { cblabelangle } + named blabelctr { cblabelctr } + import @Geometry named blabeladjust { cblabeladjust } + + named clabel { cclabel } + named clabelmargin { cclabelmargin } + named clabelfont { cclabelfont } + named clabelbreak { cclabelbreak } + named clabelformat right @Body { cclabelformat @Body } + import @Geometry named clabelpos { cclabelpos } + named clabelprox { cclabelprox } + import @Geometry named clabelangle { cclabelangle } + named clabelctr { cclabelctr } + import @Geometry named clabeladjust { cclabeladjust } + + named dlabel { cdlabel } + named dlabelmargin { cdlabelmargin } + named dlabelfont { cdlabelfont } + named dlabelbreak { cdlabelbreak } + named dlabelformat right @Body { cdlabelformat @Body } + import @Geometry named dlabelpos { cdlabelpos } + named dlabelprox { cdlabelprox } + import @Geometry named dlabelangle { cdlabelangle } + named dlabelctr { cdlabelctr } + import @Geometry named dlabeladjust { cdlabeladjust } + + right @Body + { + + def @LabelPos + left x + right y + { + nodelabelpos @Case { + x @Yield y + else @Yield "" + } + } + + def @If + left cond + right x + { + cond @Case { + { yes Yes } @Yield x + else @Yield "" + } + } + + + def @Strut right x + { + def vs { 0.5w @VShift { vstrut @High } } + def hs { hstrut @Wide } + + @HContract @VContract { + @HContract @VContract x | vs / hs | + } + } + + def @Indent right x + { + x @Case { + { top left } @Yield 0.0rt + { ctr } @Yield 0.5rt + { foot right } @Yield 1.0rt + { mctr } @Yield 0.5bx + else @Yield x + } + } + + def @VSize right x + { + vsize @Case { + "" @Yield x + else @Yield { vsize @High { /{@Indent vindent} x / } } + } + } + + def @HSize right x + { + hsize @Case { + "" @Yield x + else @Yield { hsize @Wide { |{@Indent hindent} x | } } + } + } + + def @Align right x + { + x @Case { + { top left } @Yield 0.0w + { ctr } @Yield 0.5w + { foot right } @Yield 1.0w + { mark } @Yield "+0i" + else @Yield x + } + } + + def @ALabel + { + @DoLabel + which { "a" } + label { alabel @Else nodelabel } + labelmargin { alabelmargin @Else nodelabelmargin } + labelfont { alabelfont @Else nodelabelfont } + labelbreak { alabelbreak @Else nodelabelbreak } + labelformat { alabelformat @Body @Else nodelabelformat @Body} + labelpos { alabelpos @Else nodelabelpos } + labelprox { alabelprox @Else nodelabelprox } + labelangle { alabelangle @Else nodelabelangle } + labelctr { alabelctr @Else nodelabelctr } + labeladjust { alabeladjust @Else nodelabeladjust } + } + + def @BLabel + { + @DoLabel + which { "b" } + label { blabel @Else nodelabel } + labelmargin { blabelmargin @Else nodelabelmargin } + labelfont { blabelfont @Else nodelabelfont } + labelbreak { blabelbreak @Else nodelabelbreak } + labelformat { blabelformat @Body @Else nodelabelformat @Body} + labelpos { blabelpos @Else nodelabelpos } + labelprox { blabelprox @Else nodelabelprox } + labelangle { blabelangle @Else nodelabelangle } + labelctr { blabelctr @Else nodelabelctr } + labeladjust { blabeladjust @Else nodelabeladjust } + } + + def @CLabel + { + @DoLabel + which { "c" } + label { clabel @Else nodelabel } + labelmargin { clabelmargin @Else nodelabelmargin } + labelfont { clabelfont @Else nodelabelfont } + labelbreak { clabelbreak @Else nodelabelbreak } + labelformat { clabelformat @Body @Else nodelabelformat @Body} + labelpos { clabelpos @Else nodelabelpos } + labelprox { clabelprox @Else nodelabelprox } + labelangle { clabelangle @Else nodelabelangle } + labelctr { clabelctr @Else nodelabelctr } + labeladjust { clabeladjust @Else nodelabeladjust } + } + + def @DLabel + { + @DoLabel + which { "d" } + label { dlabel @Else nodelabel } + labelmargin { dlabelmargin @Else nodelabelmargin } + labelfont { dlabelfont @Else nodelabelfont } + labelbreak { dlabelbreak @Else nodelabelbreak } + labelformat { dlabelformat @Body @Else nodelabelformat @Body} + labelpos { dlabelpos @Else nodelabelpos } + labelprox { dlabelprox @Else nodelabelprox } + labelangle { dlabelangle @Else nodelabelangle } + labelctr { dlabelctr @Else nodelabelctr } + labeladjust { dlabeladjust @Else nodelabeladjust } + } + + import @Geometry + def @OutLine + { + @BackEnd @Case { + PostScript @Yield { + outline @Case { + box @Yield { "ldiagbox" } + curvebox @Yield { "("margin") ldiagcurvebox" } + shadowbox @Yield { shadow "ldiagshadow ldiagbox" } + square @Yield { "ldiagsquare" } + diamond @Yield { "ldiagdiamond" } + polygon @Yield { sides angle "ldiagpolygon" } + isosceles @Yield { "ldiagisosceles" } + ellipse @Yield { "ldiagellipse" } + circle @Yield { "ldiagcircle" } + else @Yield { + outline + margin { "("margin") ldiagdecodelength" } + shadow { shadow } + sides { sides } + angle { angle } + } + } + } + PDF @Yield {} + } + } + + def @Value + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + { + "ldiagnodebegin [" @OutLine "]" outlinedashlength + "[" outlinestyle "]" outlinewidth + "{" @ColourCommand outlinecolour "}" + paint @PSAddPaint texture "ldiagnodeend" + "(IN) ldiagpushtagdict" + // + "ldiagpopuptagdict" + } + @Graphic + { + {@Align valign} @VShift {@Align halign} @HShift + @AddMargins + mtop { topmargin @Else vmargin @Else margin } + mfoot { footmargin @Else vmargin @Else margin } + mleft { leftmargin @Else hmargin @Else margin } + mright { rightmargin @Else hmargin @Else margin } + @HSize @VSize @HContract @VContract + font @Font break @Break format @Strut @Body + } + / {alabel @Else nodelabel} @IfNonEmpty @ALabel + / {blabel @Else nodelabel} @IfNonEmpty @BLabel + / {clabel @Else nodelabel} @IfNonEmpty @CLabel + / {dlabel @Else nodelabel} @IfNonEmpty @DLabel + } + } + PDF @Yield {} + } + } + + def @TValue + { + nodetag @Case { + "" @Yield @Value + else @Yield { nodetag:: @Value } + } + } + + translate @Case { + "" @Yield @TValue + else @Yield { + @Null & # so that preceding space gets chewed up + @Transform translate { translate } rotate { rotate } @TValue + } + } + } + + + ####################################################################### + # # + # @DNode # + # # + ####################################################################### + + def @DNode + import @Geometry named translate + named to precedence 10 left x right y { + @BackEnd @Case { + PostScript @Yield { x y "ldiagpsub" } + PDF @Yield {""} + } + } + {} + import @Geometry named rotate { 0d } + import @Geometry named outline + named margin {} + named shadow {} + named sides {} + named angle {} + { doutline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named margin { dmargin } + import @Geometry named shadow { dshadow } + import @Geometry named sides { dsides } + import @Geometry named angle { dangle } + named nodetag { dnodetag } + named outlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { doutlinestyle } + import @Geometry named outlinedashlength { doutlinedashlength} + import @Geometry named outlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { doutlinewidth } + named outlinecolour outlinecolor { doutlinecolour } + named paint { dpaint } + import @TextureImport named texture { dtexture } + named font { dfont } + named break { dbreak } + named format right @Body { dformat @Body } + named valign { dvalign } + named vsize { dvsize } + named vindent { dvindent } + named vstrut + named no { 0.0f } + named yes { 1.0f } + { dvstrut } + named vmargin { dvmargin } + named topmargin { dtopmargin } + named footmargin { dfootmargin } + + named halign { dhalign } + named hsize { dhsize } + named hindent { dhindent } + named hstrut + named no { 0.0f } + named yes { 1.0f } + { dhstrut } + named hmargin { dhmargin } + named leftmargin { dleftmargin } + named rightmargin { drightmargin } + + named nodelabel { dnodelabel } + named nodelabelmargin { dnodelabelmargin } + named nodelabelfont { dnodelabelfont } + named nodelabelbreak { dnodelabelbreak } + named nodelabelformat right @Body { dnodelabelformat @Body } + import @Geometry named nodelabelpos { dnodelabelpos } + named nodelabelprox { dnodelabelprox } + import @Geometry named nodelabelangle { dnodelabelangle } + named nodelabelctr { dnodelabelctr } + import @Geometry named nodelabeladjust { dnodelabeladjust } + + named alabel { dalabel } + named alabelmargin { dalabelmargin } + named alabelfont { dalabelfont } + named alabelbreak { dalabelbreak } + named alabelformat right @Body { dalabelformat @Body } + import @Geometry named alabelpos { dalabelpos } + named alabelprox { dalabelprox } + import @Geometry named alabelangle { dalabelangle } + named alabelctr { dalabelctr } + import @Geometry named alabeladjust { calabeladjust } + + named blabel { dblabel } + named blabelmargin { dblabelmargin } + named blabelfont { dblabelfont } + named blabelbreak { dblabelbreak } + named blabelformat right @Body { dblabelformat @Body } + import @Geometry named blabelpos { dblabelpos } + named blabelprox { dblabelprox } + import @Geometry named blabelangle { dblabelangle } + named blabelctr { dblabelctr } + import @Geometry named blabeladjust { dblabeladjust } + + named clabel { dclabel } + named clabelmargin { dclabelmargin } + named clabelfont { dclabelfont } + named clabelbreak { dclabelbreak } + named clabelformat right @Body { dclabelformat @Body } + import @Geometry named clabelpos { dclabelpos } + named clabelprox { dclabelprox } + import @Geometry named clabelangle { dclabelangle } + named clabelctr { dclabelctr } + import @Geometry named clabeladjust { dclabeladjust } + + named dlabel { ddlabel } + named dlabelmargin { ddlabelmargin } + named dlabelfont { ddlabelfont } + named dlabelbreak { ddlabelbreak } + named dlabelformat right @Body { ddlabelformat @Body } + import @Geometry named dlabelpos { ddlabelpos } + named dlabelprox { ddlabelprox } + import @Geometry named dlabelangle { ddlabelangle } + named dlabelctr { ddlabelctr } + import @Geometry named dlabeladjust { ddlabeladjust } + + right @Body + { + + def @LabelPos + left x + right y + { + nodelabelpos @Case { + x @Yield y + else @Yield "" + } + } + + def @If + left cond + right x + { + cond @Case { + { yes Yes } @Yield x + else @Yield "" + } + } + + + def @Strut right x + { + def vs { 0.5w @VShift { vstrut @High } } + def hs { hstrut @Wide } + + @HContract @VContract { + @HContract @VContract x | vs / hs | + } + } + + def @Indent right x + { + x @Case { + { top left } @Yield 0.0rt + { ctr } @Yield 0.5rt + { foot right } @Yield 1.0rt + { mctr } @Yield 0.5bx + else @Yield x + } + } + + def @VSize right x + { + vsize @Case { + "" @Yield x + else @Yield { vsize @High { /{@Indent vindent} x / } } + } + } + + def @HSize right x + { + hsize @Case { + "" @Yield x + else @Yield { hsize @Wide { |{@Indent hindent} x | } } + } + } + + def @Align right x + { + x @Case { + { top left } @Yield 0.0w + { ctr } @Yield 0.5w + { foot right } @Yield 1.0w + { mark } @Yield "+0i" + else @Yield x + } + } + + def @ALabel + { + @DoLabel + which { "a" } + label { alabel @Else nodelabel } + labelmargin { alabelmargin @Else nodelabelmargin } + labelfont { alabelfont @Else nodelabelfont } + labelbreak { alabelbreak @Else nodelabelbreak } + labelformat { alabelformat @Body @Else nodelabelformat @Body} + labelpos { alabelpos @Else nodelabelpos } + labelprox { alabelprox @Else nodelabelprox } + labelangle { alabelangle @Else nodelabelangle } + labelctr { alabelctr @Else nodelabelctr } + labeladjust { alabeladjust @Else nodelabeladjust } + } + + def @BLabel + { + @DoLabel + which { "b" } + label { blabel @Else nodelabel } + labelmargin { blabelmargin @Else nodelabelmargin } + labelfont { blabelfont @Else nodelabelfont } + labelbreak { blabelbreak @Else nodelabelbreak } + labelformat { blabelformat @Body @Else nodelabelformat @Body} + labelpos { blabelpos @Else nodelabelpos } + labelprox { blabelprox @Else nodelabelprox } + labelangle { blabelangle @Else nodelabelangle } + labelctr { blabelctr @Else nodelabelctr } + labeladjust { blabeladjust @Else nodelabeladjust } + } + + def @CLabel + { + @DoLabel + which { "c" } + label { clabel @Else nodelabel } + labelmargin { clabelmargin @Else nodelabelmargin } + labelfont { clabelfont @Else nodelabelfont } + labelbreak { clabelbreak @Else nodelabelbreak } + labelformat { clabelformat @Body @Else nodelabelformat @Body} + labelpos { clabelpos @Else nodelabelpos } + labelprox { clabelprox @Else nodelabelprox } + labelangle { clabelangle @Else nodelabelangle } + labelctr { clabelctr @Else nodelabelctr } + labeladjust { clabeladjust @Else nodelabeladjust } + } + + def @DLabel + { + @DoLabel + which { "d" } + label { dlabel @Else nodelabel } + labelmargin { dlabelmargin @Else nodelabelmargin } + labelfont { dlabelfont @Else nodelabelfont } + labelbreak { dlabelbreak @Else nodelabelbreak } + labelformat { dlabelformat @Body @Else nodelabelformat @Body} + labelpos { dlabelpos @Else nodelabelpos } + labelprox { dlabelprox @Else nodelabelprox } + labelangle { dlabelangle @Else nodelabelangle } + labelctr { dlabelctr @Else nodelabelctr } + labeladjust { dlabeladjust @Else nodelabeladjust } + } + + import @Geometry + def @OutLine + { + @BackEnd @Case { + PostScript @Yield { + outline @Case { + box @Yield { "ldiagbox" } + curvebox @Yield { "("margin") ldiagcurvebox" } + shadowbox @Yield { shadow "ldiagshadow ldiagbox" } + square @Yield { "ldiagsquare" } + diamond @Yield { "ldiagdiamond" } + polygon @Yield { sides angle "ldiagpolygon" } + isosceles @Yield { "ldiagisosceles" } + ellipse @Yield { "ldiagellipse" } + circle @Yield { "ldiagcircle" } + else @Yield { + outline + margin { "("margin") ldiagdecodelength" } + shadow { shadow } + sides { sides } + angle { angle } + } + } + } + PDF @Yield {} + } + } + + def @Value + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + { + "ldiagnodebegin [" @OutLine "]" outlinedashlength + "[" outlinestyle "]" outlinewidth + "{" @ColourCommand outlinecolour "}" + paint @PSAddPaint texture "ldiagnodeend" + "(IN) ldiagpushtagdict" + // + "ldiagpopuptagdict" + } + @Graphic + { + {@Align valign} @VShift {@Align halign} @HShift + @AddMargins + mtop { topmargin @Else vmargin @Else margin } + mfoot { footmargin @Else vmargin @Else margin } + mleft { leftmargin @Else hmargin @Else margin } + mright { rightmargin @Else hmargin @Else margin } + @HSize @VSize @HContract @VContract + font @Font break @Break format @Strut @Body + } + / {alabel @Else nodelabel} @IfNonEmpty @ALabel + / {blabel @Else nodelabel} @IfNonEmpty @BLabel + / {clabel @Else nodelabel} @IfNonEmpty @CLabel + / {dlabel @Else nodelabel} @IfNonEmpty @DLabel + } + } + PDF @Yield {} + } + } + + def @TValue + { + nodetag @Case { + "" @Yield @Value + else @Yield { nodetag:: @Value } + } + } + + translate @Case { + "" @Yield @TValue + else @Yield { + @Null & # so that preceding space gets chewed up + @Transform translate { translate } rotate { rotate } @TValue + } + } + } + + + ####################################################################### + # # + # @ENode # + # # + ####################################################################### + + def @ENode + import @Geometry named translate + named to precedence 10 left x right y { + @BackEnd @Case { + PostScript @Yield { x y "ldiagpsub" } + PDF @Yield {""} + } + } + {} + import @Geometry named rotate { 0d } + import @Geometry named outline + named margin {} + named shadow {} + named sides {} + named angle {} + { eoutline + margin { margin } + shadow { shadow } + sides { sides } + angle { angle } + } + named margin { emargin } + import @Geometry named shadow { eshadow } + import @Geometry named sides { esides } + import @Geometry named angle { eangle } + named nodetag { enodetag } + named outlinestyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { eoutlinestyle } + import @Geometry named outlinedashlength { eoutlinedashlength} + import @Geometry named outlinewidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { eoutlinewidth } + named outlinecolour outlinecolor { eoutlinecolour } + named paint { epaint } + import @TextureImport named texture { etexture } + named font { efont } + named break { ebreak } + named format right @Body { eformat @Body } + named valign { evalign } + named vsize { evsize } + named vindent { evindent } + named vstrut + named no { 0.0f } + named yes { 1.0f } + { evstrut } + named vmargin { evmargin } + named topmargin { etopmargin } + named footmargin { efootmargin } + + named halign { ehalign } + named hsize { ehsize } + named hindent { ehindent } + named hstrut + named no { 0.0f } + named yes { 1.0f } + { ehstrut } + named hmargin { ehmargin } + named leftmargin { eleftmargin } + named rightmargin { erightmargin } + + named nodelabel { enodelabel } + named nodelabelmargin { enodelabelmargin } + named nodelabelfont { enodelabelfont } + named nodelabelbreak { enodelabelbreak } + named nodelabelformat right @Body { enodelabelformat @Body } + import @Geometry named nodelabelpos { enodelabelpos } + named nodelabelprox { enodelabelprox } + import @Geometry named nodelabelangle { enodelabelangle } + named nodelabelctr { enodelabelctr } + import @Geometry named nodelabeladjust { enodelabeladjust } + + named alabel { ealabel } + named alabelmargin { ealabelmargin } + named alabelfont { ealabelfont } + named alabelbreak { ealabelbreak } + named alabelformat right @Body { ealabelformat @Body } + import @Geometry named alabelpos { ealabelpos } + named alabelprox { ealabelprox } + import @Geometry named alabelangle { ealabelangle } + named alabelctr { ealabelctr } + import @Geometry named alabeladjust { ealabeladjust } + + named blabel { eblabel } + named blabelmargin { eblabelmargin } + named blabelfont { eblabelfont } + named blabelbreak { eblabelbreak } + named blabelformat right @Body { eblabelformat @Body } + import @Geometry named blabelpos { eblabelpos } + named blabelprox { eblabelprox } + import @Geometry named blabelangle { eblabelangle } + named blabelctr { eblabelctr } + import @Geometry named blabeladjust { eblabeladjust } + + named clabel { eclabel } + named clabelmargin { eclabelmargin } + named clabelfont { eclabelfont } + named clabelbreak { eclabelbreak } + named clabelformat right @Body { eclabelformat @Body } + import @Geometry named clabelpos { eclabelpos } + named clabelprox { eclabelprox } + import @Geometry named clabelangle { eclabelangle } + named clabelctr { eclabelctr } + import @Geometry named clabeladjust { eclabeladjust } + + named dlabel { edlabel } + named dlabelmargin { edlabelmargin } + named dlabelfont { edlabelfont } + named dlabelbreak { edlabelbreak } + named dlabelformat right @Body { edlabelformat @Body } + import @Geometry named dlabelpos { edlabelpos } + named dlabelprox { edlabelprox } + import @Geometry named dlabelangle { edlabelangle } + named dlabelctr { edlabelctr } + import @Geometry named dlabeladjust { edlabeladjust } + + right @Body + { + + def @LabelPos + left x + right y + { + nodelabelpos @Case { + x @Yield y + else @Yield "" + } + } + + def @If + left cond + right x + { + cond @Case { + { yes Yes } @Yield x + else @Yield "" + } + } + + + def @Strut right x + { + def vs { 0.5w @VShift { vstrut @High } } + def hs { hstrut @Wide } + + @HContract @VContract { + @HContract @VContract x | vs / hs | + } + } + + def @Indent right x + { + x @Case { + { top left } @Yield 0.0rt + { ctr } @Yield 0.5rt + { foot right } @Yield 1.0rt + { mctr } @Yield 0.5bx + else @Yield x + } + } + + def @VSize right x + { + vsize @Case { + "" @Yield x + else @Yield { vsize @High { /{@Indent vindent} x / } } + } + } + + def @HSize right x + { + hsize @Case { + "" @Yield x + else @Yield { hsize @Wide { |{@Indent hindent} x | } } + } + } + + def @Align right x + { + x @Case { + { top left } @Yield 0.0w + { ctr } @Yield 0.5w + { foot right } @Yield 1.0w + { mark } @Yield "+0i" + else @Yield x + } + } + + def @ALabel + { + @DoLabel + which { "a" } + label { alabel @Else nodelabel } + labelmargin { alabelmargin @Else nodelabelmargin } + labelfont { alabelfont @Else nodelabelfont } + labelbreak { alabelbreak @Else nodelabelbreak } + labelformat { alabelformat @Body @Else nodelabelformat @Body} + labelpos { alabelpos @Else nodelabelpos } + labelprox { alabelprox @Else nodelabelprox } + labelangle { alabelangle @Else nodelabelangle } + labelctr { alabelctr @Else nodelabelctr } + labeladjust { alabeladjust @Else nodelabeladjust } + } + + def @BLabel + { + @DoLabel + which { "b" } + label { blabel @Else nodelabel } + labelmargin { blabelmargin @Else nodelabelmargin } + labelfont { blabelfont @Else nodelabelfont } + labelbreak { blabelbreak @Else nodelabelbreak } + labelformat { blabelformat @Body @Else nodelabelformat @Body} + labelpos { blabelpos @Else nodelabelpos } + labelprox { blabelprox @Else nodelabelprox } + labelangle { blabelangle @Else nodelabelangle } + labelctr { blabelctr @Else nodelabelctr } + labeladjust { blabeladjust @Else nodelabeladjust } + } + + def @CLabel + { + @DoLabel + which { "c" } + label { clabel @Else nodelabel } + labelmargin { clabelmargin @Else nodelabelmargin } + labelfont { clabelfont @Else nodelabelfont } + labelbreak { clabelbreak @Else nodelabelbreak } + labelformat { clabelformat @Body @Else nodelabelformat @Body} + labelpos { clabelpos @Else nodelabelpos } + labelprox { clabelprox @Else nodelabelprox } + labelangle { clabelangle @Else nodelabelangle } + labelctr { clabelctr @Else nodelabelctr } + labeladjust { clabeladjust @Else nodelabeladjust } + } + + def @DLabel + { + @DoLabel + which { "d" } + label { dlabel @Else nodelabel } + labelmargin { dlabelmargin @Else nodelabelmargin } + labelfont { dlabelfont @Else nodelabelfont } + labelbreak { dlabelbreak @Else nodelabelbreak } + labelformat { dlabelformat @Body @Else nodelabelformat @Body} + labelpos { dlabelpos @Else nodelabelpos } + labelprox { dlabelprox @Else nodelabelprox } + labelangle { dlabelangle @Else nodelabelangle } + labelctr { dlabelctr @Else nodelabelctr } + labeladjust { dlabeladjust @Else nodelabeladjust } + } + + import @Geometry + def @OutLine + { + @BackEnd @Case { + PostScript @Yield { + outline @Case { + box @Yield { "ldiagbox" } + curvebox @Yield { "("margin") ldiagcurvebox" } + shadowbox @Yield { shadow "ldiagshadow ldiagbox" } + square @Yield { "ldiagsquare" } + diamond @Yield { "ldiagdiamond" } + polygon @Yield { sides angle "ldiagpolygon" } + isosceles @Yield { "ldiagisosceles" } + ellipse @Yield { "ldiagellipse" } + circle @Yield { "ldiagcircle" } + else @Yield { + outline + margin { "("margin") ldiagdecodelength" } + shadow { shadow } + sides { sides } + angle { angle } + } + } + } + PDF @Yield {} + } + } + + def @Value + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + { + "ldiagnodebegin [" @OutLine "]" outlinedashlength + "[" outlinestyle "]" outlinewidth + "{" @ColourCommand outlinecolour "}" + paint @PSAddPaint texture "ldiagnodeend" + "(IN) ldiagpushtagdict" + // + "ldiagpopuptagdict" + } + @Graphic + { + {@Align valign} @VShift {@Align halign} @HShift + @AddMargins + mtop { topmargin @Else vmargin @Else margin } + mfoot { footmargin @Else vmargin @Else margin } + mleft { leftmargin @Else hmargin @Else margin } + mright { rightmargin @Else hmargin @Else margin } + @HSize @VSize @HContract @VContract + font @Font break @Break format @Strut @Body + } + / {alabel @Else nodelabel} @IfNonEmpty @ALabel + / {blabel @Else nodelabel} @IfNonEmpty @BLabel + / {clabel @Else nodelabel} @IfNonEmpty @CLabel + / {dlabel @Else nodelabel} @IfNonEmpty @DLabel + } + } + PDF @Yield {} + } + } + + def @TValue + { + nodetag @Case { + "" @Yield @Value + else @Yield { nodetag:: @Value } + } + } + + translate @Case { + "" @Yield @TValue + else @Yield { + @Null & # so that preceding space gets chewed up + @Transform translate { translate } rotate { rotate } @TValue + } + } + } + + + ####################################################################### + # # + # @Box, @CurveBox, and other standard node abbreviations # + # # + ####################################################################### + + macro @@Node { @Node } + macro @Box { @Node outline { box } } + macro @CurveBox { @Node outline { curvebox } } + macro @ShadowBox { @Node outline { shadowbox } } + macro @Square { @Node outline { square } } + macro @Diamond { @Node outline { diamond } } + macro @Polygon { @Node outline { polygon } } + macro @Isosceles { @Node outline { isosceles } } + macro @Ellipse { @Node outline { ellipse } } + macro @Circle { @Node outline { circle } } + + + ####################################################################### + # # + # Arrowheads # + # # + ####################################################################### + + macro @InsulatedNode { + @Node + topmargin { 0i } + footmargin { 0i } + leftmargin { 0i } + rightmargin { 0i } + alabel {} + blabel {} + clabel {} + dlabel {} + hsize {} + vsize {} + vstrut { no } + hstrut { no } + paint { nochange } + texture { solid } + outlinestyle { noline } + } + + def @SolidArrowHead + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + { + @InsulatedNode + outlinewidth { pathwidth } + outline { + @BackEnd @Case { + PostScript @Yield { + "ldiagsolidarrowhead" + } + PDF @Yield {} + } + } + { + length @Wide width @High + } + } + + def @SolidWithBarArrowHead + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + { + @InsulatedNode + outlinewidth { pathwidth } + outline { + @BackEnd @Case { + PostScript @Yield { + pathwidth "ldiagsolidwithbararrowhead" + } + PDF @Yield {} + } + } + { + length @Wide width @High + } + } + + def @OpenArrowHead + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + named pathgap { pathgap } + { + @InsulatedNode + outlinewidth { pathwidth } + outline { + @BackEnd @Case { + PostScript @Yield { + pathwidth pathgap "ldiagopenarrowhead" + } + PDF @Yield {} + } + } + { + length @Wide width @High + } + } + + def @HalfOpenArrowHead + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + named pathgap { pathgap } + { + @InsulatedNode + outlinewidth { pathwidth } + outline { + @BackEnd @Case { + PostScript @Yield { + pathwidth pathgap "ldiaghalfopenarrowhead" + } + PDF @Yield {} + } + } + { + length @Wide width @High + } + } + + def @SolidCurvedArrowHead + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + { + @InsulatedNode + outlinewidth { pathwidth } + outline { + @BackEnd @Case { + PostScript @Yield { + "ldiagsolidcurvedarrowhead" + } + PDF @Yield {} + } + } + { + length @Wide width @High + } + } + + def @OpenCurvedArrowHead + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + named pathgap { pathgap } + { + @InsulatedNode + outlinewidth { pathwidth } + outline { + @BackEnd @Case { + PostScript @Yield { + pathwidth pathgap "ldiagopencurvedarrowhead" + } + PDF @Yield {} + } + } + { + length @Wide width @High + } + } + + def @HalfOpenCurvedArrowHead + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + named pathgap { pathgap } + { + @InsulatedNode + outlinewidth { pathwidth } + outline { + @BackEnd @Case { + PostScript @Yield { + pathwidth pathgap "ldiaghalfopencurvedarrowhead" + } + PDF @Yield {} + } + } + { + length @Wide width @High + } + } + + def @CircleArrowHead + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + { + @InsulatedNode + outlinewidth { pathwidth } + outline { circle } + { length @Wide length @High } + } + + def @BoxArrowHead + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + { + @InsulatedNode + outlinewidth { pathwidth } + outline { box } + { length @Wide width @High } + } + + def @ManyArrowHead + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + { + @InsulatedNode + outlinewidth { pathwidth } + outline { + @BackEnd @Case { + PostScript @Yield { pathwidth "ldiagmanyarrowhead" } + PDF @Yield {} + } + } + { length @Wide width @High } + } + + def @ArrowHead + named style { arrowstyle } + named width { arrowwidth } + named length { arrowlength } + named pathwidth { pathwidth } + named pathcolour { pathcolour } + named pathgap { pathgap } + { + {@ColourCommand pathcolour} @SetColour style @Case { + solid @Yield @SolidArrowHead + width { width } length { length } + pathwidth { pathwidth } + solidwithbar @Yield @SolidWithBarArrowHead + width { width } length { length } + pathwidth { pathwidth } + halfopen @Yield @HalfOpenArrowHead + width { width } length { length } + pathwidth { pathwidth } pathgap { pathgap } + open @Yield @OpenArrowHead + width { width } length { length } + pathwidth { pathwidth } pathgap { pathgap } + curvedsolid @Yield @SolidCurvedArrowHead + width { width } length { length } + pathwidth { pathwidth } + curvedhalfopen @Yield @HalfOpenCurvedArrowHead + width { width } length { length } + pathwidth { pathwidth } pathgap { pathgap } + curvedopen @Yield @OpenCurvedArrowHead + width { width } length { length } + pathwidth { pathwidth } pathgap { pathgap } + circle @Yield @CircleArrowHead + width { width } length { length } + pathwidth { pathwidth } + box @Yield @BoxArrowHead + width { width } length { length } + pathwidth { pathwidth } + many @Yield @ManyArrowHead + width { width } length { length } + pathwidth { pathwidth } + } + } + + + ####################################################################### + # # + # @Link # + # # + ####################################################################### + + def @Link + import @Geometry named path + named from {} + named to {} + named bias {} + named fbias {} + named tbias {} + named hfrac {} + named hbias {} + named radius {} + named xindent {} + named zindent {} + named frompt {} + named topt {} + named arrow {} + named arrowlength {} + named backarrowlength {} + { path + from { from } + to { to } + bias { bias } + fbias { fbias } + tbias { tbias } + hfrac { hfrac } + hbias { hbias } + radius { radius } + xindent { xindent } + zindent { zindent } + frompt { frompt } + topt { topt } + arrow { arrow } + arrowlength { arrowlength } + backarrowlength { backarrowlength } + } + import @Geometry named from { from } + import @Geometry named to { to } + 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 } + import @Geometry named frompt { frompt } + import @Geometry named topt { topt } + named pathstyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { pathstyle } + import @Geometry named pathdashlength { pathdashlength } + import @Geometry named pathwidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { pathwidth } + named pathcolour pathcolor { pathcolour } + import @Geometry named pathgap + named thin { 0.08 ft } + named medium { 0.16 ft } + named thick { 0.24 ft } + { pathgap } + + named arrow { arrow } + named arrowstyle { arrowstyle } + named arrowwidth { arrowwidth } + named arrowlength { arrowlength } + named backarrowstyle { backarrowstyle } + named backarrowwidth { backarrowwidth } + named backarrowlength { backarrowlength } + + named linklabel { linklabel } + named linklabelmargin { linklabelmargin } + named linklabelfont { linklabelfont } + named linklabelbreak { linklabelbreak } + named linklabelformat right @Body { linklabelformat @Body } + import @Geometry named linklabelpos { linklabelpos } + named linklabelprox { linklabelprox } + import @Geometry named linklabelangle { linklabelangle } + named linklabelctr { linklabelctr } + import @Geometry named linklabeladjust { linklabeladjust } + + named xlabel { xlabel } + named xlabelmargin { xlabelmargin } + named xlabelfont { xlabelfont } + named xlabelbreak { xlabelbreak } + named xlabelformat right @Body { xlabelformat @Body } + import @Geometry named xlabelpos { xlabelpos } + named xlabelprox { xlabelprox } + import @Geometry named xlabelangle { xlabelangle } + named xlabelctr { xlabelctr } + import @Geometry named xlabeladjust { xlabeladjust } + + named ylabel { ylabel } + named ylabelmargin { ylabelmargin } + named ylabelfont { ylabelfont } + named ylabelbreak { ylabelbreak } + named ylabelformat right @Body { ylabelformat @Body } + import @Geometry named ylabelpos { ylabelpos } + named ylabelprox { ylabelprox } + import @Geometry named ylabelangle { ylabelangle } + named ylabelctr { ylabelctr } + import @Geometry named ylabeladjust { ylabeladjust } + + named zlabel { zlabel } + named zlabelmargin { zlabelmargin } + named zlabelfont { zlabelfont } + named zlabelbreak { zlabelbreak } + named zlabelformat right @Body { zlabelformat @Body } + import @Geometry named zlabelpos { zlabelpos } + named zlabelprox { zlabelprox } + import @Geometry named zlabelangle { zlabelangle } + named zlabelctr { zlabelctr } + import @Geometry named zlabeladjust { zlabeladjust } + + named fromlabel { fromlabel } + named fromlabelmargin { fromlabelmargin } + named fromlabelfont { fromlabelfont } + named fromlabelbreak { fromlabelbreak } + named fromlabelformat right @Body { fromlabelformat @Body } + import @Geometry named fromlabelpos { fromlabelpos } + named fromlabelprox { fromlabelprox } + import @Geometry named fromlabelangle { fromlabelangle } + named fromlabelctr { fromlabelctr } + import @Geometry named fromlabeladjust { fromlabeladjust } + + named tolabel { tolabel } + named tolabelmargin { tolabelmargin } + named tolabelfont { tolabelfont } + named tolabelbreak { tolabelbreak } + named tolabelformat right @Body { tolabelformat @Body } + import @Geometry named tolabelpos { tolabelpos } + named tolabelprox { tolabelprox } + import @Geometry named tolabelangle { tolabelangle } + named tolabelctr { tolabelctr } + import @Geometry named tolabeladjust{ tolabeladjust } + + { + def @XLabel + { + @DoLabel + which { "x" } + label { xlabel @Else linklabel } + labelmargin { xlabelmargin @Else linklabelmargin } + labelfont { xlabelfont @Else linklabelfont } + labelbreak { xlabelbreak @Else linklabelbreak } + labelformat { xlabelformat @Body @Else linklabelformat @Body} + labelpos { xlabelpos @Else linklabelpos } + labelprox { xlabelprox @Else linklabelprox } + labelangle { xlabelangle @Else linklabelangle } + labelctr { xlabelctr @Else linklabelctr } + labeladjust { xlabeladjust @Else linklabeladjust } + } + + def @YLabel + { + @DoLabel + which { "y" } + label { ylabel @Else linklabel } + labelmargin { ylabelmargin @Else linklabelmargin } + labelfont { ylabelfont @Else linklabelfont } + labelbreak { ylabelbreak @Else linklabelbreak } + labelformat { ylabelformat @Body @Else linklabelformat @Body} + labelpos { ylabelpos @Else linklabelpos } + labelprox { ylabelprox @Else linklabelprox } + labelangle { ylabelangle @Else linklabelangle } + labelctr { ylabelctr @Else linklabelctr } + labeladjust { ylabeladjust @Else linklabeladjust } + } + + def @ZLabel + { + @DoLabel + which { "z" } + label { zlabel @Else linklabel } + labelmargin { zlabelmargin @Else linklabelmargin } + labelfont { zlabelfont @Else linklabelfont } + labelbreak { zlabelbreak @Else linklabelbreak } + labelformat { zlabelformat @Body @Else linklabelformat @Body} + labelpos { zlabelpos @Else linklabelpos } + labelprox { zlabelprox @Else linklabelprox } + labelangle { zlabelangle @Else linklabelangle } + labelctr { zlabelctr @Else linklabelctr } + labeladjust { zlabeladjust @Else linklabeladjust } + } + + def @PathGap + { + path @Case { + doubleline @Yield { pathgap } + else @Yield { "0" } + } + } + + def @FromArrow + { + arrow @Case { + { back both } @Yield { + @ArrowHead + style { backarrowstyle } + width { backarrowwidth } + length { backarrowlength } + pathwidth { pathwidth } + pathcolour { pathcolour } + pathgap { @PathGap } + } + else @Yield "" + } + } + + def @ToArrow + { + arrow @Case { + { yes forward both } @Yield { + @ArrowHead + style { arrowstyle } + width { arrowwidth } + length { arrowlength } + pathwidth { pathwidth } + pathcolour { pathcolour } + pathgap { @PathGap } + } + else @Yield "" + } + } + + import @Geometry + def @LinePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent "ldiaglinepath" + # FROM :< {from??CTR angleto to??CTR} + # FROM :: from boundaryatangle FROM@ANGLE + # ++ {arrow @FromArrowLength backarrowlength}atangle FROM@ANGLE + # TO :< FROM@ANGLE + # TO :: to boundaryatangle { TO@ANGLE - 180d } + # ++ {arrow @ToArrowLength arrowlength} atangle {TO@ANGLE - 180d} + # + # LMID :: FROM ** 0.5 ++ TO ** 0.5 + # LMID :< FROM@ANGLE + # XINDENT := xindent min { FROM distance LMID } + # LFROM :: FROM ++ XINDENT atangle FROM@ANGLE + # LFROM :< FROM@ANGLE + # ZINDENT := zindent min { TO distance LMID } + # LTO :: TO -- ZINDENT atangle FROM@ANGLE + # LTO :< FROM@ANGLE + # + # if cond { direct } + # then { FROM TO } + # else { FROM LFROM LMID LTO TO } + } + PDF @Yield {} + } + } + + import @Geometry + def @DoubleLinePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent pathgap "ldiagdoublelinepath" + # FROM :< {from??CTR angleto to??CTR} + # FROM :: from boundaryatangle FROM@ANGLE + # ++ {arrow @FromArrowLength backarrowlength}atangle FROM@ANGLE + # TO :< FROM@ANGLE + # TO :: to boundaryatangle { TO@ANGLE - 180d } + # ++ {arrow @ToArrowLength arrowlength} atangle {TO@ANGLE - 180d} + # + # LMID :: FROM ** 0.5 ++ TO ** 0.5 + # LMID :< FROM@ANGLE + # XINDENT := xindent min { FROM distance LMID } + # LFROM :: FROM ++ XINDENT atangle FROM@ANGLE + # LFROM :< FROM@ANGLE + # ZINDENT := zindent min { TO distance LMID } + # LTO :: TO -- ZINDENT atangle FROM@ANGLE + # LTO :< FROM@ANGLE + # + # if cond { direct } + # then { FROM TO } + # else { FROM LFROM LMID LTO TO } + } + PDF @Yield {} + } + } + + import @Geometry + def @ACurvePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias "ldiagacurvepath" + # #B1 := bias max 0.02f + # #B2 := { from??CTR distance to??CTR } * 0.5 + # #BIAS := B1 min B2 + # BIAS := bias max 0.02f + # XMID := from??CTR ** 0.5 ++ to??CTR ** 0.5 + # XTOP := XMID ++ BIAS atangle {from??CTR angleto to??CTR - 90d} + # CTR := { from??CTR XTOP ldiaglinebetween + # to??CTR XTOP ldiaglinebetween ldiaglineintersect } + # FROM :: aabout + # circum { from } + # extra { arrow @FromArrowLength backarrowlength } + # centre { CTR } + # FROM :< if cond { from??CTR distance FROM > 0 } + # then { from??CTR angleto FROM } + # else { CTR angleto FROM + 90d } + # TO :: cabout + # circum { to } + # extra { arrow @ToArrowLength arrowlength } + # centre { CTR } + # TO :< if cond { TO distance to??CTR > 0 } + # then { TO angleto to??CTR } + # else { CTR angleto TO + 90d } + # + # RADIUS := CTR distance FROM + # LMID :: CTR ++ RADIUS atangle { + # CTR angleto FROM + + # { {360d + {CTR angleto TO} - {CTR angleto FROM}} mod 360 } / 2 + # } + # LMID :< CTR angleto LMID + 90d + # + # XINDENT := xindent min { FROM distance LMID } + # LFROM :: CTR ++ RADIUS atangle { + # CTR angleto { FROM ++ XINDENT atangle FROM@ANGLE } } + # LFROM :< CTR angleto LFROM + 90d + # ZINDENT := zindent min { TO distance LMID } + # LTO :: CTR ++ RADIUS atangle { + # CTR angleto { TO ++ ZINDENT atangle {TO@ANGLE+180d}}} + # LTO :< CTR angleto LTO + 90d + # + # if cond { direct } + # then { FROM [CTR] TO } + # else { FROM [CTR] LFROM [CTR] LMID [CTR] LTO [CTR] TO } + } + PDF @Yield {} + } + } + + import @Geometry + def @CCurvePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias "ldiagccurvepath" + # #B1 := bias max 0.02f + # #B2 := { from??CTR distance to??CTR } * 0.5 + # #BIAS := B1 min B2 + # BIAS := bias max 0.02f + # XMID := from??CTR ** 0.5 ++ to??CTR ** 0.5 + # XTOP := XMID ++ BIAS atangle {from??CTR angleto to??CTR + 90d} + # CTR := { from??CTR XTOP ldiaglinebetween + # to??CTR XTOP ldiaglinebetween ldiaglineintersect } + # FROM :: cabout + # circum { from } + # extra { arrow @FromArrowLength backarrowlength } + # centre { CTR } + # FROM :< if cond { from??CTR distance FROM > 0 } + # then { from??CTR angleto FROM } + # else { CTR angleto FROM - 90d } + # TO :: aabout + # circum { to } + # extra { arrow @ToArrowLength arrowlength } + # centre { CTR } + # TO :< if cond { TO distance to??CTR > 0 } + # then { TO angleto to??CTR } + # else { CTR angleto TO - 90d } + # + # RADIUS := CTR distance FROM + # LMID :: CTR ++ RADIUS atangle { + # CTR angleto TO + + # { {360d + {CTR angleto FROM} - {CTR angleto TO} } mod 360 } / 2 + # } + # LMID :< CTR angleto LMID - 90d + # + # XINDENT := xindent min { FROM distance LMID } + # LFROM :: CTR ++ RADIUS atangle { + # CTR angleto { FROM ++ XINDENT atangle FROM@ANGLE } } + # LFROM :< CTR angleto LFROM - 90d + # ZINDENT := zindent min { TO distance LMID } + # LTO :: CTR ++ RADIUS atangle { + # CTR angleto { TO ++ ZINDENT atangle {TO@ANGLE+180d}}} + # LTO :< CTR angleto LTO - 90d + # + # if cond { direct } + # then { FROM [CTR clockwise] TO } + # else { FROM [CTR clockwise] LFROM [CTR clockwise] + # LMID [CTR clockwise] LTO [CTR clockwise] TO } + } + PDF @Yield {} + } + } + + import @Geometry + def @BezierPath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent [ frompt ] [ topt ] "ldiagbezierpath" + # FROM :< from??CTR angleto frompt + # FROM :: from boundaryatangle FROM@ANGLE + # ++ {arrow @FromArrowLength backarrowlength} atangle FROM@ANGLE + # TO :< topt angleto to??CTR + # TO :: to boundaryatangle { TO@ANGLE + 180d } + # ++ {arrow @ToArrowLength arrowlength} atangle { TO@ANGLE + 180d } + # LFROM :: FROM ++ { xindent atangle FROM@ANGLE } + # LFROM :< FROM@ANGLE + # LTO :: TO ++ zindent atangle { TO@ANGLE + 180d } + # LTO :< TO@ANGLE + # LMID :: { FROM ++ TO ++ frompt ++ topt } ** 0.25 + # FROM [frompt topt] TO + } + PDF @Yield {} + } + } + + import @Geometry + def @VHLinePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent "ldiagvhlinepath" + # CTR := { {xcoord from??CTR} {ycoord to??CTR} } + # FANG := from??CTR angleto CTR + # TANG := to??CTR angleto CTR + # FROM :: from boundaryatangle FANG + # ++ {arrow @FromArrowLength backarrowlength} atangle FANG + # FROM :< FANG + # TO :: to boundaryatangle TANG + # ++ {arrow @ToArrowLength arrowlength} atangle TANG + # TO :< TANG + 180d + # FDIST := FROM distance CTR + # TDIST := TO distance CTR + # XINDENT := xindent min FDIST + # ZINDENT := zindent min TDIST + # LFROM :: FROM ++ XINDENT atangle FANG + # LFROM :< FROM@ANGLE + # LTO :: TO ++ ZINDENT atangle TANG + # LTO :< TO@ANGLE + # LMID :: CTR + # LMID :< {1f atangle {FANG + 180d}} angleto + # {1f atangle {TANG + 180d}} + # FROM LFROM LMID LTO TO + } + PDF @Yield {} + } + } + + import @Geometry + def @VHCurvePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent radius "ldiagvhcurvepath" + # CTR := { {xcoord from??CTR} {ycoord to??CTR} } + # FANG := from??CTR angleto CTR + # TANG := to??CTR angleto CTR + # FROM :: from boundaryatangle FANG + # ++ {arrow @FromArrowLength backarrowlength} atangle FANG + # FROM :< FANG + # TO :: to boundaryatangle TANG + # ++ {arrow @ToArrowLength arrowlength} atangle TANG + # TO :< TANG + 180d + # FDIST := FROM distance CTR + # TDIST := TO distance CTR + # RADIUS := radius min FDIST min TDIST + # XINDENT := xindent min { FDIST - RADIUS } + # ZINDENT := zindent min { TDIST - RADIUS } + # LFROM :: FROM ++ XINDENT atangle FANG + # LFROM :< FROM@ANGLE + # LTO :: TO ++ ZINDENT atangle TANG + # LTO :< TO@ANGLE + # FCTR := CTR ++ RADIUS atangle { FROM@ANGLE + 180d } + # TCTR := CTR ++ RADIUS atangle { TO@ANGLE } + # XCTR := CTR ++ RADIUS atangle { FROM@ANGLE + 180d } + # ++ RADIUS atangle { TO@ANGLE } + # LMID :: XCTR ++ RADIUS atangle { XCTR angleto CTR } + # LMID :< FCTR angleto TCTR + # FROM LFROM FCTR + # { FCTR angleto TCTR } quadcase + # 0 { } + # 0-90 { [XCTR clockwise] } + # 90 { } + # 90-180 { [XCTR] } + # 180 { } + # 180-270 { [XCTR clockwise] } + # 270 { } + # 270-360 { [XCTR] } + # TCTR LTO TO + } + PDF @Yield {} + } + } + + import @Geometry + def @HVLinePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent "ldiaghvlinepath" + # CTR := { {xcoord to??CTR} {ycoord from??CTR} } + # FANG := from??CTR angleto CTR + # TANG := to??CTR angleto CTR + # FROM :: from boundaryatangle FANG + # ++ {arrow @FromArrowLength backarrowlength} atangle FANG + # FROM :< FANG + # TO :: to boundaryatangle TANG + # ++ {arrow @ToArrowLength arrowlength} atangle TANG + # TO :< TANG + 180d + # FDIST := FROM distance CTR + # TDIST := TO distance CTR + # XINDENT := xindent min FDIST + # ZINDENT := zindent min TDIST + # LFROM :: FROM ++ XINDENT atangle FANG + # LFROM :< FROM@ANGLE + # LTO :: TO ++ ZINDENT atangle TANG + # LTO :< TO@ANGLE + # LMID :: CTR + # LMID :< {1f atangle {FANG + 180d}} angleto + # {1f atangle {TANG + 180d}} + # FROM LFROM LMID LTO TO + } + PDF @Yield {} + } + } + + import @Geometry + def @HVCurvePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent radius "ldiaghvcurvepath" + # CTR := { {xcoord to??CTR} {ycoord from??CTR} } + # FANG := from??CTR angleto CTR + # TANG := to??CTR angleto CTR + # FROM :: from boundaryatangle FANG + # ++ {arrow @FromArrowLength backarrowlength} atangle FANG + # FROM :< FANG + # TO :: to boundaryatangle TANG + # ++ {arrow @ToArrowLength arrowlength} atangle TANG + # TO :< TANG + 180d + # FDIST := FROM distance CTR + # TDIST := TO distance CTR + # RADIUS := radius min FDIST min TDIST + # XINDENT := xindent min { FDIST - RADIUS } + # ZINDENT := zindent min { TDIST - RADIUS } + # LFROM :: FROM ++ XINDENT atangle FANG + # LFROM :< FROM@ANGLE + # LTO :: TO ++ ZINDENT atangle TANG + # LTO :< TO@ANGLE + # FCTR := CTR ++ RADIUS atangle { FROM@ANGLE + 180d } + # TCTR := CTR ++ RADIUS atangle { TO@ANGLE } + # XCTR := CTR ++ RADIUS atangle { FROM@ANGLE + 180d } + # ++ RADIUS atangle { TO@ANGLE } + # LMID :: XCTR ++ RADIUS atangle { XCTR angleto CTR } + # LMID :< FCTR angleto TCTR + # FROM LFROM FCTR + # { FCTR angleto TCTR } quadcase + # 0 { } + # 0-90 { [XCTR] } + # 90 { } + # 90-180 { [XCTR clockwise] } + # 180 { } + # 180-270 { [XCTR] } + # 270 { } + # 270-360 { [XCTR clockwise] } + # TCTR LTO TO + } + PDF @Yield {} + } + } + + import @Geometry + def @LVRLinePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias "ldiaglvrlinepath" + # FROM :: from boundaryatangle 180d + # ++ {arrow @FromArrowLength backarrowlength} atangle 180d + # FROM :< 180d + # TO :: to boundaryatangle 180d + # ++ {arrow @ToArrowLength arrowlength} atangle 180d + # TO :< 0d + # XLEFT := {{xcoord FROM} min {xcoord TO}} - bias + # P1 :: { XLEFT ycoord FROM } + # P2 :: { XLEFT ycoord TO } + # VERT := P1 angleto P2 + # P1 :< P1 angleto {P1++{1f atangle 180d}++{1f atangle VERT}} + # P2 :< P2 angleto {P2++{1f atangle 0d} ++{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 :< 180d + # LTO :: TO -- { ZINDENT 0 } + # LTO :< 0d + # FROM LFROM P1 LMID P2 LTO TO + } + PDF @Yield {} + } + } + + import @Geometry + def @LVRCurvePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias radius "ldiaglvrcurvepath" + # FROM :: from boundaryatangle 180d + # ++ {arrow @FromArrowLength backarrowlength} atangle 180d + # FROM :< 180d + # TO :: to boundaryatangle 180d + # ++ {arrow @ToArrowLength arrowlength} atangle 180d + # TO :< 0d + # XLEFT := {{xcoord FROM} min {xcoord TO}} - bias + # XP1 := { XLEFT ycoord FROM } + # XP2 := { XLEFT ycoord TO } + # VERT := XP1 angleto XP2 + # LMID :: XP1 ** 0.5 ++ XP2 ** 0.5 + # LMID :< VERT + # XINDENT := xindent min {FROM distance XP1} + # ZINDENT := zindent min {XP2 distance TO} + # LFROM :: FROM -- { XINDENT 0 } + # LFROM :< 180d + # LTO :: TO -- { ZINDENT 0 } + # LTO :< 0d + # RADIUS := radius min { { XP1 distance XP2 } / 2 } + # XP1PRE := XP1 ++ { RADIUS atangle 0d } + # 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 0d } + # XP2CTR := XP2PRE ++ { RADIUS atangle 0d } + # P2 :: XP2CTR ++ { RADIUS atangle { XP2CTR angleto XP2 } } + # P2 :< XP2PRE angleto XP2POST + # FROM LFROM XP1PRE + # {round VERT} quadcase + # 90 { [XP1CTR clockwise] P1 [XP1CTR clockwise] } + # 270 { [XP1CTR] P1 [XP1CTR] } + # XP1POST LMID XP2PRE + # {round VERT} quadcase + # 90 { [XP2CTR clockwise] P2 [XP2CTR clockwise] } + # 270 { [XP2CTR] P2 [XP2CTR] } + # XP2POST LTO TO + } + PDF @Yield {} + } + } + + import @Geometry + def @RVLLinePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias "ldiagrvllinepath" + # FROM :: from boundaryatangle 0d + # ++ {arrow @FromArrowLength backarrowlength} 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 @RVLCurvePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias radius "ldiagrvlcurvepath" + # FROM :: from boundaryatangle 0d + # ++ {arrow @FromArrowLength backarrowlength} atangle 0d + # FROM :< 0d + # TO :: to boundaryatangle 0d + # ++ {arrow @ToArrowLength arrowlength} atangle 0d + # TO :< 180d + # XRIGHT := {{xcoord FROM} max {xcoord TO}} + bias + # XP1 := { XRIGHT ycoord FROM } + # XP2 := { XRIGHT ycoord TO } + # VERT := XP1 angleto XP2 + # LMID :: XP1 ** 0.5 ++ XP2 ** 0.5 + # LMID :< VERT + # XINDENT := xindent min {FROM distance XP1} + # ZINDENT := zindent min {XP2 distance TO} + # LFROM :: FROM ++ { XINDENT 0 } + # LFROM :< 0d + # LTO :: TO ++ { ZINDENT 0 } + # LTO :< 180d + # RADIUS := radius min { { XP1 distance XP2 } * 0.5 } + # XP1PRE := XP1 ++ { RADIUS atangle 180d } + # 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 180d } + # XP2CTR := XP2PRE ++ { RADIUS atangle 180d } + # P2 :: XP2CTR ++ { RADIUS atangle { XP2CTR angleto XP2 } } + # P2 :< XP2PRE angleto XP2POST + # FROM LFROM XP1PRE + # {round VERT} quadcase + # 90 { [XP1CTR] P1 [XP1CTR] } + # 270 { [XP1CTR clockwise] P1 [XP1CTR clockwise] } + # XP1POST LMID XP2PRE + # {round VERT} quadcase + # 90 { [XP2CTR] P2 [XP2CTR] } + # 270 { [XP2CTR clockwise] P2 [XP2CTR clockwise] } + # XP2POST LTO TO + } + PDF @Yield {} + } + } + + + import @Geometry + def @DHULinePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias "ldiagdhulinepath" + } + PDF @Yield {} + } + } + + import @Geometry + def @DHUCurvePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias radius "ldiagdhucurvepath" + } + PDF @Yield {} + } + } + + import @Geometry + def @UHDLinePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias "ldiaguhdlinepath" + } + PDF @Yield {} + } + } + + import @Geometry + def @UHDCurvePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias radius "ldiaguhdcurvepath" + } + PDF @Yield {} + } + } + + + import @Geometry + def @HVHLinePath # still to do + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {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 backarrowlength} 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 backarrowlength} + {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 backarrowlength} 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 backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent hfrac hbias "ldiagvhvlinepath" + # FROM :: from boundaryatangle 0d + # ++ {arrow @FromArrowLength backarrowlength} 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 backarrowlength} + {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 + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias fbias tbias "ldiagdwraplinepath" + # DIRN := if cond { xcoord from??CTR < xcoord to??CTR } + # then { 180d } else { 0d } + # FROM :: from boundaryatangle DIRN + # ++ {arrow @FromArrowLength backarrowlength} atangle DIRN + # FROM :< DIRN + # TO :: to boundaryatangle { DIRN + 180d } + # ++ {arrow @ToArrowLength arrowlength} atangle { DIRN + 180d } + # TO :< DIRN + # P1 :: FROM ++ {fbias max 0} atangle DIRN + # P1 :< if cond { DIRN = 180d } then { 225d } else { -45d } + # P4 :: TO ++ {tbias max 0} atangle { DIRN + 180d } + # P4 :< if cond { DIRN = 180d } then { 135d } else { 45d } + # YC := ycoord { from boundaryatangle 270d } min + # ycoord { to boundaryatangle 270d } + # - { bias max 0 } + # P2 :: { xcoord P1 YC } + # P2 :< P4@ANGLE - 180d + # P3 :: { xcoord P4 YC } + # P3 :< P1@ANGLE - 180d + # XINDENT := xindent min { FROM distance P1 } + # LFROM :: FROM ++ XINDENT atangle DIRN + # LFROM :< FROM@ANGLE + # ZINDENT := zindent min { TO distance P4 } + # LTO :: TO ++ ZINDENT atangle { DIRN + 180d } + # LTO :< TO@ANGLE + # LMID :: P2 ** 0.5 ++ P3 ** 0.5 + # LMID :< DIRN - 180d + # FROM P1 P2 P3 P4 TO + } + PDF @Yield {} + } + } + + import @Geometry + def @DWrapCurvePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias fbias tbias radius "ldiagdwrapcurvepath" + # DIRN := if cond { xcoord from??CTR < xcoord to??CTR } + # then { 180d } else { 0d } + # CLOCK := if cond { xcoord from??CTR < xcoord to??CTR } + # then { anticlockwise } else { clockwise } + # FROM :: from boundaryatangle DIRN + # ++ {arrow @FromArrowLength backarrowlength} atangle DIRN + # FROM :< DIRN + # TO :: to boundaryatangle { DIRN + 180d } + # ++ {arrow @ToArrowLength arrowlength} atangle { DIRN + 180d } + # TO :< DIRN + # + # XP1 := FROM ++ {fbias max 0} atangle DIRN + # XP4 := TO ++ {tbias max 0} atangle { DIRN + 180d } + # YC := ycoord { from boundaryatangle 270d } min + # ycoord { to boundaryatangle 270d } + # - { bias max 0 } + # XP2 := { xcoord XP1 YC } + # XP3 := { xcoord XP4 YC } + # + # RP1 := radius min { XP1 distance FROM } min + # { { XP1 distance XP2 } / 2 } + # XP1PRE := XP1 ++ RP1 atangle { XP1 angleto FROM } + # XP1POST := XP1 ++ RP1 atangle { XP1 angleto XP2 } + # XP1CTR := XP1PRE ++ RP1 atangle { XP1 angleto XP2 } + # P1 :: XP1CTR ++ RP1 atangle { XP1CTR angleto XP1 } + # P1 :< XP1CTR angleto P1 + DIRN - 90d + # + # RP2 := radius min { { XP1 distance XP2 } / 2 } + # min { { XP2 distance XP3 } / 2 } + # XP2PRE := XP2 ++ RP2 atangle { XP2 angleto XP1 } + # XP2POST := XP2 ++ RP2 atangle { XP2 angleto XP3 } + # XP2CTR := XP2PRE ++ RP2 atangle { XP2 angleto XP3 } + # P2 :: XP2CTR ++ RP2 atangle { XP2CTR angleto XP2 } + # P2 :< XP2CTR angleto P2 + DIRN - 90d + # + # RP3 := radius min { { XP2 distance XP3 } / 2 } + # min { { XP3 distance XP4 } / 2 } + # XP3PRE := XP3 ++ RP3 atangle { XP3 angleto XP2 } + # XP3POST := XP3 ++ RP3 atangle { XP3 angleto XP4 } + # XP3CTR := XP3PRE ++ RP3 atangle { XP3 angleto XP4 } + # P3 :: XP3CTR ++ RP3 atangle { XP3CTR angleto XP3 } + # P3 :< XP3CTR angleto P3 + DIRN - 90d + # + # RP4 := radius min { { XP4 distance XP3 } / 2 } + # min { XP4 distance TO } + # XP4PRE := XP4 ++ RP4 atangle { XP4 angleto XP3 } + # XP4POST := XP4 ++ RP4 atangle { XP4 angleto TO } + # XP4CTR := XP4PRE ++ RP4 atangle { XP4 angleto TO } + # P4 :: XP4CTR ++ RP4 atangle { XP4CTR angleto XP4 } + # P4 :< XP4CTR angleto P4 + DIRN - 90d + # + # XINDENT := xindent min { FROM distance XP1PRE } + # LFROM :: FROM ++ XINDENT atangle DIRN + # LFROM :< FROM@ANGLE + # + # LMID :: XP2 ** 0.5 ++ XP3 ** 0.5 + # LMID :< DIRN - 180d + # + # ZINDENT := zindent min { TO distance XP4POST } + # LTO :: TO ++ ZINDENT atangle { DIRN + 180d } + # LTO :< TO@ANGLE + # + # FROM LFROM + # XP1PRE [XP1CTR CLOCK] XP1POST + # XP2PRE [XP2CTR CLOCK] XP2POST + # LMID + # XP3PRE [XP3CTR CLOCK] XP3POST + # XP4PRE [XP4CTR CLOCK] XP4POST + # LTO TO + } + PDF @Yield {} + } + } + + import @Geometry + def @UWrapLinePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias fbias tbias "ldiaguwraplinepath" + # DIRN := if cond { xcoord from??CTR < xcoord to??CTR } + # then { 180d } else { 0d } + # FROM :: from boundaryatangle DIRN + # ++ {arrow @FromArrowLength backarrowlength} atangle DIRN + # FROM :< DIRN + # TO :: to boundaryatangle { DIRN + 180d } + # ++ {arrow @ToArrowLength arrowlength} atangle { DIRN + 180d } + # TO :< DIRN + # P1 :: FROM ++ {fbias max 0} atangle DIRN + # P1 :< if cond { DIRN = 180d } then { 135d } else { 45d } + # P4 :: TO ++ {tbias max 0} atangle { DIRN + 180d } + # P4 :< if cond { DIRN = 180d } then { 225d } else { -45d } + # YC := ycoord { from boundaryatangle 90d } max + # ycoord { to boundaryatangle 90d } + # + { bias max 0 } + # P2 :: { xcoord P1 YC } + # P2 :< P4@ANGLE - 180d + # P3 :: { xcoord P4 YC } + # P3 :< P1@ANGLE - 180d + # XINDENT := xindent min { FROM distance P1 } + # LFROM :: FROM ++ XINDENT atangle DIRN + # LFROM :< FROM@ANGLE + # ZINDENT := zindent min { TO distance P4 } + # LTO :: TO ++ ZINDENT atangle { DIRN + 180d } + # LTO :< TO@ANGLE + # LMID :: P2 ** 0.5 ++ P3 ** 0.5 + # LMID :< DIRN - 180d + # FROM P1 P2 P3 P4 TO + } + PDF @Yield {} + } + } + + import @Geometry + def @UWrapCurvePath + { + @BackEnd @Case { + PostScript @Yield { + {arrow @FromArrowLength backarrowlength} + {arrow @ToArrowLength arrowlength} + "{" from "}" "{" to "}" + xindent zindent bias fbias tbias radius "ldiaguwrapcurvepath" + # DIRN := if cond { xcoord from??CTR < xcoord to??CTR } + # then { 180d } else { 0d } + # CLOCK := if cond { xcoord from??CTR < xcoord to??CTR } + # then { clockwise } else { anticlockwise } + # FROM :: from boundaryatangle DIRN + # ++ {arrow @FromArrowLength backarrowlength} atangle DIRN + # FROM :< DIRN + # TO :: to boundaryatangle { DIRN + 180d } + # ++ {arrow @ToArrowLength arrowlength} atangle { DIRN + 180d } + # TO :< DIRN + # + # XP1 := FROM ++ {fbias max 0} atangle DIRN + # XP4 := TO ++ {tbias max 0} atangle { DIRN + 180d } + # YC := ycoord { from boundaryatangle 90d } max + # ycoord { to boundaryatangle 90d } + # + { bias max 0 } + # XP2 := { xcoord XP1 YC } + # XP3 := { xcoord XP4 YC } + # + # RP1 := radius min { XP1 distance FROM } min + # { { XP1 distance XP2 } / 2 } + # XP1PRE := XP1 ++ RP1 atangle { XP1 angleto FROM } + # XP1POST := XP1 ++ RP1 atangle { XP1 angleto XP2 } + # XP1CTR := XP1PRE ++ RP1 atangle { XP1 angleto XP2 } + # P1 :: XP1CTR ++ RP1 atangle { XP1CTR angleto XP1 } + # P1 :< XP1CTR angleto P1 + DIRN + 90d + # + # RP2 := radius min { { XP1 distance XP2 } / 2 } + # min { { XP2 distance XP3 } / 2 } + # XP2PRE := XP2 ++ RP2 atangle { XP2 angleto XP1 } + # XP2POST := XP2 ++ RP2 atangle { XP2 angleto XP3 } + # XP2CTR := XP2PRE ++ RP2 atangle { XP2 angleto XP3 } + # P2 :: XP2CTR ++ RP2 atangle { XP2CTR angleto XP2 } + # P2 :< XP2CTR angleto P2 + DIRN + 90d + # + # RP3 := radius min { { XP2 distance XP3 } / 2 } + # min { { XP3 distance XP4 } / 2 } + # XP3PRE := XP3 ++ RP3 atangle { XP3 angleto XP2 } + # XP3POST := XP3 ++ RP3 atangle { XP3 angleto XP4 } + # XP3CTR := XP3PRE ++ RP3 atangle { XP3 angleto XP4 } + # P3 :: XP3CTR ++ RP3 atangle { XP3CTR angleto XP3 } + # P3 :< XP3CTR angleto P3 + DIRN + 90d + # + # RP4 := radius min { { XP4 distance XP3 } / 2 } + # min { XP4 distance TO } + # XP4PRE := XP4 ++ RP4 atangle { XP4 angleto XP3 } + # XP4POST := XP4 ++ RP4 atangle { XP4 angleto TO } + # XP4CTR := XP4PRE ++ RP4 atangle { XP4 angleto TO } + # P4 :: XP4CTR ++ RP4 atangle { XP4CTR angleto XP4 } + # P4 :< XP4CTR angleto P4 + DIRN + 90d + # + # XINDENT := xindent min { FROM distance XP1PRE } + # LFROM :: FROM ++ XINDENT atangle DIRN + # LFROM :< FROM@ANGLE + # + # LMID :: XP2 ** 0.5 ++ XP3 ** 0.5 + # LMID :< DIRN - 180d + # + # ZINDENT := zindent min { TO distance XP4POST } + # LTO :: TO ++ ZINDENT atangle { DIRN + 180d } + # LTO :< TO@ANGLE + # + # FROM LFROM + # XP1PRE [XP1CTR CLOCK] XP1POST + # XP2PRE [XP2CTR CLOCK] XP2POST + # LMID + # XP3PRE [XP3CTR CLOCK] XP3POST + # XP4PRE [XP4CTR CLOCK] XP4POST + # LTO TO + } + PDF @Yield {} + } + } + + import @Geometry + def @Path + { + path @Case { + line @Yield @LinePath + doubleline @Yield @DoubleLinePath + { acurve curve } @Yield @ACurvePath + ccurve @Yield @CCurvePath + bezier @Yield @BezierPath + vhline @Yield @VHLinePath + vhcurve @Yield @VHCurvePath + hvline @Yield @HVLinePath + hvcurve @Yield @HVCurvePath + lvrline @Yield @LVRLinePath + lvrcurve @Yield @LVRCurvePath + rvlline @Yield @RVLLinePath + rvlcurve @Yield @RVLCurvePath + dhuline @Yield @DHULinePath + dhucurve @Yield @DHUCurvePath + uhdline @Yield @UHDLinePath + uhdcurve @Yield @UHDCurvePath + hvhline @Yield @HVHLinePath + hvhcurve @Yield @HVHCurvePath + vhvline @Yield @VHVLinePath + vhvcurve @Yield @VHVCurvePath + dwrapline @Yield @DWrapLinePath + dwrapcurve @Yield @DWrapCurvePath + uwrapline @Yield @UWrapLinePath + uwrapcurve @Yield @UWrapCurvePath + else @Yield { + path + from { from } + to { to } + bias { bias } + fbias { fbias } + tbias { tbias } + hfrac { hfrac } + hbias { hbias } + radius { radius } + xindent { xindent } + zindent { zindent } + frompt { frompt } + topt { topt } + arrow { arrow } + arrowlength { arrowlength } + backarrowlength { backarrowlength } + } + } + } + + def @FromLabel + { + @DoLabel + which { "f" } + label { fromlabel @Else @FromArrow } + labelmargin { fromlabelmargin } + labelfont { fromlabelfont } + labelbreak { fromlabelbreak } + labelformat { fromlabelformat @Body } + labelpos { fromlabelpos } + labelprox { fromlabelprox } + labelangle { fromlabelangle } + labelctr { fromlabelctr } + labeladjust { fromlabeladjust } + } + + def @ToLabel + { + @DoLabel + which { "t" } + label { tolabel @Else @ToArrow } + labelmargin { tolabelmargin } + labelfont { tolabelfont } + labelbreak { tolabelbreak } + labelformat { tolabelformat @Body } + labelpos { tolabelpos } + labelprox { tolabelprox } + labelangle { tolabelangle } + labelctr { tolabelctr } + labeladjust { tolabeladjust } + } + + def @Direct + { + pathstyle @Case { + { + "/ldiagsolid" + "/ldiagdashed" + "/ldiagdotted" + "/ldiagnoline" + "/ldiagcdashed" + "/ldiagdotdashed" + "/ldiagdotcdashed" + "/ldiagdotdotdashed" + "/ldiagdotdotcdashed" + "/ldiagdotdotdotdashed" + "/ldiagdotdotdotcdashed" + } @Yield 1 + else @Yield 0 + } + } + + @BackEnd @Case { + PostScript @Yield { + + @Null & # so that preceding space gets chewed up + { + @Direct "ldiaglinkbegin" @ColourCommand pathcolour + "[" @Path "]" pathdashlength "[" pathstyle "]" pathwidth "ldiaglinkend" + } + @Graphic + { + / { fromlabel @Else @FromArrow} @IfNonEmpty @FromLabel + / { xlabel @Else linklabel } @IfNonEmpty @XLabel + / { ylabel @Else linklabel } @IfNonEmpty @YLabel + / { zlabel @Else linklabel } @IfNonEmpty @ZLabel + / { tolabel @Else @ToArrow } @IfNonEmpty @ToLabel + } + + } + PDF @Yield {} + } + } + + + def @ObjectLink + precedence 90 + associativity left + left x + named treehsep { treehsep } + named treevsep { treevsep } + named format + named x {} + named y {} + named insinuatelink {} + named treehsep {} + named treevsep {} + { x | y | insinuatelink } + import @Geometry named path + named from {} + named to {} + named bias {} + named fbias {} + named tbias {} + named hfrac {} + named hbias {} + named radius {} + named xindent {} + named zindent {} + named frompt {} + named topt {} + named arrow {} + named arrowlength {} + named backarrowlength {} + { path + from { from } + to { to } + bias { bias } + fbias { fbias } + tbias { tbias } + hfrac { hfrac } + hbias { hbias } + radius { radius } + xindent { xindent } + zindent { zindent } + frompt { frompt } + topt { topt } + arrow { arrow } + arrowlength { arrowlength } + backarrowlength { backarrowlength } + } + import @Geometry named basefrom { } + import @Geometry named baseto { } + import @Geometry named from { } + import @Geometry named to { } + 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 } + import @Geometry named frompt { frompt } + import @Geometry named topt { topt } + named pathstyle + named solid { "/ldiagsolid" } + named dashed { "/ldiagdashed" } + named cdashed { "/ldiagcdashed" } + named dotdashed { "/ldiagdotdashed" } + named dotcdashed { "/ldiagdotcdashed" } + named dotdotdashed { "/ldiagdotdotdashed" } + named dotdotcdashed { "/ldiagdotdotcdashed" } + named dotdotdotdashed { "/ldiagdotdotdotdashed" } + named dotdotdotcdashed { "/ldiagdotdotdotcdashed" } + named dotted { "/ldiagdotted" } + named noline { "/ldiagnoline" } + { pathstyle } + import @Geometry named pathdashlength { pathdashlength } + import @Geometry named pathwidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { pathwidth } + named pathcolour { pathcolour } + import @Geometry named pathgap + named thin { 0.08 ft } + named medium { 0.16 ft } + named thick { 0.24 ft } + { pathgap } + + named arrow { arrow } + named arrowstyle { arrowstyle } + named arrowwidth { arrowwidth } + named arrowlength { arrowlength } + named backarrowstyle { backarrowstyle } + named backarrowwidth { backarrowwidth } + named backarrowlength { backarrowlength } + + named linklabel { linklabel } + named linklabelmargin { linklabelmargin } + named linklabelfont { linklabelfont } + named linklabelbreak { linklabelbreak } + named linklabelformat right @Body { linklabelformat @Body } + import @Geometry named linklabelpos { linklabelpos } + named linklabelprox { linklabelprox } + import @Geometry named linklabelangle { linklabelangle } + named linklabelctr { linklabelctr } + import @Geometry named linklabeladjust { linklabeladjust } + + named xlabel { xlabel } + named xlabelmargin { xlabelmargin } + named xlabelfont { xlabelfont } + named xlabelbreak { xlabelbreak } + named xlabelformat right @Body { xlabelformat @Body } + import @Geometry named xlabelpos { xlabelpos } + named xlabelprox { xlabelprox } + import @Geometry named xlabelangle { xlabelangle } + named xlabelctr { xlabelctr } + import @Geometry named xlabeladjust { xlabeladjust } + + named ylabel { ylabel } + named ylabelmargin { ylabelmargin } + named ylabelfont { ylabelfont } + named ylabelbreak { ylabelbreak } + named ylabelformat right @Body { ylabelformat @Body } + import @Geometry named ylabelpos { ylabelpos } + named ylabelprox { ylabelprox } + import @Geometry named ylabelangle { ylabelangle } + named ylabelctr { ylabelctr } + import @Geometry named ylabeladjust { ylabeladjust } + + named zlabel { zlabel } + named zlabelmargin { zlabelmargin } + named zlabelfont { zlabelfont } + named zlabelbreak { zlabelbreak } + named zlabelformat right @Body { zlabelformat @Body } + import @Geometry named zlabelpos { zlabelpos } + named zlabelprox { zlabelprox } + import @Geometry named zlabelangle { zlabelangle } + named zlabelctr { zlabelctr } + import @Geometry named zlabeladjust { zlabeladjust } + + named fromlabel { fromlabel } + named fromlabelmargin { fromlabelmargin } + named fromlabelfont { fromlabelfont } + named fromlabelbreak { fromlabelbreak } + named fromlabelformat right @Body { fromlabelformat @Body } + import @Geometry named fromlabelpos { fromlabelpos } + named fromlabelprox { fromlabelprox } + import @Geometry named fromlabelangle { fromlabelangle } + named fromlabelctr { fromlabelctr } + import @Geometry named fromlabeladjust { fromlabeladjust } + + named tolabel { tolabel } + named tolabelmargin { tolabelmargin } + named tolabelfont { tolabelfont } + named tolabelbreak { tolabelbreak } + named tolabelformat right @Body { tolabelformat @Body } + import @Geometry named tolabelpos { tolabelpos } + named tolabelprox { tolabelprox } + import @Geometry named tolabelangle { tolabelangle } + named tolabelctr { tolabelctr } + import @Geometry named tolabeladjust{ tolabeladjust } + right y + + { + def @From + { + from @Case { + "" @Yield basefrom + else @Yield { basefrom"@"from } + } + } + + def @To + { + to @Case { + "" @Yield baseto + else @Yield { baseto"@"to } + } + } + + format + x { x } + y { y } + treehsep { treehsep } + treevsep { treevsep } + insinuatelink { + @Link + from { @From } + to { @To } + bias { bias } + fbias { fbias } + tbias { tbias } + hfrac { hfrac } + hbias { hbias } + radius { radius } + xindent { xindent } + zindent { zindent } + frompt { frompt } + topt { topt } + path { path + from { @From } + to { @To } + bias { bias } + fbias { fbias } + tbias { tbias } + hfrac { hfrac } + hbias { hbias } + radius { radius } + xindent { xindent } + zindent { zindent } + frompt { frompt } + topt { topt } + arrow { arrow } + arrowlength { arrowlength } + backarrowlength { backarrowlength } + } + pathstyle { pathstyle } + pathdashlength { pathdashlength } + pathwidth { pathwidth } + pathcolour { pathcolour } + pathgap { pathgap } + arrow { arrow } + arrowstyle { arrowstyle } + arrowwidth { arrowwidth } + arrowlength { arrowlength } + backarrowstyle { backarrowstyle } + backarrowwidth { backarrowwidth } + backarrowlength { backarrowlength } + + linklabel { linklabel } + linklabelmargin { linklabelmargin } + linklabelfont { linklabelfont } + linklabelbreak { linklabelbreak } + linklabelformat { linklabelformat @Body } + linklabelpos { linklabelpos } + linklabelprox { linklabelprox } + linklabelangle { linklabelangle } + linklabelctr { linklabelctr } + linklabeladjust { linklabeladjust } + + xlabel { xlabel } + xlabelmargin { xlabelmargin } + xlabelfont { xlabelfont } + xlabelbreak { xlabelbreak } + xlabelformat { xlabelformat @Body } + xlabelpos { xlabelpos } + xlabelprox { xlabelprox } + xlabelangle { xlabelangle } + xlabelctr { xlabelctr } + xlabeladjust { xlabeladjust } + + ylabel { ylabel } + ylabelmargin { ylabelmargin } + ylabelfont { ylabelfont } + ylabelbreak { ylabelbreak } + ylabelformat { ylabelformat @Body } + ylabelpos { ylabelpos } + ylabelprox { ylabelprox } + ylabelangle { ylabelangle } + ylabelctr { ylabelctr } + ylabeladjust { ylabeladjust } + + zlabel { zlabel } + zlabelmargin { zlabelmargin } + zlabelfont { zlabelfont } + zlabelbreak { zlabelbreak } + zlabelformat { zlabelformat @Body } + zlabelpos { zlabelpos } + zlabelprox { zlabelprox } + zlabelangle { zlabelangle } + zlabelctr { zlabelctr } + zlabeladjust { zlabeladjust } + + fromlabel { fromlabel } + fromlabelmargin { fromlabelmargin } + fromlabelfont { fromlabelfont } + fromlabelbreak { fromlabelbreak } + fromlabelformat { fromlabelformat @Body } + fromlabelpos { fromlabelpos } + fromlabelprox { fromlabelprox } + fromlabelangle { fromlabelangle } + fromlabelctr { fromlabelctr } + fromlabeladjust { fromlabeladjust } + + tolabel { tolabel } + tolabelmargin { tolabelmargin } + tolabelfont { tolabelfont } + tolabelbreak { tolabelbreak } + tolabelformat { tolabelformat @Body } + tolabelpos { tolabelpos } + tolabelprox { tolabelprox } + tolabelangle { tolabelangle } + tolabelctr { tolabelctr } + tolabeladjust { tolabeladjust } + } + } + + + ####################################################################### + # # + # Abbreviations for standard link types # + # # + ####################################################################### + + macro @Line { @Link path { line } } + macro @DoubleLine { @Link path { doubleline } } + macro @Arrow { @Link path { line } arrow { yes } } + macro @DoubleArrow { @Link path {doubleline} arrow { yes } } + macro @Curve { @Link path { curve } } + macro @CurveArrow { @Link path { curve } arrow { yes } } + macro @ACurve { @Link path { acurve } } + macro @ACurveArrow { @Link path { acurve } arrow { yes } } + macro @CCurve { @Link path { ccurve } } + macro @CCurveArrow { @Link path { ccurve } arrow { yes } } + + macro @Bezier { @Link path { bezier } } + macro @BezierArrow { @Link path { bezier } arrow { yes } } + + macro @HVLine { @Link path { hvline } } + macro @HVArrow { @Link path { hvline } arrow { yes } } + macro @VHLine { @Link path { vhline } } + macro @VHArrow { @Link path { vhline } arrow { yes } } + macro @HVCurve { @Link path { hvcurve } } + macro @HVCurveArrow { @Link path { hvcurve } arrow { yes } } + macro @VHCurve { @Link path { vhcurve } } + macro @VHCurveArrow { @Link path { vhcurve } arrow { yes } } + + macro @LVRLine { @Link path { lvrline } } + macro @LVRArrow { @Link path { lvrline } arrow { yes } } + macro @RVLLine { @Link path { rvlline } } + macro @RVLArrow { @Link path { rvlline } arrow { yes } } + macro @LVRCurve { @Link path { lvrcurve } } + macro @LVRCurveArrow { @Link path { lvrcurve } arrow { yes } } + macro @RVLCurve { @Link path { rvlcurve } } + macro @RVLCurveArrow { @Link path { rvlcurve } arrow { yes } } + + macro @DHULine { @Link path { dhuline } } + macro @DHUArrow { @Link path { dhuline } arrow { yes } } + macro @UHDLine { @Link path { uhdline } } + macro @UHDArrow { @Link path { uhdline } arrow { yes } } + macro @DHUCurve { @Link path { dhucurve } } + macro @DHUCurveArrow { @Link path { dhucurve } arrow { yes } } + macro @UHDCurve { @Link path { uhdcurve } } + macro @UHDCurveArrow { @Link path { uhdcurve } 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} } + macro @UWrapArrow { @Link path { uwrapline} arrow { yes } } + macro @DWrapCurve { @Link path {dwrapcurve} } + macro @DWrapCurveArrow { @Link path {dwrapcurve} arrow { yes } } + macro @UWrapCurve { @Link path {uwrapcurve} } + macro @UWrapCurveArrow { @Link path {uwrapcurve} arrow { yes } } + + + ####################################################################### + # # + # Tree code. # + # # + ####################################################################### + + export + + @Node @Box @CurveBox @ShadowBox @Square @Diamond + @Polygon @Isosceles @Ellipse @Circle + @LeftSub @ZeroWidthLeftSub @RightSub @ZeroWidthRightSub + @FirstSub @NextSub @StubSub + + def @Tree + named treehindent + named left { 0.0rt } + named ctr { 0.5rt } + named right { 1.0rt } + { treehindent } + body x + { + + macro @TNode { @@Node nodetag { T } } + macro @Node { @TNode } + macro @Box { @TNode outline { box } } + macro @CurveBox { @TNode outline { curvebox } } + macro @ShadowBox { @TNode outline { shadowbox } } + macro @Square { @TNode outline { square } } + macro @Diamond { @TNode outline { diamond } } + macro @Polygon { @TNode outline { polygon } } + macro @Isosceles { @TNode outline { isosceles } } + macro @Ellipse { @TNode outline { ellipse } } + macro @Circle { @TNode outline { circle } } + + def fixroot + precedence 90 + left root + { + |treehindent root + } + + macro @LeftSub + { + @ObjectLink + basefrom { T } + baseto { L@T } + format { { /treevsep {L::y} } |treehsep x | insinuatelink } + } + + macro @ZeroWidthLeftSub + { + @ObjectLink + basefrom { T } + baseto { L@T } + format { { /treevsep @ZeroWidth { {L::y} ^|treehsep } } | + x | insinuatelink } + } + + macro @FirstSub + { + fixroot // + @ObjectLink + basefrom { T } + baseto { S@T } + format { //treevsep {S::y} | insinuatelink | } + } + + macro @NextSub + { + @ObjectLink + basefrom { T } + baseto { S@T } + format { x |treehsep { / {S::y} | insinuatelink | } } + } + + macro @RightSub + { + @ObjectLink + basefrom { T } + baseto { R@T } + format { x |treehsep { /treevsep {R::y} } | insinuatelink } + } + + macro @ZeroWidthRightSub + { + @ObjectLink + basefrom { T } + baseto { R@T } + format { x | { /treevsep @ZeroWidth { |treehsep {R::y} } } + | insinuatelink } + } + + macro @StubSub + { + @ObjectLink + basefrom { T } + baseto { T } + format { @VContract { |0.5rt x | // |0.5rt + S:: @BoxLabels @CatchTags y | } | insinuatelink } + # path { from S@T@SW S@T@SE to } + path { + P1:: S@SW + P2:: S@SE + FROM:: from boundaryatangle { from??CTR angleto P1 } + TO:: to boundaryatangle { to??CTR angleto P2 } + FROM P1 P2 TO + } + } + + @HContract @VContract x + } + + export + + @Node @Box @CurveBox @ShadowBox @Square @Diamond + @Polygon @Isosceles @Ellipse @Circle + @LeftSub @ZeroWidthLeftSub @RightSub @ZeroWidthRightSub + @FirstSub @NextSub @StubSub + + def @HTree + named treevindent + named top { 0.0rt } + named ctr { 0.5rt } + named foot { 1.0rt } + { treevindent } + body x + { + + macro @TNode { @@Node nodetag { T } } + macro @Node { @TNode } + macro @Box { @TNode outline { box } } + macro @CurveBox { @TNode outline { curvebox } } + macro @ShadowBox { @TNode outline { shadowbox } } + macro @Square { @TNode outline { square } } + macro @Diamond { @TNode outline { diamond } } + macro @Polygon { @TNode outline { polygon } } + macro @Isosceles { @TNode outline { isosceles } } + macro @Ellipse { @TNode outline { ellipse } } + macro @Circle { @TNode outline { circle } } + + def fixroot + precedence 90 + left root + { + /treevindent root + } + + macro @LeftSub + { + @ObjectLink + basefrom { T } + baseto { L@T } + format { { |treehsep {L::y} } /treevsep x / insinuatelink } + } + + macro @ZeroWidthLeftSub + { + @ObjectLink + basefrom { T } + baseto { L@T } + format { { |treehsep @ZeroWidth { {L::y} ^/treevsep } } / + x / insinuatelink } + } + + macro @FirstSub + { + fixroot || + @ObjectLink + basefrom { T } + baseto { S@T } + format { ||treehsep { {S::y} / insinuatelink / } } + } + + macro @NextSub + { + @ObjectLink + basefrom { T } + baseto { S@T } + format { x /treevsep { | {S::y} { / insinuatelink / } } } + } + + macro @RightSub + { + @ObjectLink + basefrom { T } + baseto { R@T } + format { x /treevsep { |treehsep {R::y} } / insinuatelink } + } + + macro @ZeroWidthRightSub + { + @ObjectLink + basefrom { T } + baseto { R@T } + format { x / { |treehsep @ZeroWidth { /treevsep {R::y} } } + / insinuatelink } + } + + macro @StubSub + { + @ObjectLink + basefrom { T } + baseto { T } + format { @VContract { { /0.5rt x / } || { /0.5rt + S:: @BoxLabels @CatchTags y / } } / insinuatelink } + # path { from S@T@SW S@T@SE to } + path { + P1:: S@NE + P2:: S@SE + FROM:: from boundaryatangle { from??CTR angleto P1 } + TO:: to boundaryatangle { to??CTR angleto P2 } + FROM P1 P2 TO + } + } + + @HContract @VContract x + } + + + ####################################################################### + # # + # Syntax diagrams code # + # # + # Helper definitions; also skips # + # # + ####################################################################### + + def pslength right x { "("x") ldiagdecodelength" } + def pssyntaxgap { "("syntaxgap") ldiagdecodelength" } + def pssyntaxbias { "("syntaxbias") ldiagdecodelength" } + def pssyntaxradius { "("syntaxradius") ldiagdecodelength" } + + def @ArrowLeftFrom left direction right pt + { + @Line arrow { direction } from { pt } to { pt -- { pssyntaxgap 0 } } + } + + def @ArrowRightFrom left direction right pt + { + @Line arrow { direction } from { pt } to { pt ++ { pssyntaxgap 0 } } + } + + def @ArrowUpFrom left direction right pt + { + @Line arrow { direction } from { pt } to { pt ++ { 0 pssyntaxgap } } + } + + def @ArrowDownFrom left direction right pt + { + @Line arrow { direction } from { pt } to { pt -- { 0 pssyntaxgap } } + } + + macro @LineLeftFrom { no @ArrowLeftFrom } + macro @LineRightFrom { no @ArrowRightFrom } + macro @LineUpFrom { no @ArrowUpFrom } + macro @LineDownFrom { no @ArrowDownFrom } + + macro @Right { "right" } + macro @Up { "up" } + macro @Left { "left" } + macro @Down { "down" } + + def @CurrDirection { @GetContext "diag_dirn" } + + def @GoRight right x { {"diag_dirn" @Yield @Right} @SetContext x } + def @GoUp right x { {"diag_dirn" @Yield @Up } @SetContext x } + def @GoLeft right x { {"diag_dirn" @Yield @Left } @SetContext x } + def @GoDown right x { {"diag_dirn" @Yield @Down } @SetContext x } + + # macro @Right { "1p" } + # macro @Up { "2p" } + # macro @Left { "3p" } + # macro @Down { "4p" } + + # macro @CurrDirection { @CurrZUnit } + + # def @GoRight right x { @Right @ZUnit x } + # def @GoUp right x { @Up @ZUnit x } + # def @GoLeft right x { @Left @ZUnit x } + # def @GoDown right x { @Down @ZUnit x } + + def @GoReverse right x + { + @CurrDirection @Case { + @Right @Yield @GoLeft x + @Up @Yield @GoDown x + @Left @Yield @GoRight x + @Down @Yield @GoUp x + } + } + + + def @LabelMarks right x { + @HContract @VContract @ANode + outline { + NMK:: { xmark ysize } + SMK:: { xmark 0 } + WMK:: { 0 ymark } + EMK:: { xsize ymark } + NW:: { 0 ysize } + SW:: { 0 0 } + SE:: { xsize 0 } + NE:: { xsize ysize } + } + font {} + margin { 0c } + vstrut { no } + outlinestyle { noline } + halign { mark } + valign { mark } + x + } + + def @HSkip + { + OX:: @LabelMarks { syntaxgap @Wide {} } + / @Line from { "OX@WMK" } to { "OX@EMK" } + } + + def @VSkip + { + OX:: @LabelMarks { syntaxgap @High {} } + / @Line from { "OX@NMK" } to { "OX@SMK" } + } + + def @Skip + { + @CurrDirection @Case { + { @Left @Right } @Yield @HSkip + { @Up @Down } @Yield @VSkip + } + } + + def @LRLine right x + { + @HContract @VContract { @HSkip | x | @HSkip } + } + + def @UDLine right x + { + @HContract @VContract { @VSkip / x / @VSkip } + } + + + ####################################################################### + # # + # Ordinary starts: @StartRight, @StartUp, @StartLeft, @StartDown # + # # + ####################################################################### + + def @StartRight right x + { + @VContract { + @LabelMarks { + |syntaxgap @GoRight x |syntaxgap + } + / @LineRightFrom WMK + / back @ArrowLeftFrom EMK + } + } + + def @StartUp right x + { + @VContract { + @LabelMarks { + ^/syntaxgap @GoUp x /syntaxgap + } + / @LineUpFrom SMK + / back @ArrowDownFrom NMK + } + } + + def @StartLeft right x + { + @VContract { + @LabelMarks { + |syntaxgap @GoLeft x |syntaxgap + } + / @LineLeftFrom EMK + / back @ArrowRightFrom WMK + } + } + + def @StartDown right x + { + @VContract { + @LabelMarks { + ^/syntaxgap @GoDown x /syntaxgap + } + / @LineDownFrom NMK + / back @ArrowUpFrom SMK + } + } + + + ####################################################################### + # # + # Fancy starts: @StartRightRight, @StartRightDown # + # # + ####################################################################### + + def @StartRightRight + named A {} + named B {} + { + AA:: @LabelMarks { @HSkip & @GoRight A } + //syntaxgap + //syntaxgap + |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap + CC:: @LabelMarks {} + //syntaxgap + //syntaxgap + |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap + BB:: @LabelMarks { @GoRight B & @HSkip } + // @RVLCurve from { AA@EMK } to { CC@WMK } + bias { pssyntaxbias } radius { pssyntaxradius } + // @LVRCurve from { CC@WMK } to { BB@WMK } + bias { pssyntaxbias } radius { pssyntaxradius } + back @ArrowLeftFrom BB@EMK + } + + def @StartRightRightRight + named A {} + named B {} + named C {} + { + AA:: @LabelMarks { @HSkip & @GoRight A } + //syntaxgap + //syntaxgap + |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap + XX:: @LabelMarks {} + //syntaxgap + //syntaxgap + |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap + BB:: @LabelMarks { @GoRight B & @HSkip } + //syntaxgap + //syntaxgap + |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap + YY:: @LabelMarks {} + //syntaxgap + //syntaxgap + |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap |syntaxgap + CC:: @LabelMarks { @GoRight C & @HSkip } + //syntaxgap + //syntaxgap + // @RVLCurve from { AA@EMK } to { XX@WMK } + bias { pssyntaxbias } radius { pssyntaxradius } + // @LVRCurve from { XX@WMK } to { BB@WMK } + bias { pssyntaxbias } radius { pssyntaxradius } + // @RVLCurve from { BB@EMK } to { YY@WMK } + bias { pssyntaxbias } radius { pssyntaxradius } + // @LVRCurve from { YY@WMK } to { CC@WMK } + bias { pssyntaxbias } radius { pssyntaxradius } + back @ArrowLeftFrom CC@EMK + } + + def @StartRightDown + named A {} + named B {} + { + @HContract @VContract { + / BB:: @LabelMarks |syntaxgap AA::@LabelMarks @GoRight A |syntaxbias + /syntaxgap | | + /syntaxgap | | + } + / @Line from { BB@EMK } to { AA@WMK } + / @RVLCurve from { AA@EMK } to { xcoord AA@EMK pssyntaxgap } + bias { pssyntaxbias } radius { pssyntaxradius } + / @HVCurve from { xcoord AA@EMK pssyntaxgap } to { 0 0 } + bias { pssyntaxbias } radius { pssyntaxradius } + / @GoDown B + / @VSkip + / CC:: @LabelMarks {} + / back @ArrowUpFrom CC@NMK + } + + + ####################################################################### + # # + # Cells: @XCell, @ACell, @BCell, @CCell # + # # + ####################################################################### + + def @RightCell right x + { + @VContract { + @LabelMarks { + |syntaxgap x |syntaxgap + } + / forward @ArrowRightFrom WMK + / @LineLeftFrom EMK + } + } + + def @LeftCell right x + { + @VContract { + @LabelMarks { + |syntaxgap x |syntaxgap + } + / forward @ArrowLeftFrom EMK + / @LineRightFrom WMK + } + } + + def @DownCell right x + { + @VContract { + @LabelMarks { + ^/syntaxgap x /syntaxgap + } + / forward @ArrowDownFrom NMK + / @LineUpFrom SMK + } + } + + def @UpCell right x + { + @VContract { + @LabelMarks { + ^/syntaxgap x /syntaxgap + } + / forward @ArrowUpFrom SMK + / @LineDownFrom NMK + } + } + + def @XCell right x + { + @CurrDirection @Case { + @Right @Yield @RightCell x + @Up @Yield @UpCell x + @Left @Yield @LeftCell x + @Down @Yield @DownCell x + } + } + + macro @ACell { @XCell @ANode } + macro @BCell { @XCell @BNode } + macro @CCell { @XCell @CNode } + macro @DCell { @XCell @DNode } + macro @ECell { @XCell @ENode } + + + ####################################################################### + # # + # @Sequence # + # # + ####################################################################### + + def @Sequence + named A {} + named B {} + named C {} + named D {} + named E {} + named F {} + named G {} + named H {} + named I {} + named J {} + named K {} + named L {} + { + + @CurrDirection @Case { + @Right @Yield + @HContract { A | B | C | D | E | F | G | H | I | J | K | L } + @Up @Yield + @VContract { L / K / J / I / H / G / F / E / D / C / B / A } + @Left @Yield + @HContract { L | K | J | I | H | G | F | E | D | C | B | A } + @Down @Yield + @VContract { A / B / C / D / E / F / G / H / I / J / K / L } + } + } + + + ####################################################################### + # # + # @OneOrBoth # + # # + ####################################################################### + + def @OneOrBoth + named A {} + named B {} + { + + def @ALH { + @HContract { + |syntaxgap + "AX":: restrict { "(WMK) (EMK)" } @LabelMarks A + |syntaxgap + } + } + + def @BLH { + @HContract { + |syntaxgap + "BX":: restrict { "(WMK) (EMK)" } @LabelMarks B + |syntaxgap + } + } + + def @ALV { + @VContract { + /syntaxgap + "AX":: restrict { "(NMK) (SMK)" } @LabelMarks A + /syntaxgap + } + } + + def @BLV { + @VContract { + /syntaxgap + "BX":: restrict { "(NMK) (SMK)" } @LabelMarks B + /syntaxgap + } + } + + def @RightOneOrBoth + { + @LRLine { + @HContract @VContract { @ALH | /syntaxgap | @BLH } + // + @HVCurve from { "BX@WMK" } to { 0 ycoord "AX@WMK" } + arrow { no } bias { pssyntaxbias } radius { pssyntaxradius } + // + @HVCurve from { "BX@EMK" } to { xsize ycoord "AX@WMK" } + arrow { yes } bias { pssyntaxbias } radius { pssyntaxradius } + // + @Line from { 0 ycoord "AX@WMK" } to { "AX@WMK" } + // + @Line from { "AX@EMK" } to { xsize ycoord "AX@WMK" } + // + @Arrow + from { {xcoord "AX@EMK" * 0.5 + xcoord "BX@WMK" * 0.5} + ycoord "AX@EMK" } + to { {xcoord "AX@EMK" * 0.5 + xcoord "BX@WMK" * 0.5} + ycoord "BX@WMK" } + } + } + + def @LeftOneOrBoth + { + @LRLine { + @HContract @VContract { | @ALH /syntaxgap @BLH | } + // + @HVCurve from { "BX@WMK" } to { 0 ycoord "AX@WMK" } + arrow { yes } bias { pssyntaxbias } radius { pssyntaxradius } + // + @HVCurve from { "BX@EMK" } to { xsize ycoord "AX@WMK" } + arrow { no } bias { pssyntaxbias } radius { pssyntaxradius } + // + @Line from { 0 ycoord "AX@WMK" } to { "AX@WMK" } + // + @Line from { "AX@EMK" } to { xsize ycoord "AX@WMK" } + // + @Arrow + from { {xcoord "AX@WMK" * 0.5 + xcoord "BX@EMK" * 0.5} + ycoord "AX@WMK" } + to { {xcoord "AX@WMK" * 0.5 + xcoord "BX@EMK" * 0.5} + ycoord "BX@EMK" } + } + } + + def @DownOneOrBoth + { + @UDLine { + @HContract @VContract { @ALV |syntaxgap / | @BLV } + || + @VHCurve from { "BX@NMK" } to { xcoord "AX@NMK" ysize } + arrow { no } bias { pssyntaxbias } radius { pssyntaxradius } + || + @VHCurve from { "BX@SMK" } to { xcoord "AX@NMK" 0 } + arrow { yes } bias { pssyntaxbias } radius { pssyntaxradius } + || + @Line from { xcoord "AX@NMK" ysize } to { "AX@NMK" } + || + @Line from { "AX@SMK" } to { xcoord "AX@SMK" 0 } + || + @Arrow + from { xcoord "AX@SMK" + {ycoord "AX@SMK" * 0.5 + ycoord "BX@NMK" * 0.5} } + to { xcoord "BX@NMK" + {ycoord "AX@SMK" * 0.5 + ycoord "BX@NMK" * 0.5} } + } + } + + def @UpOneOrBoth + { + @UDLine { + @HContract @VContract { |syntaxgap @BLV / @ALV | } + || + @VHCurve from { "BX@NMK" } to { xcoord "AX@NMK" ysize } + arrow { yes } bias { pssyntaxbias } radius { pssyntaxradius } + || + @VHCurve from { "BX@SMK" } to { xcoord "AX@NMK" 0 } + arrow { no } bias { pssyntaxbias } radius { pssyntaxradius } + || + @Line from { xcoord "AX@NMK" ysize } to { "AX@NMK" } + || + @Line from { "AX@SMK" } to { xcoord "AX@SMK" 0 } + || + @Arrow + from { xcoord "AX@NMK" + {ycoord "AX@NMK" * 0.5 + ycoord "BX@SMK" * 0.5} } + to { xcoord "BX@SMK" + {ycoord "AX@NMK" * 0.5 + ycoord "BX@SMK" * 0.5} } + } + } + + @CurrDirection @Case { + @Right @Yield @RightOneOrBoth + @Up @Yield @UpOneOrBoth + @Left @Yield @LeftOneOrBoth + @Down @Yield @DownOneOrBoth + } + } + + ####################################################################### + # # + # @Select and @Optional # + # # + ####################################################################### + + def @Select + named A {} + named B {} + named C {} + named D {} + named E {} + named F {} + named G {} + named H {} + named I {} + named J {} + named K {} + named L {} + { + + def @RLFirstOrMiddle + left label + named i { 0i } + named al { no } + named ar { no } + right x + { + {|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" } + arrow { ar } + } + + def @UDFirstOrMiddle + left label + named i { 0i } + named au { no } + named ad { no } + right x + { + {/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 } + arrow { ad } + } + + def @RLLast + left label + named i { 0i } + named al { no } + named ar { no } + right x + { + {|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" } + arrow { ar } bias { pssyntaxbias } radius { pssyntaxradius } + } + + def @UDLast + left label + named i { 0i } + named au { no } + named ad { no } + right x + { + {/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 } + arrow { ad } bias { pssyntaxbias } radius { pssyntaxradius } + } + + def @DirectedSelect + named @First left label right x {} + named @Middle left label right x {} + named @Last left label right x {} + named @Join precedence 90 left x right y {} + { + + def @LastIsA + { + A + } + + def @LastIsB + { + AX @First A + @Join BX @Last B + } + + def @LastIsC + { + AX @First A + @Join BX @Middle B + @Join CX @Last C + } + + def @LastIsD + { + AX @First A + @Join BX @Middle B + @Join CX @Middle C + @Join DX @Last D + } + + def @LastIsE + { + AX @First A + @Join BX @Middle B + @Join CX @Middle C + @Join DX @Middle D + @Join EX @Last E + } + + def @LastIsF + { + AX @First A + @Join BX @Middle B + @Join CX @Middle C + @Join DX @Middle D + @Join EX @Middle E + @Join FX @Last F + } + + def @UpToF + { + AX @First A + @Join BX @Middle B + @Join CX @Middle C + @Join DX @Middle D + @Join EX @Middle E + @Join FX @Middle F + } + + def @LastIsG + { + @UpToF + @Join GX @Last G + } + + def @LastIsH + { + @UpToF + @Join GX @Middle G + @Join HX @Last H + } + + def @LastIsI + { + @UpToF + @Join GX @Middle G + @Join HX @Middle H + @Join IX @Last I + } + + def @LastIsJ + { + @UpToF + @Join GX @Middle G + @Join HX @Middle H + @Join IX @Middle I + @Join JX @Last J + } + + def @LastIsK + { + @UpToF + @Join GX @Middle G + @Join HX @Middle H + @Join IX @Middle I + @Join JX @Middle J + @Join KX @Last K + } + + def @LastIsL + { + @UpToF + @Join GX @Middle G + @Join HX @Middle H + @Join IX @Middle I + @Join JX @Middle J + @Join KX @Middle K + @Join LX @Last L + } + + def @TryA { A @Case { {} @Yield @Skip else @Yield @LastIsA } } + def @TryB { B @Case { {} @Yield @TryA else @Yield @LastIsB } } + def @TryC { C @Case { {} @Yield @TryB else @Yield @LastIsC } } + def @TryD { D @Case { {} @Yield @TryC else @Yield @LastIsD } } + def @TryE { E @Case { {} @Yield @TryD else @Yield @LastIsE } } + def @TryF { F @Case { {} @Yield @TryE else @Yield @LastIsF } } + def @TryG { G @Case { {} @Yield @TryF else @Yield @LastIsG } } + def @TryH { H @Case { {} @Yield @TryG else @Yield @LastIsH } } + def @TryI { I @Case { {} @Yield @TryH else @Yield @LastIsI } } + def @TryJ { J @Case { {} @Yield @TryI else @Yield @LastIsJ } } + def @TryK { K @Case { {} @Yield @TryJ else @Yield @LastIsK } } + def @TryL { L @Case { {} @Yield @TryK else @Yield @LastIsL } } + + @TryL + } + + def @RightSelect + { + @LRLine @DirectedSelect + @First { label @RLFirstOrMiddle x } + @Middle { label @RLFirstOrMiddle ar { yes } x } + @Last { label @RLLast ar { yes } x } + @Join { x //syntaxgap y } + } + + def @UpSelect + { + @UDLine @DirectedSelect + @First { label @UDFirstOrMiddle i { 1r } x } + @Middle { label @UDFirstOrMiddle i { 1r } au { yes } x } + @Last { label @UDLast i { 1r } au { yes } x } + @Join { x ||syntaxgap y } + } + + def @LeftSelect + { + @LRLine @DirectedSelect + @First { label @RLFirstOrMiddle i { 1r } x } + @Middle { label @RLFirstOrMiddle i { 1r } al { yes } x } + @Last { label @RLLast i { 1r } al { yes } x } + @Join { x //syntaxgap y } + } + + def @DownSelect + { + @UDLine @DirectedSelect + @First { label @UDFirstOrMiddle x } + @Middle { label @UDFirstOrMiddle ad { yes } x } + @Last { label @UDLast ad { yes } x } + @Join { x ||syntaxgap y } + } + + @CurrDirection @Case { + @Right @Yield @RightSelect + @Up @Yield @UpSelect + @Left @Yield @LeftSelect + @Down @Yield @DownSelect + } + } + + + def @Optional right x + { + @Select A { @Skip } B { x } + } + + + ####################################################################### + # # + # @OptionalDiverted # + # # + ####################################################################### + + def @DownRightOptionalDiverted right x + { + @UDLine { + OX:: @LabelMarks { + |syntaxgap AX:: @LabelMarks @GoRight x |syntaxbias + /syntaxgap + } + / @Line from { "OX@NW" } to { "OX@SW" } + / @Line from { "OX@WMK" } to { "OX@IN@AX@WMK" } + / @RVLCurveArrow from { "OX@IN@AX@EMK" } to { "OX@SW" } + bias { pssyntaxbias } radius { pssyntaxradius } + } + } + + def @UpRightOptionalDiverted right x + { + @UDLine { + OX:: @LabelMarks { + ^/syntaxgap + |syntaxgap AX:: @LabelMarks @GoRight x |syntaxbias + } + / @Line from { "OX@NW" } to { "OX@SW" } + / @Line from { "OX@WMK" } to { "OX@IN@AX@WMK" } + / @RVLCurveArrow from { "OX@IN@AX@EMK" } to { "OX@NW" } + bias { pssyntaxbias } radius { pssyntaxradius } + } + } + + def @RightDownOptionalDiverted right x + { + @LRLine { + OX:: @LabelMarks { + { /syntaxgap AX:: @LabelMarks @GoDown x /syntaxbias } + |syntaxgap + } + / @Line from { "OX@NW" } to { "OX@NE" } + / @Line from { "OX@NMK" } to { "OX@IN@AX@NMK" } + / @VHCurve from {"OX@IN@AX@SMK"} to { "OX@SE"--{pssyntaxgap 0} } + bias { pssyntaxbias } radius { pssyntaxradius } + / @HVCurve from { "OX@SE" -- {pssyntaxgap 0} } to { "OX@NE" } + arrow { yes } bias { pssyntaxbias } radius { pssyntaxradius } + } + } + + def @LeftDownOptionalDiverted right x + { + @LRLine { + OX:: @LabelMarks { + ^|syntaxgap + { /syntaxgap AX:: @LabelMarks @GoDown x /syntaxbias } + } + / @Line from { "OX@NW" } to { "OX@NE" } + / @Line from { "OX@NMK" } to { "OX@IN@AX@NMK" } + / @VHCurve from {"OX@IN@AX@SMK"} to { "OX@SW"++{pssyntaxgap 0} } + bias { pssyntaxbias } radius { pssyntaxradius } + / @HVCurve from { "OX@SW" ++ {pssyntaxgap 0} } to { "OX@NW" } + arrow { yes } bias { pssyntaxbias } radius { pssyntaxradius } + } + } + + def @OptionalDiverted right x + { + @CurrDirection @Case { + @Right @Yield @RightDownOptionalDiverted x + @Up @Yield @UpRightOptionalDiverted x + @Left @Yield @LeftDownOptionalDiverted x + @Down @Yield @DownRightOptionalDiverted x + } + } + + + ####################################################################### + # # + # @Diverted # + # # + ####################################################################### + + def @DownRightDiverted right x + { + @UDLine { + OX:: @LabelMarks { + |syntaxgap AX:: @LabelMarks @GoRight x |syntaxbias + ^/syntaxgap + /syntaxgap + } + / @VHCurve from { "OX@NW" } to { "OX@IN@AX@WMK" } + bias { pssyntaxbias } radius { pssyntaxradius } + / @RVLCurve from { "OX@IN@AX@EMK" } + to { xcoord "OX@IN@AX@WMK" ycoord "OX@EMK" } + bias { pssyntaxbias } radius { pssyntaxradius } + / @HVCurve from { xcoord "OX@IN@AX@WMK" ycoord "OX@EMK" } + to { "OX@SW" } bias { pssyntaxbias } radius {pssyntaxradius} + } + } + + def @UpRightDiverted right x + { + @UDLine { + OX:: @LabelMarks { + ^/syntaxgap + /syntaxgap + |syntaxgap AX:: @LabelMarks @GoRight x |syntaxbias + } + / @VHCurve from { "OX@SW" } to { "OX@IN@AX@WMK" } + bias { pssyntaxbias } radius { pssyntaxradius } + / @RVLCurve from { "OX@IN@AX@EMK" } + to { xcoord "OX@IN@AX@WMK" ycoord "OX@EMK" } + bias { pssyntaxbias } radius { pssyntaxradius } + / @HVCurve from { xcoord "OX@IN@AX@WMK" ycoord "OX@EMK" } + to { "OX@NW" } bias { pssyntaxbias } radius {pssyntaxradius} + } + } + + def @RightDownDiverted right x + { + @LRLine { + OX:: @LabelMarks { + { /syntaxgap AX:: @LabelMarks @GoDown x /syntaxbias } + ^|syntaxgap + |syntaxgap + } + / @HVCurve from { "OX@NW" } to { "OX@IN@AX@NMK" } + bias { pssyntaxbias } radius { pssyntaxradius } + / @VHCurve from { "OX@IN@AX@SMK" } + to { xcoord "OX@IN@AX@EMK" ycoord "OX@SMK" } + bias { pssyntaxbias } radius { pssyntaxradius } + / @HVCurve from { xcoord "OX@IN@AX@EMK" ycoord "OX@SMK" } + to { "OX@IN@AX@EMK" ++ { pssyntaxgap 0 } } + bias { pssyntaxbias } radius {pssyntaxradius} + / @VHCurve from { "OX@IN@AX@EMK" ++ { pssyntaxgap 0 } } + to { "OX@NE" } bias { pssyntaxbias } radius {pssyntaxradius} + } + } + + def @LeftDownDiverted right x + { + @LRLine { + OX:: @LabelMarks { + |syntaxgap + ^|syntaxgap + { /syntaxgap AX:: @LabelMarks @GoDown x /syntaxbias } + } + / @HVCurve from { "OX@NE" } to { "OX@IN@AX@NMK" } + bias { pssyntaxbias } radius { pssyntaxradius } + / @VHCurve from { "OX@IN@AX@SMK" } + to { xcoord "OX@IN@AX@WMK" ycoord "OX@SMK" } + bias { pssyntaxbias } radius { pssyntaxradius } + / @HVCurve from { xcoord "OX@IN@AX@WMK" ycoord "OX@SMK" } + to { "OX@IN@AX@WMK" -- { pssyntaxgap 0 } } + bias { pssyntaxbias } radius {pssyntaxradius} + / @VHCurve from { "OX@IN@AX@WMK" -- { pssyntaxgap 0 } } + to { "OX@NW" } bias { pssyntaxbias } radius {pssyntaxradius} + } + } + + def @Diverted right x + { + @CurrDirection @Case { + @Right @Yield @RightDownDiverted x + @Up @Yield @UpRightDiverted x + @Left @Yield @LeftDownDiverted x + @Down @Yield @DownRightDiverted x + } + } + + + ####################################################################### + # # + # @RepeatDiverted # + # # + ####################################################################### + + def @RepeatDiverted right x + { + # this implementation exploits the coincidental similarity + # of @RepeatDiverted to @OptionalDiverted + + @CurrDirection @Case { + @Right @Yield @LeftDownOptionalDiverted x + @Up @Yield @DownRightOptionalDiverted x + @Left @Yield @RightDownOptionalDiverted x + @Down @Yield @UpRightOptionalDiverted x + } + } + + + + ####################################################################### + # # + # @Loop and @Repeat # + # # + ####################################################################### + + def @Loop + named A {} + named B {} + { + def @LeftOrRightLoop + named al { no } + named ar { no } + { + @LRLine { + @HContract @VContract { OX:: @LabelMarks { + { |syntaxgap AX:: @LabelMarks A |syntaxgap } + //syntaxgap + { |0.5rt BX:: @LabelMarks @GoReverse B |syntaxgap } + } } + / @Line from { "OX@WMK" } to { "OX@IN@AX@WMK" } + / @Line from { "OX@EMK" } to { "OX@IN@AX@EMK" } + / @HVCurve from { "OX@IN@BX@EMK" } to { "OX@EMK" } + arrow { ar } bias {pssyntaxbias} radius {pssyntaxradius} + / @HVCurve from { "OX@IN@BX@WMK" } to { "OX@WMK" } + arrow { al } bias {pssyntaxbias} radius {pssyntaxradius} + } + } + + def @UpOrDownLoop + named au { no } + named ad { no } + { + @UDLine { + @HContract @VContract { OX:: @LabelMarks { + { /syntaxgap AX:: @LabelMarks A /syntaxgap } + ||syntaxgap + { /0.5rt BX:: @LabelMarks @GoReverse B /syntaxgap } + } } + / @Line from { "OX@NMK" } to { "OX@IN@AX@NMK" } + / @Line from { "OX@SMK" } to { "OX@IN@AX@SMK" } + / @VHCurve from { "OX@IN@BX@NMK" } to { "OX@NMK" } + arrow { au } bias {pssyntaxbias} radius {pssyntaxradius} + / @VHCurve from { "OX@IN@BX@SMK" } to { "OX@SMK" } + arrow { ad } bias {pssyntaxbias} radius {pssyntaxradius} + } + } + + @CurrDirection @Case { + @Right @Yield @LeftOrRightLoop al { yes } + @Up @Yield @UpOrDownLoop ad { yes } + @Left @Yield @LeftOrRightLoop ar { yes } + @Down @Yield @UpOrDownLoop au { yes } + } + } + + def @Repeat right x + { + @Loop + A { x } + B { @Skip } + } + + + ####################################################################### + # # + # @LoopOpposite and @RepeatOpposite # + # # + ####################################################################### + + def @LoopOpposite + named A {} + named B {} + { + def @LeftOrRightLoopOpposite + named al { no } + named ar { no } + { + @LRLine { + @HContract @VContract { OX:: @LabelMarks { + { |0.5rt BX:: @LabelMarks @GoReverse B |syntaxgap } + //syntaxgap + ^//syntaxgap + { |syntaxgap AX:: @LabelMarks A |syntaxgap } + } } + / @Line from { "OX@WMK" } to { "OX@IN@AX@WMK" } + / @Line from { "OX@EMK" } to { "OX@IN@AX@EMK" } + / @HVCurve from { "OX@IN@BX@EMK" } to { "OX@EMK" } + arrow { ar } bias {pssyntaxbias} radius {pssyntaxradius} + / @HVCurve from { "OX@IN@BX@WMK" } to { "OX@WMK" } + arrow { al } bias {pssyntaxbias} radius {pssyntaxradius} + } + } + + def @UpOrDownLoopOpposite + named au { no } + named ad { no } + { + @UDLine { + @HContract @VContract { OX:: @LabelMarks { + { /0.5rt BX:: @LabelMarks @GoReverse B /syntaxgap } + ^||syntaxgap + { /syntaxgap AX:: @LabelMarks A /syntaxgap } + } } + / @Line from { "OX@NMK" } to { "OX@IN@AX@NMK" } + / @Line from { "OX@SMK" } to { "OX@IN@AX@SMK" } + / @VHCurve from { "OX@IN@BX@NMK" } to { "OX@NMK" } + arrow { au } bias {pssyntaxbias} radius {pssyntaxradius} + / @VHCurve from { "OX@IN@BX@SMK" } to { "OX@SMK" } + arrow { ad } bias {pssyntaxbias} radius {pssyntaxradius} + } + } + + @CurrDirection @Case { + @Right @Yield @LeftOrRightLoopOpposite al { yes } + @Up @Yield @UpOrDownLoopOpposite ad { yes } + @Left @Yield @LeftOrRightLoopOpposite ar { yes } + @Down @Yield @UpOrDownLoopOpposite au { yes } + } + } + + def @RepeatOpposite right x + { + @LoopOpposite + A { x } + B { @Skip } + } + + + ####################################################################### + # # + # Value of whole diagram # + # # + ####################################################################### + + def @DiagValue right x + { + @BackEnd @Case { + PostScript @Yield { + { + save @Case { + { yes Yes } @Yield "grestore save gsave" + else @Yield {} + } + maxlabels "ldiagbegin" + // + "ldiagend" + save @Case { + { yes Yes } @Yield "restore" + else @Yield {} + } + } @Graphic x } + + PDF @Yield {} + } + } + + title @Case { + + "--titledft--" @Yield @DiagValue @Body + + else @Yield { title titleformat @DiagValue @Body } + } + + @End @Diag + + + macro @SyntaxDiag { + @Diag + avalign { mark } + avstrut { yes } + amargin { 0.2f } + aoutline { box } + afont { Slope } + + bvalign { mark } + bvstrut { yes } + bmargin { 0.2f } + boutline { curvebox } + bfont { Bold } + + cvalign { mark } + cvstrut { yes } + cmargin { 0.2f } + coutline { circle } + chsize { 1f } + + arrowlength { 0.4f } + backarrowlength { 0.4f } + } +} diff --git a/include/include/diagf.etc b/include/include/diagf.etc new file mode 100644 index 0000000..02141b6 --- /dev/null +++ b/include/include/diagf.etc @@ -0,0 +1,644 @@ + +############################################################################### +# # +# Lout @Geometry package for algebra and geometry in PostScript # +# Version 1.0 (June 1996) # +# Jeffrey H. Kingston # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export + + i c p m s v f d "-0" "-1" "-2" "-3" "-4" "-5" "-6" "-7" "-8" "-9" "-." + pi e sqrt abs ceiling floor truncate round cos sin atan + exp log rand max min "*" "/" idiv mod "+" "-" + xcoord ycoord distance angleto ":=" ":==" "::" ":<" prev "??" "?!?" + boundaryatangle atangle + "**" "++" "--" anglefix anydebug "," + "=" "!=" "==" "!==" "<" "<=" ">" ">=" not and xor or + if quadcase signcase xloop yloop zloop + cabout aabout + +def @Geometry +{ + def i + precedence 100 + left x + { + x "in" + } + + def c + precedence 100 + left x + { + x "cm" + } + + def p + precedence 100 + left x + { + x "pt" + } + + def m + precedence 100 + left x + { + x "em" + } + + def s + precedence 100 + left x + { + x "sp" + } + + def v + precedence 100 + left x + { + x "vs" + } + + def f + precedence 100 + left x + { + x "ft" + } + + def d + precedence 100 + left x + { + x "dg" + } + + def pi + { + "ldiagpi" + } + + def e + { + "ldiage" + } + + def sqrt + precedence 99 + right y + { + y "sqrt" + } + + def abs + precedence 99 + right y + { + y "abs" + } + + def anglefix + precedence 99 + right y + { + y "ldiagfixangle" + } + + def ceiling + precedence 99 + right y + { + y "ceiling" + } + + def floor + precedence 99 + right y + { + y "floor" + } + + def truncate + precedence 99 + right y + { + y "truncate" + } + + def round + precedence 99 + right y + { + y "round" + } + + def cos + precedence 99 + right y + { + y "cos" + } + + def sin + precedence 99 + right y + { + y "sin" + } + + def xcoord + precedence 99 + right y + { + y "pop" + } + + def ycoord + precedence 99 + right y + { + y "exch pop" + } + + def distance + precedence 98 + left x + right y + { + x y "ldiagdistance" + } + + def angleto + precedence 98 + left x + right y + { + x y "ldiagangleto" + } + + def atan + precedence 98 + left x + right y + { + x y "atan" + } + + def exp + precedence 98 + left x + right y + { + x y "exp" + } + + def log + precedence 98 + left x + right y + { + x y "ldiaglog" + } + + def rand + precedence 98 + left x + right y + { + x y "dorand" + } + + def max + precedence 98 + left x + right y + { + x y "ldiagmax" + } + + def min + precedence 98 + left x + right y + { + x y "ldiagmin" + } + + def "*" + precedence 97 + left x + right y + { + x y "mul" + } + + def "/" + precedence 96 + associativity left + left x + right y + { + x y "div" + } + + def idiv + precedence 96 + associativity left + left x + right y + { + x y "idiv" + } + + def mod + precedence 96 + left x + right y + { + x "cvi" y "cvi mod" + } + + def "+" + precedence 95 + associativity left + left x + right y + { + x @Case { + "" @Yield y + else @Yield { x y "add" } + } + } + + def "-" + precedence 95 + associativity left + left x + right y + { + x @Case { + "" @Yield { y "neg" } + else @Yield { x y "sub" } + } + } + + def "-0" { "-0" } + def "-1" { "-1" } + def "-2" { "-2" } + def "-3" { "-3" } + def "-4" { "-4" } + def "-5" { "-5" } + def "-6" { "-6" } + def "-7" { "-7" } + def "-8" { "-8" } + def "-9" { "-9" } + def "-." { "-." } + + def prev + { + "ldiagprevious" + } + + def "??" + precedence 99 + left x + right y + { + "{" x "} ("y") ldiagdolabel" + } + + def "?!?" + precedence 99 + left x + right y + { + "{" x "} "y" ldiagdolabel" + } + + def boundaryatangle + precedence 89 + left x + right y + { + x??"CTR" y x??"CIRCUM" "ldiagpadd" + } + + def atangle + precedence 89 + left x + right y + { + 0 0 x y "ldiagatangle" + } + + def "**" + precedence 88 + left x + right y + { + x y "ldiagpmul" + } + + def "++" + precedence 87 + associativity left + left x + right y + { + x y "ldiagpadd" + } + + def "--" + precedence 87 + associativity left + left x + right y + { + y x "ldiagpsub" + } + + def "=" + precedence 79 + left x + right y + { + x y "eq" + } + + def "!=" + precedence 79 + left x + right y + { + x y "ne" + } + + def "==" + precedence 79 + left x + right y + { + x y "ldiagangleeq" + } + + def "!==" + precedence 79 + left x + right y + { + x y "ldiaganglene" + } + + def "<" + precedence 79 + left x + right y + { + x y "lt" + } + + def "<=" + precedence 79 + left x + right y + { + x y "le" + } + + def ">" + precedence 79 + left x + right y + { + x y "gt" + } + + def ">=" + precedence 79 + left x + right y + { + x y "ge" + } + + def not + precedence 78 + right y + { + y "not" + } + + def and + precedence 77 + left x + right y + { + x y "and" + } + + def xor + precedence 76 + left x + right y + { + x y "xor" + } + + def or + precedence 76 + left x + right y + { + x y "or" + } + + def "," + precedence 70 + left x + right y + { + OOO ++ { OOX -- OOO }**x ++ { OOY -- OOO }**y + } + + def ":=" + precedence 20 + left x + right y + { + "/"x "[" y "] cvx def" + } + + def ":==" + precedence 20 + left x + right y + { + "/"x "[" y "counttomark 2 add (assigning) exch ldiagdebugprint ] cvx def" + } + + def "::" + precedence 20 + left x + right y + { + y "/"x "ldiagpointdef" + } + + def ":<" + precedence 20 + left x + right y + { + y "/"x"@ANGLE ldiagangledef" + } + + def if + named cond {} + named then {} + named else {} + { + cond "{" then "} {" else "} ifelse" + } + + def quadcase + precedence 10 + left angle + named "0" {} + named "0-90" {} + named "90" {} + named "90-180" {} + named "180" {} + named "180-270" {} + named "270" {} + named "270-360" {} + { + "{" 0-90 "} {" 270 "} {" 180 "} {" 90 "}" + "{" 0 "} {" 270-360 "} {" 180-270 "} {" 90-180 "}" angle "ldiagquadcase" + } + + def signcase + precedence 10 + left number + named neg {} + named zero {} + named pos {} + { + "{" neg "} {" zero "} {" pos "}" number "ldiagsigncase" + } + + def xloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named x { "xval" } {} + { + from by to "{ /xval exch def" do "} for" + } + + def yloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named y { "yval" } {} + { + from by to "{ /yval exch def" do "} for" + } + + def zloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named z { "zval" } {} + { + from by to "{ /zval exch def" do "} for" + } + + def anydebug + right tag + { + "[" tag "counttomark ("tag") exch ldiagdebugprint cleartomark" + } + + def aabout + named circum {} + named extra {} + named centre {} + { + "{" circum "} cvlit" extra "[" centre "] cvx ldiagaabout" + # ZXCTR := centre + # ZFCTR := circum??CTR + # ZAREF := ZFCTR angleto ZXCTR + # ZAMIN := 0d + # ZPMIN := circum boundaryatangle { ZAREF - ZAMIN } + # ++ extra atangle { ZAREF - ZAMIN } + # ZAMAX := 90d + # ZPMAX := circum boundaryatangle { ZAREF - ZAMAX } + # ++ extra atangle { ZAREF - ZAMAX } + # xloop from { 1 } to { 12 } by { 1 } do { + # ZAMID := { ZAMIN + ZAMAX } * 0.5 + # ZPMID := circum boundaryatangle { ZAREF - ZAMID } + # ++ extra atangle { ZAREF - ZAMID } + # if cond { {ZPMID distance ZXCTR} > {ZFCTR distance ZXCTR} } then { + # ZAMAX := ZAMID + # ZPMAX := ZPMID + # } + # else { + # ZAMIN := ZAMID + # ZPMIN := ZPMID + # } + # } + # ZPMID + } + + def cabout + named circum {} + named extra {} + named centre {} + { + "{" circum "} cvlit" extra "[" centre "] cvx ldiagcabout" + # ZXCTR := centre + # ZFCTR := circum??CTR + # ZAREF := ZFCTR angleto ZXCTR + # ZAMIN := 0d + # ZPMIN := circum boundaryatangle { ZAREF + ZAMIN } + # ++ extra atangle { ZAREF + ZAMIN } + # ZAMAX := 90d + # ZPMAX := circum boundaryatangle { ZAREF + ZAMAX } + # ++ extra atangle { ZAREF + ZAMAX } + # xloop from { 1 } to { 12 } by { 1 } do { + # ZAMID := { ZAMIN + ZAMAX } * 0.5 + # ZPMID := circum boundaryatangle { ZAREF + ZAMID } + # ++ extra atangle { ZAREF + ZAMID } + # if cond { {ZPMID distance ZXCTR} > {ZFCTR distance ZXCTR} } then { + # ZAMAX := ZAMID + # ZPMAX := ZPMID + # } + # else { + # ZAMIN := ZAMID + # ZPMIN := ZPMID + # } + # } + # ZPMID + } +} diff --git a/include/include/diagf.lpg b/include/include/diagf.lpg new file mode 100644 index 0000000..846d510 --- /dev/null +++ b/include/include/diagf.lpg @@ -0,0 +1,3414 @@ +%%BeginResource: procset LoutDiagPrependGraphic +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Diag Jeffrey H. Kingston % +% Version 2.0 (includes CIRCUM label) September 1996 % +% % +% This file has been placed in the public domain by its author, % +% Jeffrey H. Kingston % +% % +% 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 + +% 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 + +% - ldiagdebugnextline - +/ldiagdebugnextline +{ + ldiagdebugposy 72 lt + { /ldiagdebugposx ldiagdebugposx 144 add store + /ldiagdebugposy 432 store + } + { + /ldiagdebugposy ldiagdebugposy 12 sub store + } ifelse + ldiagdebugposx ldiagdebugposy moveto +} def + +% - ldiagdebugbeginindent - +/ldiagdebugbeginindent +{ + /ldiagdebugposx ldiagdebugposx 12 add store +} def + +% - ldiagdebugendindent - +/ldiagdebugendindent +{ + /ldiagdebugposx ldiagdebugposx 12 sub store +} 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 + ldiagdebugnextline + /Times-Roman findfont 10 scalefont setfont + 0 setgray show + ldiagdebugbeginindent + count 1 sub 2 copy lt { pop } { exch pop } ifelse 1 sub + 0 exch 1 exch + { + ldiagdebugnextline + index + dup type (dicttype) eq + { + (begin dict) show + ldiagdebugbeginindent + { + ldiagdebugnextline + pop 100 string cvs show + } forall + ldiagdebugendindent + ldiagdebugnextline + (end dict) show + } + { + dup type (arraytype) eq + { + (begin array) show + ldiagdebugbeginindent + { + ldiagdebugnextline + 100 string cvs show + } forall + ldiagdebugendindent + ldiagdebugnextline + (end array) show + } + { + 100 string cvs show + } ifelse + } ifelse + } for + ldiagdebugendindent + 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 noline line: <length> <dashlength> ldiagnoline - +/ldiagnoline +{ pop pop +} 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 + +% scale array elements by factor: <array> <factor> ldiagscalearray <array> +/ldiagscalearray +{ + [ exch 3 2 roll + { exch dup 3 1 roll mul exch } forall + pop ] +} def + +% sum array elements: <array> ldiagsumarray <number> +/ldiagsumarray +{ + 0 exch { add } forall +} def + +% begin a more complex line: <length> <dashlength> ldiaglinebegin - +/ldiaglinebegin +{ + % (Entering ldiaglinebegin) 2 ldiagdebugprint + 20 dict begin + /dashlen exch 1 pt ldiagmax def + /len exch def + /gap dashlen def + /halfgap dashlen 2 div def + /dash dashlen def + /halfdash dashlen 2 div def + /dot 0 def + % (Leaving ldiaglinebegin) 0 ldiagdebugprint +} def + +% end a more complex line: <linecap> <cycle> <startpos> <stoppos> ldiaglineend - +/ldiaglineend +{ + % (Entering ldiaglineend) 3 ldiagdebugprint + /stoppos exch def + /startpos exch def + /cycle exch def + /linecap exch def + /stopposlen stoppos ldiagsumarray def + /startposlen startpos ldiagsumarray def + /cyclelen cycle ldiagsumarray def + /effectivelen len startposlen add stopposlen sub def + effectivelen 0 gt cyclelen 0 gt and + { + /repeats effectivelen cyclelen div ceiling def + /factor len repeats cyclelen mul startposlen sub stopposlen add div def + cycle factor ldiagscalearray startposlen factor mul setdash + linecap setlinecap stroke + } if + end + % (Leaving ldiaglineend) 0 ldiagdebugprint +} def + +% stroke a dotdashed line: <length> <dashlength> ldiagdotdashed - +/ldiagdotdashed +{ + ldiaglinebegin + 1 [dash gap dot gap] [] [dash] + ldiaglineend +} def + +% stroke a dotcdashed line: <length> <dashlength> ldiagdotcdashed - +/ldiagdotcdashed +{ + ldiaglinebegin + 1 [dash gap dot gap] [halfdash] [halfdash] + ldiaglineend +} def + +% stroke a dotdotdashed line: <length> <dashlength> ldiagdotdotdashed - +/ldiagdotdotdashed +{ + ldiaglinebegin + 1 [dash gap dot gap dot gap] [] [dash] + ldiaglineend +} def + +% stroke a dotdotcdashed line: <length> <dashlength> ldiagdotdotcdashed - +/ldiagdotdotcdashed +{ + ldiaglinebegin + 1 [dash gap dot gap dot gap] [halfdash] [halfdash] + ldiaglineend +} def + +% stroke a dotdotdotdashed line: <length> <dashlength> ldiagdotdotdotdashed - +/ldiagdotdotdotdashed +{ + ldiaglinebegin + 1 [dash gap dot gap dot gap dot gap] [] [dash] + ldiaglineend +} def + +% stroke a dotdotdotcdashed line: <length> <dashlength> ldiagdotdotdotcdashed - +/ldiagdotdotdotcdashed +{ + ldiaglinebegin + 1 [dash gap dot gap dot gap dot gap] [halfdash] [halfdash] + ldiaglineend +} def + +% shape and labels of the @Box symbol +% ldiagbox <shape> +/ldiagbox +{ + 0 0 /SW ldiagpointdef + xsize 0 /SE ldiagpointdef + xsize ysize /NE ldiagpointdef + 0 ysize /NW ldiagpointdef + + xsize 0.25 mul ysize /NNW ldiagpointdef + xsize 0.75 mul ysize /NNE ldiagpointdef + xsize 0.25 mul 0 /SSW ldiagpointdef + xsize 0.75 mul 0 /SSE 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 /SSW@ANGLE ldiagangledef + 0 dg /S@ANGLE ldiagangledef + 0 dg /SSE@ANGLE ldiagangledef + 45 dg /SE@ANGLE ldiagangledef + 90 dg /E@ANGLE ldiagangledef + 135 dg /NE@ANGLE ldiagangledef + 180 dg /NNE@ANGLE ldiagangledef + 180 dg /N@ANGLE ldiagangledef + 180 dg /NNW@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> <colour> <paint> ldiagnodeend - +/ldiagnodeend +{ + % (Entering ldiagnodeend) 0 ldiagdebugprint + end % matches begin in ldiagnodebegin + 5 index gsave ldiagpaintpath grestore % <outline> <dl> <st> <lw> <cl> + 4 index ldiagsetpath clip newpath % <outline> <dl> <st> <lw> <cl> + exec % <outline> <dl> <st> <lw> + 2 mul setlinewidth % <outline> <dl> <st> + 3 -1 roll % <dashlength> <st> <outline> + 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 (unused) +% /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 +% <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, +% 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 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 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 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 + } + { + pop exch false + % (Leaving ldiagfindabel (concat not sensible)) 3 ldiagdebugprint + } ifelse + } ifelse + } ifelse +} bind def + +% execute <proc>@<string> or else default: <proc> <string> ldiagdolabel <various> +/ldiagdolabel +{ + % (Entering ldiagdolabel) 2 ldiagdebugprint + ldiagfindlabel not + { + dup (CIRCUM) eq + { pop pop pop 0 0 + } + { + dup (ANGLE) eq + { pop pop 0 + } + { pop cvx exec + } ifelse + } ifelse + } if + % (Leaving ldiagdolabel) 2 ldiagdebugprint +} bind def + +% execute a proc depending on whether number is negative, zero, or positive +% procneg proczero procpos number ldiagsigncase <anything> +/ldiagsigncase +{ + % (Entering ldiagsigncase) 4 ldiagdebugprint + dup 0 lt + { pop pop pop exec + } + { 0 gt + { exch pop exch pop exec + } + { pop exch pop exec + } ifelse + } ifelse + % (Leaving ldiagsigncase) 0 ldiagdebugprint +} bind def + +% execute proci if angle is in ith quadrant +% proc45 proc270 proc180 proc90 proc0 proc315 proc225 proc135 angle ldiagquadcase <anything> +/ldiagquadcase +{ + % (Entering ldiagquadcase) 9 ldiagdebugprint + round ldiagfixangle cvi dup 90 mod 0 eq + { 90 idiv 4 add } { 90 idiv } ifelse + 8 exch roll pop pop pop pop pop pop pop exec + % (Leaving ldiagquadcase) 0 ldiagdebugprint +} bind def + +% decode Lout length into PostScript length +% <string> ldiagdecodelength <number> +/ldiagdecodelength +{ + % (Entering ldiagdecodelength) 1 ldiagdebugprint + (f) search + { exch pop exch pop cvr ft + } + { (c) search + { exch pop exch pop cvr cm + } + { (p) search + { exch pop exch pop cvr pt + } + { (m) search + { exch pop exch pop cvr em + } + { (s) search + { exch pop exch pop cvr sp + } + { (v) search + { exch pop exch pop cvr vs + } + { (i) search + { exch pop exch pop cvr in + } + { pop 0 + } ifelse + } ifelse + } ifelse + } ifelse + } ifelse + } ifelse + } ifelse + % (Leaving ldiagdecodelength) 1 ldiagdebugprint +} def + +% implement aabout function +% logical form: <circum> <extra> <centre> aabout <point> +% actual form: { <labelorpoint> } cvlit <length> [ <point> ] cvx aabout <point> +/ldiagaabout +{ + /centre exch def + /extra exch def + /circum exch def + + /ZXCTR [ centre ] cvx def + /ZFCTR [ circum (CTR) ldiagdolabel ] cvx def + /ZAREF ZFCTR ZXCTR ldiagangleto def + /ZAMIN 0 dg def + /ZPMIN [ circum (CTR) ldiagdolabel ZAREF ZAMIN sub + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMIN sub ldiagatangle + ldiagpadd ] cvx def + + /ZAMAX 90 dg def + /ZPMAX [ circum (CTR) ldiagdolabel ZAREF ZAMAX sub + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMAX sub ldiagatangle + ldiagpadd ] cvx def + + 1 1 20 + { /xval exch def + /ZAMID ZAMIN ZAMAX add 0.5 mul def + /ZPMID [ circum (CTR) ldiagdolabel ZAREF ZAMID sub + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMID sub ldiagatangle + ldiagpadd ] cvx def + ZPMID ZXCTR ldiagdistance ZFCTR ZXCTR ldiagdistance gt + { + /ZAMAX [ ZAMID ] cvx def + /ZPMAX [ ZPMID ] cvx def + } + { + /ZAMIN [ ZAMID ] cvx def + /ZPMIN [ ZPMID ] cvx def + } ifelse + } for + ZPMID +} def + +% implement cabout function +% logical form: <circum> <extra> <centre> cabout <point> +% actual form: { <labelorpoint> } cvlit <length> [ <point> ] cvx cabout <point> +/ldiagcabout +{ + /centre exch def + /extra exch def + /circum exch def + + /ZXCTR [ centre ] cvx def + /ZFCTR [ circum (CTR) ldiagdolabel ] cvx def + /ZAREF ZFCTR ZXCTR ldiagangleto def + /ZAMIN 0 dg def + /ZPMIN [ circum (CTR) ldiagdolabel ZAREF ZAMIN add + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMIN add ldiagatangle + ldiagpadd ] cvx def + + /ZAMAX 90 dg def + /ZPMAX [ circum (CTR) ldiagdolabel ZAREF ZAMAX add + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMAX add ldiagatangle + ldiagpadd ] cvx def + + 1 1 20 + { /xval exch def + /ZAMID ZAMIN ZAMAX add 0.5 mul def + /ZPMID [ circum (CTR) ldiagdolabel ZAREF ZAMID add + circum (CIRCUM) ldiagdolabel ldiagpadd + 0 0 extra ZAREF ZAMID add ldiagatangle + ldiagpadd ] cvx def + ZPMID ZXCTR ldiagdistance ZFCTR ZXCTR ldiagdistance gt + { + /ZAMAX [ ZAMID ] cvx def + /ZPMAX [ ZPMID ] cvx def + } + { + /ZAMIN [ ZAMID ] cvx def + /ZPMIN [ ZPMID ] cvx def + } ifelse + } for + ZPMID +} def + +% fromarrowlength toarrowlength { from } { to } xindent zindent ldiaglinepath - +/ldiaglinepath +{ + % (entering ldiaglinepath) 0 ldiagdebugprint + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagangleto + /FROM@ANGLE ldiagangledef + from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd + /FROM ldiagpointdef + + FROM@ANGLE /TO@ANGLE ldiagangledef + to (CTR) ldiagdolabel TO@ANGLE 180 dg sub to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TO@ANGLE 180 dg sub ldiagatangle ldiagpadd /TO ldiagpointdef + + FROM 0.5 ldiagpmul TO 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + FROM@ANGLE /LMID@ANGLE ldiagangledef + + /XINDENT xindent FROM LMID ldiagdistance ldiagmin def + FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + + /ZINDENT zindent TO LMID ldiagdistance ldiagmin def + 0 0 ZINDENT FROM@ANGLE ldiagatangle TO ldiagpsub /LTO ldiagpointdef + FROM@ANGLE /LTO@ANGLE ldiagangledef + + direct { FROM TO } { FROM LFROM LMID LTO TO } ifelse + + % (leaving ldiaglinepath) 0 ldiagdebugprint +} def + +% fromarrowlength toarrowlength { from } { to } xindent zindent pathgap ldiagdoublelinepath - +/ldiagdoublelinepath +{ + % (entering ldiagdoublelinepath) 0 ldiagdebugprint + /pathgap exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagangleto + /FROM@ANGLE ldiagangledef + from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd + /FROM ldiagpointdef + + FROM@ANGLE /TO@ANGLE ldiagangledef + to (CTR) ldiagdolabel TO@ANGLE 180 dg sub to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TO@ANGLE 180 dg sub ldiagatangle ldiagpadd /TO ldiagpointdef + + FROM 0.5 ldiagpmul TO 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + FROM@ANGLE /LMID@ANGLE ldiagangledef + + /XINDENT xindent FROM LMID ldiagdistance ldiagmin def + FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + + /ZINDENT zindent TO LMID ldiagdistance ldiagmin def + 0 0 ZINDENT FROM@ANGLE ldiagatangle TO ldiagpsub /LTO ldiagpointdef + FROM@ANGLE /LTO@ANGLE ldiagangledef + + direct { + FROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + TO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + [] + FROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + TO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + } + { + FROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + LFROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + LMID pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + LTO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + TO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle + [] + FROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + LFROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + LMID pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + LTO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + TO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle + } ifelse + + % (leaving ldiagdoublelinepath) 0 ldiagdebugprint +} def + +% fromarrowlen toarrowlen { from } { to } xindent zindent bias ldiagacurvepath - +/ldiagacurvepath +{ + % (entering ldiagacurvepath) 0 ldiagdebugprint + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + %/B1 bias 0.02 ft ldiagmax def + %/B2 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagdistance 0.5 mul def + %/BIAS B1 B2 ldiagmin def + /BIAS bias 0.02 ft ldiagmax def + /XMID [ from (CTR) ldiagdolabel 0.5 ldiagpmul + to (CTR) ldiagdolabel 0.5 ldiagpmul ldiagpadd ] cvx def + /XTOP [ XMID 0 0 BIAS from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto 90 dg sub ldiagatangle ldiagpadd ] cvx def + /CTR [ from (CTR) ldiagdolabel XTOP ldiaglinebetween + to (CTR) ldiagdolabel XTOP ldiaglinebetween + ldiaglineintersect ] cvx def + + from fromarrowlength [ CTR ] cvx ldiagaabout /FROM ldiagpointdef + from (CTR) ldiagdolabel FROM ldiagdistance 0 gt + { from (CTR) ldiagdolabel FROM ldiagangleto + } + { CTR FROM ldiagangleto 90 dg add + } ifelse /FROM@ANGLE ldiagangledef + + to toarrowlength [ CTR ] cvx ldiagcabout /TO ldiagpointdef + TO to (CTR) ldiagdolabel ldiagdistance 0 gt + { TO to (CTR) ldiagdolabel ldiagangleto + } + { CTR TO ldiagangleto 90 dg add + } ifelse /TO@ANGLE ldiagangledef + + /RADIUS CTR FROM ldiagdistance def + CTR 0 0 RADIUS CTR FROM ldiagangleto 360 dg CTR TO ldiagangleto + add CTR FROM ldiagangleto sub cvi 360 mod 0.5 mul add + ldiagatangle ldiagpadd /LMID ldiagpointdef + CTR LMID ldiagangleto 90 dg add /LMID@ANGLE ldiagangledef + + /XINDENT xindent FROM LMID ldiagdistance ldiagmin def + CTR 0 0 RADIUS CTR FROM 0 0 XINDENT FROM@ANGLE ldiagatangle + ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LFROM ldiagpointdef + CTR LFROM ldiagangleto 90 dg add /LFROM@ANGLE ldiagangledef + + /ZINDENT zindent TO LMID ldiagdistance ldiagmin def + CTR 0 0 RADIUS CTR TO 0 0 ZINDENT TO@ANGLE 180 dg add + ldiagatangle ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LTO ldiagpointdef + CTR LTO ldiagangleto 90 dg add /LTO@ANGLE ldiagangledef + + direct + { FROM [CTR] TO } + { FROM [CTR] LFROM [CTR] LMID [CTR] LTO [CTR] TO } + ifelse + + % (leaving ldiagacurvepath) 0 ldiagdebugprint +} def + +% fromarrowlen toarrowlen { from } { to } xindent zindent bias ldiagccurvepath - +/ldiagccurvepath +{ + % (entering ldiagccurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + %/B1 bias 0.02 ft ldiagmax def + %/B2 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagdistance 0.5 mul def + %/BIAS B1 B2 ldiagmin def + /BIAS bias 0.02 ft ldiagmax def + /XMID [ from (CTR) ldiagdolabel 0.5 ldiagpmul + to (CTR) ldiagdolabel 0.5 ldiagpmul ldiagpadd ] cvx def + /XTOP [ XMID 0 0 BIAS from (CTR) ldiagdolabel to (CTR) ldiagdolabel + ldiagangleto 90 dg add ldiagatangle ldiagpadd ] cvx def + /CTR [ from (CTR) ldiagdolabel XTOP ldiaglinebetween + to (CTR) ldiagdolabel XTOP ldiaglinebetween ldiaglineintersect ] cvx def + + from fromarrowlength [ CTR ] cvx ldiagcabout /FROM ldiagpointdef + from (CTR) ldiagdolabel FROM ldiagdistance 0 gt + { from (CTR) ldiagdolabel FROM ldiagangleto } + { CTR FROM ldiagangleto 90 dg sub } + ifelse /FROM@ANGLE ldiagangledef + + to toarrowlength [ CTR ] cvx ldiagaabout /TO ldiagpointdef + TO to (CTR) ldiagdolabel ldiagdistance 0 gt + { TO to (CTR) ldiagdolabel ldiagangleto } + { CTR TO ldiagangleto 90 dg sub } + ifelse /TO@ANGLE ldiagangledef + + /RADIUS [ CTR FROM ldiagdistance ] cvx def + CTR 0 0 RADIUS CTR TO ldiagangleto 360 dg CTR FROM ldiagangleto add + CTR TO ldiagangleto sub cvi 360 cvi mod 2 div add ldiagatangle + ldiagpadd /LMID ldiagpointdef + CTR LMID ldiagangleto 90 dg sub /LMID@ANGLE ldiagangledef + + /XINDENT [ xindent FROM LMID ldiagdistance ldiagmin ] cvx def + CTR 0 0 RADIUS CTR FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd + ldiagangleto ldiagatangle ldiagpadd /LFROM ldiagpointdef + CTR LFROM ldiagangleto 90 dg sub /LFROM@ANGLE ldiagangledef + + /ZINDENT [ zindent TO LMID ldiagdistance ldiagmin ] cvx def + CTR 0 0 RADIUS CTR TO 0 0 ZINDENT TO@ANGLE 180 dg add ldiagatangle + ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LTO ldiagpointdef + CTR LTO ldiagangleto 90 dg sub /LTO@ANGLE ldiagangledef + + direct + { FROM [CTR clockwise] TO } + { FROM [CTR clockwise] LFROM [CTR clockwise] + LMID [CTR clockwise] LTO [CTR clockwise] TO } + ifelse + % (leaving ldiagccurvepath) 0 ldiagdebugprint +} def + + +% farr tarr { from } { to } xindent zindent [frompt] [topt] ldiagbezierpath - +/ldiagbezierpath +{ + % (entering ldiagbezierpath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + cvx /topt exch def + cvx /frompt exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel frompt ldiagangleto /FROM@ANGLE ldiagangledef + from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel + ldiagpadd 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd + /FROM ldiagpointdef + + topt to (CTR) ldiagdolabel ldiagangleto /TO@ANGLE ldiagangledef + to (CTR) ldiagdolabel TO@ANGLE 180 dg add to (CIRCUM) ldiagdolabel + ldiagpadd 0 0 toarrowlength TO@ANGLE 180 dg add ldiagatangle ldiagpadd + /TO ldiagpointdef + + FROM 0 0 xindent FROM@ANGLE ldiagatangle ldiagpadd + /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + + TO 0 0 zindent TO@ANGLE 180 dg add ldiagatangle ldiagpadd + /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + + FROM TO ldiagpadd frompt ldiagpadd topt ldiagpadd 0.25 ldiagpmul + /LMID ldiagpointdef + + FROM [frompt topt] TO + + % (leaving ldiagbezierpath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + + +% farr tarr { from } { to } xindent zindent ldiagvhlinepath - +/ldiagvhlinepath +{ + % (entering ldiagvhlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /CTR [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel exch pop ] cvx def + /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + + from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef + FANG /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef + TANG 180 dg add /TO@ANGLE ldiagangledef + + /FDIST [ FROM CTR ldiagdistance ] cvx def + /TDIST [ TO CTR ldiagdistance ] cvx def + /XINDENT [ xindent FDIST ldiagmin ] cvx def + /ZINDENT [ zindent TDIST ldiagmin ] cvx def + FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + + CTR /LMID ldiagpointdef + 0 0 1 ft FANG 180 dg add ldiagatangle + 0 0 1 ft TANG 180 dg add ldiagatangle + ldiagangleto /LMID@ANGLE ldiagangledef + + FROM LFROM LMID LTO TO + + % (leaving ldiagvhlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent radius ldiagvhcurvepath - +/ldiagvhcurvepath +{ + % (entering ldiagvhcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /CTR [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel exch pop ] cvx def + /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + + from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef + FANG /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef + TANG 180 dg add /TO@ANGLE ldiagangledef + + /FDIST [ FROM CTR ldiagdistance ] cvx def + /TDIST [ TO CTR ldiagdistance ] cvx def + /RADIUS [ radius FDIST TDIST ldiagmin ldiagmin ] cvx def + /XINDENT [ xindent FDIST RADIUS sub ldiagmin ] cvx def + /ZINDENT [ zindent TDIST RADIUS sub ldiagmin ] cvx def + + FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + + /FCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd ] cvx def + /TCTR [ CTR 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def + /XCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd + 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def + XCTR 0 0 RADIUS XCTR CTR ldiagangleto ldiagatangle ldiagpadd + /LMID ldiagpointdef + FCTR TCTR ldiagangleto /LMID@ANGLE ldiagangledef + + FROM LFROM FCTR + {[XCTR clockwise]} {} {} {} {} {[XCTR]} {[XCTR clockwise]} {[XCTR]} + FCTR TCTR ldiagangleto ldiagquadcase + TCTR LTO TO + + % (leaving ldiagvhcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent ldiaghvlinepath - +/ldiaghvlinepath +{ + % (entering ldiaghvlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /CTR [ to (CTR) ldiagdolabel pop from (CTR) ldiagdolabel exch pop ] cvx def + /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + + from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef + FANG /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef + TANG 180 dg add /TO@ANGLE ldiagangledef + + /FDIST [ FROM CTR ldiagdistance ] cvx def + /TDIST [ TO CTR ldiagdistance ] cvx def + /XINDENT [ xindent FDIST ldiagmin ] cvx def + /ZINDENT [ zindent TDIST ldiagmin ] cvx def + + FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + + CTR /LMID ldiagpointdef + 0 0 1 ft FANG 180 dg add ldiagatangle + 0 0 1 ft TANG 180 dg add ldiagatangle ldiagangleto + /LMID@ANGLE ldiagangledef + + FROM LFROM LMID LTO TO + + % (leaving ldiaghvlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent radius ldiaghvcurvepath - +/ldiaghvcurvepath +{ + % (entering ldiaghvcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + /CTR [ to (CTR) ldiagdolabel pop from (CTR) ldiagdolabel exch pop ] cvx def + /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def + + from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef + FANG /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef + TANG 180 dg add /TO@ANGLE ldiagangledef + + /FDIST [ FROM CTR ldiagdistance ] cvx def + /TDIST [ TO CTR ldiagdistance ] cvx def + /RADIUS [ radius FDIST TDIST ldiagmin ldiagmin ] cvx def + /XINDENT [ xindent FDIST RADIUS sub ldiagmin ] cvx def + /ZINDENT [ zindent TDIST RADIUS sub ldiagmin ] cvx def + FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef + FROM@ANGLE /LFROM@ANGLE ldiagangledef + TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef + TO@ANGLE /LTO@ANGLE ldiagangledef + + /FCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd ] cvx def + /TCTR [ CTR 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def + /XCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd + 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def + XCTR 0 0 RADIUS XCTR CTR ldiagangleto ldiagatangle ldiagpadd + /LMID ldiagpointdef + FCTR TCTR ldiagangleto /LMID@ANGLE ldiagangledef + + FROM LFROM FCTR + {[XCTR]} {} {} {} {} {[XCTR clockwise]} {[XCTR]} {[XCTR clockwise]} + FCTR TCTR ldiagangleto ldiagquadcase + TCTR LTO TO + + % (leaving ldiaghvcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias ldiaglvrlinepath - +/ldiaglvrlinepath +{ + % (entering ldiaglvrlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel 180 dg from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength 180 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 180 dg /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel 180 dg to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength 180 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 0 dg /TO@ANGLE ldiagangledef + + /XLEFT [ FROM pop TO pop ldiagmin bias sub ] cvx def + XLEFT FROM exch pop /P1 ldiagpointdef + XLEFT TO exch pop /P2 ldiagpointdef + /VERT [ P1 P2 ldiagangleto ] cvx def + P1 P1 0 0 1 ft 180 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle + ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef + P2 P2 0 0 1 ft 0 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle + ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef + + P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + VERT /LMID@ANGLE ldiagangledef + + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def + XINDENT 0 FROM ldiagpsub /LFROM ldiagpointdef + 180 dg /LFROM@ANGLE ldiagangledef + ZINDENT 0 TO ldiagpsub /LTO ldiagpointdef + 0 dg /LTO@ANGLE ldiagangledef + + FROM LFROM P1 LMID P2 LTO TO + + % (leaving ldiaglvrlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias radius ldiaglvrcurvepath - +/ldiaglvrcurvepath +{ + % (entering ldiaglvrcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel 180 dg from (CIRCUM) ldiagdolabel ldiagpadd 0 0 + fromarrowlength 180 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 180 dg /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel 180 dg to (CIRCUM) ldiagdolabel ldiagpadd 0 0 + toarrowlength 180 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 0 dg /TO@ANGLE ldiagangledef + /XLEFT [ FROM pop TO pop ldiagmin bias sub ] cvx def + /XP1 [ XLEFT FROM exch pop ] cvx def + /XP2 [ XLEFT TO exch pop ] cvx def + /VERT [ XP1 XP2 ldiagangleto ] cvx def + XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + VERT /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + XINDENT 0 FROM ldiagpsub /LFROM ldiagpointdef + 180 dg /LFROM@ANGLE ldiagangledef + ZINDENT 0 TO ldiagpsub /LTO ldiagpointdef + 0 dg /LTO@ANGLE ldiagangledef + /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def + /XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def + /XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def + XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd + /P1 ldiagpointdef + XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef + /XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def + /XP2POST [ XP2 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ XP2PRE 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def + XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd + /P2 ldiagpointdef + XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef + FROM LFROM XP1PRE + { } { [XP1CTR] P1 [XP1CTR] } { } { [XP1CTR clockwise] P1 [XP1CTR clockwise] } + { } { } { } { } VERT round ldiagquadcase + XP1POST LMID XP2PRE + { } { [XP2CTR] P2 [XP2CTR] } { } { [XP2CTR clockwise] P2 [XP2CTR clockwise] } + { } { } { } { } VERT round ldiagquadcase + XP2POST LTO TO + + % (leaving ldiaglvrcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias ldiagrvllinepath - +/ldiagrvllinepath +{ + % (entering ldiagrvllinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel 0 dg from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength 0 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 0 dg /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel 0 dg to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength 0 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 180 dg /TO@ANGLE ldiagangledef + /XRIGHT [ FROM pop TO pop ldiagmax bias add ] cvx def + XRIGHT FROM exch pop /P1 ldiagpointdef + XRIGHT TO exch pop /P2 ldiagpointdef + /VERT [ P1 P2 ldiagangleto ] cvx def + P1 P1 0 0 1 ft 0 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle + ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef + P2 P2 0 0 1 ft 180 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle + ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef + P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + VERT /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def + FROM XINDENT 0 ldiagpadd /LFROM ldiagpointdef + 0 dg /LFROM@ANGLE ldiagangledef + TO ZINDENT 0 ldiagpadd /LTO ldiagpointdef + 180 dg /LTO@ANGLE ldiagangledef + FROM LFROM P1 LMID P2 LTO TO + + % (leaving ldiagrvllinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + + +% farr tarr { from } { to } xindent zindent bias radius ldiagrvlcurvepath - +/ldiagrvlcurvepath +{ + % (entering ldiagrvlcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop + /radius exch def + /bias exch def + /zindent exch def + /xindent exch def + cvlit /to exch def + cvlit /from exch def + /toarrowlength exch def + /fromarrowlength exch def + + from (CTR) ldiagdolabel 0 dg from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength 0 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 0 dg /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel 0 dg to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength 0 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 180 dg /TO@ANGLE ldiagangledef + /XRIGHT [ FROM pop TO pop ldiagmax bias add ] cvx def + /XP1 [ XRIGHT FROM exch pop ] cvx def + /XP2 [ XRIGHT TO exch pop ] cvx def + /VERT [ XP1 XP2 ldiagangleto ] cvx def + XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + VERT /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + FROM XINDENT 0 ldiagpadd /LFROM ldiagpointdef + 0 dg /LFROM@ANGLE ldiagangledef + TO ZINDENT 0 ldiagpadd /LTO ldiagpointdef + 180 dg /LTO@ANGLE ldiagangledef + /RADIUS [ radius XP1 XP2 ldiagdistance 0.5 mul ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def + /XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def + /XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def + XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd + /P1 ldiagpointdef + XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef + /XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def + /XP2POST [ XP2 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ XP2PRE 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def + XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd + /P2 ldiagpointdef + XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef + FROM LFROM XP1PRE + {} {[XP1CTR clockwise] P1 [XP1CTR clockwise]} {} {[XP1CTR] P1 [XP1CTR]} + {} {} {} {} VERT round ldiagquadcase + XP1POST LMID XP2PRE + {} {[XP2CTR clockwise] P2 [XP2CTR clockwise]} {} {[XP2CTR] P2 [XP2CTR]} + {} {} {} {} VERT round ldiagquadcase + XP2POST LTO TO + + % (leaving ldiagrvlcurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias ldiagdhulinepath - +/ldiagdhulinepath +{ + % (entering ldiagdhulinepath) 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 270 dg from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength 270 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 270 dg /FROM@ANGLE ldiagangledef + + to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength 270 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 90 dg /TO@ANGLE ldiagangledef + + /XDOWN [ FROM exch pop TO exch pop ldiagmin bias sub ] cvx def + FROM pop XDOWN /P1 ldiagpointdef + TO pop XDOWN /P2 ldiagpointdef + /HORIZ [ P1 P2 ldiagangleto ] cvx def + P1 P1 0 0 1 ft 270 dg ldiagatangle ldiagpadd 0 0 1 ft HORIZ ldiagatangle + ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef + P2 P2 0 0 1 ft 90 dg ldiagatangle ldiagpadd 0 0 1 ft HORIZ ldiagatangle + ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef + + P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + HORIZ /LMID@ANGLE ldiagangledef + + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def + 0 XINDENT FROM ldiagpsub /LFROM ldiagpointdef + 270 dg /LFROM@ANGLE ldiagangledef + 0 ZINDENT TO ldiagpsub /LTO ldiagpointdef + 90 dg /LTO@ANGLE ldiagangledef + + FROM LFROM P1 LMID P2 LTO TO + + % (leaving ldiagdhulinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias radius ldiagdhucurvepath - +/ldiagdhucurvepath +{ + % (entering ldiagdhucurvepath) 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 270 dg from (CIRCUM) ldiagdolabel ldiagpadd 0 0 + fromarrowlength 270 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 270 dg /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd 0 0 + toarrowlength 270 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 90 dg /TO@ANGLE ldiagangledef + /XDOWN [ FROM exch pop TO exch pop ldiagmin bias sub ] cvx def + /XP1 [ FROM pop XDOWN ] cvx def + /XP2 [ TO pop XDOWN ] cvx def + /HORIZ [ XP1 XP2 ldiagangleto ] cvx def + XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + HORIZ /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + 0 XINDENT FROM ldiagpsub /LFROM ldiagpointdef + 270 dg /LFROM@ANGLE ldiagangledef + 0 ZINDENT TO ldiagpsub /LTO ldiagpointdef + 90 dg /LTO@ANGLE ldiagangledef + /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RADIUS 90 dg ldiagatangle ldiagpadd ] cvx def + /XP1POST [ XP1 0 0 RADIUS HORIZ ldiagatangle ldiagpadd ] cvx def + /XP1CTR [ XP1PRE 0 0 RADIUS HORIZ 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 HORIZ ldiagatangle XP2 ldiagpsub ] cvx def + /XP2POST [ XP2 0 0 RADIUS 90 dg ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ XP2PRE 0 0 RADIUS 90 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] } + {} {} {} HORIZ round ldiagquadcase + XP1POST LMID XP2PRE + {} {} { [XP2CTR clockwise ] P2 [XP2CTR clockwise ] } {} { [XP2CTR] P2 [XP2CTR] } + {} {} {} HORIZ round ldiagquadcase + XP2POST LTO TO + + % (leaving ldiagdhucurvepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + +% farr tarr { from } { to } xindent zindent bias ldiaguhdlinepath - +/ldiaguhdlinepath +{ + % (entering ldiaguhdlinepath) 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 90 dg from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength 90 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 90 dg /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength 90 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 270 dg /TO@ANGLE ldiagangledef + /XUP [ FROM exch pop TO exch pop ldiagmax bias add ] cvx def + FROM pop XUP /P1 ldiagpointdef + TO pop XUP /P2 ldiagpointdef + /HORIZ [ P1 P2 ldiagangleto ] cvx def + P1 P1 0 0 1 ft 90 dg ldiagatangle ldiagpadd 0 0 1 ft HORIZ ldiagatangle + ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef + P2 P2 0 0 1 ft 270 dg ldiagatangle ldiagpadd 0 0 1 ft HORIZ ldiagatangle + ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef + P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + HORIZ /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def + FROM 0 XINDENT ldiagpadd /LFROM ldiagpointdef + 90 dg /LFROM@ANGLE ldiagangledef + TO 0 ZINDENT ldiagpadd /LTO ldiagpointdef + 270 dg /LTO@ANGLE ldiagangledef + FROM LFROM P1 LMID P2 LTO TO + + % (leaving ldiaguhdlinepath) 0 ldiagdebugprint + % count ( stack size is) 1 ldiagdebugprint pop +} def + + +% farr tarr { from } { to } xindent zindent bias radius ldiaguhdcurvepath - +/ldiaguhdcurvepath +{ + % (entering ldiaguhdcurvepath) 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 90 dg from (CIRCUM) ldiagdolabel ldiagpadd + 0 0 fromarrowlength 90 dg ldiagatangle ldiagpadd /FROM ldiagpointdef + 90 dg /FROM@ANGLE ldiagangledef + to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd + 0 0 toarrowlength 90 dg ldiagatangle ldiagpadd /TO ldiagpointdef + 270 dg /TO@ANGLE ldiagangledef + /XUP [ FROM exch pop TO exch pop ldiagmax bias add ] cvx def + /XP1 [ FROM pop XUP ] cvx def + /XP2 [ TO pop XUP ] cvx def + /HORIZ [ XP1 XP2 ldiagangleto ] cvx def + XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef + HORIZ /LMID@ANGLE ldiagangledef + /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def + /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def + FROM 0 XINDENT ldiagpadd /LFROM ldiagpointdef + 90 dg /LFROM@ANGLE ldiagangledef + TO 0 ZINDENT ldiagpadd /LTO ldiagpointdef + 270 dg /LTO@ANGLE ldiagangledef + /RADIUS [ radius XP1 XP2 ldiagdistance 0.5 mul ldiagmin ] cvx def + /XP1PRE [ XP1 0 0 RADIUS 270 dg ldiagatangle ldiagpadd ] cvx def + /XP1POST [ XP1 0 0 RADIUS HORIZ ldiagatangle ldiagpadd ] cvx def + /XP1CTR [ XP1PRE 0 0 RADIUS HORIZ 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 HORIZ ldiagatangle XP2 ldiagpsub ] cvx def + /XP2POST [ XP2 0 0 RADIUS 270 dg ldiagatangle ldiagpadd ] cvx def + /XP2CTR [ XP2PRE 0 0 RADIUS 270 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]} + {} {} {} HORIZ round ldiagquadcase + XP1POST LMID XP2PRE + {} {} {[XP2CTR] P2 [XP2CTR]} {} {[XP2CTR clockwise] P2 [XP2CTR clockwise]} + {} {} {} HORIZ round ldiagquadcase + XP2POST LTO TO + + % (leaving ldiaguhdcurvepath) 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 @SolidWithBarArrowHead symbol +% <pathwidth> ldiagsolidwithbararrowhead - +/ldiagsolidwithbararrowhead +{ + /pathwidth exch def + /XBK [ xsize pathwidth 0.5 mul sub ] cvx def + /XFW [ xsize pathwidth 0.5 mul add ] cvx def + 0 0 XBK ysize 0.5 mul XBK 0 XFW 0 XFW ysize + XBK ysize XBK ysize 0.5 mul 0 ysize 0 0 +} def + +% shape and labels of the @OpenArrowHead symbol +% <pathwidth> <pathgap> ldiagopenarrowhead - +/ldiagopenarrowhead +{ + /pathgap exch def + /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 + pathgap 0 eq + { + /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 + } + { + /PNA [ 0 ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul add ] cvx def + /PSA [ 0 ysize 0.5 mul pathgap 0.5 mul sub 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 pathgap add PNI ldiagpsub ] cvx def + /PXA [ 0 pathwidth PNA ldiagpsub ] cvx def + /PXI [ 0 pathwidth PNI ldiagpsub ] cvx def + /PYA [ 0 pathwidth PSA ldiagpadd ] cvx def + /PYI [ 0 pathwidth PSI ldiagpadd ] cvx def + + PSW PE PNW PNI PNA PXA PXI PYI PYA PSA PSI PSW + } ifelse +} def + +% shape and labels of the @HalfOpenArrowHead symbol +% <pathwidth> <pathgap> ldiaghalfopenarrowhead - +/ldiaghalfopenarrowhead +{ + /pathgap exch def + /pathwidth exch def + 0 0 + xsize ysize 0.5 mul + 0 ysize + pathgap 0 eq + { + 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 + } + { + xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul add + 0 ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul add + 0 ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul sub + xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul sub + xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul add + 0 ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul add + 0 ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul sub + xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul sub + } ifelse + 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> <pathgap> ldiagopencurvedarrowhead - +/ldiagopencurvedarrowhead +{ + /pathgap exch def + /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 + 0 0 + [LR clockwise] + xsize ysize 0.5 mul + [UR clockwise] + 0 ysize + pathgap 0 eq + { + /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 + UMID + 0 ysize 0.5 mul PW2 add + 0 ysize 0.5 mul PW2 sub + LMID + } + { + /UMIDU [ + 0 ysize 0.5 mul PW2 add pathgap 0.5 mul add + xsize ysize 0.5 mul PW2 add pathgap 0.5 mul add + 0 ysize 0 0 1 ft UR 0 ysize ldiagangleto 90 add ldiagatangle + ldiagpadd 0 ysize ldiaglineintersect + ] cvx def + /UMIDL [ 0 pathwidth UMIDU ldiagpsub ] cvx def + /LMIDL [ 0 pathgap 0 pathwidth UMIDU ldiagpsub ldiagpsub ] cvx def + /LMIDU [ 0 pathwidth LMIDL ldiagpadd ] cvx def + UMIDU + 0 UMIDU exch pop + 0 UMIDL exch pop + UMIDL + LMIDU + 0 LMIDU exch pop + 0 LMIDL exch pop + LMIDL + } ifelse + 0 0 +} def + +% shape and labels of the @HalfOpenCurvedArrowHead symbol +% <pathwidth> <pathgap> ldiaghalfopencurvedarrowhead - +/ldiaghalfopencurvedarrowhead +{ + /pathgap exch def + /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 + 0 0 + [LR clockwise] + xsize ysize 0.5 mul + [UR clockwise] + 0 ysize + [BR clockwise] + pathgap 0 eq + { + /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 + UMID + 0 ysize 0.5 mul PW2 add + 0 ysize 0.5 mul PW2 sub + LMID + } + { + /XDIST [ BRAD dup mul PW2 dup mul sub sqrt ] cvx def + /UMIDU [ BR XDIST PW2 pathgap 0.5 mul add ldiagpadd ] cvx def + /UMIDL [ 0 pathwidth UMIDU ldiagpsub ] cvx def + /LMIDL [ BR XDIST 0 PW2 sub pathgap 0.5 mul sub ldiagpadd ] cvx def + /LMIDU [ 0 pathwidth LMIDL ldiagpadd ] cvx def + UMIDU + 0 UMIDU exch pop + 0 UMIDL exch pop + UMIDL + LMIDU + 0 LMIDU exch pop + 0 LMIDL exch pop + LMIDL + } ifelse + [BR clockwise] + 0 0 +} def + +% shape and labels of the @ManyArrowHead symbol +% <pathwidth> ldiagmanyarrowhead - +/ldiagmanyarrowhead +{ + /pathwidth exch def + /LL [ 0 ysize 2 div pathwidth 2 div sub ] cvx def + /LU [ 0 ysize 2 div pathwidth 2 div add ] cvx def + LL + xsize 0 + xsize pathwidth + LU + LL + [] + LL + xsize LL exch pop + xsize LU exch pop + LU + LL + [] + LL + xsize ysize pathwidth sub + xsize ysize + LU + LL +} def + +end +%%EndResource diff --git a/include/include/doc b/include/include/doc new file mode 100644 index 0000000..fca8d6a --- /dev/null +++ b/include/include/doc @@ -0,0 +1,466 @@ +############################################################################### +# # +# Lout setup file for ordinary documents # +# # +# Jeffrey H. Kingston # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude commands for standard packages. # +# # +############################################################################### + + @SysInclude { langdefs } # language definitions + @SysInclude { bsf } # BasicSetup package + @SysInclude { dsf } # DocumentSetup package + @SysInclude { docf } # OrdinarySetup extension + + +############################################################################### +# # +# @Include command for reading personal definitions from current directory. # +# # +############################################################################### + + @Include { mydefs } + + +############################################################################### +# # +# The @BasicSetup @Use clause - basics, lists, paragraphs, displays. # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@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 + # @InitialBackgroundColour { white } # initial background 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 + # @DisplayIndent { 2.00f @OrIfPlain 5s } # @IndentedDisplay indent + # @DefaultIndent { 0.5rt } # @Display indent + # @DisplayNumStyle { (num) } # style of display numbers + # @WideIndent { 4.00f @OrIfPlain 10s } # @WideTaggedList indent + # @VeryWideIndent { 8.00f @OrIfPlain 20s } # @VeryWideTaggedList indent + # @ListOuterGap { 1.00v @OrIfPlain 1f } # gap before, after lists + # @ListGap { 1.00v @OrIfPlain 1f } # gap between list items + # @ListIndent { 0s } # indent of list items + # @ListRightIndent { 0s } # right indent of list items + # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags + # @ListLabelRight { No } # right-adjust list labels + # @ListLabelRightGap { 2s } # gap when right-adjusting + # @ListFont { } # font of list items + # @ListBreak { } # break style of list items + # @NumberSeparator { . } # separates nums like 2.3.7 + # @CrossLinkFormat { @Body } # format of cross links + # @ExternalLinkFormat { @Body } # format of external links +} + + +############################################################################### +# # +# The @DocumentSetup @Use clause - page layout plus figures, tables, etc. # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@Use { @DocumentSetup + # @PageType { A4 @OrIfPlain Other} # page type (width, height) + # @PageWidth { 80s } # page width if type Other + # @PageHeight { 66f } # page height if type Other + # @PageOrientation { Portrait } # Portrait, Landscape, etc. + # @PageBackground { } # background of each page + # @TopMargin { 2.5c @OrIfPlain 6f } # top margin of all pages + # @FootMargin { 2.5c @OrIfPlain 6f } # bottom margin of all pages + # @OddLeftMargin { 2.5c @OrIfPlain 10s } # left margin of odd pages + # @OddRightMargin { 2.5c @OrIfPlain 10s } # right margin of odd pages + # @EvenLeftMargin { 2.5c @OrIfPlain 10s } # left margin of even pages + # @EvenRightMargin { 2.5c @OrIfPlain 10s } # right margin of even pages + # @OddLeftBodyMargin { 0c } # extra margin for page body + # @OddRightBodyMargin { 0c } # extra margin for page body + # @EvenLeftBodyMargin { 0c } # extra margin for page body + # @EvenRightBodyMargin{ 0c } # extra margin for page body + # @PageBoxType { None } # None Box CurveBox ShadowBox + # @PageBoxMargin { 1.00c } # page box margin + # @PageBoxLineWidth { } # page box line thickness + # @PageBoxPaint { none } # page box paint + # @PageBoxShadow { 0.60c } # shadow margin if ShadowBox + # @PageEnclose { @Body } # enclose every page in this + # @ColumnNumber { 1 } # number of columns (1 to 10) + # @ColumnGap { 1.00c @OrIfPlain 6s } # column gap + + # @FigureLocation { PageTop } # default figure location + # @FigureFormat { @CC @Body } # default figure format + # @FigureWord { figure } # "Figure" word else anything + # @FigureNumbers { Arabic } # method of numbering figures + # @FigureCaptionPos { Below } # Above or Below + # @FigureCaptionFont { -2p } # figure caption font + # @FigureCaptionBreak { adjust hyphen 1.2fx } # figure caption break + # @FigureCaptionFormat{ {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeFigureContents { No } # list of figures at start + + # @TableLocation { PageTop } # default table location + # @TableFormat { @CC @Body } # default table format + # @TableWord { table } # "Table" word else anything + # @TableNumbers { Arabic } # method of numbering tables + # @TableCaptionPos { Below } # Above or Below + # @TableCaptionFont { -2p } # table caption font + # @TableCaptionBreak { adjust hyphen 1.2fx } # table caption break + # @TableCaptionFormat { {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeTableContents { No } # list of tables at start + + # @FloaterLocation { PageTop } # default floater location + # @FloaterFormat { @CC @Body } # default floater format + # @FloaterWord { floater } # "Floater" word else anything + # @FloaterNumbers { Arabic } # method of numbering floaters + # @FloaterCaptionPos { Below } # Above or Below + # @FloaterCaptionFont { -2p } # Floater caption font + # @FloaterCaptionBreak{ adjust hyphen 1.2fx } # floater caption break + # @FloaterCaptionFormat{ {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeFloaterContents{ No } # list of floater at start + + # @MakeContents { No } # make contents? Yes or No + # @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry + # @ContentsGapAbove { 0.80v @OrIfPlain 1f } # extra gap above major entry + # @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry + # @ContentsFont { Bold } # font for major entry + # @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above `part' entry + # @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below `part' entry + # @ContentsFormat { number @DotSep title } # contents entry format + # @ContentsLeader { .. } # leader symbol in contents + # @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders + # @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width + + # @MakeReferences { Yes } # make references? Yes or No + # @RefCiteStyle { [cite] } # citation style + # @RefCiteLabels { @RefNum } # citation items + # @RefNumbers { Arabic } # reference numbers + # @RefListFormat { Labels } # NoLabels, Labels, etc. + # @RefListLabels { [@RefNum] } # ref list label format + # @RefListTitle { references } # title of reference list + # @ChapRefListTitle { references } # title of chapter ref list + # @RefListIndent { 0s } # indent to left of labels + # @RefListRightIndent { 0s } # indent to right of items + # @RefListGap { @ListGap } # gap between ref list items + # @RefListFont { } # font used in reference list + # @RefListBreak { } # break style of ref list + # @RefListLabelWidth { @ListLabelWidth } # Labels column width + # @RefListSortKey { @Tag } # sorting key + + # @MakeGlossary { No } # make glossary? Yes or No + # @GlossaryText { @Null } # glossary initial text + # @GlossaryFont { } # glossary entries font + # @GlossaryBreak { } # glossary entries break + # @GlossaryFormat { +3p @Font @S @Name # glossary entries format + # @Right @I { @Word&&page @PageNum } + # @DP @RawIndentedDisplay @Body } + # @GlossaryGap { @DisplayGap } # gap between glossary entries + # @GlossaryColumnNumber{ 2 } # glossary columns (1 to 10) + # @GlossaryColumnGap { 1.00c @OrIfPlain 6s } # glossary column gap + # @InGlossaryFont { smallcaps } # font for @InGlossary + # @InGlossaryFormat { @Body } # format for @InGlossary + + # @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 + # @IndexFormat { @Body } # @Index format + # @SubIndexFormat { {1f @Wide}@Body } # @SubIndex format + # @SubSubIndexFormat { {2f @Wide}@Body } # @SubSubIndex format + # @IndexTypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexTypeMain { @B @PageNum } # Main pagenum format + # @IndexTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexRangeFormat { @From--@To } # index page range format + # @IndexColumnNumber { 2 } # index columns (1 to 10) + # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap + # @IndexCtd { Yes } # include (ctd.) lines + # @IndexCtdWord { continued } # "ctd." in current lang. + # @IndexCtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexSpacerAbove { 2v } # space above index spacer + # @IndexSpacerBelow { 1v } # space below index spacer + # @IndexSpacerFont { +3p } # font of index spacer + # @IndexSpacerFormat { @Body } # format of index spacer + + # @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 + # @IndexAFormat { @Body } # @IndexA format + # @SubIndexAFormat { {1f @Wide}@Body } # @SubIndexA format + # @SubSubIndexAFormat { {2f @Wide}@Body } # @SubSubIndexA format + # @IndexATypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexATypeMain { @B @PageNum } # Main pagenum format + # @IndexATypeSpecial { @I @PageNum } # Special pagenum format + # @IndexARangeFormat { @From--@To } # index page range format + # @IndexAColumnNumber { 2 } # index A columns (1 to 10) + # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap + # @IndexACtd { Yes } # include (ctd.) lines + # @IndexACtdWord { continued } # "ctd." in current lang. + # @IndexACtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexASpacerAbove { 2v } # space above index A spacer + # @IndexASpacerBelow { 1v } # space below index A spacer + # @IndexASpacerFont { +3p } # font of index A spacer + # @IndexASpacerFormat { @Body } # format of index A spacer + + # @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 + # @IndexBFormat { @Body } # @IndexB format + # @SubIndexBFormat { {1f @Wide}@Body } # @SubIndexB format + # @SubSubIndexBFormat { {2f @Wide}@Body } # @SubSubIndexB format + # @IndexBTypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexBTypeMain { @B @PageNum } # Main pagenum format + # @IndexBTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexBRangeFormat { @From--@To } # index page range format + # @IndexBColumnNumber { 2 } # index B columns (1 to 10) + # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap + # @IndexBCtd { Yes } # include (ctd.) lines + # @IndexBCtdWord { continued } # "ctd." in current lang. + # @IndexBCtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexBSpacerAbove { 2v } # space above index B spacer + # @IndexBSpacerBelow { 1v } # space below index B spacer + # @IndexBSpacerFont { +3p } # font of index B spacer + # @IndexBSpacerFormat { @Body } # format of index B spacer + + # @TopGap { 0.75c @OrIfPlain 2f } # gap between figures + # @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text + + # @FootNoteNumbers { Arabic } # footnote numbers + # @FootNoteThrough { No } # numbered through chapter? + # @FootNoteLocation { ColFoot } # where the footnote appears + # @FootNoteFont { 0.80f } # font for footnotes + # @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes + # @FootNoteFormat { { number &0.05f } @Insert body } # footnote format + # @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line + # @FootAboveGap { @DisplayGap } # gap above footnote line + # @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes + # @MarginNoteFont { 0.80f } # font of margin notes + # @MarginNoteBreak { ragged 1.10fx } # break style of margin notes + # @MarginNoteHGap { 0.5c } # horizontal gap to notes + # @MarginNoteVGap { @DisplayGap } # min vertical gap between + # @MarginNoteWidth { 1.50c } # width of margin notes + # @EndNoteNumbers { Arabic } # endnote numbers + # @EndNoteFont { 0.80f } # font of endnotes + # @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes + # @EndNoteFormat { { number &0.05f } @Insert body } # endnote format + # @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes + + # @TheoremWord { theorem } # "Theorem" word, etc. + # @TheoremTitleFormat { (title) } # only if title present + # @TheoremFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @DefinitionWord { definition } # "Definition" word, etc. + # @DefinitionTitleFormat { (title) } # only if title present + # @DefinitionFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ClaimWord { claim } # "Claim" word, etc. + # @ClaimTitleFormat { (title) } # only if title present + # @ClaimFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @PropositionWord { proposition } # "Proposition" word, etc. + # @PropositionTitleFormat { (title) } # only if title present + # @PropositionFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @LemmaWord { lemma } # "Lemma" word, etc. + # @LemmaTitleFormat { (title) } # only if title present + # @LemmaFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @CorollaryWord { corollary } # "Corollary" word, etc. + # @CorollaryTitleFormat { (title) } # only if title present + # @CorollaryFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ExampleWord { example } # "Example" word, etc. + # @ExampleTitleFormat { (title) } # only if title present + # @ExampleFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ProofWord { proof } # "Proof" word, etc. + + # @PageHeaders { Simple } # None Simple Titles NoTitles + # @PageNumbers { Arabic } # page numbers + # @FirstPageNumber { 1 } # number of first page + # @IntroPageNumbers { Roman } # intro page numbers + # @IntroFirstPageNumber{ 1 } # number of first intro page + # @StructPageNums { No } # make structured page numbers + # @PageNumberFormat { number } # format of all page numbers + + # @OddTop { @Centre{- @PageNum -} } # Simple page headers + # @OddFoot { @Null } + # @EvenTop { @Centre{- @PageNum -} } + # @EvenFoot { @Null } + # @StartOddTop { @Null } + # @StartOddFoot { @Null } + # @StartEvenTop { @Null } + # @StartEvenFoot { @Null } + # @IntroOddTop { @Null } + # @IntroOddFoot { @Centre @PageNum } + # @IntroEvenTop { @Null } + # @IntroEvenFoot { @Centre @PageNum } + # @IntroStartOddTop { @Null } + # @IntroStartOddFoot { @Null } + # @IntroStartEvenTop { @Null } + # @IntroStartEvenFoot { @Null } + + # Titles, NoTitles headers + # @RunningOddTop { @I {@MinorNum @DotSep @MinorTitle} @Right @B @PageNum } + # @RunningOddFoot { @Null } + # @RunningEvenTop { @B @PageNum @Right @I {@MajorNum @DotSep @MajorTitle} } + # @RunningEvenFoot { @Null } + # @RunningStartOddTop { @Null } + # @RunningStartOddFoot { @Centre { Bold 0.8f } @Font @PageNum } + # @RunningStartEvenTop { @Null } + # @RunningStartEvenFoot { @Centre { Bold 0.8f } @Font @PageNum } + # @RunningIntroOddTop { @Null } + # @RunningIntroOddFoot { @Right @PageNum } + # @RunningIntroEvenTop { @Null } + # @RunningIntroEvenFoot { @PageNum } + # @RunningIntroStartOddTop { @Null } + # @RunningIntroStartOddFoot { @Null } + # @RunningIntroStartEvenTop { @Null } + # @RunningIntroStartEvenFoot { @Null } +} + + +############################################################################### +# # +# The @OrdinarySetup @Use clause - options specific to ordinary documents. # +# # +############################################################################### + +@Use { @OrdinarySetup + # @IndexWord { index } # word for "Index" word etc. + # @IndexAWord { index } # word for "Index" (A) + # @IndexBWord { index } # word for "Index" (B) + # @AppendixWord { appendix } # word for "Appendix" + # @SectionNumbers { Arabic } # kind of section numbers + # @FirstSectionNumber { 1 } # first section num (Arabic) + # @SubSectionNumbers { Arabic } # kind of subsection numbers + # @FirstSubSectionNumber { 1 } # first subsect num (Arabic) + # @SubSubSectionNumbers { Arabic } # kind of sub-subsect numbers + # @FirstSubSubSectionNumber { 1 } # first subsub. num (Arabic) + # @AppendixNumbers { UCAlpha } # kind of appendix numbers + # @FirstAppendixNumber { 1 } # first appendix num (Arabic) + # @SubAppendixNumbers { Arabic } # kind of subappendix numbers + # @FirstSubAppendixNumber { 1 } # first sub-app. num (Arabic) + # @SubSubAppendixNumbers { Arabic } # kind of sub-subapp. numbers + # @FirstSubSubAppendixNumber { 1 } # first sub-sub. num (Arabic) + # @SectionHeadingFont { Bold } # section head font + # @SectionHeadingBreak { ragged 1.2fx nohyphen } # section head break + # @SectionHeadingFormat { number @DotSep title } # section head fmt + # @SubSectionHeadingFont { Bold } # subsect head font + # @SubSectionHeadingBreak { ragged 1.2fx nohyphen } # subsect head break + # @SubSectionHeadingFormat { number @DotSep title } # subsect head fmt + # @SubSubSectionHeadingFont { Slope } # sub-ss. head font + # @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen } # sub-ss. head break + # @SubSubSectionHeadingFormat { number @DotSep title } # sub-ss. head fmt + # @AppendixHeadingFont { Bold } # appendix head font + # @AppendixHeadingBreak { ragged 1.2fx nohyphen } # appendix head break + # @AppendixHeadingFormat { number @DotSep title } # appendix head fmt + # @SubAppendixHeadingFont { Bold } # subapp. head font + # @SubAppendixHeadingBreak { ragged 1.2fx nohyphen } # subapp. head break + # @SubAppendixHeadingFormat { number @DotSep title } # subapp. head format + # @SubSubAppendixHeadingFont { Slope } # sub-sa. head font + # @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen } # sub-sa. head break + # @SubSubAppendixHeadingFormat{ number @DotSep title } # sub-sa. head fmt + # @ReferencesHeadingFont { Bold } # refs head font + # @ReferencesHeadingBreak { ragged 1.2fx nohyphen } # refs head break + # @ReferencesHeadingFormat { title } # refs head format + # @IndexHeadingFont { Bold } # index head font + # @IndexHeadingBreak { ragged 1.2fx nohyphen } # index head break + # @IndexHeadingFormat { title } # index head format + # @IndexAHeadingFont { Bold } # index A head font + # @IndexAHeadingBreak { ragged 1.2fx nohyphen } # index A head break + # @IndexAHeadingFormat { title } # index A head fmt + # @IndexBHeadingFont { Bold } # index B head font + # @IndexBHeadingBreak { ragged 1.2fx nohyphen } # index B head break + # @IndexBHeadingFormat { title } # index B head fmt + # @SectionGap { 2.0v @OrIfPlain 3f } # between sections + # @SubSectionGap { 1.5v @OrIfPlain 2f } # between subsects + # @SubSubSectionGap { 1.5v @OrIfPlain 2f } # between sub-subs. + # @AppendixGap { 2.0v @OrIfPlain 3f } # between appendices + # @SubAppendixGap { 1.5v @OrIfPlain 2f } # between subappendices + # @SubSubAppendixGap { 1.5v @OrIfPlain 2f } # between sub-subapps + # @SectionInContents { Yes } # add sections to contents + # @SubSectionInContents { Yes } # add subsections to contents + # @SubSubSectionInContents { No } # add sub-subsects to contents + # @AppendixInContents { Yes } # add appendices to contents + # @SubAppendixInContents { Yes } # add subappendices to contents + # @SubSubAppendixInContents { No } # add sub-subapps to contents + # @ReferencesInContents { Yes } # add ref. section to contents + # @IndexInContents { Yes } # add index to contents + # @IndexAInContents { Yes } # add index A to contents + # @IndexBInContents { Yes } # add index B to contents + # @SectionContentsIndent { 0f } # contents indent of sections + # @SubSectionContentsIndent { 3f } # contents indent of subsections + # @SubSubSectionContentsIndent{ 6f } # contents indent of sub-subsections + # @AppendixContentsIndent { 0f } # contents indent of appendices + # @SubAppendixContentsIndent { 3f } # contents indent of sub-appendices + # @SubSubAppendixContentsIndent { 6f } # contents indent of sub-subappendices + # @ReferencesContentsIndent { 0f } # contents indent of references + # @IndexContentsIndent { 0f } # contents indent of index + # @IndexAContentsIndent { 0f } # contents indent of index A + # @IndexBContentsIndent { 0f } # contents indent of index B + # @SectionNumInTheorems { No } # theorem num has section num + # @SubSectionNumInTheorems { No } # theorem num has subsect num + # @SubSubSectionNumInTheorems { No } # theorem num has sub-ss. num + # @AppendixNumInTheorems { No } # theorem num has appendix num + # @SubAppendixNumInTheorems { No } # theorem num has sub-app num + # @SubSubAppendixNumInTheorems{ No } # theorem num has sub-sa. num + # @SectionNumInDisplays { Yes } # display num has section num + # @SubSectionNumInDisplays { No } # display num has subsect num + # @SubSubSectionNumInDisplays { No } # display num has sub-ss. num + # @AppendixNumInDisplays { Yes } # display num has appendix num + # @SubAppendixNumInDisplays { Yes } # display num has sub-app num + # @SubSubAppendixNumInDisplays{ No } # display num has sub-sa. num + # @SectionNumInFigures { No } # figure num has section num + # @SubSectionNumInFigures { No } # figure num has subsect num + # @SubSubSectionNumInFigures { No } # figure num has sub-ss. num + # @AppendixNumInFigures { No } # figure num has appendix num + # @SubAppendixNumInFigures { No } # figure num has sub-app num + # @SubSubAppendixNumInFigures { No } # figure num has sub-sa. num + # @SectionNumInTables { No } # table num has section num + # @SubSectionNumInTables { No } # table num has subsect num + # @SubSubSectionNumInTables { No } # table num has sub-ss. num + # @AppendixNumInTables { No } # table num has appendix num + # @SubAppendixNumInTables { No } # table num has sub-app num + # @SubSubAppendixNumInTables { No } # table num has sub-sa. num + # @SectionNumInFloaters { No } # floater num has section num + # @SubSectionNumInFloaters { No } # floater num has subsect num + # @SubSubSectionNumInFloaters { No } # floater num has sub-ss. num + # @AppendixNumInFloaters { No } # floater num has appendix num + # @SubAppendixNumInFloaters { No } # floater num has sub-app num + # @SubSubAppendixNumInFloaters{ No } # floater num has sub-sa. num + # @SectionNumInRunners { Yes } # runners have section num + # @SubSectionNumInRunners { No } # runners have subsect num + # @SubSubSectionNumInRunners { No } # runners have sub-ss. num + # @AppendixNumInRunners { Yes } # runners have appendix num + # @SubAppendixNumInRunners { No } # runners have sub-app num + # @SubSubAppendixNumInRunners { No } # runners have sub-sa. num + # @SectionPrefix { } # for structured page nums + # @AppendixPrefix { } # for structured page nums + # @ReferencesPrefix { } # for structured page nums + # @IndexPrefix { } # for structured page nums + # @IndexAPrefix { } # for structured page nums + # @IndexBPrefix { } # for structured page nums +} + + +############################################################################### +# # +# @Database (and @SysDatabase) clauses go here. # +# # +############################################################################### + +@SysDatabase @FontDef { fontdefs } # font definitions +@SysDatabase @RefStyle { refstyle } # reference printing styles diff --git a/include/include/docf b/include/include/docf new file mode 100644 index 0000000..a1e64a8 --- /dev/null +++ b/include/include/docf @@ -0,0 +1,845 @@ + +########################################################################### +# # +# @OrdinarySetup extension to @DocumentSetup. # +# # +# Jeffrey H. Kingston # +# # +# This package extends DocumentSetup for ordinary documents. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +########################################################################### + +extend @BasicSetup @DocumentSetup +export @Doc @Document @Text +def @OrdinarySetup + + named @IndexWord { index } + named @IndexAWord { index } + named @IndexBWord { index } + named @AppendixWord { appendix } + + named @SectionNumbers { Arabic } + named @FirstSectionNumber { 1 } + named @SubSectionNumbers { Arabic } + named @FirstSubSectionNumber { 1 } + named @SubSubSectionNumbers { Arabic } + named @FirstSubSubSectionNumber { 1 } + named @AppendixNumbers { UCAlpha } + named @FirstAppendixNumber { 1 } + named @SubAppendixNumbers { Arabic } + named @FirstSubAppendixNumber { 1 } + named @SubSubAppendixNumbers { Arabic } + named @FirstSubSubAppendixNumber { 1 } + + named @SectionHeadingFont { Bold } + named @SectionHeadingBreak { ragged 1.2fx nohyphen } + named @SectionHeadingFormat + left number right title { number @Sep title } + + named @SubSectionHeadingFont { Bold } + named @SubSectionHeadingBreak { ragged 1.2fx nohyphen } + named @SubSectionHeadingFormat + left number right title { number @Sep title } + + named @SubSubSectionHeadingFont { Slope } + named @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen } + named @SubSubSectionHeadingFormat + left number right title { number @Sep title } + + named @AppendixHeadingFont { Bold } + named @AppendixHeadingBreak { ragged 1.2fx nohyphen } + named @AppendixHeadingFormat + left number right title { number @Sep title } + + named @SubAppendixHeadingFont { Bold } + named @SubAppendixHeadingBreak { ragged 1.2fx nohyphen } + named @SubAppendixHeadingFormat + left number right title { number @Sep title } + + named @SubSubAppendixHeadingFont { Slope } + named @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen } + named @SubSubAppendixHeadingFormat + left number right title { number @Sep title } + + named @ReferencesHeadingFont { Bold } + named @ReferencesHeadingBreak { ragged 1.2fx nohyphen } + named @ReferencesHeadingFormat + right title { title } + + named @IndexHeadingFont { Bold } + named @IndexHeadingBreak { ragged 1.2fx nohyphen } + named @IndexHeadingFormat + right title { title } + + named @IndexAHeadingFont { Bold } + named @IndexAHeadingBreak { ragged 1.2fx nohyphen } + named @IndexAHeadingFormat + right title { title } + + named @IndexBHeadingFont { Bold } + named @IndexBHeadingBreak { ragged 1.2fx nohyphen } + named @IndexBHeadingFormat + right title { title } + + named @SectionGap { 2.0v @OrIfPlain 3f } + named @SubSectionGap { 1.5v @OrIfPlain 2f } + named @SubSubSectionGap { 1.5v @OrIfPlain 2f } + named @AppendixGap { 2.0v @OrIfPlain 3f } + named @SubAppendixGap { 1.5v @OrIfPlain 2f } + named @SubSubAppendixGap { 1.5v @OrIfPlain 2f } + + named @SectionInContents { Yes } + named @SubSectionInContents { Yes } + named @SubSubSectionInContents { No } + named @AppendixInContents { Yes } + named @SubAppendixInContents { Yes } + named @SubSubAppendixInContents { No } + named @ReferencesInContents { Yes } + named @IndexInContents { Yes } + named @IndexAInContents { Yes } + named @IndexBInContents { Yes } + + named @SectionContentsIndent { 0f } + named @SubSectionContentsIndent { 3f } + named @SubSubSectionContentsIndent { 6f } + named @AppendixContentsIndent { 0f } + named @SubAppendixContentsIndent { 3f } + named @SubSubAppendixContentsIndent { 6f } + named @ReferencesContentsIndent { 0f } + named @IndexContentsIndent { 0f } + named @IndexAContentsIndent { 0f } + named @IndexBContentsIndent { 0f } + + named @SectionNumInTheorems { No } + named @SubSectionNumInTheorems { No } + named @SubSubSectionNumInTheorems { No } + named @AppendixNumInTheorems { No } + named @SubAppendixNumInTheorems { No } + named @SubSubAppendixNumInTheorems { No } + + named @SectionNumInDisplays { Yes } + named @SubSectionNumInDisplays { No } + named @SubSubSectionNumInDisplays { No } + named @AppendixNumInDisplays { Yes } + named @SubAppendixNumInDisplays { No } + named @SubSubAppendixNumInDisplays { No } + + named @SectionNumInFigures { No } + named @SubSectionNumInFigures { No } + named @SubSubSectionNumInFigures { No } + named @AppendixNumInFigures { No } + named @SubAppendixNumInFigures { No } + named @SubSubAppendixNumInFigures { No } + + named @SectionNumInTables { No } + named @SubSectionNumInTables { No } + named @SubSubSectionNumInTables { No } + named @AppendixNumInTables { No } + named @SubAppendixNumInTables { No } + named @SubSubAppendixNumInTables { No } + + named @SectionNumInFloaters { No } + named @SubSectionNumInFloaters { No } + named @SubSubSectionNumInFloaters { No } + named @AppendixNumInFloaters { No } + named @SubAppendixNumInFloaters { No } + named @SubSubAppendixNumInFloaters { No } + + named @SectionNumInRunners { Yes } + named @SubSectionNumInRunners { No } + named @SubSubSectionNumInRunners { No } + named @AppendixNumInRunners { Yes } + named @SubAppendixNumInRunners { No } + named @SubSubAppendixNumInRunners { No } + + named @SectionPrefix { } + named @AppendixPrefix { } + named @ReferencesPrefix { } + named @IndexPrefix { } + named @IndexAPrefix { } + named @IndexBPrefix { } +@Begin + + ####################################################################### + # # + # Lists of sections, sub(-sub)sections, appendices, etc. # + # # + ####################################################################### + + def @TextPlace { @Galley } + + export num + def @SectionList named @Tag {} right num + { + @Galley + //@SectionGap @SectionList @Next num + } + + export num + def @SubSectionList named @Tag {} right num + { + @Galley + //@SubSectionGap @SubSectionList @Next num + } + + export num + def @SubSubSectionList named @Tag {} right num + { + @Galley + //@SubSubSectionGap @SubSubSectionList @Next num + } + + export num + def @AppendixList named @Tag {} right num + { + @Galley + //@AppendixGap @AppendixList @Next num + } + + export num + def @SubAppendixList named @Tag {} right num + { + @Galley + //@SubAppendixGap @SubAppendixList @Next num + } + + export num + def @SubSubAppendixList named @Tag {} right num + { + @Galley + //@SubSubAppendixGap @SubSubAppendixList @Next num + } + + + ####################################################################### + # # + # @SendFull - send full-width text. # + # # + ####################################################################### + + def @SendFull force into { @FullPlace&&following } + right x + { + x + } + + + ####################################################################### + # # + # Document. # + # # + ####################################################################### + + def @Document + named @InitialFont { @InitialFont } + named @InitialBreak { @InitialBreak } + named @InitialOutdent { @InitialOutdent } + named @InitialSpace { @InitialSpace } + named @InitialLanguage { @InitialLanguage } + named @PageOrientation { @PageOrientation } + named @PageHeaders { @PageHeaders } + named @ColumnNumber { @ColumnNumber } + named @FirstPageNumber { @FirstPageNumber } + named @OptimizePages { @OptimizePages } + named @Unpaginated { No } + named @IndexText { @IndexText } + named @IndexAText { @IndexAText } + named @IndexBText { @IndexBText } + { + def @ReferencesPart + named @Tag {} + { + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { @RefHeading @RefListTitle } + headingfont { @ReferencesHeadingFont } + headingbreak { @ReferencesHeadingBreak } + headingformat { @ReferencesHeadingFormat @Body } + incontents { @ReferencesInContents } + contentsindent { @ReferencesContentsIndent } + pnprefix { @ReferencesPrefix } + majornum {} + majortitle {} + minornum {} + minortitle { @RefHeading @RefListTitle } + inrunners { Yes } + sendheader { @Body } + aboveheadinggap { 0f } + { //@RefListGap @ReferencesSection } + + } + + def @IndexPart + named @Tag {} + { + + def @Run + { + NonStart @Runner + @MajorNum {} + @MajorTitle { index @WordVal @IndexWord } + @MinorNum {} + @MinorTitle {} + @Owner { @Tag } + @Prefix { @IndexPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { index @WordVal @IndexWord } + headingfont { @IndexHeadingFont } + headingbreak { @IndexHeadingBreak } + headingformat { @IndexHeadingFormat @Body } + headingtext { @IndexText } + incontents { @IndexInContents } + contentsindent { @IndexContentsIndent } + pnprefix { @IndexPrefix } + inrunners { Yes } + majornum {} + majortitle {} + minornum {} + minortitle { index @WordVal @IndexWord } + sendheader { @SendFull @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @IndexSection @Run + + } + + def @IndexAPart + named @Tag {} + { + def @Run + { + NonStart @Runner + @MajorNum {} + @MajorTitle { index @WordVal @IndexAWord } + @MinorNum {} + @MinorTitle {} + @Owner { @Tag } + @Prefix { @IndexAPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { index @WordVal @IndexAWord } + headingfont { @IndexAHeadingFont } + headingbreak { @IndexAHeadingBreak } + headingformat { @IndexAHeadingFormat @Body } + headingtext { @IndexAText } + incontents { @IndexAInContents } + contentsindent { @IndexAContentsIndent } + pnprefix { @IndexAPrefix } + inrunners { Yes } + majornum {} + majortitle {} + minornum {} + minortitle { index @WordVal @IndexAWord } + sendheader { @SendFull @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @IndexASection @Run + + } + + def @IndexBPart + named @Tag {} + { + def @Run + { + NonStart @Runner + @MajorNum {} + @MajorTitle { index @WordVal @IndexBWord } + @MinorNum {} + @MinorTitle {} + @Owner { @Tag } + @Prefix { @IndexBPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { index @WordVal @IndexBWord } + headingfont { @IndexBHeadingFont } + headingbreak { @IndexBHeadingBreak } + headingformat { @IndexBHeadingFormat @Body } + headingtext { @IndexBText } + incontents { @IndexBInContents } + contentsindent { @IndexBContentsIndent } + pnprefix { @IndexBPrefix } + inrunners { Yes } + majornum {} + majortitle {} + minornum {} + minortitle { index @WordVal @IndexBWord } + sendheader { @SendFull @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @IndexBSection @Run + + } + + def @DocumentBody force into { @ColPlace&&preceding } + named @Optimize { @OptimizePages } + { + # this whole comment is now obsolete: + # It's important that the first component of @DocumentBody be + # indefinite. If it was definite, then @DocumentBody would + # attach immediately to the first page. This would prevent + # @FullWidth from attaching to that page, with the result that + # a document starting with @FullWidth would start on page 2! + + // @FootNoteThrough @Do @BeginFootNoteCounter + // @TextPlace + //@SectionGap @EndFigureList + //@SectionGap @EndNoteList 1 + //@SectionGap @MakeReferences @Do @ReferencesPart + // @MakeIndexA @Do @IndexAPart + // @MakeIndexB @Do @IndexBPart + // @MakeIndex @Do @IndexPart + // NonStart @Runner + } + + @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break + @InitialLanguage @Language @InitialSpace @Space + { @ColourCommand @InitialColour } @SetColour + { + Yes @BeginAllCounters {} + // Yes @BeginDisplayCounter {} + // Yes @BeginFigureCounter {} + // Yes @BeginTableCounter {} + // Yes @BeginFloaterCounter {} + // @BackEnd @Case { + + PlainText @Yield { + @Unpaginated @Case { + + { Yes yes } @Yield { + @ContinuousPageList + @Orient { @PageOrientation } + } + + { No no } @Yield { + @PageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @PageOrientation } + extra { Yes } + @FirstPageNumber + } + } + } + + else @Yield { + @PageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @PageOrientation } + extra { Yes } + @FirstPageNumber + } + } + // @DocumentBody + } + } + + macro @Doc { @Document // } + + + ####################################################################### + # # + # @Text containing sections, appendices, etc. # + # # + ####################################################################### + + export @ContentsGoesHere @FullWidth + @BeginSections @EndSections @Section + @BeginAppendices @EndAppendices @Appendix + def @Text force into { @TextPlace&&preceding } + body @Body + { + + def @ContentsGoesHere { @ContentsSection } + + export @ContentsGoesHere + def @FullWidth body @Body + { + def @ContentsGoesHere {} + + @SendFull { Start @Runner // @Body } + & NonStart @Runner & &2.1b & + } + + def @EndSectionsPlace { @Galley } + + def @EndSections force into { @EndSectionsPlace&&preceding } + {} + + macro @BeginSections + { //@SectionGap @SectionList @FirstSectionNumber + // @EndSectionsPlace // + } + + export @BeginSubSections @EndSubSections @SubSection @Title + def @Section force into { @SectionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage {} + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @EndSubSectionsPlace { @Galley } + + def @EndSubSections force into { @EndSubSectionsPlace&&preceding } + {} + + macro @BeginSubSections + { //@SubSectionGap @SubSectionList @FirstSubSectionNumber + // @EndSubSectionsPlace // + } + + def @SectionShortNum + { + @SectionNumbers @Then { + @BypassNumber @Dft { + @SectionNumbers @Num @SectionList&&@Tag @Open { num } + } + } + } + + export @BeginSubSubSections @EndSubSubSections @SubSubSection + def @SubSection force into { @SubSectionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @EndSubSubSectionsPlace { @Galley } + + def @EndSubSubSections force into + { @EndSubSubSectionsPlace&&preceding } + {} + + macro @BeginSubSubSections + { //@SubSubSectionGap + @SubSubSectionList @FirstSubSubSectionNumber + // @EndSubSubSectionsPlace // + } + + def @SubSectionShortNum + { + @SubSectionNumbers @Then { + @BypassNumber @Dft { + @SectionShortNum @Join @SubSectionNumbers @Num + { @SubSectionList&&@Tag @Open { num } } + } + } + } + + def @SubSubSection force into { @SubSubSectionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubSubSectionHeadingFont } + headingbreak { @SubSubSectionHeadingBreak } + headingformat { @Num @SubSubSectionHeadingFormat @Body } + incontents { @SubSubSectionInContents } + contentsindent { @SubSubSectionContentsIndent } + numbers { @SubSubSectionNumbers } + attachnum { @SubSubSectionList&&preceding @Tagged @Tag } + retrievenum { @SubSubSectionList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @SubSectionShortNum } + majornum {} + majortitle {} + intheorems { @SubSubSectionNumInTheorems } + indisplays { @SubSubSectionNumInDisplays } + infigures { @SubSubSectionNumInFigures } + intables { @SubSubSectionNumInTables } + infloaters { @SubSubSectionNumInFloaters } + inrunners { @SubSubSectionNumInRunners } + newpage { @NewPage } + @Body + + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubSectionHeadingFont } + headingbreak { @SubSectionHeadingBreak } + headingformat { @Num @SubSectionHeadingFormat @Body } + incontents { @SubSectionInContents } + contentsindent { @SubSectionContentsIndent } + numbers { @SubSectionNumbers } + attachnum { @SubSectionList&&preceding @Tagged @Tag } + retrievenum { @SubSectionList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @SectionShortNum } + majornum {} + majortitle {} + intheorems { @SubSectionNumInTheorems } + indisplays { @SubSectionNumInDisplays } + infigures { @SubSectionNumInFigures } + intables { @SubSectionNumInTables } + infloaters { @SubSectionNumInFloaters } + inrunners { @SubSectionNumInRunners } + newpage { @NewPage } + @Body + + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SectionHeadingFont } + headingbreak { @SectionHeadingBreak } + headingformat { @Num @SectionHeadingFormat @Body } + incontents { @SectionInContents } + contentsindent { @SectionContentsIndent } + numbers { @SectionNumbers } + attachnum { @SectionList&&preceding @Tagged @Tag } + retrievenum { @SectionList&&@Tag @Open { num } } + pnprefix { @SectionPrefix } + majornum {} + majortitle {} + bypassnumber { @BypassNumber } + intheorems { @SectionNumInTheorems } + indisplays { @SectionNumInDisplays } + infigures { @SectionNumInFigures } + intables { @SectionNumInTables } + infloaters { @SectionNumInFloaters } + inrunners { @SectionNumInRunners } + newpage { @NewPage } + @Body + + } + + def @EndAppendicesPlace { @Galley } + + def @EndAppendices force into { @EndAppendicesPlace&&preceding } + {} + + macro @BeginAppendices + { //@AppendixGap @AppendixList @FirstAppendixNumber + // @EndAppendicesPlace // + } + + export @BeginSubAppendices @EndSubAppendices @SubAppendix + def @Appendix force into { @AppendixList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage {} + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @EndSubAppendicesPlace { @Galley } + + def @EndSubAppendices force into + { @EndSubAppendicesPlace&&preceding } + {} + + macro @BeginSubAppendices + { //@SubAppendixGap @SubAppendixList @FirstSubAppendixNumber + // @EndSubAppendicesPlace // + } + + def @AppendixShortNum + { + @AppendixNumbers @Then { + @BypassNumber @Dft { + @AppendixNumbers @Num @AppendixList&&@Tag @Open { num } + } + } + } + + export @BeginSubSubAppendices @EndSubSubAppendices @SubSubAppendix + def @SubAppendix force into { @SubAppendixList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @EndSubSubAppendicesPlace { @Galley } + + def @EndSubSubAppendices force into + { @EndSubSubAppendicesPlace&&preceding } + {} + + macro @BeginSubSubAppendices + { //@SubSubAppendixGap + @SubSubAppendixList @FirstSubSubAppendixNumber + // @EndSubSubAppendicesPlace // + } + + def @SubAppendixShortNum + { + @SubAppendixNumbers @Then { + @BypassNumber @Dft { + @AppendixShortNum @Join @SubAppendixNumbers @Num + { @SubAppendixList&&@Tag @Open { num } } + } + } + } + + def @SubSubAppendix force into {@SubSubAppendixList&&preceding} + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubSubAppendixHeadingFont } + headingbreak { @SubSubAppendixHeadingBreak } + headingformat { @Num @SubSubAppendixHeadingFormat @Body } + incontents { @SubSubAppendixInContents } + contentsindent { @SubSubAppendixContentsIndent } + numbers { @SubSubAppendixNumbers } + attachnum { @SubSubAppendixList&&preceding @Tagged @Tag } + retrievenum { @SubSubAppendixList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @SubAppendixShortNum } + majornum {} + majortitle {} + intheorems { @SubSubAppendixNumInTheorems } + indisplays { @SubSubAppendixNumInDisplays } + infigures { @SubSubAppendixNumInFigures } + intables { @SubSubAppendixNumInTables } + infloaters { @SubSubAppendixNumInFloaters } + inrunners { @SubSubAppendixNumInRunners } + newpage { @NewPage } + @Body + + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubAppendixHeadingFont } + headingbreak { @SubAppendixHeadingBreak } + headingformat { @Num @SubAppendixHeadingFormat @Body } + incontents { @SubAppendixInContents } + contentsindent { @SubAppendixContentsIndent } + numbers { @SubAppendixNumbers } + attachnum { @SubAppendixList&&preceding @Tagged @Tag } + retrievenum { @SubAppendixList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @AppendixShortNum } + majornum {} + majortitle {} + intheorems { @SubAppendixNumInTheorems } + indisplays { @SubAppendixNumInDisplays } + infigures { @SubAppendixNumInFigures } + intables { @SubAppendixNumInTables } + infloaters { @SubAppendixNumInFloaters } + inrunners { @SubAppendixNumInRunners } + newpage { @NewPage } + @Body + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @AppendixHeadingFont } + headingbreak { @AppendixHeadingBreak } + headingformat { @Num @AppendixHeadingFormat @Body } + incontents { @AppendixInContents } + contentsindent { @AppendixContentsIndent } + word { appendix @WordVal @AppendixWord } + numbers { @AppendixNumbers } + attachnum { @AppendixList&&preceding @Tagged @Tag } + retrievenum { @AppendixList&&@Tag @Open { num } } + pnprefix { @AppendixPrefix } + majornum {} + majortitle {} + bypassnumber { @BypassNumber } + intheorems { @AppendixNumInTheorems } + indisplays { @AppendixNumInDisplays } + infigures { @AppendixNumInFigures } + intables { @AppendixNumInTables } + infloaters { @AppendixNumInFloaters } + inrunners { Yes } + newpage { @NewPage } + @Body + + } + + //1.1f + // Start @Runner + // @Body + // NonStart @Runner + + } + +@End @OrdinarySetup diff --git a/include/include/dsf b/include/include/dsf new file mode 100644 index 0000000..96e115e --- /dev/null +++ b/include/include/dsf @@ -0,0 +1,5426 @@ +############################################################################### +# # +# Lout @DocumentSetup package # +# # +# Version 1.0 by Jeffrey H. Kingston, 17 July 1991. # +# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. # +# Version 3.0 by Jeffrey H. Kingston, 19 April 1994. # +# Version 3.03 by Jeffrey H. Kingston, 6 May 1995. # +# Versions 3.04 and 3.05 by Jeffrey H. Kingston, 11 June 1995. # +# Version 3.05 by Jeffrey H. Kingston, 25 July 1995. # +# Version 3.07 by Jeffrey H. Kingston, February 1996. # +# Version 3.10 by Jeffrey H. Kingston, September 1996. # +# Version 3.11 by Jeffrey H. Kingston, December 1996. # +# Version 3.13 by Jeffrey H. Kingston, October 1998. # +# Version 3.16 by Jeffrey H. Kingston, May 1999. # +# Version 3.17 by Jeffrey H. Kingston, September 1999. # +# Version 3.21 by Jeffrey H. Kingston, May 2000. # +# Minor changes in later versions undated. # +# # +# This Lout package contains the general definitions used by all types of # +# documents. It needs to be extended (see docf, reportf, bookf, slidesf, # +# etc.) with definitions for particular document types. Consult "A User's # +# Guide to the Lout Document Formatting System" for user information. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +extend @BasicSetup + +export + + @Runner + + @Figure @Table @Floater + @FootNote @AnotherFootNote @EndNote + @LeftNote @RightNote @OuterNote @InnerNote # @Place + @Theorem @Proof @EndProof + @Definition @Claim @Proposition @Lemma @Corollary @Example + @Reference @RefStyle @RefPrint + @Ref @NoRef @ChapRef @NoChapRef + @Cite @NoCite @ChapCite @NoChapCite + + @Glossary @InGlossary + + @IndexA @SubIndexA @SubSubIndexA + @RawIndexA @RawSubIndexA @RawSubSubIndexA + @IndexABlanks @IndexASpacer @InitialIndexASpacer @IndexALetters + + @IndexB @SubIndexB @SubSubIndexB + @RawIndexB @RawSubIndexB @RawSubSubIndexB + @IndexBBlanks @IndexBSpacer @InitialIndexBSpacer @IndexBLetters + + @Index @SubIndex @SubSubIndex + @RawIndex @RawSubIndex @RawSubSubIndex + @IndexBlanks @IndexSpacer @InitialIndexSpacer @IndexLetters + + @BypassContentsEntry @BypassMajorContentsEntry + @BypassFigureContentsEntry @BypassTableContentsEntry @BypassFloaterContentsEntry + @BypassReference @BypassChapReference + @BypassBeginIndex @BypassRawIndex @BypassEndIndex + @BypassBeginIndexA @BypassRawIndexA @BypassEndIndexA + @BypassBeginIndexB @BypassRawIndexB @BypassEndIndexB + + +def @DocumentSetup + named @PageType { A4 @OrIfPlain Other} # page type (width, height) + named @PageWidth { 80s } # page width if type Other + named @PageHeight { 66f } # page height if type Other + named @PageOrientation { Portrait } # Portrait, Landscape, etc. + named @PageBackground { } # background of each page + named @TopMargin { 2.50c @OrIfPlain 6f } # top margin of all pages + named @FootMargin { 2.50c @OrIfPlain 6f } # bottom margin of all pages + named @OddLeftMargin { 2.50c @OrIfPlain 10s } # left margin of odd pages + named @OddRightMargin { 2.50c @OrIfPlain 10s } # right margin of odd pages + named @EvenLeftMargin { 2.50c @OrIfPlain 10s } # left margin of even pages + named @EvenRightMargin { 2.50c @OrIfPlain 10s } # right margin of even pages + named @OddLeftBodyMargin { 0c } # extra margin for page body + named @OddRightBodyMargin { 0c } # extra margin for page body + named @EvenLeftBodyMargin { 0c } # extra margin for page body + named @EvenRightBodyMargin { 0c } # extra margin for page body + named @PageBoxType { None } # None Box CurveBox ShadowBox + named @PageBoxMargin { 1.00c } # page box margin + import @PSLengths named @PageBoxLineWidth + { } # page box line thickness + named @PageBoxPaint { none } # page box paint + named @PageBoxShadow { 0.60c } # shadow margin if ShadowBox + named @PageEnclose right @Body { @Body } # page enclose + named @ColumnNumber { 1 } # number of columns (1 to 10) + named @ColumnGap { 1.00c @OrIfPlain 6s } # column gap + + named @FigureLocation { PageTop } # default figure location + named @FigureFormat + named @II right x { |@DisplayIndent x | } + named @QQ right x { |@DisplayIndent x |@DisplayIndent } + named @CC right x { |0.5rt x | } + named @RR right x { |1.0rt x | } + right @Body + { @CC @Body } # default figure format + named @FigureWord { figure } # "Figure" word else anything + named @FigureNumbers { Arabic } # method of numbering figures + named @FigureCaptionPos { Below } # Above or Below + named @FigureCaptionFont { -2p } # figure caption font + named @FigureCaptionBreak { adjust hyphen 1.2fx } # figure caption break + named @FigureCaptionFormat named word {} named number {} named caption {} + { {@B { word @NumSep number. &2s }} @Insert caption } + named @MakeFigureContents { No } # list of figures at start + + named @TableLocation { PageTop } # default table location + named @TableFormat + named @II right x { |@DisplayIndent x | } + named @QQ right x { |@DisplayIndent x |@DisplayIndent } + named @CC right x { |0.5rt x | } + named @RR right x { |1.0rt x | } + right @Body + { @CC @Body } # default table format + named @TableWord { table } # "Table" word else anything + named @TableNumbers { Arabic } # method of numbering tables + named @TableCaptionPos { Below } # Above or Below + named @TableCaptionFont { -2p } # figure caption font + named @TableCaptionBreak { adjust hyphen 1.2fx } # figure caption break + named @TableCaptionFormat named word {} named number {} named caption {} + { {@B { word @NumSep number. &2s }} @Insert caption } + named @MakeTableContents { No } # list of tables at start + + named @FloaterLocation { PageTop } # default floater location + named @FloaterFormat + named @II right x { |@DisplayIndent x | } + named @QQ right x { |@DisplayIndent x |@DisplayIndent } + named @CC right x { |0.5rt x | } + named @RR right x { |1.0rt x | } + right @Body + { @CC @Body } # default floater format + named @FloaterWord { floater } # "Floater" word else anything + named @FloaterNumbers { Arabic } # method of numbering floaters + named @FloaterCaptionPos { Below } # Above or Below + named @FloaterCaptionFont { -2p } # figure caption font + named @FloaterCaptionBreak { adjust hyphen 1.2fx } # figure caption break + named @FloaterCaptionFormat named word {} named number {} named caption {} + { {@B { word @NumSep number. &2s }} @Insert caption } + named @MakeFloaterContents { No } # list of floaters at start + + named @MakeContents { No } # make contents? Yes or No + named @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry + named @ContentsGapAbove { 0.80v @OrIfPlain 1f } # extra gap above major entry + named @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry + named @ContentsFont { Bold } # font for major entry + named @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above part entry + named @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below part entry + named @ContentsFormat + left number + right title + { number @Sep title } # contents format + named @ContentsLeader { .. } # leader symbol in contents + named @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders + named @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width + + named @MakeReferences { Yes } # make references? Yes or No + named @RefCiteStyle right cite { [cite] } # citation style + named @RefCiteLabels + named @RefNum {} + named @Tag {} + named @Type {} + named @Abstract {} + named @Address {} + named @Annote {} + named @Author {} + named @Day {} + named @Edition {} + named @HowPublished {} + named @InAuthor {} + named @InTitle {} + named @Institution {} + named @Journal {} + named @Keywords {} + named @Label {} + named @Month {} + named @Note {} + named @Number {} + named @Organization {} + named @Page {} + named @Pages {} + named @Pinpoint {} + named @Publisher {} + named @Title {} + named @TitleNote {} + named @TRType {} + named @Volume {} + named @Year {} + { @RefNum } # citation items + named @RefNumbers { Arabic } # reference numbers + + named @RefListFormat { Labels } # NoLabels, Labels, + # DropLabels, IntegrateLabels + named @RefListLabels + named @RefNum {} + named @Tag {} + named @Type {} + named @Abstract {} + named @Address {} + named @Annote {} + named @Author {} + named @Day {} + named @Edition {} + named @HowPublished {} + named @InAuthor {} + named @InTitle {} + named @Institution {} + named @Journal {} + named @Keywords {} + named @Label {} + named @Month {} + named @Note {} + named @Number {} + named @Organization {} + named @Page {} + named @Pages {} + named @Pinpoint {} + named @Publisher {} + named @Title {} + named @TitleNote {} + named @TRType {} + named @Volume {} + named @Year {} + { [@RefNum] } # ref list label format + named @RefListTitle { references } # title of reference list + named @ChapRefListTitle { references } # title of chapter ref list + named @RefListIndent { 0s } # indent to left of labels + named @RefListRightIndent { 0s } # indent to right of items + named @RefListGap { @ListGap } # gap between ref list items + named @RefListFont { } # font used in reference list + named @RefListBreak { } # break style of ref list + named @RefListLabelWidth { @ListLabelWidth } # numeric labels column width + named @RefListSortKey + named @Tag {} + named @Type {} + named @Abstract {} + named @Address {} + named @Annote {} + named @Author {} + named @CiteOrder {} + named @Day {} + named @Edition {} + named @HowPublished {} + named @InAuthor {} + named @InTitle {} + named @Institution {} + named @Journal {} + named @Keywords {} + named @Label {} + named @Month {} + named @Note {} + named @Number {} + named @Organization {} + named @Page {} + named @Pages {} + named @Pinpoint {} + named @Publisher {} + named @Title {} + named @TitleNote {} + named @TRType {} + named @Volume {} + named @Year {} + named ":" { "\037" } + { @Tag } # sorting key + + named @MakeGlossary { No } # make glossary? Yes or No + named @GlossaryText { @Null } # initial glossary text + named @GlossaryFont { } # font for glossary + named @GlossaryBreak { } # break style for glossary + named @GlossaryFormat # format for glossary + named @Name {} + named @PageNum {} + named @Body {} + { +3p @Font @S @Name + @Right @I { @Word&&page @PageNum } + @DP @RawIndentedDisplay @Body } + named @GlossaryGap { @DisplayGap } # gap between glossary items + named @GlossaryColumnNumber { 2 } # glossary columns (1 to 10) + named @GlossaryColumnGap { 1.00c @OrIfPlain 6s } # glossary column gap + named @InGlossaryFont { smallcaps } # font for @InGlossary + named @InGlossaryFormat right @Body { @Body } # format for @InGlossary + + 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 @IndexFormat + right @Body { @Body } # @Index format + named @SubIndexFormat + right @Body { {1f @Wide}@Body } # @SubIndex format + named @SubSubIndexFormat + right @Body { {2f @Wide}@Body } # @SubSubIndex format + named @IndexTypeOrdinary + right @PageNum { @PageNum } # ordinary page numbers + named @IndexTypeMain + right @PageNum { @B @PageNum } # main page numbers + named @IndexTypeSpecial + right @PageNum { @I @PageNum } # special page numbers + named @IndexRangeFormat + left @From + right @To { @From--@To } + named @IndexColumnNumber { 2 } # index columns (1 to 10) + named @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap + named @IndexCtd { Yes } # include (ctd.) lines + named @IndexCtdWord { continued } # "ctd." in current lang + named @IndexCtdFormat + left @Body + right @CtdWord + { @Body @I (@CtdWord) } # (ctd.) format + named @IndexSpacerAbove { 2v } # space above index spacer + named @IndexSpacerBelow { 1v } # space below index spacer + named @IndexSpacerFont { +3p } # font of index spacer + named @IndexSpacerFormat + right @Body { @Body } # format of index spacer + + 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 @IndexAFormat + right @Body { @Body } # @IndexA format + named @SubIndexAFormat + right @Body { {1f @Wide}@Body } # @SubIndexA format + named @SubSubIndexAFormat + right @Body { {2f @Wide}@Body } # @SubSubIndexA format + named @IndexATypeOrdinary + right @PageNum { @PageNum } # ordinary page numbers + named @IndexATypeMain + right @PageNum { @B @PageNum } # main page numbers + named @IndexATypeSpecial + right @PageNum { @I @PageNum } # special page numbers + named @IndexARangeFormat + left @From + right @To { @From--@To } + named @IndexAColumnNumber { 2 } # index A columns (1 to 10) + named @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap + named @IndexACtd { Yes } # include (ctd.) lines + named @IndexACtdWord { continued } # "ctd." in current lang + named @IndexACtdFormat + left @Body + right @CtdWord + { @Body @I (@CtdWord) } # (ctd.) format + named @IndexASpacerAbove { 2v } # space above index A spacer + named @IndexASpacerBelow { 1v } # space below index A spacer + named @IndexASpacerFont { +3p } # font of index A spacer + named @IndexASpacerFormat + right @Body { @Body } # format of index A spacer + + 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 @IndexBFormat + right @Body { @Body } # @IndexB format + named @SubIndexBFormat + right @Body { {1f @Wide}@Body } # @SubIndexB format + named @SubSubIndexBFormat + right @Body { {2f @Wide}@Body } # @SubSubIndexB format + named @IndexBTypeOrdinary + right @PageNum { @PageNum } # ordinary page numbers + named @IndexBTypeMain + right @PageNum { @B @PageNum } # main page numbers + named @IndexBTypeSpecial + right @PageNum { @I @PageNum } # special page numbers + named @IndexBRangeFormat + left @From + right @To { @From--@To } + named @IndexBColumnNumber { 2 } # index B columns (1 to 10) + named @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap + named @IndexBCtd { Yes } # include (ctd.) lines + named @IndexBCtdWord { continued } # "ctd." in current lang + named @IndexBCtdFormat + left @Body + right @CtdWord + { @Body @I (@CtdWord) } # (ctd.) format + named @IndexBSpacerAbove { 2v } # space above index B spacer + named @IndexBSpacerBelow { 1v } # space below index B spacer + named @IndexBSpacerFont { +3p } # font of index B spacer + named @IndexBSpacerFormat + right @Body { @Body } # format of index B spacer + + named @MakeColophon { No } # make colophon? Yes or No + named @ColophonFont { } # font for colophon + named @ColophonBreak { } # break style for colophon + named @ColophonColumnNumber { 1 } # colophon columns (1 to 10) + named @ColophonColumnGap { 1.00c @OrIfPlain 6s } # colophon column gap + + named @TopGap { 0.75c @OrIfPlain 2f } # gap between figures + named @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text + + named @FootNoteNumbers { Arabic } # footnote numbers + named @FootNoteThrough { No } # numbered through chapter? + named @FootNoteLocation { ColFoot } # where the footnote appears + named @FootNoteFont { 0.80f } # font for footnotes + named @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes + named @FootNoteFormat left number right body + { { number &0.05f } @Insert body } # break for footnotes + named @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line + named @FootAboveGap { @DisplayGap } # gap above footnote line + named @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes + + named @MarginNoteFont { 0.80f } # font of margin notes + named @MarginNoteBreak { ragged 1.10fx } # break style of margin notes + named @MarginNoteHGap { 0.5c } # horizontal gap to notes + named @MarginNoteVGap { @DisplayGap } # min vertical gap between + named @MarginNoteWidth { 1.50c } # width of margin notes + + named @EndNoteNumbers { Arabic } # endnote numbers + named @EndNoteFont { 0.80f } # font of endnotes + named @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes + named @EndNoteFormat left number right body + { { number &0.05f } @Insert body } # break for endnotes + named @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes + + named @TheoremWord { theorem } # "Theorem" word, etc. + named @TheoremTitleFormat right title + { (title) } # Theorem title format if present + named @TheoremFormat named word {} named number {} named title {} named body {} # theorem format + { { @B { word @NumSep number title: } &2s } @Insert body } + named @DefinitionWord { definition } # "Definition" word, etc. + named @DefinitionTitleFormat right title + { (title) } # Definition title format if present + named @DefinitionFormat named word {} named number {} named title {} named body {} # definition format + { { @B { word @NumSep number title: } &2s } @Insert body } + named @ClaimWord { claim } # "Claim" word, etc. + named @ClaimTitleFormat right title + { (title) } # Claim title format if present + named @ClaimFormat named word {} named number {} named title {} named body {} # claim format + { { @B { word @NumSep number title: } &2s } @Insert body } + named @PropositionWord { proposition } # "Proposition" word, etc. + named @PropositionTitleFormat right title + { (title) } # Proposition title format if present + named @PropositionFormat named word {} named number {} named title {} named body {} # proposition format + { { @B { word @NumSep number title: } &2s } @Insert body } + named @LemmaWord { lemma } # "Lemma" word, etc. + named @LemmaTitleFormat right title + { (title) } # Lemma title format if present + named @LemmaFormat named word {} named number {} named title {} named body {} # lemma format + { { @B { word @NumSep number title: } &2s } @Insert body } + named @CorollaryWord { corollary } # "Corollary" word, etc. + named @CorollaryTitleFormat right title + { (title) } # Corollary title format if present + named @CorollaryFormat named word {} named number {} named title {} named body {} # corollary format + { { @B { word @NumSep number title: } &2s } @Insert body } + named @ExampleWord { example } # "Example" word, etc. + named @ExampleTitleFormat right title + { (title) } # Example title format if present + named @ExampleFormat named word {} named number {} named title {} named body {} # example format + { { @B { word @NumSep number title: } &2s } @Insert body } + named @ProofWord { proof } # "Proof" word, etc. + + named @PageHeaders { Simple } # None Simple Titles NoTitles + named @PageNumbers { Arabic } # page numbers + named @FirstPageNumber { 1 } # number of first page + named @IntroPageNumbers { Roman } # intro page numbers + named @IntroFirstPageNumber { 1 } # number of first intro page + named @StructPageNums { No } # structured page numbers + named @PageNumberFormat right number { number } # format of page numbers + + named @OddTop right @PageNum { @Centre { - @PageNum - } } + named @OddFoot right @PageNum { @Null } + named @EvenTop right @PageNum { @Centre { - @PageNum - } } + named @EvenFoot right @PageNum { @Null } + named @StartOddTop right @PageNum { @Null } + named @StartOddFoot right @PageNum { @Null } + named @StartEvenTop right @PageNum { @Null } + named @StartEvenFoot right @PageNum { @Null } + + named @IntroOddTop right @PageNum { @Null } + named @IntroOddFoot right @PageNum { @Centre @PageNum } + named @IntroEvenTop right @PageNum { @Null } + named @IntroEvenFoot right @PageNum { @Centre @PageNum } + named @IntroStartOddTop right @PageNum { @Null } + named @IntroStartOddFoot right @PageNum { @Null } + named @IntroStartEvenTop right @PageNum { @Null } + named @IntroStartEvenFoot right @PageNum { @Null } + + named @RunningOddTop + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @I { @MinorNum @Sep @MinorTitle } @Right @B @PageNum } + + named @RunningOddFoot + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Null } + + named @RunningEvenTop + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @B @PageNum @Right @I { @MajorNum @Sep @MajorTitle } } + + named @RunningEvenFoot + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Null } + + named @RunningStartOddTop + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Null } + + named @RunningStartOddFoot + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Centre { Bold 0.8f } @Font @PageNum } + + named @RunningStartEvenTop + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Null } + + named @RunningStartEvenFoot + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Centre { Bold 0.8f } @Font @PageNum } + + + named @RunningIntroOddTop + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Null } + + named @RunningIntroOddFoot + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Right @PageNum } + + named @RunningIntroEvenTop + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Null } + + named @RunningIntroEvenFoot + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @PageNum } + + named @RunningIntroStartOddTop + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Null } + + named @RunningIntroStartOddFoot + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Null } + + named @RunningIntroStartEvenTop + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Null } + + named @RunningIntroStartEvenFoot + named @MajorNum {} named @MajorTitle {} + named @MinorNum {} named @MinorTitle {} right @PageNum + { @Null } + + +@Begin + + + ########################################################################### + # # + # @Protect x # + # # + # Like @CNP, this reserves space on the current page or else makes sure # + # x appears on the following page. # + # # + # Prior to Version 3.31 the amount of lookahead was just 3.0f. But # + # in Version 3.31, following a suggestion of Ludovic Courtes, this # + # was changed to @OneRow { 1.0f @High @LP 2.0v @High }, which # + # approximates the height of a title line, a paragraph separator, and # + # the first two lines of the section, and so works somewhat better. # + # # + ########################################################################### + + def @Protect right x { @OneRow { 1.0f @High @LP 2.0v @High } //0io // x } + + + ########################################################################### + # # + # @HLine # + # # + # Draws a horizontal line to fill available space. # + # # + ########################################################################### + + def @HLine + { + @BackEnd @Case { + PlainText @Yield { "-" @PlainGraphic 1f @High } + PostScript @Yield { {0 0 moveto xsize 0 lineto stroke} @Graphic {} } + PDF @Yield { {0 0 m __xsize 0 l S} @Graphic {} } + } + } + + + ########################################################################### + # # + # x @WordVal y # + # # + # Returns @Word&&x if x == y, otherwise y. # + # # + ########################################################################### + + def @WordVal + left x + right y + { + y @Case { + x @Yield @Word&&x + else @Yield y + } + } + + ########################################################################### + # # + # x @Dft y # + # # + # This returns x unless its value is "dft", in which case it returns y. # + # Useful for defaulting the value of one parameter to another. # + # # + ########################################################################### + + def @Dft + left x + right y + { + x @Case { + dft @Yield y + else @Yield x + } + } + + + ########################################################################### + # # + # x @Do y # + # # + # This returns @Null if x is No or None, otherwise y. # + # # + ########################################################################### + + def @Do + left x + right y + { + x @Case { + { No None } @Yield @Null + else @Yield y + } + } + + + ########################################################################### + # # + # x @NoDo y # + # # + # Negation of @Do: This returns y if x is No or None, otherwise @Null. # + # # + ########################################################################### + + def @NoDo + left x + right y + { + x @Case { + { No None } @Yield y + else @Yield @Null + } + } + + + ########################################################################### + # # + # x @Then y # + # # + # This returns the empty object if x is No or None, otherwise y. # + # # + ########################################################################### + + def @Then + left x + right y + { + x @Case { + { No None } @Yield {} + else @Yield y + } + } + + + ########################################################################### + # # + # x @NoThen y # + # # + # Negation of @Then: returns y if x is No or None, otherwise empty. # + # # + ########################################################################### + + def @NoThen + left x + right y + { + x @Case { + { No None } @Yield y + else @Yield {} + } + } + + + ########################################################################### + # # + # Number markers. # + # # + ########################################################################### + + def @Num + left numtype + right num + { + numtype @Case { + None @Yield {} + Arabic @Yield num + Roman @Yield @Roman&&num + UCRoman @Yield @UCRoman&&num + Alpha @Yield @Alpha&&num + UCAlpha @Yield @UCAlpha&&num + Bullets @Yield @FnBullets&&num + Symbols @Yield @FnSymbols&&num + } + } + + + ########################################################################### + # # + # @MakePageNum # + # # + # Make a page number. # + # # + ########################################################################### + + def @MakePageNum + named numbers {} + named rawnum {} + named prefix {} + named owner {} + { + def @OwnerNum { @PageMarker&&owner @Open { rawnum } } + + def @StructNum { @FirstPageNumber @Plus rawnum @Minus @OwnerNum } + + @PageHeaders.@StructPageNums @Case { + { Titles.Yes NoTitles.Yes } @Yield { + prefix @Join @PageNumberFormat { numbers @Num @StructNum } } + else @Yield @PageNumberFormat { numbers @Num rawnum } + } + } + + + ########################################################################### + # # + # Page size, margins, and boxes. This code culminates in @OddPage x # + # and @EvenPage x, which produce one odd or even page containing x. # + # # + ########################################################################### + + def @Width + { + @PageType @Case { + Letter @Yield 612p + Tabloid @Yield 792p + Ledger @Yield 1224p + Legal @Yield 612p + Statement @Yield 396p + Executive @Yield 540p + A0 @Yield 2380p + A1 @Yield 1684p + A2 @Yield 1190p + A3 @Yield 842p + A4 @Yield 595p + A5 @Yield 420p + ISOB4 @Yield 709p + ISOB5 @Yield 499p + JISB4 @Yield 729p + JISB5 @Yield 516p + B4 @Yield 729p + B5 @Yield 516p + Folio @Yield 612p + Quarto @Yield 610p + 10x14 @Yield 720p + Other @Yield @PageWidth + } + } + + def @Height + { + @PageType @Case { + Letter @Yield 792p + Tabloid @Yield 1224p + Ledger @Yield 792p + Legal @Yield 1008p + Statement @Yield 612p + Executive @Yield 720p + A0 @Yield 3368p + A1 @Yield 2380p + A2 @Yield 1684p + A3 @Yield 1190p + A4 @Yield 842p + A5 @Yield 595p + ISOB4 @Yield 1001p + ISOB5 @Yield 709p + JISB4 @Yield 1032p + JISB5 @Yield 729p + B4 @Yield 1032p + B5 @Yield 729p + Folio @Yield 936p + Quarto @Yield 780p + 10x14 @Yield 1008p + Other @Yield @PageHeight + } + } + + def @OrientedWidth right @Orient + { + @Orient @Case { + { Portrait ReversePortrait } @Yield @Width + { Landscape ReverseLandscape } @Yield @Height + } + } + + def @OrientedHeight right @Orient + { + @Orient @Case { + { Portrait ReversePortrait } @Yield @Height + { Landscape ReverseLandscape } @Yield @Width + } + } + + def @OrientationAngle right @Orient + { + @Orient @Case { + Portrait @Yield 0d + Landscape @Yield 90d + ReversePortrait @Yield 180d + ReverseLandscape @Yield 270d + } + } + + def @PageBox right x + { + @PageBoxType @Case { + None @Yield x + Box @Yield @Box + margin { @PageBoxMargin } + paint { @PageBoxPaint } + linewidth { @PageBoxLineWidth } x + CurveBox @Yield @CurveBox + margin { @PageBoxMargin } + paint { @PageBoxPaint } + linewidth { @PageBoxLineWidth } x + ShadowBox @Yield @ShadowBox + margin { @PageBoxMargin } + paint { @PageBoxPaint } + linewidth { @PageBoxLineWidth } + shadow { @PageBoxShadow } x + } + } + + def @PageSet right x + { +# "LoutPageSet" @Graphic # VT: case PDF produces nothing + { @BackEnd @Case { + PostScript @Yield "LoutPageSet" + else @Yield "% @DoBackground/LoutPageSet UNIMPLEMENTED" + } + } @Graphic x + } + + def @ColouriseBackground left color right x + { + color @Colour + @Box margin { 0c } paint { color } linewidth { 0c } + @InitialColour @Colour x + } + + def @MargSet + left parity + right x + { +# { parity "LoutMargSet" } @Graphic x # VT: case PDF produces nothing + { @BackEnd @Case { + PostScript @Yield { parity "LoutMargSet" } + else @Yield "% @MargSet/LoutMargSet UNIMPLEMENTED" + } + } @Graphic x + } + + def @OddPage + left extra + named @Orient {} + right x + { + @PageSet + @InitialBackgroundColour @ColouriseBackground + { @OrientationAngle @Orient } @Rotate + { @OrientedWidth @Orient } @Wide { @OrientedHeight @Orient } @High + { //@TopMargin ||@OddLeftMargin + { // || @PageBackground } @Background + # 1 @MargSet + @PageEnclose @PageBox @HExpand { extra // @VExpand x } + ||@OddRightMargin //@FootMargin + } + } + + def @EvenPage + left extra + named @Orient {} + right x + { + @PageSet + @InitialBackgroundColour @ColouriseBackground + { @OrientationAngle @Orient } @Rotate + { @OrientedWidth @Orient } @Wide { @OrientedHeight @Orient } @High + { //@TopMargin ||@EvenLeftMargin + { // || @PageBackground } @Background + # 0 @MargSet + @PageEnclose @PageBox @HExpand { extra // @VExpand x } + ||@EvenRightMargin //@FootMargin + } + } + + + ########################################################################### + # # + # Definitions for page headers and footers. There are 16 symbols here, # + # in the following arrangement: # + # # + # @(- | Running)(- | Intro)(Odd | Even)(Top | Foot)Header # + # # + # Running means that running headers are to be used. # + # Intro means that the header is destined for an introductory page. # + # Odd or Even means whether the page number will be odd or even. # + # Top or Foot means whether the header is for the top or foot of page. # + # # + ########################################################################### + + export @Start @MajorNum @MajorTitle @MinorNum @MinorTitle @Owner @Prefix + def @Runner + left @Start + named @MajorNum {} + named @MajorTitle {} + named @MinorNum {} + named @MinorTitle {} + named @Owner {} + named @Prefix {} + named @Tag {} + { + @Null + # red @Colour "(@Runner:"@Start":"@MajorTitle":"@MinorTitle")" + } + + def @DupRunner # duplicate previous runner + { + @Runner&&preceding @Open { + NonStart @Runner + @MajorNum { @MajorNum } + @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } + @MinorTitle { @MinorTitle } + @Owner { @Owner } + @Prefix { @Prefix } + } + } + + def @OddTopHeader + left @PageHeadersAndStart + right @PageNum + { + @PageHeadersAndStart @Case { + None.Start @Yield @Null + None.NonStart @Yield @Null + None.None @Yield @Null + Simple.Start @Yield @StartOddTop @PageNum + Simple.NonStart @Yield @OddTop @PageNum + Simple.None @Yield @Null + } + } + + def @OddFootHeader + left @PageHeadersAndStart + right @PageNum + { + @PageHeadersAndStart @Case { + None.Start @Yield @Null + None.NonStart @Yield @Null + None.None @Yield @Null + Simple.Start @Yield @StartOddFoot @PageNum + Simple.NonStart @Yield @OddFoot @PageNum + Simple.None @Yield @Null + } + } + + def @EvenTopHeader + left @PageHeadersAndStart + right @PageNum + { + @PageHeadersAndStart @Case { + None.Start @Yield @Null + None.NonStart @Yield @Null + None.None @Yield @Null + Simple.Start @Yield @StartEvenTop @PageNum + Simple.NonStart @Yield @EvenTop @PageNum + Simple.None @Yield @Null + } + } + + def @EvenFootHeader + left @PageHeadersAndStart + right @PageNum + { + @PageHeadersAndStart @Case { + None.Start @Yield @Null + None.NonStart @Yield @Null + None.None @Yield @Null + Simple.Start @Yield @StartEvenFoot @PageNum + Simple.NonStart @Yield @EvenFoot @PageNum + Simple.None @Yield @Null + } + } + + def @IntroOddTopHeader + left @PageHeadersAndStart + right @PageNum + { + @PageHeadersAndStart @Case { + None.Start @Yield @Null + None.NonStart @Yield @Null + None.None @Yield @Null + Simple.Start @Yield @IntroStartOddTop @PageNum + Simple.NonStart @Yield @IntroOddTop @PageNum + Simple.None @Yield @Null + } + } + + def @IntroOddFootHeader + left @PageHeadersAndStart + right @PageNum + { + @PageHeadersAndStart @Case { + None.Start @Yield @Null + None.NonStart @Yield @Null + None.None @Yield @Null + Simple.Start @Yield @IntroStartOddFoot @PageNum + Simple.NonStart @Yield @IntroOddFoot @PageNum + Simple.None @Yield @Null + } + } + + def @IntroEvenTopHeader + left @PageHeadersAndStart + right @PageNum + { + @PageHeadersAndStart @Case { + None.Start @Yield @Null + None.NonStart @Yield @Null + None.None @Yield @Null + Simple.Start @Yield @IntroStartEvenTop @PageNum + Simple.NonStart @Yield @IntroEvenTop @PageNum + Simple.None @Yield @Null + } + } + + def @IntroEvenFootHeader + left @PageHeadersAndStart + right @PageNum + { + @PageHeadersAndStart @Case { + None.Start @Yield @Null + None.NonStart @Yield @Null + None.None @Yield @Null + Simple.Start @Yield @IntroStartEvenFoot @PageNum + Simple.NonStart @Yield @IntroEvenFoot @PageNum + Simple.None @Yield @Null + } + } + + + def @RunningOddTopHeader + left @PageHeadersAndStart + named @MajorNum {} + named @MajorTitle {} + named @MinorNum {} + named @MinorTitle {} + right @PageNum + { + @PageHeadersAndStart @Case { + NoTitles.?? @Yield ?? + NoTitles.Start @Yield @RunningStartOddTop @PageNum + NoTitles.NonStart @Yield @RunningOddTop @PageNum + NoTitles.None @Yield @Null + Titles.?? @Yield ?? + Titles.Start @Yield @RunningStartOddTop + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.NonStart @Yield @RunningOddTop + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.None @Yield @Null + } + } + + def @RunningOddFootHeader + left @PageHeadersAndStart + named @MajorNum {} + named @MajorTitle {} + named @MinorNum {} + named @MinorTitle {} + right @PageNum + { + @PageHeadersAndStart @Case { + NoTitles.?? @Yield @Null + NoTitles.Start @Yield @RunningStartOddFoot @PageNum + NoTitles.NonStart @Yield @RunningOddFoot @PageNum + NoTitles.None @Yield @Null + Titles.?? @Yield @Null + Titles.Start @Yield @RunningStartOddFoot + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.NonStart @Yield @RunningOddFoot + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.None @Yield @Null + } + } + + def @RunningEvenTopHeader + left @PageHeadersAndStart + named @MajorNum {} + named @MajorTitle {} + named @MinorNum {} + named @MinorTitle {} + right @PageNum + { + @PageHeadersAndStart @Case { + NoTitles.?? @Yield ?? + NoTitles.Start @Yield @RunningStartEvenTop @PageNum + NoTitles.NonStart @Yield @RunningEvenTop @PageNum + NoTitles.None @Yield @Null + Titles.?? @Yield ?? + Titles.Start @Yield @RunningStartEvenTop + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.NonStart @Yield @RunningEvenTop + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.None @Yield @Null + } + } + + def @RunningEvenFootHeader + left @PageHeadersAndStart + named @MajorNum {} + named @MajorTitle {} + named @MinorNum {} + named @MinorTitle {} + right @PageNum + { + @PageHeadersAndStart @Case { + NoTitles.?? @Yield @Null + NoTitles.Start @Yield @RunningStartEvenFoot @PageNum + NoTitles.NonStart @Yield @RunningEvenFoot @PageNum + NoTitles.None @Yield @Null + Titles.?? @Yield @Null + Titles.Start @Yield @RunningStartEvenFoot + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.NonStart @Yield @RunningEvenFoot + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.None @Yield @Null + } + } + + def @RunningIntroOddTopHeader + left @PageHeadersAndStart + named @MajorNum {} + named @MajorTitle {} + named @MinorNum {} + named @MinorTitle {} + right @PageNum + { + @PageHeadersAndStart @Case { + NoTitles.?? @Yield ?? + NoTitles.Start @Yield @RunningIntroStartOddTop @PageNum + NoTitles.NonStart @Yield @RunningIntroOddTop @PageNum + NoTitles.None @Yield @Null + Titles.?? @Yield ?? + Titles.Start @Yield @RunningIntroStartOddTop + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.NonStart @Yield @RunningIntroOddTop + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.None @Yield @Null + } + } + + def @RunningIntroOddFootHeader + left @PageHeadersAndStart + named @MajorNum {} + named @MajorTitle {} + named @MinorNum {} + named @MinorTitle {} + right @PageNum + { + @PageHeadersAndStart @Case { + NoTitles.?? @Yield @Null + NoTitles.Start @Yield @RunningIntroStartOddFoot @PageNum + NoTitles.NonStart @Yield @RunningIntroOddFoot @PageNum + NoTitles.None @Yield @Null + Titles.?? @Yield @Null + Titles.Start @Yield @RunningIntroStartOddFoot + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.NonStart @Yield @RunningIntroOddFoot + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.None @Yield @Null + } + } + + def @RunningIntroEvenTopHeader + left @PageHeadersAndStart + named @MajorNum {} + named @MajorTitle {} + named @MinorNum {} + named @MinorTitle {} + right @PageNum + { + @PageHeadersAndStart @Case { + NoTitles.?? @Yield ?? + NoTitles.Start @Yield @RunningIntroStartEvenTop @PageNum + NoTitles.NonStart @Yield @RunningIntroEvenTop @PageNum + NoTitles.None @Yield @Null + Titles.?? @Yield ?? + Titles.Start @Yield @RunningIntroStartEvenTop + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.NonStart @Yield @RunningIntroEvenTop + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.None @Yield @Null + } + } + + def @RunningIntroEvenFootHeader + left @PageHeadersAndStart + named @MajorNum {} + named @MajorTitle {} + named @MinorNum {} + named @MinorTitle {} + right @PageNum + { + @PageHeadersAndStart @Case { + NoTitles.?? @Yield @Null + NoTitles.Start @Yield @RunningIntroStartEvenFoot @PageNum + NoTitles.NonStart @Yield @RunningIntroEvenFoot @PageNum + NoTitles.None @Yield @Null + Titles.?? @Yield @Null + Titles.Start @Yield @RunningIntroStartEvenFoot + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.NonStart @Yield @RunningIntroEvenFoot + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + @PageNum + Titles.None @Yield @Null + } + } + + + ########################################################################### + # # + # Helper definitions for laying out pages. # + # # + ########################################################################### + + def @PageTopPlace { @Galley } + def @PageFootAndTopPlace { @Galley } + def @PageFootNotePlace { @Galley } + def @FullPlace { @Galley } + def @OddFullPlace { @Galley } + def @EvenFullPlace { @Galley } + def @FullPagePlace { @Galley } + def @EvenFullPagePlace { @Galley } + def @EvenPagePlace { @Galley } + def @OddFullPagePlace { @Galley } + def @ColTopPlace { @Galley } + def @ColFootAndTopPlace { @Galley } + def @ColPlace { @Galley } + def @ColFootNotePlace { @Galley } + def @IntroFullPlace { @Galley } + def @IntroOddFullPlace { @Galley } + def @IntroEvenFullPlace { @Galley } + def @IntroColPlace { @Galley } + def @GlossaryPlace { @Galley } + def @IndexPlace { @Galley } + def @IndexAPlace { @Galley } + def @IndexBPlace { @Galley } + def @ColophonPlace { @Galley } + def @AfterLinePlace { @ForceGalley } + + def @TryAfterLinePlace right x + { + x @Case { + noforce @Yield @Galley + force @Yield @ForceGalley + } + } + + def @EvenFullPageSection + { + @OneRow @EvenFullPagePlace + // @FullPagePlace + //@MidGap @EvenFullPageSection + } + + def @OddFullPageSection + { + @OneRow @OddFullPagePlace + // @FullPagePlace + //@MidGap @OddFullPageSection + } + + def @EvenPageTopSect + { + @OneRow @EvenPagePlace + // @PageTopPlace + //@MidGap @PageFootAndTopPlace + //@MidGap @EvenPageTopSect + } + + def @OddPageTopSect + { + @PageTopPlace + //@MidGap @PageFootAndTopPlace + //@MidGap @OddPageTopSect + } + + def @PageOddTopSection right @Orient + { + @OddPageTopSect ||{@OrientedWidth @Orient} @FullPlace + ||{@OrientedWidth @Orient} @OddFullPlace + } + + def @PageEvenTopSection right @Orient + { + @EvenPageTopSect ||{@OrientedWidth @Orient} @FullPlace + ||{@OrientedWidth @Orient} @EvenFullPlace + } + + def @PageIntroOddTopSection right @Orient + { + @OddPageTopSect ||{@OrientedWidth @Orient} @IntroFullPlace + ||{@OrientedWidth @Orient} @IntroOddFullPlace + } + + def @PageIntroEvenTopSection right @Orient + { + @EvenPageTopSect + ||{@OrientedWidth @Orient} @IntroFullPlace + ||{@OrientedWidth @Orient} @IntroEvenFullPlace + } + + def @PageFootNoteList + { + @PageFootNotePlace + //@FootGap @PageFootNoteList + } + + def @PageFootNoteSection + { + @FootLen @Wide @HLine + //@FootGap @PageFootNoteList + } + + def @PageFootAndTopSect + { + @PageFootAndTopPlace + //@MidGap @PageFootAndTopSect + } + + def @PageFootSection + { + //@MidGap @PageFootAndTopSect + //@FootAboveGap @PageFootNoteSection + } + + def @ColTopSection + { + @ColTopPlace + //@MidGap @ColFootAndTopPlace + //@MidGap @TryAfterLinePlace noforce + //@MidGap @ColTopSection + } + + def @RestOfColSection + { + @AfterLinePlace + //@MidGap @TryAfterLinePlace force + //@MidGap @ColPlace @NotRevealed + //@MidGap @RestOfColSection + } + + def @IntroRestOfColSection + { + @AfterLinePlace + //@MidGap @TryAfterLinePlace force + //@MidGap @IntroColPlace @NotRevealed + //@MidGap @IntroRestOfColSection + } + + def @ColFootAndTopList { @ColFootAndTopPlace //@TopGap @ColFootAndTopList } + + def @ColFootNoteList + { + @ColFootNotePlace + //@FootGap @ColFootNoteList + } + + def @ColFootNoteSection + { + @FootLen @Wide @HLine + //@FootGap @ColFootNoteList + } + + def @ColFootSection + { + //@TopGap @ColFootAndTopList + //@FootAboveGap @ColFootNoteSection + } + + def @ColsOf + left num + named gap { @ColumnGap } + right x + { + def @Two { x ||gap x } + def @Four { @Two ||gap @Two } + def @Eight { @Four ||gap @Four } + + num @Case { + 1 @Yield { x } + 2 @Yield { @Two } + 3 @Yield { @Two ||gap x } + 4 @Yield { @Four } + 5 @Yield { @Four ||gap x } + 6 @Yield { @Four ||gap @Two } + 7 @Yield { @Four ||gap @Two ||gap x } + 8 @Yield { @Four ||gap @Four } + 9 @Yield { @Four ||gap @Four ||gap x } + 10 @Yield { @Four ||gap @Four ||gap @Two } + } + } + + def @EqualWidth right x { 500c @Wide x } # believe it or not + + def @ColList right num + { + @HExpand num @ColsOf @EqualWidth @VExpand + { + @ColTopSection //@TopGap + @ColPlace //@MidGap @RestOfColSection // //1rt + @OneRow { @ColFootSection } + + } + } + + def @IntroColList right num + { + @HExpand num @ColsOf @EqualWidth @VExpand + { + @ColTopSection //@TopGap + @IntroColPlace //@MidGap @IntroRestOfColSection // //1rt + @OneRow { @ColFootSection } + } + } + + def @ZeroColList right num + { + @HExpand num @ColsOf @EqualWidth 0c @High @ColPlace + } + + def @ZeroIntroColList right num + { + @HExpand num @ColsOf @EqualWidth 0c @High @IntroColPlace + } + + def @GlossaryColList right num + { + @HExpand num @ColsOf gap { @GlossaryColumnGap } @EqualWidth @VExpand @GlossaryPlace + } + + def @IndexColList right num + { + @HExpand num @ColsOf gap { @IndexColumnGap } @EqualWidth @VExpand @IndexPlace + } + + def @IndexAColList right num + { + @HExpand num @ColsOf gap { @IndexAColumnGap } @EqualWidth @VExpand @IndexAPlace + } + + def @IndexBColList right num + { + @HExpand num @ColsOf gap { @IndexBColumnGap } @EqualWidth @VExpand @IndexBPlace + } + + def @ColophonColList right num + { + @HExpand num @ColsOf gap { @ColophonColumnGap } @EqualWidth @VExpand @ColophonPlace + } + + + ########################################################################### + # # + # Footnotes. # + # # + ########################################################################### + + export @Tag count + def @FootNoteCounterMarker + named @Tag {} + named count {} + { + @Null + } + + def @FootNoteNum right tag + { + @FootNoteCounterMarker&&tag @Open { @Next count } + } + + def @FootNoteCounterIncrement + right tag + { + @FootNoteCounterMarker&&preceding @Tagged tag + // @FootNoteCounterMarker count { @FootNoteNum tag } + // @NumberMarker @Tag { tag } + @Value { @FootNoteNumbers @Num @FootNoteNum tag } + } + + def @BeginFootNoteCounter + { + @FootNoteCounterMarker count { 0 } + } + + def @FootNote + named @Tag {} + named @Location { @FootNoteLocation } + named @Another { No } + named @Label { Numbered } + right x + { + + def @FootLabelFmt + right x + { + @FootNoteFont @Font @FootNoteBreak @Break + +0.3v @VShift { Base 0.8f } @Font x + } + + def @FootExtra + { + @BackEnd @Case { + PlainText @Yield "," + else @Yield @FootLabelFmt "," + } + } + + def @FootLabel + { + @Label @Case { + "Numbered" @Yield { @BackEnd @Case { + PlainText @Yield { ({@NumberOf @Tag}) } + else @Yield @FootLabelFmt @NumberOf @Tag + } } + else @Yield { @BackEnd @Case { + PlainText @Yield @Label + else @Yield @FootLabelFmt @Label + } } + } + } + + def @LongFootLabel + { + @Another @Case { + No @Yield { @FootLabel } + Yes @Yield { @FootExtra &0iu @FootLabel } + } + } + + def @FootVal + { + @FootNoteFont @Font @FootNoteBreak @Break @Label @Case { + "Numbered" @Yield { + { @FootNoteCounterIncrement @Tag & @FootLabel } + @FootNoteFormat x + } + else @Yield { @FootLabel @FootNoteFormat x } + } + } + + def @PageFootNote into { @PageFootNotePlace&&following } { @FootVal } + def @ColFootNote into { @ColFootNotePlace&&following } { @FootVal } + + @Location @Case { + ColFoot @Yield { @Null &0iu @LongFootLabel & @ColFootNote } + PageFoot @Yield { @Null &0iu @LongFootLabel & @PageFootNote } + } + } + + macro @AnotherFootNote { @FootNote @Another { Yes } } + + + ########################################################################### + # # + # Definitions for page lists. There are four symbols here, in the # + # following arrangement: # + # # + # @(Simple | Running)(- | Intro)PageList # + # # + # Running means that the page list is to support running headers. # + # Intro means that the page list is an introductory page list. # + # These are then packaged into @PageList and @IntroPageList. # + # # + ########################################################################### + + def @SStart right @PageNum + { + @PageNum @Case { + { 1 0 } @Yield Start + else @Yield NonStart + } + } + + def @ChooseColList right colnum + { + @OneOf + { + @ColList colnum + @GlossaryColList @GlossaryColumnNumber + @IndexAColList @IndexAColumnNumber + @IndexBColList @IndexBColumnNumber + @IndexColList @IndexColumnNumber + @ColophonColList @ColophonColumnNumber + } + } + + def @ChooseIntroColList right colnum + { + @OneOf + { + @IntroColList colnum + @GlossaryColList @GlossaryColumnNumber + @IndexAColList @IndexAColumnNumber + @IndexBColList @IndexBColumnNumber + @IndexColList @IndexColumnNumber + @ColophonColList @ColophonColumnNumber + } + } + + def @OddBodyMargins right x + { + @OddLeftBodyMargin @Wide {} || 1 @MargSet x || @OddRightBodyMargin @Wide {} + } + + def @EvenBodyMargins right x + { + @EvenLeftBodyMargin @Wide {} || 0 @MargSet x || @EvenRightBodyMargin @Wide {} + } + + def @SimplePageList + named @ColumnNumber {} + named @PageHeaders {} + named extra { No } + named @Orient {} + named @AtTop { @Null } + right @PageNum + { + + def @OrdinaryOddPage + { + {@PageHeaders.{@SStart @PageNum}} @OddTopHeader + @PageNumberFormat { @PageNumbers @Num @PageNum } + //@MidGap + @OddBodyMargins { + @AtTop + //@MidGap @PageOddTopSection @Orient + //@MidGap @ChooseColList @ColumnNumber + } + //1rt @OneRow + { // @OddBodyMargins @PageFootSection + //@MidGap {@PageHeaders.{@SStart @PageNum}} @OddFootHeader + @PageNumberFormat { @PageNumbers @Num @PageNum } + } + } + + def @FullPageOddPage + { + {@PageHeaders.{@SStart @PageNum}} @OddTopHeader + @PageNumberFormat { @PageNumbers @Num @PageNum } + //@MidGap @OddBodyMargins @OddFullPageSection + //1rt @OneRow + { //@MidGap {@PageHeaders.{@SStart @PageNum}} @OddFootHeader + @PageNumberFormat { @PageNumbers @Num @PageNum } + } + } + + def @SimpleEvenPageList + named @ColumnNumber {} + named @PageHeaders {} + named extra { No } + right @PageNum + { + + def @OrdinaryEvenPage + { + @PageHeaders.NonStart @EvenTopHeader + @PageNumberFormat { @PageNumbers @Num @PageNum } + //@MidGap + @EvenBodyMargins { + @PageEvenTopSection @Orient + //@MidGap @ChooseColList @ColumnNumber + } + //1rt @OneRow + { // @EvenBodyMargins @PageFootSection + //@MidGap @PageHeaders.NonStart @EvenFootHeader + @PageNumberFormat { @PageNumbers @Num @PageNum } + } + } + + def @FullPageEvenPage + { + @PageHeaders.NonStart @EvenTopHeader + @PageNumberFormat { @PageNumbers @Num @PageNum } + //@MidGap @EvenBodyMargins @EvenFullPageSection + //1rt @OneRow + { //@MidGap @PageHeaders.NonStart @EvenFootHeader + @PageNumberFormat { @PageNumbers @Num @PageNum } + } + } + + @PageMarker + rawnum { @PageNum } + num { @PageNumbers @Num @PageNum } + parity { "Even" } + // @FootNoteThrough @NoDo @BeginFootNoteCounter + // {} @EvenPage @Orient { @Orient } + { + @OrdinaryEvenPage ||{@OrientedWidth @Orient} @FullPageEvenPage + } + // @SimplePageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @Orient } + @Next @PageNum + } + + @PageMarker + rawnum { @PageNum } + num { @PageNumbers @Num @PageNum } + parity { "Odd" } + // @FootNoteThrough @NoDo @BeginFootNoteCounter + // { extra @Then @OddBodyMargins @ZeroColList @ColumnNumber } @OddPage @Orient { @Orient } + { + @OrdinaryOddPage ||{@OrientedWidth @Orient} @FullPageOddPage + } + // @SimpleEvenPageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Next @PageNum + } + + def @SimpleIntroPageList + named @ColumnNumber {} + named @PageHeaders {} + named @Orient {} + named extra { No } + named @AtTop { @Null } + right @PageNum + { + @PageMarker + num { @IntroPageNumbers @Num @PageNum } + rawnum { @PageNum } + parity { "Odd" } + // @FootNoteThrough @NoDo @BeginFootNoteCounter + // { extra @Then @OddBodyMargins @ZeroIntroColList @ColumnNumber } @OddPage @Orient { @Orient } + { + {@PageHeaders.{@SStart @PageNum}} @IntroOddTopHeader + @PageNumberFormat { @IntroPageNumbers @Num @PageNum } + //@MidGap + @OddBodyMargins { + @AtTop + //@MidGap @PageIntroOddTopSection @Orient + //@MidGap @ChooseIntroColList @ColumnNumber + } + //1rt @OneRow + { // @OddBodyMargins @PageFootSection + //@MidGap + {@PageHeaders.{@SStart @PageNum}} @IntroOddFootHeader + @PageNumberFormat { @IntroPageNumbers @Num @PageNum } + } + } + // @PageMarker + num { @IntroPageNumbers @Num @Next @PageNum } + rawnum { @Next @PageNum } + parity { "Even" } + // @FootNoteThrough @NoDo @BeginFootNoteCounter + // {} @EvenPage @Orient { @Orient } + @Runner&&following @Open + { + @PageHeaders.NonStart @IntroEvenTopHeader @PageNumberFormat { @IntroPageNumbers @Num @Next @PageNum } + //@MidGap + @EvenBodyMargins { + @PageIntroEvenTopSection @Orient + //@MidGap @ChooseIntroColList @ColumnNumber + } + //1rt @OneRow + { // @EvenBodyMargins @PageFootSection + //@MidGap @PageHeaders.NonStart @IntroEvenFootHeader + @PageNumberFormat { @IntroPageNumbers @Num @Next @PageNum } + } + } + // @SimpleIntroPageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @Orient } + @Next @Next @PageNum + } + + def @SimpleOddOrEvenIntroPageList + named @ColumnNumber {} + named @PageHeaders {} + named @Orient {} + named extra { No } + named @AtTop { @Null } + right @PageNum + { + + def @SimpleEvenIntroPageList + named @ColumnNumber {} + named @PageHeaders {} + named @Orient {} + named extra { No } + named @AtTop { @Null } + right @PageNum + { + + @PageMarker + num { @IntroPageNumbers @Num @PageNum } + rawnum { @PageNum } + parity { "Even" } + // @FootNoteThrough @NoDo @BeginFootNoteCounter + // {} @EvenPage @Orient { @Orient } + @Runner&&following @Open + { + @PageHeaders.NonStart @IntroEvenTopHeader @PageNumberFormat { @IntroPageNumbers @Num @PageNum } + //@MidGap + @EvenBodyMargins { + @PageIntroEvenTopSection @Orient + //@MidGap @ChooseIntroColList @ColumnNumber + } + //1rt @OneRow + { // @EvenBodyMargins @PageFootSection + //@MidGap @PageHeaders.NonStart @IntroEvenFootHeader + @PageNumberFormat { @IntroPageNumbers @Num @PageNum } + } + } + // @SimpleOddOrEvenIntroPageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @Orient } + @Next @PageNum + } + @PageMarker + num { @IntroPageNumbers @Num @PageNum } + rawnum { @PageNum } + parity { "Odd" } + // @FootNoteThrough @NoDo @BeginFootNoteCounter + // { extra @Then @OddBodyMargins @ZeroIntroColList @ColumnNumber } @OddPage @Orient { @Orient } + { + {@PageHeaders.{@SStart @PageNum}} @IntroOddTopHeader + @PageNumberFormat { @IntroPageNumbers @Num @PageNum } + //@MidGap + @OddBodyMargins { + @AtTop + //@MidGap @PageIntroOddTopSection @Orient + //@MidGap @ChooseIntroColList @ColumnNumber + } + //1rt @OneRow + { // @OddBodyMargins @PageFootSection + //@MidGap + {@PageHeaders.{@SStart @PageNum}} @IntroOddFootHeader + @PageNumberFormat { @IntroPageNumbers @Num @PageNum } + } + } + // @SimpleEvenIntroPageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @Orient } + @Next @PageNum + } + + def @RunningPageList + named @ColumnNumber {} + named @PageHeaders {} + named extra { No } + named @Orient {} + named @AtTop { @Null } + right @PageNum + { + + def @OrdinaryOddPage + { + @Runner&&following @Open + { + @PageMarker + num { @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } } + rawnum { @PageNum } + parity { "Odd" } + // @PageHeaders.@Start @RunningOddTopHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } + } + //@MidGap + @OddBodyMargins { + @AtTop + //@MidGap @PageOddTopSection @Orient + //@MidGap @ChooseColList @ColumnNumber + } + //1rt @OneRow + { // @OddBodyMargins @PageFootSection + //@MidGap @PageHeaders.@Start @RunningOddFootHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } + } + } + } + } + + def @FullPageOddPage + { + @Runner&&following @Open + { + @PageMarker + num { @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } } + rawnum { @PageNum } + parity { "Odd" } + // @PageHeaders.@Start @RunningOddTopHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } + } + //@MidGap + @OddBodyMargins { + @AtTop + //@MidGap @OddFullPageSection + } + //1rt @OneRow + { + //@MidGap @PageHeaders.@Start @RunningOddFootHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } + } + } + } + } + + def @RunningEvenPageList + named @ColumnNumber {} + named @PageHeaders {} + right @PageNum + { + + def @OrdinaryEvenPage + { + @Runner&&following @Open + { + @PageMarker + num { @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } } + rawnum { @PageNum } + parity { "Even" } + // @PageHeaders.@Start @RunningEvenTopHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } + } + //@MidGap + @EvenBodyMargins { + @PageEvenTopSection @Orient + //@MidGap @ChooseColList @ColumnNumber + } + //1rt @OneRow + { // @EvenBodyMargins @PageFootSection + //@MidGap @PageHeaders.@Start @RunningEvenFootHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } + } + } + } + } + + def @FullPageEvenPage + { + @Runner&&following @Open + { + @PageMarker + num { @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } } + rawnum { @PageNum } + parity { "Even" } + // @PageHeaders.@Start @RunningEvenTopHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } + } + //@MidGap + @EvenBodyMargins @EvenFullPageSection + //1rt @OneRow + { + //@MidGap @PageHeaders.@Start @RunningEvenFootHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @PageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } + } + } + } + } + + @FootNoteThrough @NoDo @BeginFootNoteCounter + // {} @EvenPage @Orient { @Orient } + { + @OrdinaryEvenPage ||{@OrientedWidth @Orient} @FullPageEvenPage + } + // @RunningPageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @Orient } + @Next @PageNum + } + + @FootNoteThrough @NoDo @BeginFootNoteCounter + // { extra @Then @OddBodyMargins @ZeroColList @ColumnNumber } @OddPage @Orient { @Orient } + { + @OrdinaryOddPage ||{@OrientedWidth @Orient} @FullPageOddPage + } + // @RunningEvenPageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Next @PageNum + } + + def @RunningIntroPageList + named @ColumnNumber {} + named @PageHeaders {} + named @AtTop { @Null } + named @Orient {} + named extra { No } + right @PageNum + { + @FootNoteThrough @NoDo @BeginFootNoteCounter + // { extra @Then @OddBodyMargins @ZeroIntroColList @ColumnNumber } @OddPage @Orient { @Orient } + @Runner&&following @Open + { + @PageMarker + num { @MakePageNum + numbers { @IntroPageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } } + rawnum { @PageNum } + parity { "Odd" } + // @PageHeaders.@Start @RunningIntroOddTopHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @IntroPageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } + } + //@MidGap + @OddBodyMargins { + @AtTop + //@MidGap @PageIntroOddTopSection @Orient + //@MidGap @IntroColList @ColumnNumber + } + //1rt @OneRow + { // @OddBodyMargins @PageFootSection + //@MidGap @PageHeaders.@Start @RunningIntroOddFootHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @IntroPageNumbers } + rawnum { @PageNum } + prefix { @Prefix } + owner { @Owner } + } + } + } + // @FootNoteThrough @NoDo @BeginFootNoteCounter + // {} @EvenPage @Orient { @Orient } + @Runner&&following @Open + { + @PageMarker + num { @MakePageNum + numbers { @IntroPageNumbers } + rawnum { @Next @PageNum } + prefix { @Prefix } + owner { @Owner } } + rawnum { @Next @PageNum } + parity { "Even" } + // @PageHeaders.@Start @RunningIntroEvenTopHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @IntroPageNumbers } + rawnum { @Next @PageNum } + prefix { @Prefix } + owner { @Owner } + } + //@MidGap + @EvenBodyMargins { + @PageIntroEvenTopSection @Orient + //@MidGap @ChooseIntroColList @ColumnNumber + } + //1rt @OneRow + { // @EvenBodyMargins @PageFootSection + //@MidGap @PageHeaders.@Start @RunningIntroEvenFootHeader + @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } + @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } + { + @MakePageNum + numbers { @IntroPageNumbers } + rawnum { @Next @PageNum } + prefix { @Prefix } + owner { @Owner } + } + } + } + // @RunningIntroPageList + @PageHeaders { @PageHeaders } + @ColumnNumber { @ColumnNumber } + @Orient { @Orient } + @Next @Next @PageNum + } + + def @PageList + named @ColumnNumber {} + named @PageHeaders {} + named extra { No } + named @Orient {} + named @AtTop { @Null } + right @FirstPageNum + { + @PageHeaders @Case { + { None Simple } @Yield @SimplePageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @Orient } + extra { extra } + @AtTop { @AtTop } + @FirstPageNum + { Running Titles NoTitles } @Yield @RunningPageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @Orient } + extra { extra } + @AtTop { @AtTop } + @FirstPageNum + } + // + @PageMark last.page + } + + def @IntroPageList + named @ColumnNumber {} + named @PageHeaders {} + named @Orient {} + named extra { No } + named @AtTop { @Null } + right @FirstPageNum + { + @PageHeaders @Case { + { None Simple } @Yield @SimpleIntroPageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @Orient } + extra { extra } + @AtTop { @AtTop } + @FirstPageNum + { Running Titles NoTitles } @Yield @RunningIntroPageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @Orient } + extra { extra } + @AtTop { @AtTop } + @FirstPageNum + } + } + + def @ContinuousPageList + named @Orient {} + { + {@OrientedWidth @Orient} @Wide + { //@TopMargin ||@EvenLeftMargin + { + @BeginFootNoteCounter + // @ColPlace + //@FootAboveGap @ColFootNoteSection + //@FootAboveGap @PageFootNoteSection + } + ||@EvenRightMargin //@FootMargin + } + } + + + ########################################################################### + # # + # Table of contents (including lists of figures and tables). # + # # + ########################################################################### + + def @ContentsItem + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + named pregap { @ContentsGap } + named postgap { 0c } + named protect { No } + { +# def @Leaders { @ContentsLeader &@ContentsLeaderGap @Leaders } + + def @Leaders { @ContentsLeaderGap @Wide {} & @ContentsLeader & @Leaders } + + def @OptionalCrossLink right x + { + crosstag @Case { + "" @Yield x + else @Yield { crosstag @CrossLink x } + } + } + + def @RightPart + { + @ContentsRightWidth @Wide { + &1rt { @OptionalCrossLink pagenum //0.5vx } + } + } + +# def @Item +# { +# |indent @OptionalCrossLink number @ContentsFormat @HExpand { +# title & @ContentsLeaderGap @Wide &1rt @OneCol { +# @Leaders & @RightPart &0io +# } +# } +# |@ContentsRightWidth +# } + + def @Item + { + |indent @OptionalCrossLink number @ContentsFormat @HExpand { + title &1rt @OneCol { + @Leaders & @RightPart &0io + } + } + |@ContentsRightWidth + } + + //pregap + //0.5vx + protect @Case { + No @Yield @Item + Yes @Yield @Protect @Item + } + //postgap + } + + def @ContentsPlace { @Galley } + def @FigureContentsPlace { @Galley } + def @TableContentsPlace { @Galley } + def @FloaterContentsPlace { @Galley } + + def @SendContents into { @ContentsPlace&&foll_or_prec } + right x + { + x + } + + def @SendFigureContents into { @FigureContentsPlace&&foll_or_prec } + right x + { + x + } + + def @SendTableContents into { @TableContentsPlace&&foll_or_prec } + right x + { + x + } + + def @SendFloaterContents into { @FloaterContentsPlace&&foll_or_prec } + right x + { + x + } + + def @ContentsEntry + left wanted + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + named pregap { @ContentsGap } + named postgap { 0c } + { + @MakeContents.wanted @Case { + Yes.Yes @Yield { @SendContents @ContentsItem + indent { indent } + crosstag { crosstag } + number { number } + title { title } + pagenum { pagenum } + pregap { pregap } + postgap { postgap } + } + else @Yield @Null + } + } + + def @FigureContentsEntry + left wanted + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + named pregap { @ContentsGap } + named postgap { 0c } + { + @MakeFigureContents.wanted @Case { + Yes.Yes @Yield { @SendFigureContents @ContentsItem + indent { indent } + crosstag { crosstag } + number { number } + title { title } + pagenum { pagenum } + pregap { pregap } + postgap { postgap } + } + else @Yield @Null + } + } + + def @TableContentsEntry + left wanted + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + named pregap { @ContentsGap } + named postgap { 0c } + { + @MakeTableContents.wanted @Case { + Yes.Yes @Yield { @SendTableContents @ContentsItem + indent { indent } + crosstag { crosstag } + number { number } + title { title } + pagenum { pagenum } + pregap { pregap } + postgap { postgap } + } + else @Yield @Null + } + } + + def @FloaterContentsEntry + left wanted + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + named pregap { @ContentsGap } + named postgap { 0c } + { + @MakeFloaterContents.wanted @Case { + Yes.Yes @Yield { @SendFloaterContents @ContentsItem + indent { indent } + crosstag { crosstag } + number { number } + title { title } + pagenum { pagenum } + pregap { pregap } + postgap { postgap } + } + else @Yield @Null + } + } + + def @MajorContentsEntry + left wanted + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + named pregap { @ContentsGapAbove } + named postgap { @ContentsGapBelow } + { + @MakeContents.wanted @Case { + Yes.Yes @Yield { @SendContents @ContentsItem + indent { indent } + crosstag { crosstag } + number { @ContentsFont @Font number } + title { @ContentsFont @Font title } + pagenum { pagenum } + pregap { pregap } + postgap { postgap } + protect { Yes } + } + else @Yield @Null + } + } + + def @VeryMajorContentsEntry + left wanted + named indent { 0.5rt } + named title {} + named pregap { @ContentsPartGapAbove } + named postgap { @ContentsPartGapBelow } + { + def item + { + //pregap + //0.5vx + |indent @ContentsFont @Font @OneCol title | + //0.5vx + //postgap + } + + @MakeContents.wanted @Case { + Yes.Yes @Yield @SendContents item + else @Yield @Null + } + + } + + def @ContentsSection + { + def @ContentsList { @ContentsPlace // @ContentsList } + + @MakeContents @Case { + { Yes Bypass } @Yield @ContentsList + else @Yield @Null + } + } + + def @FigureContentsSection + { + def @FigureContentsList { @FigureContentsPlace // @FigureContentsList } + + @MakeFigureContents @Case { + { Yes Bypass } @Yield @FigureContentsList + else @Yield @Null + } + } + + def @TableContentsSection + { + def @TableContentsList { @TableContentsPlace // @TableContentsList } + + @MakeTableContents @Case { + { Yes Bypass } @Yield @TableContentsList + else @Yield @Null + } + } + + def @FloaterContentsSection + { + def @FloaterContentsList { @FloaterContentsPlace // @FloaterContentsList } + + @MakeFloaterContents @Case { + { Yes Bypass } @Yield @FloaterContentsList + else @Yield @Null + } + } + + ########################################################################### + # # + # Bypass table of contents. # + # # + ########################################################################### + + def @BypassContentsEntry into { @ContentsPlace&&preceding } + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + { + @MakeContents @Case { + Bypass @Yield { @ContentsItem + indent { indent } + crosstag { crosstag } + number { number } + title { title } + pagenum { pagenum } + pregap { @ContentsGap } + postgap { 0c } + } + else @Yield @Null + } + } + + def @BypassFigureContentsEntry into { @FigureContentsPlace&&preceding } + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + { + @MakeFigureContents @Case { + Bypass @Yield { @ContentsItem + indent { indent } + crosstag { crosstag } + number { number } + title { title } + pagenum { pagenum } + pregap { @ContentsGap } + postgap { 0c } + } + else @Yield @Null + } + } + + def @BypassTableContentsEntry into { @TableContentsPlace&&preceding } + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + { + @MakeTableContents @Case { + Bypass @Yield { @ContentsItem + indent { indent } + crosstag { crosstag } + number { number } + title { title } + pagenum { pagenum } + pregap { @ContentsGap } + postgap { 0c } + } + else @Yield @Null + } + } + + def @BypassFloaterContentsEntry into { @FloaterContentsPlace&&preceding } + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + { + @MakeFloaterContents @Case { + Bypass @Yield { @ContentsItem + indent { indent } + crosstag { crosstag } + number { number } + title { title } + pagenum { pagenum } + pregap { @ContentsGap } + postgap { 0c } + } + else @Yield @Null + } + } + + def @BypassMajorContentsEntry into { @ContentsPlace&&preceding } + named indent { 0f } + named crosstag {} + named number {} + named title {} + named pagenum {} + { + @MakeContents @Case { + Bypass @Yield { @ContentsItem + indent { indent } + crosstag { crosstag } + number { @B number } + title { @B title } + pagenum { pagenum } + pregap { @ContentsGapAbove } + postgap { @ContentsGapBelow } + } + else @Yield @Null + } + } + + + ########################################################################### + # # + # Endnotes. # + # # + ########################################################################### + + export num + def @EndNoteList + named @Tag {} + right num + { + @Galley //@EndNoteGap @EndNoteList @Next num + } + + def endtag right num + { + @BackEnd @Case { + PlainText @Yield { + ({@EndNoteNumbers @Num num}) + } + else @Yield { + +0.3v @VShift 0.8f @Font @EndNoteNumbers @Num num + } + } + } + + def @EndNote + named @Tag {} + right x + { + def ftag + { + @EndNoteFont @Font @EndNoteList&&@Tag @Open { endtag num } + } + + def @ENote into { @EndNoteList&&following } + { + @EndNoteFont @Font @EndNoteBreak @Break + { { @EndNoteList&&preceding @Tagged @Tag ftag } @EndNoteFormat x } + } + + @Null & @EndNoteFont @Font ftag & @ENote + } + + + ########################################################################### + # # + # Margin Notes. # + # # + ########################################################################### + + # moved to bsf + #def @ZeroSize right x + #{ + # @HContract @VContract { ^/0io |0io @OneCol @OneRow x |0io /0io } + #} + + def @MargPut + left parity + right x + { + @MarginNoteFont @Font @MarginNoteBreak @Break @ZeroSize { + @BackEnd @Case { + PlainText @Yield "" + PostScript @Yield { + { parity "LoutMargShift gsave" // "grestore" } @Graphic + { + |@MarginNoteHGap @MarginNoteWidth @Wide @OneRow x + |@MarginNoteHGap //@MarginNoteVGap + } + } + PDF @Yield { "% @MargPut/LoutMargShift UNIMPLEMENTED" @Graphic { + |@MarginNoteHGap @MarginNoteWidth @Wide @OneRow x + |@MarginNoteHGap //@MarginNoteVGap + } # VT: PDF currently has no output + } + } + } + } + + def @LeftNote right x { @Null & 0 @MargPut x } + def @RightNote right x { @Null & 1 @MargPut x } + def @OuterNote right x { @Null & 2 @MargPut x } + def @InnerNote right x { @Null & 3 @MargPut x } + + + ########################################################################### + # # + # @Place: places an object at an arbitrary point on the page. # + # # + ########################################################################### + +# +# VT: the expressions in the braces will work for PostScript but not for PDF +# they should be modified in the way the "named c { " cm" }" blocks were modified above +# but since the point of @Place is to output a matrix (?), I have not implemented this change +# + def @OldPlace + import @PSLengths named x + named "+" precedence 96 associativity left left a right b { a b "add" } + named "-" precedence 96 associativity left left a right b { a b "sub" } + named "/" precedence 97 associativity left left a right b { a b "div" } + named "*" precedence 98 associativity left left a right b { a b "mul" } + # named c precedence 99 left a { a "cm" } + # named i precedence 99 left a { a "in" } + # named e precedence 99 left a { a "em" } + # named p precedence 99 left a { a "pt" } + # named f precedence 99 left a { a "ft" } + # named s precedence 99 left a { a "sp" } + # named v precedence 99 left a { a "vs" } + # named cm precedence 99 left a { a "cm" } + # named in precedence 99 left a { a "in" } + # named em precedence 99 left a { a "em" } + # named pt precedence 99 left a { a "pt" } + # named ft precedence 99 left a { a "ft" } + # named sp precedence 99 left a { a "sp" } + # named vs precedence 99 left a { a "vs" } + { 0 } + import @PSLengths named y + named "+" precedence 96 associativity left left a right b { a b "add" } + named "-" precedence 96 associativity left left a right b { a b "sub" } + named "/" precedence 97 associativity left left a right b { a b "div" } + named "*" precedence 98 associativity left left a right b { a b "mul" } + # named c precedence 99 left a { a "cm" } + # named i precedence 99 left a { a "in" } + # named e precedence 99 left a { a "em" } + # named p precedence 99 left a { a "pt" } + # named f precedence 99 left a { a "ft" } + # named s precedence 99 left a { a "sp" } + # named v precedence 99 left a { a "vs" } + # named cm precedence 99 left a { a "cm" } + # named in precedence 99 left a { a "in" } + # named em precedence 99 left a { a "em" } + # named pt precedence 99 left a { a "pt" } + # named ft precedence 99 left a { a "ft" } + # named sp precedence 99 left a { a "sp" } + # named vs precedence 99 left a { a "vs" } + { 0 } + right val + { + @ZeroSize { + @BackEnd @Case { + PlainText @Yield "" + PostScript @Yield { + { "LoutPageDict begin matr setmatrix" x y "translate end gsave" + // "grestore" } @Graphic val + } + else @Yield { { "% @Place UNIMPLEMENTED" } @Graphic val # VT: PDF currently has no output + } + } + } + } + + + ########################################################################### + # # + # @Theorem, @Proof, and @EndProof # + # # + ########################################################################### + + export @Tag val + def @TheoremCounterMarker + named @Tag {} + named val {} + { + @Null + } + + def @BeginTheoremCounter + right prefix + { + @TheoremCounterMarker val { prefix @Join 0 } + } + + def @TheoremNum right tag + { + @TheoremCounterMarker&&tag @Open { @Next val } + } + + def @TheoremCounterIncrement + right tag + { + @TheoremCounterMarker&&preceding @Tagged tag + @TheoremCounterMarker val { @TheoremNum tag } + @NumberMarker @Tag { tag } @Value { @TheoremNum tag } + } + + def @Theorem + named @Tag {} + named @Title {} + right x + { + def @TheoremTitle + { + @Title @Case { + "" @Yield @Null + else @Yield @TheoremTitleFormat @Title + } + } + + { @PageMark @Tag & @TheoremCounterIncrement @Tag } @Insert + @TheoremFormat + word { theorem @WordVal @TheoremWord } + number { @TheoremNum @Tag } + title { @TheoremTitle } + body { x } + } + + macro @Proof { @B { {proof @WordVal @ProofWord}: } &2s } + + macro @EndProof { &1rt @Box {} } + + + ########################################################################### + # # + # @Definition # + # # + ########################################################################### + + export @Tag val + def @DefinitionCounterMarker + named @Tag {} + named val {} + { + @Null + } + + def @BeginDefinitionCounter + right prefix + { + @DefinitionCounterMarker val { prefix @Join 0 } + } + + def @DefinitionNum right tag + { + @DefinitionCounterMarker&&tag @Open { @Next val } + } + + def @DefinitionCounterIncrement + right tag + { + @DefinitionCounterMarker&&preceding @Tagged tag + @DefinitionCounterMarker val { @DefinitionNum tag } + @NumberMarker @Tag { tag } @Value { @DefinitionNum tag } + } + + def @Definition + named @Tag {} + named @Title {} + right x + { + def @DefinitionTitle + { + @Title @Case { + "" @Yield @Null + else @Yield @DefinitionTitleFormat @Title + } + } + + { @PageMark @Tag & @DefinitionCounterIncrement @Tag } @Insert + @DefinitionFormat + word { definition @WordVal @DefinitionWord } + number { @DefinitionNum @Tag } + title { @DefinitionTitle } + body { x } + } + + + ########################################################################### + # # + # @Claim # + # # + ########################################################################### + + export @Tag val + def @ClaimCounterMarker + named @Tag {} + named val {} + { + @Null + } + + def @BeginClaimCounter + right prefix + { + @ClaimCounterMarker val { prefix @Join 0 } + } + + def @ClaimNum right tag + { + @ClaimCounterMarker&&tag @Open { @Next val } + } + + def @ClaimCounterIncrement + right tag + { + @ClaimCounterMarker&&preceding @Tagged tag + @ClaimCounterMarker val { @ClaimNum tag } + @NumberMarker @Tag { tag } @Value { @ClaimNum tag } + } + + def @Claim + named @Tag {} + named @Title {} + right x + { + def @ClaimTitle + { + @Title @Case { + "" @Yield @Null + else @Yield @ClaimTitleFormat @Title + } + } + + { @PageMark @Tag & @ClaimCounterIncrement @Tag } @Insert + @ClaimFormat + word { claim @WordVal @ClaimWord } + number { @ClaimNum @Tag } + title { @ClaimTitle } + body { x } + } + + + ########################################################################### + # # + # @Proposition # + # # + ########################################################################### + + export @Tag val + def @PropositionCounterMarker + named @Tag {} + named val {} + { + @Null + } + + def @BeginPropositionCounter + right prefix + { + @PropositionCounterMarker val { prefix @Join 0 } + } + + def @PropositionNum right tag + { + @PropositionCounterMarker&&tag @Open { @Next val } + } + + def @PropositionCounterIncrement + right tag + { + @PropositionCounterMarker&&preceding @Tagged tag + @PropositionCounterMarker val { @PropositionNum tag } + @NumberMarker @Tag { tag } @Value { @PropositionNum tag } + } + + def @Proposition + named @Tag {} + named @Title {} + right x + { + def @PropositionTitle + { + @Title @Case { + "" @Yield @Null + else @Yield @PropositionTitleFormat @Title + } + } + + { @PageMark @Tag & @PropositionCounterIncrement @Tag } @Insert + @PropositionFormat + word { proposition @WordVal @PropositionWord } + number { @PropositionNum @Tag } + title { @PropositionTitle } + body { x } + } + + + ########################################################################### + # # + # @Lemma # + # # + ########################################################################### + + export @Tag val + def @LemmaCounterMarker + named @Tag {} + named val {} + { + @Null + } + + def @BeginLemmaCounter + right prefix + { + @LemmaCounterMarker val { prefix @Join 0 } + } + + def @LemmaNum right tag + { + @LemmaCounterMarker&&tag @Open { @Next val } + } + + def @LemmaCounterIncrement + right tag + { + @LemmaCounterMarker&&preceding @Tagged tag + @LemmaCounterMarker val { @LemmaNum tag } + @NumberMarker @Tag { tag } @Value { @LemmaNum tag } + } + + def @Lemma + named @Tag {} + named @Title {} + right x + { + def @LemmaTitle + { + @Title @Case { + "" @Yield @Null + else @Yield @LemmaTitleFormat @Title + } + } + + { @PageMark @Tag & @LemmaCounterIncrement @Tag } @Insert + @LemmaFormat + word { lemma @WordVal @LemmaWord } + number { @LemmaNum @Tag } + title { @LemmaTitle } + body { x } + } + + + ########################################################################### + # # + # @Corollary # + # # + ########################################################################### + + export @Tag val + def @CorollaryCounterMarker + named @Tag {} + named val {} + { + @Null + } + + def @BeginCorollaryCounter + right prefix + { + @CorollaryCounterMarker val { prefix @Join 0 } + } + + def @CorollaryNum right tag + { + @CorollaryCounterMarker&&tag @Open { @Next val } + } + + def @CorollaryCounterIncrement + right tag + { + @CorollaryCounterMarker&&preceding @Tagged tag + @CorollaryCounterMarker val { @CorollaryNum tag } + @NumberMarker @Tag { tag } @Value { @CorollaryNum tag } + } + + def @Corollary + named @Tag {} + named @Title {} + right x + { + def @CorollaryTitle + { + @Title @Case { + "" @Yield @Null + else @Yield @CorollaryTitleFormat @Title + } + } + + { @PageMark @Tag & @CorollaryCounterIncrement @Tag } @Insert + @CorollaryFormat + word { corollary @WordVal @CorollaryWord } + number { @CorollaryNum @Tag } + title { @CorollaryTitle } + body { x } + } + + + ########################################################################### + # # + # @Example # + # # + ########################################################################### + + export @Tag val + def @ExampleCounterMarker + named @Tag {} + named val {} + { + @Null + } + + def @BeginExampleCounter + right prefix + { + @ExampleCounterMarker val { prefix @Join 0 } + } + + def @ExampleNum right tag + { + @ExampleCounterMarker&&tag @Open { @Next val } + } + + def @ExampleCounterIncrement + right tag + { + @ExampleCounterMarker&&preceding @Tagged tag + @ExampleCounterMarker val { @ExampleNum tag } + @NumberMarker @Tag { tag } @Value { @ExampleNum tag } + } + + def @Example + named @Tag {} + named @Title {} + right x + { + def @ExampleTitle + { + @Title @Case { + "" @Yield @Null + else @Yield @ExampleTitleFormat @Title + } + } + + { @PageMark @Tag & @ExampleCounterIncrement @Tag } @Insert + @ExampleFormat + word { example @WordVal @ExampleWord } + number { @ExampleNum @Tag } + title { @ExampleTitle } + body { x } + } + + + ########################################################################### + # # + # @BeginAllCounters - begin all counters # + # # + ########################################################################### + + def @BeginAllCounters + left condition + right prefix + { + condition @Do { + @BeginTheoremCounter prefix + // @BeginDefinitionCounter prefix + // @BeginClaimCounter prefix + // @BeginPropositionCounter prefix + // @BeginLemmaCounter prefix + // @BeginCorollaryCounter prefix + // @BeginExampleCounter prefix + } + } + + + ########################################################################### + # # + # @Reference - a reference. # + # # + ########################################################################### + + export @Tag @Type @Abstract @Address @Annote @Author @Day @Edition + @HowPublished @InAuthor @InTitle @Institution @Journal @Keywords + @Label @Month @Note @Number @Organization @Page @Pages @Pinpoint + @Publisher @Title @TitleNote @TRType @URL @Volume @Year + + def @Reference + named compulsory @Tag {} + named compulsory @Type {} + named @Abstract {} + named @Address {} + named @Annote {} + named @Author {} + named @Day {} + named @Edition {} + named @HowPublished {} + named @InAuthor {} + named @InTitle {} + named @Institution {} + named @Journal {} + named @Keywords {} + named @Label {} + named @Month {} + named @Note {} + named @Number {} + named @Organization {} + named @Page {} + named @Pages {} + named @Pinpoint {} + named @Publisher {} + named @Title {} + named @TitleNote {} + named @TRType {} + named @URL + named "~" { "~" } + named "/" { "/" &0p } + named "//" { "//" &0p } {} + named @Volume {} + named @Year {} + { @Null } + + + ########################################################################### + # # + # @CiteLabel - the value of the label of a reference within a citation. # + # # + ########################################################################### + + def @CiteLabel + left label + right tag + { + tag @CrossLink @RefCiteLabels + @RefNum { @NumberOf tag } + @Tag { tag } + @Type { @Reference&&tag @Open { @Type } } + @Abstract { @Reference&&tag @Open { @Abstract } } + @Address { @Reference&&tag @Open { @Address } } + @Annote { @Reference&&tag @Open { @Annote } } + @Author { @Reference&&tag @Open { @Author } } + @Day { @Reference&&tag @Open { @Day } } + @Edition { @Reference&&tag @Open { @Edition } } + @HowPublished { @Reference&&tag @Open { @HowPublished } } + @InAuthor { @Reference&&tag @Open { @InAuthor } } + @InTitle { @Reference&&tag @Open { @InTitle } } + @Institution { @Reference&&tag @Open { @Institution } } + @Journal { @Reference&&tag @Open { @Journal } } + @Keywords { @Reference&&tag @Open { @Keywords } } + + @Label { label @Case { + "" @Yield {@Reference&&tag @Open {@Label}} + else @Yield label + } } + + @Month { @Reference&&tag @Open { @Month } } + @Note { @Reference&&tag @Open { @Note } } + @Number { @Reference&&tag @Open { @Number } } + @Organization { @Reference&&tag @Open { @Organization } } + @Page { @Reference&&tag @Open { @Page } } + @Pages { @Reference&&tag @Open { @Pages } } + @Pinpoint { @Reference&&tag @Open { @Pinpoint } } + @Publisher { @Reference&&tag @Open { @Publisher } } + @Title { @Reference&&tag @Open { @Title } } + @TitleNote { @Reference&&tag @Open { @TitleNote } } + @TRType { @Reference&&tag @Open { @TRType } } + @Volume { @Reference&&tag @Open { @Volume } } + @Year { @Reference&&tag @Open { @Year } } + } + + + ########################################################################### + # # + # @ListLabel - the value of the label of a reference within a ref list. # + # # + ########################################################################### + + def @ListLabel + left label + right tag + { + @RefListLabels + @RefNum { @NumberOf tag } + @Tag { tag } + @Type { @Reference&&tag @Open { @Type } } + @Abstract { @Reference&&tag @Open { @Abstract } } + @Address { @Reference&&tag @Open { @Address } } + @Annote { @Reference&&tag @Open { @Annote } } + @Author { @Reference&&tag @Open { @Author } } + @Day { @Reference&&tag @Open { @Day } } + @Edition { @Reference&&tag @Open { @Edition } } + @HowPublished { @Reference&&tag @Open { @HowPublished } } + @InAuthor { @Reference&&tag @Open { @InAuthor } } + @InTitle { @Reference&&tag @Open { @InTitle } } + @Institution { @Reference&&tag @Open { @Institution } } + @Journal { @Reference&&tag @Open { @Journal } } + @Keywords { @Reference&&tag @Open { @Keywords } } + + @Label { label @Case { + "" @Yield {@Reference&&tag @Open {@Label}} + else @Yield label + } } + + @Month { @Reference&&tag @Open { @Month } } + @Note { @Reference&&tag @Open { @Note } } + @Number { @Reference&&tag @Open { @Number } } + @Organization { @Reference&&tag @Open { @Organization } } + @Page { @Reference&&tag @Open { @Page } } + @Pages { @Reference&&tag @Open { @Pages } } + @Pinpoint { @Reference&&tag @Open { @Pinpoint } } + @Publisher { @Reference&&tag @Open { @Publisher } } + @Title { @Reference&&tag @Open { @Title } } + @TitleNote { @Reference&&tag @Open { @TitleNote } } + @TRType { @Reference&&tag @Open { @TRType } } + @Volume { @Reference&&tag @Open { @Volume } } + @Year { @Reference&&tag @Open { @Year } } + } + + + ########################################################################### + # # + # @SortKey - the value of the sort key of a reference. # + # # + ########################################################################### + + def @SortKey + left label + right tag + { + @RefListSortKey + @Tag { tag } + @Type { @Reference&&tag @Open { @Type } } + @Abstract { @Reference&&tag @Open { @Abstract } } + @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 } } + @InAuthor { @Reference&&tag @Open { @InAuthor } } + @InTitle { @Reference&&tag @Open { @InTitle } } + @Institution { @Reference&&tag @Open { @Institution } } + @Journal { @Reference&&tag @Open { @Journal } } + @Keywords { @Reference&&tag @Open { @Keywords } } + + @Label { label @Case { + "" @Yield {@Reference&&tag @Open {@Label}} + else @Yield label + } + } + + @Month { @Reference&&tag @Open { @Month } } + @Note { @Reference&&tag @Open { @Note } } + @Number { @Reference&&tag @Open { @Number } } + @Organization { @Reference&&tag @Open { @Organization } } + @Page { @Reference&&tag @Open { @Page } } + @Pages { @Reference&&tag @Open { @Pages } } + @Pinpoint { @Reference&&tag @Open { @Pinpoint } } + @Publisher { @Reference&&tag @Open { @Publisher } } + @Title { @Reference&&tag @Open { @Title } } + @TitleNote { @Reference&&tag @Open { @TitleNote } } + @TRType { @Reference&&tag @Open { @TRType } } + @Volume { @Reference&&tag @Open { @Volume } } + @Year { @Reference&&tag @Open { @Year } } + } + + + ########################################################################### + # # + # @RefStyle - a reference printing style. # + # # + ########################################################################### + + export @Style + def @RefStyle + left @Tag + named @Style right reftag {} + {} + + + ########################################################################### + # # + # @RefPrint - prints reference with tag reftag in appropriate style. # + # # + ########################################################################### + + def @RefPrint right reftag + { & @RefStyle&&{ @Reference&&reftag @Open { @Type } } + @Open { @Style reftag } & + } + + + ########################################################################### + # # + # @ReferencesSection and @ChapReferencesSection - a list of references. # + # # + ########################################################################### + + def @RefPlace { @Galley } + def @ChapRefPlace { @Galley } + + def @BypassRefPlace { @Galley } + def @BypassChapRefPlace { @Galley } + + def @ReferencesSection + { + def @RefList right num + { + @NumberMarker @Value { @RefNumbers @Num num } & | @RefPlace + //@RefListGap @RefList @Next num + } + + def @BypassRefList + { + @BypassRefPlace //@RefListGap @BypassRefList + } + + @RefList 1 + //@RefListGap + @BypassRefList + } + + def @ChapReferencesSection + { + def @ChapRefList right num + { + @NumberMarker @Value { @RefNumbers @Num num } & | @ChapRefPlace + //@RefListGap @ChapRefList @Next num + } + + def @BypassChapRefList + { + @BypassChapRefPlace //@RefListGap @BypassChapRefList + } + + @ChapRefList 1 + //@RefListGap + @BypassChapRefList + } + + + ########################################################################### + # # + # @RefHeading - heading for reference lists. # + # # + ########################################################################### + + def @RefHeading right x + { x @Case { + references @Yield @Word&&references + bibliography @Yield @Word&&bibliography + else @Yield x + } + } + + + ####################################################################### + # # + # @ChapRefSection # + # # + ####################################################################### + + def @ChapRefSection + { + @Heading @RefHeading @ChapRefListTitle + @DP + @ChapReferencesSection + } + + + ########################################################################### + # # + # @SendRef and @ChapSendRef - send one reference to the reference list. # + # # + ########################################################################### + + def @RefItem + left lab + right ref + { + def @ZeroWidth right x { &0io @OneCol x &0io } + + @RefListFormat @Case { + NoLabels @Yield { ref } + Labels @Yield { @ZeroWidth lab |@RefListLabelWidth ref } + DropLabels @Yield { lab //1vx |@RefListLabelWidth ref } + InLabels @Yield { lab & 2s @Wide & ref } + } + } + + + def @RefListItem + left label + right tag + { + @RefListFont @Font @RefListBreak @Break { + @NumberMarker&&preceding @Tagged tag & @PageMark tag + |@RefListIndent {label @ListLabel tag} @RefItem {@RefPrint tag} + |@RefListRightIndent + } + } + + + def @SendRef into { @RefPlace&&foll_or_prec } + left label + right tag + { + def @Key { label @SortKey tag } + + # no @Merge i.e. omit duplicates + + label @RefListItem tag + } + + + def @ChapSendRef into { @ChapRefPlace&&foll_or_prec } + left label + right tag + { + def @Key { label @SortKey tag } + + # no @Merge i.e. omit duplicates + + label @RefListItem tag + } + + + ########################################################################### + # # + # @Ref (bare citation) and its variants. # + # # + ########################################################################### + + def @Ref + named label {} + right tag + { + @MakeReferences @Case { + Yes @Yield { label @CiteLabel tag & label @SendRef tag } + else @Yield @Null + } + } + + def @NoRef + named label {} + right tag + { + @MakeReferences @Case { + Yes @Yield { label @SendRef tag } + else @Yield @Null + } + } + + def @ChapRef + named label {} + right tag + { + @MakeReferences @Case { + Yes @Yield { label @CiteLabel tag & label @ChapSendRef tag } + else @Yield @Null + } + } + + def @NoChapRef + named label {} + right tag + { + @MakeReferences @Case { + Yes @Yield { label @ChapSendRef tag } + else @Yield @Null + } + } + + + ########################################################################### + # # + # Bypass references. # + # # + ########################################################################### + + def @BypassReference into { @BypassRefPlace&&preceding } + named label {} + named value {} + { + @MakeReferences @Case { + Bypass @Yield { label @RefItem value } + else @Yield @Null + } + } + + def @BypassChapReference into { @BypassChapRefPlace&&preceding } + named label {} + named value {} + { + @MakeReferences @Case { + Bypass @Yield { label @RefItem value } + else @Yield @Null + } + } + + + ########################################################################### + # # + # @Cite (citation) and its variants. # + # # + ########################################################################### + + export "$" "," ";" + def @Cite body cite + { + macro "$" { @Ref } + def "," precedence 90 left x { x"," } + def ";" precedence 90 left x { x";" } + + @MakeReferences @Case { + Yes @Yield { + @RefCiteStyle cite + } + else @Yield @Null + } + } + + export "$" "," ";" + def @NoCite body cite + { + macro "$" { @NoRef } + def "," precedence 90 left x { x"," } + def ";" precedence 90 left x { x";" } + + @MakeReferences @Case { + Yes @Yield { cite } + else @Yield @Null + } + } + + export "$" "," ";" + def @ChapCite body cite + { + macro "$" { @ChapRef } + def "," precedence 90 left x { x"," } + def ";" precedence 90 left x { x";" } + + @MakeReferences @Case { + Yes @Yield { @RefCiteStyle cite } + else @Yield @Null + } + } + + export "$" "," ";" + def @NoChapCite body cite + { + macro "$" { @NoChapRef } + def "," precedence 90 left x { x } + def ";" precedence 90 left x { x";" } + + @MakeReferences @Case { + Yes @Yield { cite } + else @Yield @Null + } + } + + ########################################################################### + # # + # Floating figures. # + # # + ########################################################################### + + export @Tag prefix + def @FigurePrefixMarker + named @Tag {} + named prefix {} + { + @Null + } + + export @Tag count + def @FigureCounterMarker + named @Tag {} + named count {} + { + @Null + } + + def @RawFigureNum right tag + { + @FigureCounterMarker&&tag @Open { @Next count } + } + + def @FigureCounterIncrement + right tag + { + @FigureCounterMarker&&preceding @Tagged tag + // @FigurePrefixMarker&&preceding @Tagged tag + // @FigureCounterMarker count { @RawFigureNum tag } + // @NumberMarker @Tag { tag } + @Value { { @FigurePrefixMarker&&tag @Open { prefix } } + @Join {@FigureNumbers @Num @RawFigureNum tag} + } + } + + def @BeginFigureCounter + left condition + right prefix + { + condition @Do { + @FigurePrefixMarker prefix { prefix } + // @FigureCounterMarker count { 0 } + } + } + + def @EndFigureList { @Galley //@MidGap @EndFigureList } + + def @Figure + named @Tag {} + named @Caption { dft } + named @ShortCaption { dft } + named @CaptionPos { @FigureCaptionPos } + named @Format + named @II right x { |@DisplayIndent x | } + named @QQ right x { |@DisplayIndent x |@DisplayIndent } + named @CC right x { |0.5rt x | } + named @RR right x { |1.0rt x | } + right @Body { @FigureFormat @Body } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @OnePage { dft } + named @Location { @FigureLocation } + right @Body + { + def @FigureNumber + { + @BypassNumber @Dft @NumberOf @Tag + } + + def @ContentsCaption + { + @ShortCaption @Dft @Caption + } + + def @OnePg + { + @OnePage @Case { + { No no } @Yield No + { Yes yes } @Yield Yes + dft @Yield { @Location @Case { + PageTop @Yield No + EvenPageTop @Yield No + FullPage @Yield No + EvenFullPage @Yield No + PageFoot @Yield Yes + ColTop @Yield No + ColFoot @Yield Yes + ColEnd @Yield No + Display @Yield Yes + AfterLine @Yield Yes + TryAfterLine @Yield Yes + Raw @Yield No + } + } + } + } + + def @CaptionState + { + @Caption @Case { + dft @Yield None + else @Yield { @CaptionPos @Case { + { Below below } @Yield Below + { Above above } @Yield Above + } } + } + } + + #def @FigureLabel + #{ + # @FigureNumbers @Case { + # No @Yield @Null + # else @Yield { + # @CaptionFormat { {figure @WordVal @FigureWord} @NumSep @FigureNumber } + # } + # } + #} + + def @CaptionVal + { + @FigureCaptionFont @Font @FigureCaptionBreak @Break + { ||0.5rt @FigureCaptionFormat + word { figure @WordVal @FigureWord } + number { @FigureNumber } + caption { @Caption } + } + } + + def @FigureVal + { + @InitialLanguage @Language + { + @MakeFigureContents @FigureContentsEntry + indent { 0f } + crosstag { @Tag } + number { @FigureNumber } + title { @InitialLanguage @Language @ContentsCaption } + pagenum { @PageOf @Tag } + // @FigureCounterIncrement @Tag + // @TitleMarker @Tag { @Tag } @Value { @Caption } + // @Body + // @PageMark @Tag + } + } + + def @FigureTarget + { + @Location @Case { + PageTop @Yield @PageTopPlace&&following + EvenPageTop @Yield @PageTopPlace&&following + FullPage @Yield @FullPagePlace&&following + EvenFullPage @Yield @FullPagePlace&&following + PageFoot @Yield @PageFootAndTopPlace&&following + ColTop @Yield @ColTopPlace&&following + ColFoot @Yield @ColFootAndTopPlace&&following + ColEnd @Yield @EndFigureList&&following + Display @Yield @AfterLinePlace&&following + AfterLine @Yield @AfterLinePlace&&following + TryAfterLine @Yield @TryAfterLinePlace&&following + } + } + + def @SendEncl into { @FigureTarget } + right x + { + def @Enclose right x + { + @OnePg @Case { + No @Yield @Format x + Yes @Yield x + } + } + + x + } + + def @Send into { @FigureTarget } + right x + { + x + } + + def @EvenFullPageSend into { @EvenFullPagePlace&&following } + right x + { + @OneRow @HExpand x + } + + def @EvenPageSend into { @EvenPagePlace&&following } + right x + { + @OneRow @HExpand x + } + + def @RawFigureVal + { + @OnePg.@CaptionState @Case + { + Yes.Below @Yield @OneRow { @Format @FigureVal @DP @CaptionVal } + Yes.Above @Yield @OneRow { @CaptionVal @DP @Format @FigureVal } + Yes.None @Yield @OneRow { @Format @FigureVal } + No.Below @Yield { @Format @FigureVal @DP @CaptionVal } + No.Above @Yield { @CaptionVal @DP @Format @FigureVal } + No.None @Yield { @Format @FigureVal } + } + } + + def @NonRawFigureVal + { + @OnePg.@CaptionState @Case + { + Yes.Below @Yield { + @Send @OneRow @HExpand { @Format @FigureVal @DP @CaptionVal // @DupRunner} + } + Yes.Above @Yield { + @Send @OneRow @HExpand { @CaptionVal @DP @Format @FigureVal // @DupRunner} + } + Yes.None @Yield { + @Send @OneRow @HExpand { @Format @FigureVal // @DupRunner } + } + No.Below @Yield { + @SendEncl { @FigureVal // @Send { @CaptionVal // @DupRunner } } + } + No.Above @Yield { + @Send { @CaptionVal // @SendEncl { @FigureVal // @DupRunner } } + } + No.None @Yield { + @SendEncl { @FigureVal // @DupRunner } + } + } + } + + @Location @Case { + Raw @Yield @RawFigureVal + Display @Yield { @NonRawFigureVal &1rt } + EvenPageTop @Yield @EvenPageSend @NonRawFigureVal + EvenFullPage @Yield @EvenFullPageSend @NonRawFigureVal + else @Yield @NonRawFigureVal + } + } + + + ########################################################################### + # # + # Floating tables (exact clone of figure code immediately above). # + # # + ########################################################################### + + export @Tag prefix + def @TablePrefixMarker + named @Tag {} + named prefix {} + { + @Null + } + + export @Tag count + def @TableCounterMarker + named @Tag {} + named count {} + { + @Null + } + + def @RawTableNum right tag + { + @TableCounterMarker&&tag @Open { @Next count } + } + + def @TableCounterIncrement + right tag + { + @TableCounterMarker&&preceding @Tagged tag + // @TablePrefixMarker&&preceding @Tagged tag + // @TableCounterMarker count { @RawTableNum tag } + // @NumberMarker @Tag { tag } + @Value { { @TablePrefixMarker&&tag @Open { prefix } } + @Join {@TableNumbers @Num @RawTableNum tag} + } + } + + def @BeginTableCounter + left condition + right prefix + { + condition @Do { + @TablePrefixMarker prefix { prefix } + // @TableCounterMarker count { 0 } + } + } + + def @EndTableList { @Galley //@MidGap @EndTableList } + + def @Table + named @Tag {} + named @Caption { dft } + named @ShortCaption { dft } + named @CaptionPos { @TableCaptionPos } + named @Format + named @II right x { |@DisplayIndent x | } + named @QQ right x { |@DisplayIndent x |@DisplayIndent } + named @CC right x { |0.5rt x | } + named @RR right x { |1.0rt x | } + right @Body { @TableFormat @Body } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @OnePage { dft } + named @Location { @TableLocation } + right @Body + { + def @TableNumber + { + @BypassNumber @Dft @NumberOf @Tag + } + + def @ContentsCaption + { + @ShortCaption @Dft @Caption + } + + def @OnePg + { + @OnePage @Case { + { No no } @Yield No + { Yes yes } @Yield Yes + dft @Yield { @Location @Case { + PageTop @Yield No + EvenPageTop @Yield No + FullPage @Yield No + EvenFullPage @Yield No + PageFoot @Yield Yes + ColTop @Yield No + ColFoot @Yield Yes + ColEnd @Yield No + Display @Yield Yes + AfterLine @Yield Yes + TryAfterLine @Yield Yes + Raw @Yield No + } + } + } + } + + def @CaptionState + { + @Caption @Case { + dft @Yield None + else @Yield { @CaptionPos @Case { + { Below below } @Yield Below + { Above above } @Yield Above + } } + } + } + + def @CaptionVal + { + @TableCaptionFont @Font @TableCaptionBreak @Break + { ||0.5rt @TableCaptionFormat + word { table @WordVal @TableWord } + number { @TableNumber } + caption { @Caption } + } + } + + def @TableVal + { + @InitialLanguage @Language + { + @MakeTableContents @TableContentsEntry + indent { 0f } + crosstag { @Tag } + number { @TableNumber } + title { @InitialLanguage @Language @ContentsCaption } + pagenum { @PageOf @Tag } + // @TableCounterIncrement @Tag + // @TitleMarker @Tag { @Tag } @Value { @Caption } + // @Body + // @PageMark @Tag + } + } + + def @TableTarget + { + @Location @Case { + PageTop @Yield @PageTopPlace&&following + EvenPageTop @Yield @PageTopPlace&&following + FullPage @Yield @FullPagePlace&&following + EvenFullPage @Yield @FullPagePlace&&following + PageFoot @Yield @PageFootAndTopPlace&&following + ColTop @Yield @ColTopPlace&&following + ColFoot @Yield @ColFootAndTopPlace&&following + ColEnd @Yield @EndTableList&&following + Display @Yield @AfterLinePlace&&following + AfterLine @Yield @AfterLinePlace&&following + TryAfterLine @Yield @TryAfterLinePlace&&following + } + } + + def @SendEncl into { @TableTarget } + right x + { + def @Enclose right x + { + @OnePg @Case { + No @Yield @Format x + Yes @Yield x + } + } + + x + } + + def @Send into { @TableTarget } + right x + { + x + } + + def @EvenFullPageSend into { @EvenFullPagePlace&&following } + right x + { + @OneRow @HExpand x + } + + def @EvenPageSend into { @EvenPagePlace&&following } + right x + { + @OneRow @HExpand x + } + + def @RawTableVal + { + @OnePg.@CaptionState @Case + { + Yes.Below @Yield @OneRow { @Format @TableVal @DP @CaptionVal } + Yes.Above @Yield @OneRow { @CaptionVal @DP @Format @TableVal } + Yes.None @Yield @OneRow { @Format @TableVal } + No.Below @Yield { @Format @TableVal @DP @CaptionVal } + No.Above @Yield { @CaptionVal @DP @Format @TableVal } + No.None @Yield { @Format @TableVal } + } + } + + def @NonRawTableVal + { + @OnePg.@CaptionState @Case + { + Yes.Below @Yield { + @Send @OneRow @HExpand { @Format @TableVal @DP @CaptionVal // @DupRunner} + } + Yes.Above @Yield { + @Send @OneRow @HExpand { @CaptionVal @DP @Format @TableVal // @DupRunner} + } + Yes.None @Yield { + @Send @OneRow @HExpand { @Format @TableVal // @DupRunner } + } + No.Below @Yield { + @SendEncl { @TableVal // @Send { @CaptionVal // @DupRunner } } + } + No.Above @Yield { + @Send { @CaptionVal // @SendEncl { @TableVal // @DupRunner } } + } + No.None @Yield { + @SendEncl { @TableVal // @DupRunner } + } + } + } + + @Location @Case { + Raw @Yield @RawTableVal + Display @Yield { @NonRawTableVal &1rt } + EvenPageTop @Yield @EvenPageSend @NonRawTableVal + EvenFullPage @Yield @EvenFullPageSend @NonRawTableVal + else @Yield @NonRawTableVal + } + } + + + ########################################################################### + # # + # Floating floaters (exact clone of figure and table code above). # + # # + ########################################################################### + + export @Tag prefix + def @FloaterPrefixMarker + named @Tag {} + named prefix {} + { + @Null + } + + export @Tag count + def @FloaterCounterMarker + named @Tag {} + named count {} + { + @Null + } + + def @RawFloaterNum right tag + { + @FloaterCounterMarker&&tag @Open { @Next count } + } + + def @FloaterCounterIncrement + right tag + { + @FloaterCounterMarker&&preceding @Tagged tag + // @FloaterPrefixMarker&&preceding @Tagged tag + // @FloaterCounterMarker count { @RawFloaterNum tag } + // @NumberMarker @Tag { tag } + @Value { { @FloaterPrefixMarker&&tag @Open { prefix } } + @Join {@FloaterNumbers @Num @RawFloaterNum tag} + } + } + + def @BeginFloaterCounter + left condition + right prefix + { + condition @Do { + @FloaterPrefixMarker prefix { prefix } + // @FloaterCounterMarker count { 0 } + } + } + + def @EndFloaterList { @Galley //@MidGap @EndFloaterList } + + def @Floater + named @Tag {} + named @Caption { dft } + named @ShortCaption { dft } + named @CaptionPos { @FloaterCaptionPos } + named @Format + named @II right x { |@DisplayIndent x | } + named @QQ right x { |@DisplayIndent x |@DisplayIndent } + named @CC right x { |0.5rt x | } + named @RR right x { |1.0rt x | } + right @Body { @FloaterFormat @Body } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @OnePage { dft } + named @Location { @FloaterLocation } + right @Body + { + def @FloaterNumber + { + @BypassNumber @Dft @NumberOf @Tag + } + + def @ContentsCaption + { + @ShortCaption @Dft @Caption + } + + def @OnePg + { + @OnePage @Case { + { No no } @Yield No + { Yes yes } @Yield Yes + dft @Yield { @Location @Case { + PageTop @Yield No + EvenPageTop @Yield No + FullPage @Yield No + EvenFullPage @Yield No + PageFoot @Yield Yes + ColTop @Yield No + ColFoot @Yield Yes + ColEnd @Yield No + Display @Yield Yes + AfterLine @Yield Yes + TryAfterLine @Yield Yes + Raw @Yield No + } + } + } + } + + def @CaptionState + { + @Caption @Case { + dft @Yield None + else @Yield { @CaptionPos @Case { + { Below below } @Yield Below + { Above above } @Yield Above + } } + } + } + + def @CaptionVal + { + @FloaterCaptionFont @Font @FloaterCaptionBreak @Break + { ||0.5rt @FloaterCaptionFormat + word { floater @WordVal @FloaterWord } + number { @FloaterNumber } + caption { @Caption } + } + } + + def @FloaterVal + { + @InitialLanguage @Language + { + @MakeFloaterContents @FloaterContentsEntry + indent { 0f } + crosstag { @Tag } + number { @FloaterNumber } + title { @InitialLanguage @Language @ContentsCaption } + pagenum { @PageOf @Tag } + // @FloaterCounterIncrement @Tag + // @TitleMarker @Tag { @Tag } @Value { @Caption } + // @Body + // @PageMark @Tag + } + } + + def @FloaterTarget + { + @Location @Case { + PageTop @Yield @PageTopPlace&&following + EvenPageTop @Yield @PageTopPlace&&following + FullPage @Yield @FullPagePlace&&following + EvenFullPage @Yield @FullPagePlace&&following + PageFoot @Yield @PageFootAndTopPlace&&following + ColTop @Yield @ColTopPlace&&following + ColFoot @Yield @ColFootAndTopPlace&&following + ColEnd @Yield @EndFloaterList&&following + Display @Yield @AfterLinePlace&&following + AfterLine @Yield @AfterLinePlace&&following + TryAfterLine @Yield @TryAfterLinePlace&&following + } + } + + def @SendEncl into { @FloaterTarget } + right x + { + def @Enclose right x + { + @OnePg @Case { + No @Yield @Format x + Yes @Yield x + } + } + + x + } + + def @Send into { @FloaterTarget } + right x + { + x + } + + def @EvenFullPageSend into { @EvenFullPagePlace&&following } + right x + { + @OneRow @HExpand x + } + + def @EvenPageSend into { @EvenPagePlace&&following } + right x + { + @OneRow @HExpand x + } + + def @RawFloaterVal + { + @OnePg.@CaptionState @Case + { + Yes.Below @Yield @OneRow { @Format @FloaterVal @DP @CaptionVal } + Yes.Above @Yield @OneRow { @CaptionVal @DP @Format @FloaterVal } + Yes.None @Yield @OneRow { @Format @FloaterVal } + No.Below @Yield { @Format @FloaterVal @DP @CaptionVal } + No.Above @Yield { @CaptionVal @DP @Format @FloaterVal } + No.None @Yield { @Format @FloaterVal } + } + } + + def @NonRawFloaterVal + { + @OnePg.@CaptionState @Case + { + Yes.Below @Yield { + @Send @OneRow @HExpand { @Format @FloaterVal @DP @CaptionVal // @DupRunner} + } + Yes.Above @Yield { + @Send @OneRow @HExpand { @CaptionVal @DP @Format @FloaterVal // @DupRunner} + } + Yes.None @Yield { + @Send @OneRow @HExpand { @Format @FloaterVal // @DupRunner } + } + No.Below @Yield { + @SendEncl { @FloaterVal // @Send { @CaptionVal // @DupRunner } } + } + No.Above @Yield { + @Send { @CaptionVal // @SendEncl { @FloaterVal // @DupRunner } } + } + No.None @Yield { + @SendEncl { @FloaterVal // @DupRunner } + } + } + } + + @Location @Case { + Raw @Yield @RawFloaterVal + Display @Yield { @NonRawFloaterVal &1rt } + EvenPageTop @Yield @EvenPageSend @NonRawFloaterVal + EvenFullPage @Yield @EvenFullPageSend @NonRawFloaterVal + else @Yield @NonRawFloaterVal + } + } + + + ########################################################################### + # # + # Glossary. # + # # + ########################################################################### + + def @GlossaryList { @Galley //@GlossaryGap @GlossaryList } + + def @GlossarySection into { @GlossaryPlace&&following } + right etc + { + // @GlossaryList + // etc + //1rt + } + + def @DoGlossary into { @GlossaryList&&following } + left @Key + named name {} + named pnum {} + right body + { + @GlossaryFont @Font @GlossaryBreak @Break @GlossaryFormat + @Name { name } + @PageNum { pnum } + @Body { body } + } + + def @Glossary + left name + named sortkey { dft } + right body + { + def key { sortkey @Dft name } + + @MakeGlossary @Case { + { Yes yes } @Yield { @PageMark key & + key @DoGlossary name { name } pnum { @PageOf key } body + } + else @Yield @Null + } + } + + def @InGlossary + right x + { + @MakeGlossary @Case { + { Yes yes } @Yield { @InGlossaryFormat @InGlossaryFont @Font x } + else @Yield x + } + } + + + ########################################################################### + # # + # Index. # + # # + ########################################################################### + + def @IndexList { @Galley //1vx @IndexList } + def @BypassIndexList { @Galley //1vx @BypassIndexList } + + def @IndexSection into { @IndexPlace&&following } + right etc + { + // @IndexBreak @Break @IndexList + // @IndexBreak @Break @BypassIndexList + // @ClearHeaderComponent + // etc + //1rt + } + + def @DoIndex into { @IndexList&&following } + left @Key # sort key + named pgrange {} # page numbers, or empty if none + named depth {} # 0, 1, or 2 (@Index, @Sub, or @SubSub) + right body # body, not including any prefix + { + def @Body + { + depth @Case { + 0 @Yield @IndexFormat body + 1 @Yield @SubIndexFormat body + 2 @Yield @SubSubIndexFormat body + } + } + + def @Enclose right x + { + @IndexCtd.depth @Case { + + Yes.0 @Yield { + @ClearHeaderComponent + //1vx + x + //1vx + 1vx @SetHeaderComponent { + @Body @IndexCtdFormat {continued @WordVal @IndexCtdWord} + } + //1vx + 1vx @BeginHeaderComponent (unused) + } + + Yes.1 @Yield { + @EndHeaderComponent + //1vx + x + //1vx + 1vx @BeginHeaderComponent { + @Body @IndexCtdFormat {continued @WordVal @IndexCtdWord} + } + } + + else @Yield x + + } + } + + def @Merge left lpart right rpart + { + { lpart @Rump { lpart @Meld rpart } } @Case + { + "" @Yield lpart + else @Yield { { lpart{@OneCol ,} } @Meld rpart } + } + + } + + @IndexFont @Font @IndexBreak @Break pgrange @Case { + "" @Yield { @Body &"0.03fu" {} } + else @Yield { @Body &"0.03fu" {}{@OneCol ,} pgrange } + + } + } + + def @RawIndex + left lpart + named depth { 0 } + right rpart + { + @MakeIndex @Case { + Yes @Yield { lpart @DoIndex depth { depth } rpart } + else @Yield @Null + } + } + + macro @RawSubIndex { @RawIndex depth { 1 } } + macro @RawSubSubIndex { @RawIndex depth { 2 } } + + def @Index + left lpart + named @Tag {} + named pnformat right @PageNum { Ordinary } + named depth { 0 } + named to {} + right rpart + { + def @PgMk right tag + { + tag @CrossLink @PageOf tag + } + + def @Fmt right x + { + {pnformat x} @Case + { + Ordinary @Yield @IndexTypeOrdinary x + Main @Yield @IndexTypeMain x + Special @Yield @IndexTypeSpecial x + else @Yield {pnformat x} + } + } + + def @PgRange + { + to @Case + { + "" @Yield @PgMk @Tag + else @Yield { + { @PageOf @Tag } @Case + { + { @PageOf to } @Yield { @PgMk @Tag } + else @Yield { {@PgMk @Tag} @IndexRangeFormat {@PgMk to} } + } + } + } + } + + @MakeIndex @Case { + Yes @Yield { + @PageMark @Tag & + lpart @DoIndex depth { depth } pgrange { @Fmt @PgRange } rpart } + else @Yield @Null + } + } + + macro @SubIndex { @Index depth { 1 } } + macro @SubSubIndex { @Index depth { 2 } } + + def @IndexBlanks + { + b @RawIndex {} c @RawIndex {} d @RawIndex {} e @RawIndex {} + f @RawIndex {} g @RawIndex {} h @RawIndex {} i @RawIndex {} + j @RawIndex {} k @RawIndex {} l @RawIndex {} m @RawIndex {} + n @RawIndex {} o @RawIndex {} p @RawIndex {} q @RawIndex {} + r @RawIndex {} s @RawIndex {} t @RawIndex {} u @RawIndex {} + v @RawIndex {} w @RawIndex {} x @RawIndex {} y @RawIndex {} + z @RawIndex {} + } + + def @IndexSpacer + left lpart + named above { @IndexSpacerAbove } + named below { @IndexSpacerBelow } + named font { @IndexSpacerFont } + named format right @Body { @IndexSpacerFormat @Body } + right rpart + { + def @Send into { @IndexList&&following } + right @Key + { + @ClearHeaderComponent + // + //above + @CNP + @OneRow { font @Font format rpart //below } + } + + @MakeIndex @Case { + Yes @Yield @Send lpart + else @Yield @Null + } + } + + macro @InitialIndexSpacer { @IndexSpacer above { 0i } } + + def @IndexLetters + { + a @InitialIndexSpacer A + b @IndexSpacer B c @IndexSpacer C d @IndexSpacer D e @IndexSpacer E + f @IndexSpacer F g @IndexSpacer G h @IndexSpacer H i @IndexSpacer I + j @IndexSpacer J k @IndexSpacer K l @IndexSpacer L m @IndexSpacer M + n @IndexSpacer N o @IndexSpacer O p @IndexSpacer P q @IndexSpacer Q + r @IndexSpacer R s @IndexSpacer S t @IndexSpacer T u @IndexSpacer U + v @IndexSpacer V w @IndexSpacer W x @IndexSpacer X y @IndexSpacer Y + z @IndexSpacer Z + } + + def @BypassBeginIndexPlace { @Galley } + + def @BypassBeginIndex force into { @BypassBeginIndexPlace&&preceding } {} + + def @BypassRawIndex force into { @BypassIndexList&&preceding } + named indent { 0f } + right x + { + &indent x + } + + def @BypassEndIndex { @Null } + + + ########################################################################### + # # + # IndexA. # + # # + ########################################################################### + + def @IndexAList { @Galley //1vx @IndexAList } + def @BypassIndexAList { @Galley //1vx @BypassIndexAList } + + def @IndexASection into { @IndexAPlace&&following } + right etc + { + // @IndexABreak @Break @IndexAList + // @IndexABreak @Break @BypassIndexAList + // @ClearHeaderComponent + // etc + //1rt + } + + def @DoIndexA into { @IndexAList&&following } + left @Key # sort key + named pgrange {} # page numbers, or empty if none + named depth {} # 0, 1, or 2 (@IndexA, @Sub, or @SubSub) + right body # body, not including any prefix + { + def @Body + { + depth @Case { + 0 @Yield @IndexAFormat body + 1 @Yield @SubIndexAFormat body + 2 @Yield @SubSubIndexAFormat body + } + } + + def @Enclose right x + { + @IndexACtd.depth @Case { + + Yes.0 @Yield { + @ClearHeaderComponent + //1vx + x + //1vx + 1vx @SetHeaderComponent { + @Body @IndexACtdFormat {continued @WordVal @IndexACtdWord} + } + //1vx + 1vx @BeginHeaderComponent (unused) + } + + Yes.1 @Yield { + @EndHeaderComponent + //1vx + x + //1vx + 1vx @BeginHeaderComponent { + @Body @IndexACtdFormat {continued @WordVal @IndexACtdWord} + } + } + + else @Yield x + + } + } + + def @Merge left lpart right rpart + { + { lpart @Rump { lpart @Meld rpart } } @Case + { + "" @Yield lpart + else @Yield { { lpart{@OneCol ,} } @Meld rpart } + } + + } + + @IndexAFont @Font @IndexABreak @Break pgrange @Case { + "" @Yield { @Body &"0.03fu" {} } + else @Yield { @Body &"0.03fu" {}{@OneCol ,} pgrange } + + } + } + + def @RawIndexA + left lpart + named depth { 0 } + right rpart + { + @MakeIndexA @Case { + Yes @Yield { lpart @DoIndexA depth { depth } rpart } + else @Yield @Null + } + } + + macro @RawSubIndexA { @RawIndexA depth { 1 } } + macro @RawSubSubIndexA { @RawIndexA depth { 2 } } + + def @IndexA + left lpart + named @Tag {} + named pnformat right @PageNum { Ordinary } + named depth { 0 } + named to {} + right rpart + { + def @PgMk right tag + { + tag @CrossLink @PageOf tag + } + + def @Fmt right x + { + {pnformat x} @Case + { + Ordinary @Yield @IndexATypeOrdinary x + Main @Yield @IndexATypeMain x + Special @Yield @IndexATypeSpecial x + else @Yield {pnformat x} + } + } + + def @PgRange + { + to @Case + { + "" @Yield @PgMk @Tag + else @Yield { + { @PageOf @Tag } @Case + { + { @PageOf to } @Yield { @PgMk @Tag } + else @Yield { {@PgMk @Tag} @IndexARangeFormat {@PgMk to} } + } + } + } + } + + @MakeIndexA @Case { + Yes @Yield { + @PageMark @Tag & + lpart @DoIndexA depth { depth } pgrange { @Fmt @PgRange } rpart } + else @Yield @Null + } + } + + macro @SubIndexA { @IndexA depth { 1 } } + macro @SubSubIndexA { @IndexA depth { 2 } } + + def @IndexABlanks + { + b @RawIndexA {} c @RawIndexA {} d @RawIndexA {} e @RawIndexA {} + f @RawIndexA {} g @RawIndexA {} h @RawIndexA {} i @RawIndexA {} + j @RawIndexA {} k @RawIndexA {} l @RawIndexA {} m @RawIndexA {} + n @RawIndexA {} o @RawIndexA {} p @RawIndexA {} q @RawIndexA {} + r @RawIndexA {} s @RawIndexA {} t @RawIndexA {} u @RawIndexA {} + v @RawIndexA {} w @RawIndexA {} x @RawIndexA {} y @RawIndexA {} + z @RawIndexA {} + } + + def @IndexASpacer + left lpart + named above { @IndexASpacerAbove } + named below { @IndexASpacerBelow } + named font { @IndexASpacerFont } + named format right @Body { @IndexASpacerFormat @Body } + right rpart + { + def @Send into { @IndexAList&&following } + right @Key + { + @ClearHeaderComponent + // + //above + @CNP + @OneRow { font @Font format rpart //below } + } + + @MakeIndexA @Case { + Yes @Yield @Send lpart + else @Yield @Null + } + } + + macro @InitialIndexASpacer { @IndexASpacer above { 0i } } + + def @IndexALetters + { + a @InitialIndexASpacer A + b @IndexASpacer B c @IndexASpacer C d @IndexASpacer D e @IndexASpacer E + f @IndexASpacer F g @IndexASpacer G h @IndexASpacer H i @IndexASpacer I + j @IndexASpacer J k @IndexASpacer K l @IndexASpacer L m @IndexASpacer M + n @IndexASpacer N o @IndexASpacer O p @IndexASpacer P q @IndexASpacer Q + r @IndexASpacer R s @IndexASpacer S t @IndexASpacer T u @IndexASpacer U + v @IndexASpacer V w @IndexASpacer W x @IndexASpacer X y @IndexASpacer Y + z @IndexASpacer Z + } + + def @BypassBeginIndexAPlace { @Galley } + + def @BypassBeginIndexA force into { @BypassBeginIndexAPlace&&preceding } {} + + def @BypassRawIndexA force into { @BypassIndexAList&&preceding } + named indent { 0f } + right x + { + &indent x + } + + def @BypassEndIndexA { @Null } + + + ########################################################################### + # # + # IndexB. # + # # + ########################################################################### + + def @IndexBList { @Galley //1vx @IndexBList } + def @BypassIndexBList { @Galley //1vx @BypassIndexBList } + + def @IndexBSection into { @IndexBPlace&&following } + right etc + { + // @IndexBBreak @Break @IndexBList + // @IndexBBreak @Break @BypassIndexBList + // @ClearHeaderComponent + // etc + //1rt + } + + def @DoIndexB into { @IndexBList&&following } + left @Key # sort key + named pgrange {} # page numbers, or empty if none + named depth {} # 0, 1, or 2 (@IndexB, @Sub, or @SubSub) + right body # body, not including any prefix + { + def @Body + { + depth @Case { + 0 @Yield @IndexBFormat body + 1 @Yield @SubIndexBFormat body + 2 @Yield @SubSubIndexBFormat body + } + } + + def @Enclose right x + { + @IndexBCtd.depth @Case { + + Yes.0 @Yield { + @ClearHeaderComponent + //1vx + x + //1vx + 1vx @SetHeaderComponent { + @Body @IndexBCtdFormat {continued @WordVal @IndexBCtdWord} + } + //1vx + 1vx @BeginHeaderComponent (unused) + } + + Yes.1 @Yield { + @EndHeaderComponent + //1vx + x + //1vx + 1vx @BeginHeaderComponent { + @Body @IndexBCtdFormat {continued @WordVal @IndexBCtdWord} + } + } + + else @Yield x + + } + } + + def @Merge left lpart right rpart + { + { lpart @Rump { lpart @Meld rpart } } @Case + { + "" @Yield lpart + else @Yield { { lpart{@OneCol ,} } @Meld rpart } + } + + } + + @IndexBFont @Font @IndexBBreak @Break pgrange @Case { + "" @Yield { @Body &"0.03fu" {} } + else @Yield { @Body &"0.03fu" {}{@OneCol ,} pgrange } + + } + } + + def @RawIndexB + left lpart + named depth { 0 } + right rpart + { + @MakeIndexB @Case { + Yes @Yield { lpart @DoIndexB depth { depth } rpart } + else @Yield @Null + } + } + + macro @RawSubIndexB { @RawIndexB depth { 1 } } + macro @RawSubSubIndexB { @RawIndexB depth { 2 } } + + def @IndexB + left lpart + named @Tag {} + named pnformat right @PageNum { Ordinary } + named depth { 0 } + named to {} + right rpart + { + def @PgMk right tag + { + tag @CrossLink @PageOf tag + } + + def @Fmt right x + { + {pnformat x} @Case + { + Ordinary @Yield @IndexBTypeOrdinary x + Main @Yield @IndexBTypeMain x + Special @Yield @IndexBTypeSpecial x + else @Yield {pnformat x} + } + } + + def @PgRange + { + to @Case + { + "" @Yield @PgMk @Tag + else @Yield { + { @PageOf @Tag } @Case + { + { @PageOf to } @Yield { @PgMk @Tag } + else @Yield { {@PgMk @Tag} @IndexBRangeFormat {@PgMk to} } + } + } + } + } + + @MakeIndexB @Case { + Yes @Yield { + @PageMark @Tag & + lpart @DoIndexB depth { depth } pgrange { @Fmt @PgRange } rpart } + else @Yield @Null + } + } + + macro @SubIndexB { @IndexB depth { 1 } } + macro @SubSubIndexB { @IndexB depth { 2 } } + + def @IndexBBlanks + { + b @RawIndexB {} c @RawIndexB {} d @RawIndexB {} e @RawIndexB {} + f @RawIndexB {} g @RawIndexB {} h @RawIndexB {} i @RawIndexB {} + j @RawIndexB {} k @RawIndexB {} l @RawIndexB {} m @RawIndexB {} + n @RawIndexB {} o @RawIndexB {} p @RawIndexB {} q @RawIndexB {} + r @RawIndexB {} s @RawIndexB {} t @RawIndexB {} u @RawIndexB {} + v @RawIndexB {} w @RawIndexB {} x @RawIndexB {} y @RawIndexB {} + z @RawIndexB {} + } + + def @IndexBSpacer + left lpart + named above { @IndexBSpacerAbove } + named below { @IndexBSpacerBelow } + named font { @IndexBSpacerFont } + named format right @Body { @IndexBSpacerFormat @Body } + right rpart + { + def @Send into { @IndexBList&&following } + right @Key + { + @ClearHeaderComponent + // + //above + @CNP + @OneRow { font @Font format rpart //below } + } + + @MakeIndexB @Case { + Yes @Yield @Send lpart + else @Yield @Null + } + } + + macro @InitialIndexBSpacer { @IndexBSpacer above { 0i } } + + def @IndexBLetters + { + a @InitialIndexBSpacer A + b @IndexBSpacer B c @IndexBSpacer C d @IndexBSpacer D e @IndexBSpacer E + f @IndexBSpacer F g @IndexBSpacer G h @IndexBSpacer H i @IndexBSpacer I + j @IndexBSpacer J k @IndexBSpacer K l @IndexBSpacer L m @IndexBSpacer M + n @IndexBSpacer N o @IndexBSpacer O p @IndexBSpacer P q @IndexBSpacer Q + r @IndexBSpacer R s @IndexBSpacer S t @IndexBSpacer T u @IndexBSpacer U + v @IndexBSpacer V w @IndexBSpacer W x @IndexBSpacer X y @IndexBSpacer Y + z @IndexBSpacer Z + } + + def @BypassBeginIndexBPlace { @Galley } + + def @BypassBeginIndexB force into { @BypassBeginIndexBPlace&&preceding } {} + + def @BypassRawIndexB force into { @BypassIndexBList&&preceding } + named indent { 0f } + right x + { + &indent x + } + + def @BypassEndIndexB { @Null } + + + ########################################################################### + # # + # Colophon. # + # # + ########################################################################### + + def @ColophonList { @Galley //1vx @ColophonList } + + def @ColophonSection into { @ColophonPlace&&following } + right etc + { + // @ColophonBreak @Break @ColophonFont @Font @ColophonList + // etc + //1rt + } + + + ########################################################################### + # # + # @LargeScaleStructure # + # # + # The prototype for the value of each large-scale structure symbol # + # (@Chapter, @Section, etc.) # + # # + ########################################################################### + + def @LargeScaleStructure + named tag {} # tag of this large-scale structure sym + named type {} # MajorIntro, Major, VeryMajor, or Minor + named initiallanguage {} # its language + named title {} # its full title + named runningtitle { dft } # its running title Jeffk 12/11/02 from {} + named aboveheadinggap { 0f } # gap above heading + named headingfont {} # its heading font + 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 used if type is Minor + named word {} + named numbers { None } + named attachnum {} # only if numbers is not None + named retrievenum {} # only if numbers is not None + named bypassnumber {} # only if numbers is not None, or VeryMajor + named prefix {} # prefix of number of this symbol + named pnprefix {} # prefix for page numbers of this sym + named majornum { dft } + named majortitle { dft } + named minornum { dft } + named minortitle { dft } + named intheorems { No } + named indisplays { No } + named infigures { No } + named intables { No } + named infloaters { No } + named inrunners { No } + named sendheader right @Body {} + named innergap {} + named endifmajor right innergap { + @EndFigureList + //innergap @EndNoteList 1 + //innergap @ChapRefSection + } + named wantindefinite { No } + named newpage { No } + right @Body + { + + def @ShortNum + { + numbers @Then { + bypassnumber @Dft { + prefix @Join { numbers @Num retrievenum } + } + } + } + + def @LongNum + { + numbers @Then { + # initiallanguage @Language { word @NumSep @ShortNum } + @ShortNum @Case { + "" @Yield { } # numberless: don't produce `word' + else @Yield { + initiallanguage @Language { word @NumSep @ShortNum } + } + } + } + } + + def @ShortTitle + { + initiallanguage @Language { runningtitle @Dft title } + } + + def @IfMajor right x + { + type @Case { + { MajorIntro Major ExtraMajor ExtraMajorIntro } @Yield x + else @Yield @Null + } + } + + def @StartIfMajor { + type @Case { + { MajorIntro Major ExtraMajor ExtraMajorIntro VeryMajor } @Yield Start + else @Yield NonStart + } + } + + def @Run right start + { + inrunners @Do type @Case { + + { Major MajorIntro } @Yield { + start @Runner + @MajorNum { majornum @Dft @LongNum } + @MajorTitle { majortitle @Dft @ShortTitle } + @MinorNum {} + @MinorTitle {} + @Owner { tag } + @Prefix { pnprefix @Join @ShortNum } + } + + { ExtraMajor ExtraMajorIntro } @Yield { + start @Runner + @MajorNum { majornum @Dft @LongNum } + @MajorTitle { majortitle @Dft @ShortTitle } + @MinorNum { majornum @Dft @LongNum } + @MinorTitle { majortitle @Dft @ShortTitle } + @Owner { tag } + @Prefix { pnprefix @Join @ShortNum } + } + + { VeryMajor } @Yield { + start @Runner + @MajorNum { majornum @Dft @LongNum } + @MajorTitle { majortitle @Dft @ShortTitle } + @MinorNum {} + @MinorTitle {} + @Owner { tag } + @Prefix {} + } + + Minor @Yield { + start @Runner + @MajorNum { majornum @Dft @LongNum } + @MajorTitle { majortitle @Dft @ShortTitle } + @MinorNum { minornum @Dft @LongNum } + @MinorTitle { minortitle @Dft @ShortTitle } + @Owner { tag } + @Prefix { pnprefix @Join @ShortNum } + } + } + } + + def @ContentsStuff + { + incontents.type @Case { + + Yes.Minor @Yield { + incontents @ContentsEntry + indent { contentsindent } + crosstag { tag } + number { @LongNum } + title { initiallanguage @Language title } + pagenum { @PageOf tag } + } + + { Yes.Major Yes.MajorIntro Yes.ExtraMajor Yes.ExtraMajorIntro } @Yield { + incontents @MajorContentsEntry + indent { contentsindent } + crosstag { tag } + number { @LongNum } + title { initiallanguage @Language title } + pagenum { @PageOf tag } + } + + { Yes.VeryMajor } @Yield { + incontents @VeryMajorContentsEntry + indent { contentsindent } + title { initiallanguage @Language { + bypassnumber @ColonSep title } } + } + + else @Yield @Null + } + } + + def @MinorTitle right x + { + newpage @Case { + { No no } @Yield @Protect {@LongNum headingformat title} + { Yes yes } @Yield { @Null @NP @LongNum headingformat title } + } + } + + def @Heading + { + + type @Case { + + Minor @Yield { + headingfont @Font headingbreak @Break + @MinorTitle {@LongNum headingformat title} + // @Run @StartIfMajor + // @PageMark tag + @DP headingtext + } + + { Major MajorIntro ExtraMajor ExtraMajorIntro } @Yield { + sendheader { + //aboveheadinggap + headingfont @Font + headingbreak @Break { @LongNum headingformat title } + // @Run @StartIfMajor + // @PageMark tag + @DP headingtext + } + } + + { VeryMajor } @Yield { sendheader { + //aboveheadinggap + headingfont @Font + headingbreak @Break { bypassnumber headingformat title } + // @Run @StartIfMajor + // @PageMark tag + @DP headingtext + } + } + } + } + + initiallanguage @Language { + @Heading + // wantindefinite @Case { + Yes @Yield @Null + No @Yield "" + } + // numbers @Do { + attachnum & @NumberMarker @Tag { tag } @Value { @ShortNum } + } + // @IfMajor { @FootNoteThrough @Do @BeginFootNoteCounter } + # // @Run @StartIfMajor + // @ContentsStuff + // @TitleMarker @Tag { tag } @Value { title } + // intheorems @BeginAllCounters @ShortNum + // indisplays @BeginDisplayCounter @ShortNum + // infigures @BeginFigureCounter @ShortNum + // intables @BeginTableCounter @ShortNum + // infloaters @BeginFloaterCounter @ShortNum + // @Body + //innergap @IfMajor endifmajor innergap + // @Run NonStart + } + } + +@End @DocumentSetup diff --git a/include/include/eiffel b/include/include/eiffel new file mode 100644 index 0000000..4fc89ea --- /dev/null +++ b/include/include/eiffel @@ -0,0 +1,118 @@ +############################################################################### +# # +# Lout setup file for Eiffel program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { eiffelf } + + +############################################################################### +# # +# @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 { @EiffelSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # numberedblanks { Yes } # No or Yes + # style { varying @OrIfPlain 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # spacing mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/eiffelf b/include/include/eiffelf new file mode 100644 index 0000000..b76b6bc --- /dev/null +++ b/include/include/eiffelf @@ -0,0 +1,446 @@ + +############################################################################### +# # +# Lout @EiffelSetup package for formatting Eiffel programs # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +# 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @Eiffel +def @EiffelSetup + named pipe { } # pipe through this first + named numbered { No } # want lines numbered? + named blanknumbered { Yes } # blank lines numbered? + named style + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { varying @OrIfPlain 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 @Eiffel + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lEiffel" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lEiffel" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @Eiffel + +@End @EiffelSetup diff --git a/include/include/eq b/include/include/eq new file mode 100644 index 0000000..6d35832 --- /dev/null +++ b/include/include/eq @@ -0,0 +1,29 @@ +############################################################################### +# # +# Lout setup file for equation formatting # +# # +# Jeffrey H. Kingston # +# 5 February 1999 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# The @SysInclude { eqf } line # +# # +# This line causes Lout to read the definitions for equations, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { eqf } + + +############################################################################### +# # +# This package does not offer default options that can be changed. # +# # +############################################################################### diff --git a/include/include/eqf b/include/include/eqf new file mode 100644 index 0000000..23dd3bd --- /dev/null +++ b/include/include/eqf @@ -0,0 +1,1717 @@ + +############################################################################### +# # +# Lout @Eq package for equation formatting (Version 3.0) # +# # +# Version 1.0 by Jeffrey H. Kingston, December 1990. # +# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. # +# Version 3.0 by Jeffrey H. Kingston and Robert Marsa, March 1996. # +# # +# This package makes extensive use of the Adobe Systems Symbol font, and # +# it assumes that the font has not been recoded. It could be rewritten # +# using the @Char symbol to be made independent of any recoding, but since # +# there seems no reason to ever recode this font, I haven't bothered. # +# # +# See "Eq - a Lout package for typesetting mathematics" for user # +# information. Acknowledgement: the @Eq language is based closely on # +# the Eqn language of B. W. Kernighan and L. L. Cherry; the spacing rules # +# are similar to those of the TeX system by D. E. Knuth. # +# # +# Version 3.0 makes use of the new x and y units of measurement to improve # +# the spacing rules. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export "`" "``" "```" bin rel punct non vctr big small + + space exclam universal numbersign existential percent + ampersand suchthat parenleft parenright asteriskmath + plus comma minus period slash zero one two three four + five six seven eight nine colon semicolon less equal + greater question congruent Alpha Beta Chi Delta Epsilon + Phi Gamma Eta Iota thetaone Kappa Lambda Mu Nu Omicron + Pi Theta Rho Sigma Tau Upsilon sigmaone Omega Xi Psi Zeta + bracketleft therefore bracketright perpendicular underscore + radicalex alpha beta chi delta epsilon phi gamma eta iota + phione kappa lambda mu nu omicron pi theta rho sigma tau + upsilon omegaone omega xi psi zeta braceleft bar braceright + similar Upsilonone minute lessequal fraction infinity florin + club diamond heart spade arrowboth arrowleft arrowup + arrowright arrowdown degree plusminus second greaterequal + multiply proportional partialdiff bullet divide notequal + equivalence approxequal ellipsis arrowvertex arrowhorizex + carriagereturn aleph Ifraktur Rfraktur weierstrass + circlemultiply circleplus emptyset intersection union + propersuperset reflexsuperset notsubset propersubset + reflexsubset element notelement angle gradient registerserif + copyrightserif trademarkserif product radical dotmath + logicalnot logicaland logicalor arrowdblboth arrowdblleft + arrowdblup arrowdblright arrowdbldown lozenge angleleft + registersans copyrightsans trademarksans summation parenlefttp + parenleftex parenleftbt bracketlefttp bracketleftex + bracketleftbt bracelefttp braceleftmid braceleftbt braceex + angleright integral integraltp integralex integralbt + parenrighttp parenrightex parenrightbt bracketrighttp + bracketrightex bracketrightbt bracerighttp bracerightmid + bracerightbt + + hbar Re Im partial infty prime nabla surd top bot dbar + triangle backslash forall exists neg + circle filledcircle square + + sum prod coprod int oint bcap bcup bvee bwedge bodot botimes + boplus buplus + + "+" "-" "+-" "-+" setminus cdot times "*" circ div cap cup uplus + sqcap sqcup triangleleft triangleright + wr bigcirc bigtriangleup bigtriangledown vee wedge oplus ominus + otimes oslash odot dagger daggerdbl amalg + + "<" ">" "=" "<=" prec preceq "<<" subset subseteq sqsubseteq + in vdash smile frown ">=" succ succeq ">>" supset supseteq + sqsupseteq ni dashv mid parallel "==" "~" "-~" asymp "~~" + "=~" bowtie propto models doteq trieq perp notsub notin "!=" not + "<->" "<--" "-->" up down "<=>" "<==" "==>" dblup dbldown + ":" "::" ":=" + + lpar blpar rpar brpar lbrack blbrack rbrack brbrack lbrace blbrace + rbrace brbrace lfloor blfloor rfloor brfloor lceil blceil + rceil brceil langle blangle rangle brangle + + ";" "," col + + "!" "?" "%" "(" ")" "[" "]" + + arccos arcsin arctan arg cos cosh cot coth csc deg det dim exp + gcd hom inf ker lg lim liminf limsup ln log max min Pr sec sin + sinh supr tan tanh mod ldots cdots vdots ddots del grad + "..." ",...," "'" "''" "'''" "''''" empty + + triangleup triangledown + + leftarrow longleftarrow dblleftarrow dbllongleftarrow + rightarrow longrightarrow dblrightarrow dbllongrightarrow + leftrightarrow longleftrightarrow dblleftrightarrow dbllongleftrightarrow + mapsto longmapsto hookleftarrow hookrightarrow leadsto + leftharpoonup rightharpoonup leftharpoondown rightharpoondown + rightleftharpoons + uparrow dbluparrow downarrow dbldownarrow updownarrow dblupdownarrow + nearrow searrow swarrow nwarrow + + sup sub tsub supp on ton frac half third over from to widefrom wideto + dot dotdot hat tilde vec dyad overbar underbar sqrt root zroot + nextcol above labove cabove rabove mabove + matrix pmatrix bmatrix brmatrix fmatrix cmatrix amatrix + + "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" + +def @Eq + named initzunit { 1f } + body @Body +@Begin + + + ################################################################### + # # + # Context-sensitive format changes. # + # # + # Equation formatting (according to Knuth) demands changes in # + # the appearance of equations depending on context. These are: # + # # + # @Smaller x Superscripts and subscripts are to be set # + # in a smaller font size. The @Smaller # + # symbol implements this by changing the # + # f unit. # + # # + # @HSqueeze x The horizontal space surrounding binary # + # operators and relations is to be reduced # + # within superscripts and subscripts, etc. # + # The @HSqueeze symbol implements this by # + # changing the y unit, which is not used by # + # Lout but which is used by symbols @ThinGap, # + # @MedGap and @ThickGap. # + # # + # @VSqueeze x The vertical space taken by superscripts # + # and subscripts is to be reduced within # + # built-up fractions and under root signs. # + # The @VSqueeze symbol implements this by # + # changing the z unit, which is not used by # + # Lout but is used by the @SupGap symbol. # + # # + # Knuth also recommends some changes that depend on whether the # + # equation is displayed or inline; these are not implemented, # + # except that the @E symbol for inline equations (defined as # + # a macro at the bottom of this file) includes a @VSqueeze. # + # # + ################################################################### + + def @SpaceGap { 0.05f } + + def @Smaller right x { 0.7f @Font @SpaceGap @Space x } + + def @HSqueeze right x { 0.2f @YUnit x } + + def @VSqueeze right x { 0.7f @ZUnit x } + + def @SkewGap { 0.05f } + def @SupGap { 0.43zk } + def @ThinGap { 0.15y } + def @MedGap { 0.20y } + def @ThickGap { 0.25y } + def @ColGap { 0.8f } + def @RowGap { 0.5f } + + def "`" { &@ThinGap } + def "``" { &@MedGap } + def "```" { &@ThickGap } + + def bin right x { `` x `` } + def rel right x { ``` x ``` } + def punct right x { x ` } + def non right x { 0c @YUnit x } + def big right x { 1.3f @Font @SpaceGap @Space x } + def small right x { 0.6f @Font @SpaceGap @Space x } + + def @Base right x { Base @Font x } + def @Sym right x { {Symbol Base} @Font x } + + def @HLine + named line { @BackEnd @Case { PostScript @Yield { "0.05 ft setlinewidth" } PDF @Yield { "__mul(__loutf, 0.05) w" } } } + { + @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto xsize 0 lineto" line "stroke" } @Graphic {} + } + PDF @Yield { # note re-arrangement of commands (setlinewidth (='w') not allowed in a path) + { line "0 0 m __xsize 0 l s" } @Graphic {} + } + } + } + + def @VLine + { + @BackEnd @Case { + PostScript @Yield { + "0 0 moveto 0 ysize lineto 0.05 ft setlinewidth stroke" @Graphic {} + } + PDF @Yield { + "__mul(__loutf, 0.05) w 0 0 m 0 __ysize l s" @Graphic {} + } + } + } + + def vctr + right x + { + 0.5w @VShift x + } + + def @Strut right x + { + @OneCol { x | @OneRow { 0.5f @High ^/ 0.5f @High } } + } + + ################################################################### + # # + # Full names # + # # + # These symbols and their names are taken directly from the # + # Adobe Systems Inc. Symbol font (see PostScript Language # + # Reference Manual, pp. 256-257). The only differences are: # + # # + # Adobe: theta1 Eq: thetaone # + # sigma1 sigmaone # + # phi1 phione # + # omega1 omegaone # + # # + # These were needed since Lout identifiers do not have digits. # + # # + ################################################################### + + def space { @Sym "\040" } + def exclam { @Sym "\041" } + def universal { @Sym "\042" } + def numbersign { @Sym "\043" } + def existential { @Sym "\044" } + def percent { @Sym "\045" } + def ampersand { @Sym "\046" } + def suchthat { @Sym "\047" } + def parenleft { @Sym "\050" } + def parenright { @Sym "\051" } + def asteriskmath { @Sym "\052" } + def plus { @Sym "+" } + def comma { @Sym "\054" } + def minus { @Sym "-" } + def period { @Sym "\056" } + def slash { @Sym "\057" } + def zero { @Sym "\060" } + def one { @Sym "\061" } + def two { @Sym "\062" } + def three { @Sym "\063" } + def four { @Sym "\064" } + def five { @Sym "\065" } + def six { @Sym "\066" } + def seven { @Sym "\067" } + def eight { @Sym "\070" } + def nine { @Sym "\071" } + def colon { @Sym "\072" } + def semicolon { @Sym "\073" } + def less { @Sym "\074" } + def equal { @Sym "\075" } + def greater { @Sym "\076" } + def question { @Sym "\077" } + def congruent { @Sym "\100" } + def Alpha { @Sym "\101" } + def Beta { @Sym "\102" } + def Chi { @Sym "\103" } + def Delta { @Sym "\104" } + def Epsilon { @Sym "\105" } + def Phi { @Sym "\106" } + def Gamma { @Sym "\107" } + def Eta { @Sym "\110" } + def Iota { @Sym "\111" } + def thetaone { @Sym "\112" } + def Kappa { @Sym "\113" } + + def Lambda { @Sym "\114" } + def Mu { @Sym "\115" } + def Nu { @Sym "\116" } + def Omicron { @Sym "\117" } + def Pi { @Sym "\120" } + def Theta { @Sym "\121" } + def Rho { @Sym "\122" } + def Sigma { @Sym "\123" } + def Tau { @Sym "\124" } + def Upsilon { @Sym "\125" } + def sigmaone { @Sym "\126" } + def Omega { @Sym "\127" } + def Xi { @Sym "\130" } + def Psi { @Sym "\131" } + def Zeta { @Sym "\132" } + def bracketleft { @Sym "\133" } + def therefore { @Sym "\134" } + def bracketright { @Sym "\135" } + def perpendicular { @Sym "\136" } + def underscore { @Sym "\137" } + def radicalex { @Sym "\140" } + def alpha { @Sym "\141" } + def beta { @Sym "\142" } + def chi { @Sym "\143" } + def delta { @Sym "\144" } + def epsilon { @Sym "\145" } + def phi { @Sym "\146" } + def gamma { @Sym "\147" } + def eta { @Sym "\150" } + def iota { @Sym "\151" } + def phione { @Sym "\152" } + def kappa { @Sym "\153" } + def lambda { @Sym "\154" } + def mu { @Sym "\155" } + def nu { @Sym "\156" } + + def omicron { @Sym "\157" } + def pi { @Sym "\160" } + def theta { @Sym "\161" } + def rho { @Sym "\162" } + def sigma { @Sym "\163" } + def tau { @Sym "\164" } + def upsilon { @Sym "\165" } + def omegaone { @Sym "\166" } + def omega { @Sym "\167" } + def xi { @Sym "\170" } + def psi { @Sym "\171" } + def zeta { @Sym "\172" } + def braceleft { @Sym "\173" } + def bar { @Sym "\174" } + def braceright { @Sym "\175" } + def similar { @Sym "\176" } + def Upsilonone { @Sym "\241" } + def minute { @Sym "\242" } + def lessequal { @Sym "\243" } + def fraction { @Sym "\244" } + def infinity { "1.2f" @Font @Sym "\245" } + def florin { @Sym "\246" } + def club { @Sym "\247" } + def diamond { @Sym "\250" } + def heart { @Sym "\251" } + def spade { @Sym "\252" } + def arrowboth { @Sym "\253" } + def arrowleft { @Sym "\254" } + def arrowup { @Sym "\255" } + def arrowright { @Sym "\256" } + def arrowdown { @Sym "\257" } + def degree { @Sym "\260" } + def plusminus { @Sym "\261" } + def second { @Sym "\262" } + def greaterequal { @Sym "\263" } + + def multiply { @Sym "\264" } + def proportional { @Sym "\265" } + def partialdiff { @Sym "\266" } + def bullet { @Sym "\267" } + def divide { @Sym "\270" } + def notequal { @Sym "\271" } + def equivalence { @Sym "\272" } + def approxequal { @Sym "\273" } + def ellipsis { @Sym "\274" } + def arrowvertex { @Sym "\275" } + def arrowhorizex { @Sym "\276" } + def carriagereturn { @Sym "\277" } + def aleph { @Sym "\300" } + def Ifraktur { @Sym "\301" } + def Rfraktur { @Sym "\302" } + def weierstrass { @Sym "\303" } + def circlemultiply { @Sym "\304" } + def circleplus { @Sym "\305" } + def emptyset { @Sym "\306" } + def intersection { @Sym "\307" } + def union { @Sym "\310" } + def propersuperset { @Sym "\311" } + def reflexsuperset { @Sym "\312" } + def notsubset { @Sym "\313" } + def propersubset { @Sym "\314" } + def reflexsubset { @Sym "\315" } + def element { @Sym "\316" } + def notelement { @Sym "\317" } + def angle { @Sym "\320" } + def gradient { @Sym "\321" } + def registerserif { @Sym "\322" } + def copyrightserif { @Sym "\323" } + def trademarkserif { @Sym "\324" } + def product { @Sym "\325" } + def radical { @Sym "\326" } + def dotmath { @Sym "\327" } + + def @PureDot # dot with no extra space + { + @HContract { &0io 0.4w @HShift dotmath } + } + + def logicalnot { @Sym "\330" } + def logicaland { @Sym "\331" } + def logicalor { @Sym "\332" } + def arrowdblboth { @Sym "\333" } + def arrowdblleft { @Sym "\334" } + def arrowdblup { @Sym "\335" } + def arrowdblright { @Sym "\336" } + def arrowdbldown { @Sym "\337" } + def lozenge { @Sym "\340" } + def angleleft { @Sym "\341" } + def registersans { @Sym "\342" } + def copyrightsans { @Sym "\343" } + def trademarksans { @Sym "\344" } + def summation { @Sym "\345" } + def parenlefttp { @Sym "\346" } + def parenleftex { @Sym "\347" } + def parenleftbt { @Sym "\350" } + def bracketlefttp { @Sym "\351" } + def bracketleftex { @Sym "\352" } + def bracketleftbt { @Sym "\353" } + def bracelefttp { @Sym "\354" } + def braceleftmid { @Sym "\355" } + def braceleftbt { @Sym "\356" } + def braceex { @Sym "\357" } + def angleright { @Sym "\361" } + def integral { @Sym "\362" } + def integraltp { @Sym "\363" } + def integralex { @Sym "\364" } + def integralbt { @Sym "\365" } + def parenrighttp { @Sym "\366" } + def parenrightex { @Sym "\367" } + def parenrightbt { @Sym "\370" } + def bracketrighttp { @Sym "\371" } + def bracketrightex { @Sym "\372" } + def bracketrightbt { @Sym "\373" } + def bracerighttp { @Sym "\374" } + def bracerightmid { @Sym "\375" } + def bracerightbt { @Sym "\376" } + + + ################################################################### + # # + # Short names # + # # + # These symbols, their names, and their spacing, are based on # + # the list in Appendix F of Donald E. Knuth's The TeXBook. # + # # + # Group 1 (lowercase Greek letters): see full names above # + # Group 2 (uppercase Greek letters): see full names above # + # Group 3 (calligraphic capitals): not provided by Eq # + # # + ################################################################### + + ################################################################### + # # + # Group 4 (miscellaneous Ord symbols) # + # # + # Not all of Knuth's symbols are available. The four suits # + # (heartsuit, etc.), have definitions above. # + # # + ################################################################### + + def hbar { @OneCol { &0.1f @Base "-" ^/0.25fo h } } + def Re { Rfraktur } + def Im { Ifraktur } + def partial { partialdiff } + def infty { infinity } + def prime { minute } + #def emptyset { defined above } + def nabla { gradient } + def surd { radical } + def top { 180d @Rotate perpendicular } + def bot { perpendicular } + def dbar { @Base "||" } + #def angle { defined above } + def backslash { "\\" } + def forall { universal } + def exists { existential } + def neg { logicalnot } + + def circle + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "xsize ysize 2 div moveto" + "xsize 2 div ysize 2 div xsize 2 div 0 360 arc" + "0.04 ft setlinewidth stroke" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + PDF @Yield { + # + # VT: draws a counterclockwise 360 degree arc from 0 to +360 + # degree positions (straight right to straight right) with + # centre = (xsize/2, ysize/2) and radius = xsize/2, + # implemented as two counterclockwise 180 degree arcs. + # start at (xsize, ysize/2); the control points are: + # + # pt1 = (xsize, ysize/2 + (4/3 * xsize/2)) + # pt2 = (0, ysize/2 + (4/3 * xsize/2)) + # + # end at (0, ysize/2). Then start at (0, ysize/2); control points + # + # pt1 = (0, ysize/2 - (4/3 * xsize/2)) + # pt2 = (xsize, ysize/2 - (4/3 * xsize/2)) + # + # and end at (xsize, ysize/2). + + { + "__mul(0.04, __loutf) w" + "__xsize __div(__ysize, 2) m" + "__xsize __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __div(__ysize, 2) c" + "0 __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __div(__ysize, 2) c S" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + } + } + + def filledcircle + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "xsize ysize 2 div moveto" + "xsize 2 div ysize 2 div xsize 2 div 0 360 arc" + "0.04 ft setlinewidth fill" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + PDF @Yield { + # + # JK: I don't know how to fill in PDF, so this doesn't! + # + # VT: draws a counterclockwise 360 degree arc from 0 to +360 + # degree positions (straight right to straight right) with + # centre = (xsize/2, ysize/2) and radius = xsize/2, + # implemented as two counterclockwise 180 degree arcs. + # start at (xsize, ysize/2); the control points are: + # + # pt1 = (xsize, ysize/2 + (4/3 * xsize/2)) + # pt2 = (0, ysize/2 + (4/3 * xsize/2)) + # + # end at (0, ysize/2). Then start at (0, ysize/2); control points + # + # pt1 = (0, ysize/2 - (4/3 * xsize/2)) + # pt2 = (xsize, ysize/2 - (4/3 * xsize/2)) + # + # and end at (xsize, ysize/2). + + { + "__mul(0.04, __loutf) w" + "__xsize __div(__ysize, 2) m" + "__xsize __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __div(__ysize, 2) c" + "0 __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __div(__ysize, 2) c S" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + } + } + + def square + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "0 0 moveto xsize 0 lineto xsize ysize lineto" + "0 ysize lineto closepath" + "0.04 ft setlinewidth stroke" + } @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High } + } + PDF @Yield { + { + "__mul(__loutf, 0.04) w" + "0 0 m __xsize 0 l __xsize __ysize l" + "0 __ysize l s" + } @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High } + } + } + } + + def triangle + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "0 0 moveto xsize 0 lineto" + "xsize 2 div ysize lineto closepath" + "0.04 ft setlinewidth stroke" + } @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } + } + PDF @Yield { + { + "__mul(__loutf, 0.04) w" + "0 0 m __xsize 0 l" + "__div(__xsize, 2) __ysize l s" + } @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } + } + } + } + + + ################################################################### + # # + # Group 6 ("Large" operators) # + # # + # Knuth's large operators automatically change size depending # + # on whether the equation is display or inline. Eq does not # + # do this; instead, the `big' operator must be used. # + # # + ################################################################### + + def sum { summation } + def prod { product } + def coprod { 180d @Rotate vctr product } + def int { 1.3f @Font vctr integral } + def oint { @OneCol { vctr degree |0.015fo int } } + def bcap { 1.3f @Font intersection } + def bcup { 1.3f @Font union } + def bvee { 1.3f @Font logicalor } + def bwedge { 1.3f @Font logicaland } + def bodot { & 1.3f @Font @HContract { circle /0io &0.5rt @PureDot } } + def botimes { 1.3f @Font circlemultiply } + def boplus { 1.3f @Font circleplus } + def buplus { & 1.3f @Font @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union } } + + ################################################################### + # # + # Group 7 (binary operations) # + # # + # All of Knuth's symbols are available except \star, \diamond # + # and \bullet; a few have been given more mnemonic names. # + # # + ################################################################### + + def "+" { bin plus } + def "-" { bin minus } + def "+-" { bin plusminus } + def "-+" { bin 180d @Rotate plusminus } + def setminus { bin backslash } + def cdot { bin dotmath } + def times { bin multiply } + def "*" { bin asteriskmath } + #def diamond { name used above } + def circ { bin circle } + #def bullet { name used above } + def div { bin divide } + def cap { bin intersection } + def cup { bin union } + def uplus { bin @OneRow @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union}} + def sqcap { bin + { @HContract @VContract + @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto 0 ysize lineto xsize ysize lineto" + "xsize 0 lineto" + "0.04 ft setlinewidth stroke" + } + @Graphic + { 0.3f @Wide 0.3f @High ^| ^/ + 0.3f @Wide 0.3f @High + } + } + PDF @Yield { + { "__mul(__loutf, 0.04) w" + "0 0 m 0 __ysize l __xsize __ysize l" + "__xsize 0 l s" + } + @Graphic + { 0.3f @Wide 0.3f @High ^| ^/ + 0.3f @Wide 0.3f @High + } + } + } + } + } + def sqcup { 180d @Rotate sqcap } + def triangleleft { bin 90d @Rotate 0.8f @Font triangle } + def triangleright { bin "-90d" @Rotate 0.8f @Font triangle} + def wr { bin vctr {90d @Rotate similar} } + def bigcirc { bin 1.2f @Font circle } + def bigtriangleup { bin 1.2f @Font triangle } + def bigtriangledown { bin 180d @Rotate 1.2f @Font triangle } + def vee { bin logicalor } + def wedge { bin logicaland } + def oplus { bin circleplus } + def ominus { bin @OneRow @HContract { circle /0io &0.5rt minus}} + def otimes { bin circlemultiply } + def oslash {`vctr 60d @Rotate @HContract {circle /0io &0.5rt minus`}} + def odot { bin @OneRow @HContract {circle /0io &0.5rt @PureDot }} + def dagger { bin @Base @Char "dagger" } + def daggerdbl { bin @Base @Char "daggerdbl" } + def amalg { bin 180d @Rotate vctr product } + + ################################################################### + # # + # Group 8 (relations) # + # # + # All Knuth's operators are available, but many have been # + # given different, more mnemonic names. Also included is # + # a not operator for negating the relations. # + # # + ################################################################### + + def "<" { rel less } + def ">" { rel greater } + def "=" { rel equal } + def "<=" { rel lessequal } + def prec { rel { 0.45f @Font "-90d" @Rotate + { parenrighttp ^| parenlefttp } + } + } + def preceq { rel { @OneRow non prec /0.1f minus } } + def "<<" { rel {less less} } + def subset { rel propersubset } + def subseteq { rel reflexsubset } + def sqsubseteq { rel @HContract @VContract + @BackEnd @Case { + PostScript @Yield { + { { "xsize 0 moveto" + "0 0 lineto" + "0 ysize lineto" + "xsize ysize lineto" + "0.04 ft setlinewidth stroke" + } + @Graphic + { 0.5f @Wide 0.25f @High ^/ + 0.25f @High + } + /0.1f minus + } + } + PDF @Yield { + { { "__mul(__loutf, 0.04) w" + "__xsize 0 m" + "0 0 l" + "0 __ysize l" + "__xsize __ysize l s" + } + @Graphic + { 0.5f @Wide 0.25f @High ^/ + 0.25f @High + } + /0.1f minus + } + } + } + } + + def in { rel element } + def vdash { rel vctr{"-90d" @Rotate perpendicular}} + def smile { rel vctr 90d @Rotate parenleft } + def frown { rel vctr 90d @Rotate parenright } + + def ">=" { rel greaterequal } + def succ { rel { 0.45f @Font 90d @Rotate + { parenrighttp ^| parenlefttp } + } + } + def succeq { rel { @OneRow non succ /0.1f minus } } + def ">>" { rel {greater greater} } + def supset { rel propersuperset } + def supseteq { rel reflexsuperset } + def sqsupseteq { rel @HContract @VContract + @BackEnd @Case { + PostScript @Yield { + { { "0 0 moveto xsize 0 lineto" + "xsize ysize lineto" + "0 ysize lineto" + "0.04 ft setlinewidth stroke" + } + @Graphic + { 0.5f @Wide 0.25f @High ^/ + 0.25f @High + } + /0.1f minus + } + } + PDF @Yield { + { { "__mul(__loutf, 0.04) w" + "0 0 m __xsize 0 l" + "__xsize __ysize l" + "0 __ysize l s" + } + @Graphic + { 0.5f @Wide 0.25f @High ^/ + 0.25f @High + } + /0.1f minus + } + } + } + } + def ni { rel 180d @Rotate element } + def dashv { rel vctr {90d @Rotate perpendicular} } + def mid { rel @Base "|" } + def parallel { rel @Base "||" } + + def "==" { rel equivalence } + def "~" { rel similar } + def "-~" { rel @OneRow{similar^/0.07f/0.07f minus}} + def asymp { rel 0.7f @Font @OneRow + { 90d @Rotate parenleft ^/0.008f + /0.008f 90d @Rotate parenright } + } + def "~~" { rel approxequal } + def "=~" { rel congruent } + def bowtie { rel{non triangleright non triangleleft}} + def propto { rel proportional } + def models { rel{@Base vctr "|" &0.05fo vctr equal}} + def trieq { rel @OneRow @HContract {&0.5rt small triangle^/0.15f equal}} + def doteq { rel @OneRow @HContract {&0.5rt dotmath^/0.15f equal}} + def perp { rel perpendicular } + + def notsub { rel notsubset } + def notin { rel notelement } + def "!=" { rel notequal } + + def "<->" { rel arrowboth } + def "<--" { rel arrowleft } + def "-->" { rel arrowright } + def up { rel arrowup } + def down { rel arrowdown } + def "<=>" { rel arrowdblboth } + def "<==" { rel arrowdblleft } + def "==>" { rel arrowdblright } + def dblup { rel arrowdblup } + def dbldown { rel arrowdbldown } + + def ":" { rel colon } + def "::" { rel @OneCol {colon ` colon} } + def ":=" { rel { colon{ //0.05fo equal} } } + + def not right x { @HContract {@OneCol x /0co &0.5rt slash}} + + + ################################################################### + # # + # Groups 11 and 12 - openings and closings. # + # # + ################################################################### + + def lpar { parenleft } + def rpar { parenright } + def lbrack { bracketleft } + def rbrack { bracketright } + def lbrace { braceleft } + def rbrace { braceright } + def lfloor { ` "-0.15f" @VShift bracketleftbt } + def rfloor { "-0.15f" @VShift bracketrightbt ` } + def lceil { ` "-0.1f" @VShift bracketlefttp } + def rceil { "-0.1f" @VShift bracketrighttp ` } + def langle { angleleft } + def rangle { angleright } + + def blpar { @OneRow {parenlefttp ^/ parenleftex / parenleftbt } } + def brpar { @OneRow {parenrighttp ^/ parenrightex / parenrightbt } } + def blbrack { @OneRow {bracketlefttp ^/ bracketleftex / bracketleftbt } } + def brbrack { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightbt} } + def blbrace { @OneRow {bracelefttp ^/ braceleftmid / braceleftbt } } + def brbrace { @OneRow {bracerighttp ^/ bracerightmid / bracerightbt } } + def blfloor { @OneRow {bracketleftex ^/ bracketleftex / bracketleftbt } } + def brfloor { @OneRow {bracketrightex ^/ bracketrightex / bracketrightbt} } + def blceil { @OneRow {bracketlefttp ^/ bracketleftex / bracketleftex } } + def brceil { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightex} } + def blangle { @HContract @VContract + @BackEnd @Case { + PostScript @Yield { + { "xsize 0 moveto" + "0 ysize 2 div lineto" + "xsize ysize lineto" + "0.04 ft setlinewidth stroke" + } + @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + PDF @Yield { + { "__mul(__loutf, 0.04) w" + "__xsize 0 m" + "0 __div(__ysize, 2) l" + "__xsize __ysize l S" + } + @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + } + } + def brangle { @HContract @VContract + @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto" + "xsize ysize 2 div lineto" + "0 ysize lineto" + "0.04 ft setlinewidth stroke" + } + @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + PDF @Yield { + { "__mul(__loutf, 0.04) w" + "0 0 m" + "__xsize __div(__ysize, 2) l" + "0 __ysize l S" + } + @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + } + } + + + ################################################################### + # # + # Group 13 - punctuation. # + # # + ################################################################### + + def ";" { punct semicolon } + def "," { punct comma } + def col { punct colon } + + + ################################################################### + # # + # Additional short symbols (Knuth p. 132) # + # # + ################################################################### + + def "!" { exclam } + def "?" { question } + def "%" { percent } + def "(" { parenleft } + def ")" { parenright } + def "[" { bracketleft } + def "]" { bracketright } + + + ################################################################### + # # + # Common mathematical functions (from Knuth p. 162). # + # mod is included, since @Rel mod is easily typed if needed. # + # # + ################################################################### + + def arccos { @Base "arccos" } + def arcsin { @Base "arcsin" } + def arctan { @Base "arctan" } + def arg { @Base "arg" } + def cos { @Base "cos" } + def cosh { @Base "cosh" } + def cot { @Base "cot" } + def coth { @Base "coth" } + def csc { @Base "csc" } + def deg { @Base "deg" } + def det { @Base "det" } + def dim { @Base "dim" } + def exp { @Base "exp" } + def gcd { @Base "gcd" } + def hom { @Base "hom" } + def inf { @Base "inf" } + def ker { @Base "ker" } + def lg { @Base "lg" } + def lim { @Base "lim" } + def liminf { @OneCol { @Base "lim" ` @Base "inf" } } + def limsup { @OneCol { @Base "lim" ` @Base "sup" } } + def ln { @Base "ln" } + def log { @Base "log" } + def max { @Base "max" } + def min { @Base "min" } + def Pr { @Base "Pr" } + def sec { @Base "sec" } + def sin { @Base "sin" } + def sinh { @Base "sinh" } + def supr { @Base "sup" } + def tan { @Base "tan" } + def tanh { @Base "tanh" } + def mod { @Base "mod" } + + + ################################################################### + # # + # Arrow symbols. # + # # + ################################################################### + + def leftarrow { arrowleft } + def longleftarrow { { 1.6 1 } @Scale arrowleft } + def dblleftarrow { arrowdblleft } + def dbllongleftarrow { { 1.6 1 } @Scale arrowdblleft } + def rightarrow { arrowright } + def longrightarrow { { 1.6 1 } @Scale arrowright } + def dblrightarrow { arrowdblright } + def dbllongrightarrow { { 1.6 1 } @Scale arrowdblright } + def leftrightarrow { arrowboth } + def longleftrightarrow { { 1.6 1 } @Scale arrowboth } + def dblleftrightarrow { arrowdblboth } + def dbllongleftrightarrow { { 1.6 1 } @Scale arrowdblboth } + + def mapsto + { + @HContract @VContract { + @BackEnd @Case { + PostScript @Yield { + "0 ymark 0.16 ft sub moveto 0 ymark 0.16 ft add lineto stroke" + @Graphic arrowright + } + PDF @Yield { + "0 __sub(__ymark, __mul(__loutf, 0.16)) m 0 __add(__ymark, __mul(__loutf, 0.16)) l S" + @Graphic arrowright + } + } + } + } + + def longmapsto + { + @HContract @VContract { + @BackEnd @Case { + PostScript @Yield { + "0 ymark 0.16 ft sub moveto 0 ymark 0.16 ft add lineto stroke" + @Graphic { { 1.6 1 } @Scale arrowright } + } + PDF @Yield { + "0 __sub(__ymark, __mul(__loutf, 0.16)) m 0 __add(__ymark, __mul(__loutf, 0.16)) l S" + @Graphic { { 1.6 1 } @Scale arrowright } + } + } + } + } + + def hookleftarrow + { + @HContract @VContract { + @BackEnd @Case { + + PostScript @Yield { + "xsize ymark moveto xsize ymark 0.1 ft add 0.1 ft -90 90 arc stroke" + @Graphic leftarrow + } + + PDF @Yield { +# +# VT: draws a counterclockwise 180 degree arc from -90 to +90 degree positions +# (straight down to straight up) with centre = (xsize, ymark + 0.1 ft) +# and radius = 0.1 ft +# +# the control points therefore are: +# pt1 = (xsize + (4/3 * 0.1 ft), ymark) and pt2 = (xsize + (4/3 * 0.1 ft), ymark + 0.2 ft) +# + { + "__xsize __ymark m" # pt0 + "__add(__xsize, __div(__mul(0.4, __loutf), 3)) __ymark" # pt1 + "__add(__xsize, __div(__mul(0.4, __loutf), 3)) __add(__ymark, __mul(0.2, __loutf))" # pt2 + "__xsize __add(__ymark, __mul(0.2, __loutf)) c S" # pt3 + } + @Graphic leftarrow + } + + } + } + } + + def hookrightarrow + { + @HContract @VContract { + @BackEnd @Case { + + PostScript @Yield { + "0 ymark moveto 0 0.1 ft ymark add 0.1 ft -90 90 arcn stroke" + @Graphic rightarrow + } + + PDF @Yield { +# +# VT: draws a clockwise 180 degree arc from -90 to +90 degree positions +# (straight down to straight up) with centre = (0, ymark + 0.1 ft) +# and radius = 0.1 ft +# +# the control points therefore are: +# pt1 = (-4/3 * 0.1 ft, ymark) and pt2 = (-4/3 * 0.1 ft, ymark + 0.2 ft) +# + { + "0 __ymark m" # pt0 + "__div(__mul(-0.4, __loutf), 3) __ymark" # pt1 + "__div(__mul(-0.4, __loutf), 3) __add(__ymark, __mul(0.2, __loutf))" # pt2 + "0 __add(__ymark, __mul(0.2, __loutf)) c S" # pt3 + } + @Graphic rightarrow + } + + } + } + } + + def @ClipToSize right x + { + @HContract @VContract + @BackEnd @Case { + PostScript @Yield { + { + "grestore newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" + "0 ysize lineto closepath clip gsave" + } @Graphic x + } + PDF @Yield { + "Q n 0 0 __xsize __ysize re W n q" @Graphic x + } + } + } + + def @ClipAboveMark + left amount + right x + { + @ClipToSize { ^//{{amount}o} x } + } + + def @ClipBelowMark + left amount + right x + { + @ClipToSize { x //{{amount}o} } + } + + def leftharpoonup + { + 0.04f @ClipBelowMark leftarrow + } + + def rightharpoonup + { + 0.04f @ClipBelowMark rightarrow + } + + def leftharpoondown + { + 0.02f @ClipAboveMark leftarrow + } + + def rightharpoondown + { + 0.02f @ClipAboveMark rightarrow + } + + def rightleftharpoons + { + @HContract @VContract { + rightharpoonup + ^//0.1fo + //0.1fo + leftharpoondown + } + } + + def leadsto { @HContract { similar &0.4fo arrowright } } + + def uparrow { arrowup } + def dbluparrow { arrowdblup } + def downarrow { arrowdown } + def dbldownarrow { arrowdbldown } + def updownarrow { @HContract { arrowup &0io arrowdown } } + def dblupdownarrow { @VContract { arrowdblup ^//0.2fo arrowdbldown } } + def nearrow { 0.5w @VShift 0.5w @HShift 45d @Rotate arrowright } + def searrow { 0.5w @VShift 0.5w @HShift 315d @Rotate arrowright } + def swarrow { 0.5w @VShift 0.5w @HShift 225d @Rotate arrowright } + def nwarrow { 0.5w @VShift 0.5w @HShift 135d @Rotate arrowright } + + + ################################################################### + # # + # Other symbols taken from TeX. # + # # + ################################################################### + + def ldots { . &0.3f . &0.3f . } + def cdots { dotmath &0.3f dotmath &0.3f dotmath } + def vdots { @OneRow { dotmath ^/0.3f dotmath /0.3f dotmath } } + def ddots { @OneCol @OneRow + { dotmath + ^/0.3f |0.3f dotmath + /0.3f | |0.3f dotmath + } + } + + + ################################################################### + # # + # Symbols taken from eqn (Kernighan and Cherry 1975). # + # # + ################################################################### + + def del { gradient } + def grad { gradient } + def "..." { ellipsis } + def ",...," { , ellipsis ``` , } + def "'" { minute } + def "''" { minute minute } + def "'''" { minute minute minute } + def "''''" { minute minute minute minute } + def empty { emptyset } + + + + ################################################################### + # # + # Miscellaneous # + # # + ################################################################### + + def triangleup { 0.8f @Font triangle } + def triangledown { 180d @Rotate 0.8f @Font triangle } + + ################################################################### + # # + # Symbols with parameters. # + # # + # These symbols are essentially those of eqn, with some # + # changes and additions. # + # # + ################################################################### + + def sup + precedence 60 + associativity left + left x + named gap { @SupGap } + right y + { + @HContract @VContract + { | 0.45w @VShift @Smaller @HSqueeze @VSqueeze y + ^/gap x + } + } + + def sub + precedence 60 + associativity left + left x + named gap { @SupGap } + right y + { + @HContract @VContract + { + # x + "." @KernShrink x + /gap | @Smaller @HSqueeze @VSqueeze y + } + } + + def tsub + precedence 60 + associativity left + left x + named gap { @SupGap } + right y + { + @HContract @VContract + { + x + /gap | &0io 0.2f @HShift @Smaller @HSqueeze @VSqueeze y + } + } + + def supp + precedence 60 + associativity left + left x + named gap { @SupGap } + right y + { + @HContract @VContract + { + { ^/gap x /gap } | y + } + } + + def on + precedence 61 + associativity left + left x + named gap { @SupGap } + right y + { + @Smaller @HSqueeze @VSqueeze x ^/ / + @Smaller @HSqueeze @VSqueeze y + } + + def ton + precedence 61 + associativity left + left x + named gap { @SupGap } + right y + { + @Smaller @HSqueeze @VSqueeze x ^/ / + &0io 0.3f @HShift @Smaller @HSqueeze @VSqueeze y + } + + def frac + precedence 54 + associativity left + left x + named gap { 0.2f } + right y + { + @HContract @VContract @Smaller @HSqueeze @VSqueeze + { 1w @VShift { x /gap } | fraction &0io | 0w @VShift { |gap y } + } + } + + def half { 1 frac 2 } + def third { 1 frac 3 } + + def over + precedence 54 + associativity left + left x + named gap { 0.2f } + right y + { + @HContract @VContract + { |0.5rt @OneCol @VSqueeze x + ^//gap @HLine + //gap |0.5rt @OneCol @VSqueeze @Strut y + } + } + + def from + precedence 58 + associativity left + left x + named gap { @ThinGap } + named skew { 0c } + right y + { + @HContract @VContract + { |0.5rt x + //gap |0.5rt &skew @Smaller @HSqueeze @VSqueeze y + } + } + + def to + precedence 58 + associativity left + left x + named gap { @ThinGap } + named skew { 0c } + right y + { + @HContract @VContract + { |0.5rt &skew @Smaller @HSqueeze @VSqueeze y + ^//gap |0.5rt x + } + } + + def widefrom + precedence 58 + associativity left + left x + named gap { @ThinGap } + right y + { + @HContract @VContract + { + x //gap @HScale y + } + } + + def wideto + precedence 58 + associativity left + left x + named gap { @ThinGap } + right y + { + @HContract @VContract + { + @HScale y ^//gap x + } + } + + def dot + precedence 62 + left x + named gap { @ThinGap } + { + x to gap { gap } skew { @SkewGap } . + } + + def dotdot + precedence 62 + left x + named gap { @ThinGap } + { + x to gap { gap } skew { @SkewGap } .. + } + + def hat + precedence 62 + left x + named gap { @ThinGap } + { + x to gap { gap } skew { @SkewGap } @Base "^" + } + + def tilde + precedence 62 + left x + named gap { @ThinGap } + { + x to gap { gap } skew { @SkewGap } @Base "~" + } + + def vec + precedence 62 + left x + named gap { @ThinGap } + { + x to gap { gap } skew { @SkewGap } arrowright + } + + def dyad + precedence 62 + left x + named gap { @ThinGap } + { + x to gap { gap } skew { @SkewGap } arrowboth + } + + def overbar + precedence 62 + left x + named gap { @ThinGap } + { + x wideto gap { gap } minus + } + + def underbar + precedence 62 + left x + named gap { @ThinGap } + { + x widefrom gap { gap } minus + } + + def sqrt + precedence 56 + named gap { @ThinGap } + right x + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + @VScale surd | @OneRow + { + @HLine line { "0.03 ft setlinewidth 2 setlinecap" } + ^//gap |gap @VSqueeze @Strut x # //gap + } + } + } + PDF @Yield { + @HContract @VContract + { +# +# VT: this PDF is correct but it renders badly in Acrobat (?problem +# with scaling by fractional factors) +# In other words, the @VScale value comes through correctly but it +# looks ugly; GhostScript's translation actually expands the +# "draw surd" instruction into raw moveto's and lineto's which +# it presumably gets from the font's definition of the glyph! +# + @VScale surd | @OneRow + { + @HLine line { "__mul(__loutf, 0.03) w 2 J" } + ^//gap |gap @VSqueeze @Strut x # //gap + } + } + } + } + } + + def root + precedence 56 + left x + right y + { + "" sup x &0io sqrt y + } + + def zroot + precedence 56 + left x + right y + { + def zsup right x { "+0.3f" @VShift 0.5f @Font @Space x } + + "-0.4f" @HShift { 1w @HShift { zsup x } } &0co sqrt y + } + + def above + precedence 52 + left x + named gap { @RowGap } + right y + { + |0.5rt x //gap |0.5rt y + } + + def labove + precedence 52 + left x + named gap { @RowGap } + right y + { + x //gap y + } + + def cabove + precedence 52 + left x + named gap { @RowGap } + right y + { + |0.5rt x //gap |0.5rt y + } + + def rabove + precedence 52 + left x + named gap { @RowGap } + right y + { + |1rt x //gap |1rt y + } + + def mabove + precedence 52 + left x + named gap { @RowGap } + right y + { + x /gap y + } + + def nextcol + precedence 50 + left x + named gap { @ColGap } + right y + { + x |gap y + } + + export row axisrow col lcol ccol rcol mcol + def matrix + precedence 100 + named gap { @MedGap } + named strut + named no { } + named No { } + named yes { 0.5f } + named Yes { 0.5f } + { No } + named atleft {} + named atright {} + named userow { No } + named shiftdelim { Yes } + body x + { + def @Strut + { + strut @Case { + "" @Yield {} + else @Yield { @OneRow { strut @High ^/ strut @High } } + } + } + + def newrow + precedence 50 + associativity left + left x + right y + { + x @Case { + "" @Yield { y | @Strut } + else @Yield { x /@RowGap y | @Strut } + } + } + + macro row { newrow "" } + + def newaxisrow + precedence 50 + associativity left + left x + right y + { + x @Case { + "" @Yield { y | @Strut } + else @Yield { x ^/@RowGap y | @Strut } + } + } + + macro axisrow { newaxisrow "" } + + def col + precedence 52 + associativity left + left x + named indent { 0.5rt } + right y + { + x @Case { + "" @Yield { &indent @OneCol y } + else @Yield { x |@ColGap &indent @OneCol y } + } + } + + def lcol + precedence 52 + associativity left + left x + right y + { + x col indent { 0i } y + } + + def ccol + precedence 52 + associativity left + left x + right y + { + x col indent { 0.5rt } y + } + + def rcol + precedence 52 + associativity left + left x + right y + { + x col indent { 1rt } y + } + + def mcol + precedence 52 + associativity left + left x + right y + { + x @Case { + "" @Yield { @OneCol y } + else @Yield { x |@ColGap @OneCol y } + } + } + + def delim right x + { + x @Case + { + "" @Yield @Null + else @Yield + { + shiftdelim @Case { + { Yes yes } @Yield { @VScale x } + else @Yield { @VCover x } + } + } + } + } + + @HContract @VContract { + delim atleft &@ThinGap + userow @Case { + {Yes yes} @Yield @HContract @VContract {^//gap @OneRow x //gap} + else @Yield vctr @HContract @VContract { //gap x //gap } + } + &@ThinGap delim atright + } + } + + macro pmatrix { matrix atleft { "1.5f" @Font ( } atright { "1.5f" @Font ) }} + macro bmatrix { matrix atleft { blbrack } atright { brbrack } } + macro brmatrix { matrix atleft { blbrace } atright { brbrace } } + macro fmatrix { matrix atleft { blfloor } atright { brfloor } } + macro cmatrix { matrix atleft { blceil } atright { brceil } } + macro amatrix { matrix atleft { blangle } atright { brangle } } + + ################################################################### + # # + # Group 5 (digits) # + # # + ################################################################### + + def "0" { zero } + def "1" { one } + def "2" { two } + def "3" { three } + def "4" { four } + def "5" { five } + def "6" { six } + def "7" { seven } + def "8" { eight } + def "9" { nine } + + + { Slope xheight2mark nostrut } @Font { separate @SpaceGap } @Space + initzunit @ZUnit 1f @YUnit @Body + +@End @Eq + +macro @E { @OneCol @Eq initzunit { 0.7f } } diff --git a/include/include/fig b/include/include/fig new file mode 100644 index 0000000..60395ae --- /dev/null +++ b/include/include/fig @@ -0,0 +1,29 @@ +############################################################################### +# # +# Lout setup file for figure drawing (OBSOLETE: use @Diag instead) # +# # +# Jeffrey H. Kingston # +# 5 February 1999 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# The @SysInclude { figf } line # +# # +# This line causes Lout to read the definitions for equations, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { figf } + + +############################################################################### +# # +# This package does not offer the ability to change default options. # +# # +############################################################################### diff --git a/include/include/figf b/include/include/figf new file mode 100644 index 0000000..0fd060f --- /dev/null +++ b/include/include/figf @@ -0,0 +1,926 @@ + +############################################################################### +# # +# Lout @Fig package for drawing figures (Version 2.0) # +# # +# Version 1.0 by Jeffrey H. Kingston, October 1991. # +# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. # +# Symbol names changed by JHK 5 March 1993 to avoid clashes with EPS files. # +# @CurveBox and @ShadowBox added by JHK April 1995. # +# # +# See "Fig - a Lout package for drawing figures" for user information. # +# # +# This package is now obsolete, having been replaced by @Diag. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +@SysPrependGraphic { "figf.lpg" } + +export in cm pt em sp vs ft dg + "<<" "**" "++" "--" @Max @Min + @Distance @XDistance @YDistance @Angle + @Prev "::" @Label @BaseOf @MarkOf @ShowLabels @Figure + @Frame @Box @CurveBox @ShadowBox @Square @Diamond @Polygon @Ellipse + @Circle @HLine @VLine @Line @HArrow @VArrow @Arrow @Arc + +def @Fig + named maxlabels { 200 } + named linestyle { solid } + named linewidth { 0.5 pt } + named linecap { round } + named dashlength { 0.15 cm } + named paint { nopaint } + named margin { 0.4c } + named arrow { noarrow } + named headstyle { open } + named headwidth { 0.05 cm } + named headlength { 0.15 cm } + body @Body +@Begin + + # Like @Graphic, but affects the graphics state of right parameter + def @InnerGraphic + left ps + right x + { + @BackEnd @Case { + PostScript @Yield { { ps gsave // grestore } @Graphic x } + PDF @Yield { } + } + } + + def in precedence 39 left x { + @BackEnd @Case { + PostScript @Yield { x "in" } + PDF @Yield { "__mul(__in, "x")" } + } + } + + def cm precedence 39 left x { + @BackEnd @Case { + PostScript @Yield { x "cm" } + PDF @Yield { "__mul(__cm, "x")" } + } + } + + def pt precedence 39 left x { + @BackEnd @Case { + PostScript @Yield { x "pt" } + PDF @Yield { "__mul(__pt, "x")" } + } + } + + def em precedence 39 left x { + @BackEnd @Case { + PostScript @Yield { x "em" } + PDF @Yield { "__mul(__em, "x")" } + } + } + + def sp precedence 39 left x { + @BackEnd @Case { + PostScript @Yield { x "sp" } + PDF @Yield { "__mul(__louts, "x")" } + } + } + + def vs precedence 39 left x { + @BackEnd @Case { + PostScript @Yield { x "vs" } + PDF @Yield { "__mul(__loutv, "x")" } + } + } + + def ft precedence 39 left x { + @BackEnd @Case { + PostScript @Yield { x "ft" } + PDF @Yield { "__mul(__loutf, "x")" } + } + } + + def dg precedence 39 left x { + @BackEnd @Case { + PostScript @Yield { x "dg" } + PDF @Yield { } + } + } + + def "<<" + precedence 38 + left length + right angle + { + @BackEnd @Case { + PostScript @Yield { + 0 0 length angle "lfigatangle" + } + PDF @Yield { + } + } + } + + def "**" + precedence 37 + left point + right length + { + @BackEnd @Case { + PostScript @Yield { + point length "lfigpmul" + } + PDF @Yield { + } + } + } + + def "++" + precedence 36 + associativity left + left x + right y + { + @BackEnd @Case { + PostScript @Yield { + x y "lfigpadd" + } + PDF @Yield { + } + } + } + + def "--" + precedence 36 + associativity left + left x + right y + { + @BackEnd @Case { + PostScript @Yield { + y x "lfigpsub" + } + PDF @Yield { + } + } + } + + def @Max + precedence 36 + left x + right y + { + @BackEnd @Case { + PostScript @Yield { + x y "lfigpmax" + } + PDF @Yield { + } + } + } + + def @Min + precedence 36 + left x + right y + { + @BackEnd @Case { + PostScript @Yield { + x y "lfigpmin" + } + PDF @Yield { + } + } + } + + def @Distance + precedence 35 + left x + right y + { + @BackEnd @Case { + PostScript @Yield { + x y "lfigdistance" + } + PDF @Yield { + } + } + } + + def @XDistance + precedence 35 + left x + right y + { + @BackEnd @Case { + PostScript @Yield { + x y "lfigxdistance" + } + PDF @Yield { + } + } + } + + def @YDistance + precedence 35 + left x + right y + { + @BackEnd @Case { + PostScript @Yield { + x y "lfigydistance" + } + PDF @Yield { + } + } + } + + def @Angle + precedence 35 + left x + right y + { + @BackEnd @Case { + PostScript @Yield { + x y "lfigangle" + } + PDF @Yield { + } + } + } + + def @Prev + { + @BackEnd @Case { + PostScript @Yield { + "lfigprevious" + } + PDF @Yield { + } + } + } + + def "::" + precedence 33 + left name + right x + { + @BackEnd @Case { + PostScript @Yield { + { "currentdict end" maxlabels "dict begin begin" + // "("name") lfigpromotelabels" } @Graphic x + } + PDF @Yield { + } + } + } + + def @Label + right name + { + @BackEnd @Case { + PostScript @Yield { + "/"name "lfigpointdef" + } + PDF @Yield { + } + } + } + + def @MarkOf + precedence 32 + left point + right x + { + @BackEnd @Case { + PostScript @Yield { + { point "translate" } @InnerGraphic + { + /0io |0io @OneCol @OneRow x |0io /0io + } + } + PDF @Yield { + } + } + } + + def @BaseOf + precedence 32 + left point + right x + { + @BackEnd @Case { + PostScript @Yield { + { point "translate" } @InnerGraphic + { + /0io |0io @OneRow @OneCol { + | @OneCol @OneRow x ^/ + } |0io /0io + } + } + PDF @Yield { + } + } + } + + def @ShowLabels + { + @BackEnd @Case { + PostScript @Yield { + "lfigshowlabels" @Graphic + } + PDF @Yield { + } + } + } + + def @Figure + named shape { } + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named arrow { arrow } + named headstyle { headstyle } + named headwidth { headwidth } + named headlength { headlength } + named paint { paint } + named margin { 0c } + right x + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + #fill the shape + paint @Case + { + nopaint @Yield {} + + { nochange darkblue blue lightblue darkgreen green lightgreen + darkred red lightred darkcyan cyan lightcyan darkmagenta + magenta lightmagenta darkyellow yellow lightyellow darkgray + gray lightgray darkgrey grey lightgrey black white } + @Yield + { "/lfig"paint "[" shape "] gsave lfigpaintpath grestore" } + } + + # stroke the path and add any arrowheads + linestyle @Case + { + { solid dashed cdashed dotted noline } @Yield + { + linewidth "setlinewidth" "lfig"linecap "setlinecap" + dashlength "/lfig"linestyle "[" shape "] lfigdopath" + arrow @Case + { + noarrow @Yield { pop pop } + { forward back both } @Yield + { dashlength "/lfig"linestyle "/"lfigblack + headstyle @Case + { { open halfopen closed } @Yield "lfig"headstyle } + headlength headwidth "lfig"arrow + } + } + } + } + } + @Graphic + { + ^/margin ^|margin @OneCol @OneRow x |margin + /margin + } + } + + PDF @Yield { + } + } + } + + def @Frame + right x + { + @Figure + shape {xsize 0 @Label X 0 ysize @Label Y} + { x } + } + + def @Box + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { margin } + right x + { + @Figure + shape { + # 0 0 @Label SW + # xsize 0 @Label SE + # xsize ysize @Label NE + # 0 ysize @Label NW + # SE ** 0.5 @Label S + # NW ** 0.5 @Label W + # W ++ SE @Label E + # S ++ NW @Label N + # NE ** 0.5 @Label CTR + # SW SE NE NW SW + lfigbox + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + x + } + + + def @CurveBox + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { margin } + right x + { + @Figure + shape { + lfigcurvebox + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + { 0c @HShift x } + } + + def @ShadowBox + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { margin } + named shadow { 0.2f } + right x + { + @BackEnd @Case { + PostScript @Yield { + @VContract @HContract 0c @HShift "lfigshadow" @Graphic + { + ^/shadow ^|shadow 0c @HShift + @Figure + shape { + lfigbox + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + 0c @HShift x + |shadow /shadow + } + } + PDF @Yield { + @VContract @HContract 0c @HShift + +# "lfigshadow" @Graphic is this: + { "__mul(__xmark, 2) 0 m __xsize 0 l" # xmark 2 mul 0 moveto xsize 0 lineto + "__xsize __sub(__ysize, __mul(__xmark, 2)) l" # xsize ysize xmark 2 mul sub lineto + "__sub(__xsize, __xmark) __sub(ysize, __mul(__xmark, 2)) l" # xsize xmark sub ysize xmark 2 mul sub lineto + "__sub(__xsize, __xmark) __xmark l" # xsize xmark sub xmark lineto + "__mul(__xmark, 2) __xmark l h f" # xmark 2 mul xmark lineto closepath fill + } @Graphic + + { + ^/shadow ^|shadow 0c @HShift + @Figure + shape { + lfigbox + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + 0c @HShift x + |shadow /shadow + } + } + } + } + + def @Square + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { margin } + right x + { + @Figure + shape { + # {xsize ysize} ** 0.5 @Label CTR + # CTR ++ {{xsize xsize} @Max {ysize ysize}}**0.5 @Label NE + # CTR ++ { {CTR @Distance NE} << 135 } @Label NW + # CTR ++ { {CTR @Distance NE} << 225 } @Label SW + # CTR ++ { {CTR @Distance NE} << 315 } @Label SE + # SW ** 0.5 ++ SE ** 0.5 @Label S + # NW ** 0.5 ++ NE ** 0.5 @Label N + # SW ** 0.5 ++ NW ** 0.5 @Label W + # SE ** 0.5 ++ NE ** 0.5 @Label E + # SW SE NE NW SW + lfigsquare + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + x + } + + def @Diamond + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { margin } + right x + { + @Figure + shape { + # {xsize 0} ** 0.5 @Label S + # {0 ysize} ** 0.5 @Label W + # S ++ W @Label CTR + # CTR ++ W @Label N + # CTR ++ S @Label E + # S E N W S + lfigdiamond + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + x + } + + def @Polygon + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { margin } + named sides { 3 } + named angle { "dup 180 exch div" } + right x + { + @Figure + shape { sides angle lfigpolygon } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + x + } + + def @Ellipse + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { margin } + right x + { + @Figure + shape { + # {xsize 0} ** 0.5 @Label S + # {0 ysize} ** 0.5 @Label W + # S ++ W @Label CTR + # CTR ++ W @Label N + # CTR ++ S @Label E + # CTR ++ {xsize 0} ** 0.3536 ++ {0 ysize} ** 0.3536 @Label NE + # CTR ++ {xsize 0} ** 0.3536 -- {0 ysize} ** 0.3536 @Label SE + # CTR -- {xsize 0} ** 0.3536 ++ {0 ysize} ** 0.3536 @Label NW + # CTR -- {xsize 0} ** 0.3536 -- {0 ysize} ** 0.3536 @Label SW + # S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S + lfigellipse + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + x + } + + def @Circle + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { margin } + right x + { + @Figure + shape { + # {xsize ysize} **0.5 @Label CTR + # CTR ++ {{xsize 0} @Max {ysize 0}}**0.5 @Label E + # CTR ++ { {CTR @Distance E} << 45 } @Label NE + # CTR ++ { {CTR @Distance E} << 90 } @Label N + # CTR ++ { {CTR @Distance E} << 135 } @Label NW + # CTR ++ { {CTR @Distance E} << 180 } @Label W + # CTR ++ { {CTR @Distance E} << 225 } @Label SW + # CTR ++ { {CTR @Distance E} << 270 } @Label S + # CTR ++ { {CTR @Distance E} << 315 } @Label SE + # S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S + lfigcircle + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + x + } + + def @HLine + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { 0c } + named arrow { arrow } + named headstyle { headstyle } + named headwidth { headwidth } + named headlength { headlength } + right x + { + @Figure + shape { + # 0 ymark @Prev @Label FROM + # xsize ymark @Prev @Label TO + lfighline + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + arrow { arrow } + headstyle { headstyle } + headwidth { headwidth } + headlength { headlength } + x + } + + def @VLine + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { 0c } + named arrow { arrow } + named headstyle { headstyle } + named headwidth { headwidth } + named headlength { headlength } + right x + { + @Figure + shape { + # xmark ysize @Prev @Label FROM + # xmark 0 @Prev @Label TO + lfigvline + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + arrow { arrow } + headstyle { headstyle } + headwidth { headwidth } + headlength { headlength } + x + } + + def @HArrow + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { 0c } + named arrow { forward } + named headstyle { headstyle } + named headwidth { headwidth } + named headlength { headlength } + right x + { + @Figure + shape { + # 0 ymark @Prev @Label FROM + # xsize ymark @Prev @Label TO + lfighline + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + arrow { arrow } + headstyle { headstyle } + headwidth { headwidth } + headlength { headlength } + x + } + + def @VArrow + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { 0c } + named arrow { forward } + named headstyle { headstyle } + named headwidth { headwidth } + named headlength { headlength } + right x + { + @Figure + shape { + # xmark ysize @Prev @Label FROM + # xmark 0 @Prev @Label TO + lfigvline + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + arrow { arrow } + headstyle { headstyle } + headwidth { headwidth } + headlength { headlength } + x + } + + def @Line + named from { 0 ysize } + named to { xsize 0 } + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { 0c } + named arrow { arrow } + named headstyle { headstyle } + named headwidth { headwidth } + named headlength { headlength } + right x + { + @Figure + shape { + from @Prev @Label FROM + to @Prev @Label TO + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + arrow { arrow } + headstyle { headstyle } + headwidth { headwidth } + headlength { headlength } + x + } + + def @Arrow + named from { 0 ysize } + named to { xsize 0 } + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { 0c } + named arrow { forward } + named headstyle { headstyle } + named headwidth { headwidth } + named headlength { headlength } + right x + { + @Figure + shape { + from @Prev @Label FROM + to @Prev @Label TO + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + arrow { arrow } + headstyle { headstyle } + headwidth { headwidth } + headlength { headlength } + x + } + + def @Arc + named from { 0 ysize } + named to { xsize 0 } + named ctr { 0 0 } + named direction { clockwise } + named linestyle { linestyle } + named linewidth { linewidth } + named linecap { linecap } + named dashlength { dashlength } + named paint { paint } + named margin { 0c } + named arrow { noarrow } + named headstyle { headstyle } + named headwidth { headwidth } + named headlength { headlength } + right x + { + @Figure + shape { + from @Label FROM + to @Label TO + ctr @Label CTR + FROM [ CTR + direction @Case { {clockwise anticlockwise} @Yield direction } + ] TO + } + linestyle { linestyle } + linewidth { linewidth } + linecap { linecap } + dashlength { dashlength } + paint { paint } + margin { margin } + arrow { arrow } + headstyle { headstyle } + headwidth { headwidth } + headlength { headlength } + x + } + + @BackEnd @Case { + PostScript @Yield { + { "grestore save gsave" maxlabels "dict begin lfigdict begin" + // "end end restore" + } @Graphic @Body + } + PDF @Yield { + } + } + +@End @Fig diff --git a/include/include/figf.lpg b/include/include/figf.lpg new file mode 100644 index 0000000..7465cef --- /dev/null +++ b/include/include/figf.lpg @@ -0,0 +1,1010 @@ +%%BeginResource: procset LoutFigPrependGraphic +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Fig Jeffrey H. Kingston % +% Version 2.0 (includes CIRCUM label) January 1992 % +% % +% This file has been placed in the public domain by its author, % +% Jeffrey H. Kingston % +% % +% Although Fig is now obsolete I have updated it 20 October 2002 % +% to work with textures, i.e. replacing setrgbcolor with % +% LoutSetRGBColor. % +% % +% To assist in avoiding name clashes, the names of all symbols % +% defined here begin with "lfig". However, this is not feasible % +% with user-defined labels and some labels used by users. % +% % +% <point> is two numbers, a point. % +% <length> is one number, a length % +% <angle> is one number, an angle in degrees % +% <dashlength> is one number, the preferred length of a dash % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +errordict begin + /handleerror + { + { /Times-Roman findfont 8 pt scalefont setfont + 0 setgray 4 pt 4 pt moveto + $error /errorname get + dup lfigdict exch known + { lfigdict exch get } + { 30 string cvs } ifelse + show + ( Command: ) show + $error /command get 30 string cvs show + } stopped {} if + showpage stop + } def +end + +% concat strings: <string> <string> lfigconcat <string> +% must be defined outside lfigdict since used in lfigpromotelabels +/lfigconcat +{ 2 copy length exch length add string + dup 0 4 index putinterval + dup 3 index length 3 index putinterval + 3 1 roll pop pop +} def + +% <string> lfigdebugprint - +% must be defined outside lfigdict since used in arbitrary places +% /lfigdebugprint +% { print +% (; operand stack:\n) print +% count copy +% count 2 idiv +% { == +% (\n) print +% } repeat +% (\n) print +% } def + +/lfigdict 120 dict def +lfigdict begin + +% error messages +/dictfull (dictfull error: too many labels?) def +/dictstackoverflow (dictstackoverflow error: labels nested too deeply?) def +/execstackoverflow (execstackoverflow error: figure nested too deeply?) def +/limitcheck (limitcheck error: figure nested too deeply or too large?) def +/syntaxerror (syntaxerror error: syntax error in text of figure?) def +/typecheck (typecheck error: syntax error in text of figure?) def +/undefined (undefined error: unknown or misspelt label?) def +/VMError (VMError error: run out of memory?) def + +% push pi onto stack: - lfigpi <num> +/lfigpi 3.14159 def + +% arc directions +/clockwise false def +/anticlockwise true def + +% maximum of two numbers: <num> <num> lfigmax <num> +/lfigmax { 2 copy gt { pop } { exch pop } ifelse } def + +% minimum of two numbers: <num> <num> lfigmin <num> +/lfigmin { 2 copy lt { pop } { exch pop } ifelse } def + +% add two points: <point> <point> lfigpadd <point> +/lfigpadd { exch 3 1 roll add 3 1 roll add exch } def + +% subtract first point from second: <point> <point> lfigpsub <point> +/lfigpsub { 3 2 roll sub 3 1 roll exch sub exch } def + +% max two points: <point> <point> lfigpmax <point> +/lfigpmax { exch 3 1 roll lfigmax 3 1 roll lfigmax exch } def + +% min two points: <point> <point> lfigpmin <point> +/lfigpmin { exch 3 1 roll lfigmin 3 1 roll lfigmin exch } def + +% scalar multiplication: <point> <num> lfigpmul <point> +/lfigpmul { dup 3 1 roll mul 3 1 roll mul exch } def + +% point at angle and distance: <point> <length> <angle> lfigatangle <point> +/lfigatangle { 2 copy cos mul 3 1 roll sin mul lfigpadd } def + +% angle from one point to another: <point> <point> lfigangle <angle> +/lfigangle { lfigpsub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def + +% distance between two points: <point> <point> lfigdistance <length> +/lfigdistance { lfigpsub dup mul exch dup mul add sqrt } def + +% difference in x coords: <point> <point> lfigxdistance <length> +/lfigxdistance { pop 3 1 roll pop sub } def + +%difference in y coords: <point> <point> lfigydistance <length> +/lfigydistance { 3 1 roll pop sub exch pop } def + +% stroke a solid line: <length> <dashlength> lfigsolid - +/lfigsolid +{ pop pop [] 0 setdash stroke +} def + +% stroke a lfigdashed line: <length> <dashlength> lfigdashed - +/lfigdashed +{ 2 copy div 2 le 1 index 0 le or + { exch pop 1 pt lfigmax [ exch dup ] 0 setdash } + { dup [ exch 4 2 roll 2 copy div + 1 sub 2 div ceiling dup 4 1 roll + 1 add mul sub exch div ] 0 setdash + } ifelse stroke +} def + +% stroke a lfigcdashed line: <length> <dashlength> lfigcdashed - +/lfigcdashed +{ 2 copy le 1 index 0 le or + { exch pop 1 pt lfigmax [ exch dup ] dup 0 get 2 div setdash } + { dup [ 4 2 roll exch 2 copy exch div + 2 div ceiling div 1 index sub + ] exch 2 div setdash + } ifelse stroke +} def + +% stroke a dotted line: <length> <dashlength> lfigdotted - +/lfigdotted +{ 2 copy le 1 index 0 le or + { exch pop 1 pt lfigmax [ exch 0 exch ] 0 setdash } + { 1 index exch div ceiling div + [ 0 3 2 roll ] 0 setdash + } ifelse stroke +} def + +% stroke a noline line: <length> <dashlength> lfignoline - +/lfignoline +{ pop pop +} def + +% painting (i.e. filling): - lfigwhite - (etc.) +/lfignopaint { } def +/lfignochange { fill } def +/lfigdarkblue { 0.0 0.0 0.5 LoutSetRGBColor fill } def +/lfigblue { 0.0 0.0 1.0 LoutSetRGBColor fill } def +/lfiglightblue { 0.5 0.5 1.0 LoutSetRGBColor fill } def +/lfigdarkgreen { 0.0 0.5 0.0 LoutSetRGBColor fill } def +/lfiggreen { 0.0 1.0 0.0 LoutSetRGBColor fill } def +/lfiglightgreen { 0.5 1.0 0.5 LoutSetRGBColor fill } def +/lfigdarkred { 0.5 0.0 0.0 LoutSetRGBColor fill } def +/lfigred { 1.0 0.0 0.0 LoutSetRGBColor fill } def +/lfiglightred { 1.0 0.5 0.5 LoutSetRGBColor fill } def +/lfigdarkcyan { 0.0 0.5 0.5 LoutSetRGBColor fill } def +/lfigcyan { 0.0 1.0 1.0 LoutSetRGBColor fill } def +/lfiglightcyan { 0.5 1.0 1.0 LoutSetRGBColor fill } def +/lfigdarkmagenta { 0.5 0.0 0.5 LoutSetRGBColor fill } def +/lfigmagenta { 1.0 0.0 1.0 LoutSetRGBColor fill } def +/lfiglightmagenta { 1.0 0.5 1.0 LoutSetRGBColor fill } def +/lfigdarkyellow { 0.5 0.5 0.0 LoutSetRGBColor fill } def +/lfigyellow { 1.0 1.0 0.0 LoutSetRGBColor fill } def +/lfiglightyellow { 1.0 1.0 0.5 LoutSetRGBColor fill } def +/lfigdarkgray { 0.2 0.2 0.2 LoutSetRGBColor fill } def +/lfiggray { 0.5 0.5 0.5 LoutSetRGBColor fill } def +/lfiglightgray { 0.8 0.8 0.8 LoutSetRGBColor fill } def +/lfigdarkgrey { 0.2 0.2 0.2 LoutSetRGBColor fill } def +/lfiggrey { 0.5 0.5 0.5 LoutSetRGBColor fill } def +/lfiglightgrey { 0.8 0.8 0.8 LoutSetRGBColor fill } def +/lfigblack { 0.0 0.0 0.0 LoutSetRGBColor fill } def +/lfigwhite { 1.0 1.0 1.0 LoutSetRGBColor fill } def + +% line caps (and joins, not currently used) +/lfigbutt 0 def +/lfiground 1 def +/lfigprojecting 2 def +/lfigmiter 0 def +/lfigbevel 2 def + +% shape and labels of the @Box symbol +/lfigbox +{ + 0 0 /SW lfigpointdef + xsize 0 /SE lfigpointdef + xsize ysize /NE lfigpointdef + 0 ysize /NW lfigpointdef + SE 0.5 lfigpmul /S lfigpointdef + NW 0.5 lfigpmul /W lfigpointdef + W SE lfigpadd /E lfigpointdef + S NW lfigpadd /N lfigpointdef + NE 0.5 lfigpmul /CTR lfigpointdef + [ CTR NE lfigpsub /lfigboxcircum cvx ] lfigcircumdef + SW SE NE NW SW +} def + +% shape and labels of the @CurveBox symbol +/lfigcurvebox +{ + + xsize 0.5 mul ysize 0.5 mul /CTR lfigpointdef + xsize 0.5 mul 0 /S lfigpointdef + xsize ysize 0.5 mul /E lfigpointdef + xsize 0.5 mul ysize /N lfigpointdef + 0 ysize 0.5 mul /W lfigpointdef + + xmark 0.293 mul xmark 0.293 mul /SW lfigpointdef + xsize xmark 0.293 mul sub xmark 0.293 mul /SE lfigpointdef + xsize xmark 0.293 mul sub ysize xmark 0.293 mul sub /NE lfigpointdef + xmark 0.293 mul ysize xmark 0.293 mul sub /NW lfigpointdef + + [ xsize ysize 0.5 lfigpmul xmark /lfigcurveboxcircum cvx ] lfigcircumdef + + xmark 0 + xsize xmark sub 0 + [ xsize xmark sub xmark ] + xsize xmark + xsize ysize xmark sub + [ xsize xmark sub ysize xmark sub ] + xsize xmark sub ysize + xmark ysize + [ xmark ysize xmark sub ] + 0 ysize xmark sub + 0 xmark + [ xmark xmark ] + xmark 0 +} def + +% shadow of the @ShadowBox symbol +% its shape and labels are done, somewhat inaccurately, with lfigbox +/lfigshadow +{ xmark 2 mul 0 moveto xsize 0 lineto + xsize ysize xmark 2 mul sub lineto + xsize xmark sub ysize xmark 2 mul sub lineto + xsize xmark sub xmark lineto + xmark 2 mul xmark lineto closepath fill +} def + +% shape and labels of the @Square symbol +/lfigsquare +{ + xsize ysize 0.5 lfigpmul /CTR lfigpointdef + CTR xsize xsize ysize ysize lfigpmax 0.5 lfigpmul lfigpadd /NE lfigpointdef + CTR 0 0 CTR NE lfigdistance 135 lfigatangle lfigpadd /NW lfigpointdef + CTR 0 0 CTR NE lfigdistance 225 lfigatangle lfigpadd /SW lfigpointdef + CTR 0 0 CTR NE lfigdistance 315 lfigatangle lfigpadd /SE lfigpointdef + SW 0.5 lfigpmul SE 0.5 lfigpmul lfigpadd /S lfigpointdef + NW 0.5 lfigpmul NE 0.5 lfigpmul lfigpadd /N lfigpointdef + SW 0.5 lfigpmul NW 0.5 lfigpmul lfigpadd /W lfigpointdef + SE 0.5 lfigpmul NE 0.5 lfigpmul lfigpadd /E lfigpointdef + [ CTR NE lfigpsub /lfigboxcircum cvx ] lfigcircumdef + SW SE NE NW SW +} def + +% shape and labels of the @Diamond symbol +/lfigdiamond +{ + xsize 0 0.5 lfigpmul /S lfigpointdef + 0 ysize 0.5 lfigpmul /W lfigpointdef + S W lfigpadd /CTR lfigpointdef + CTR W lfigpadd /N lfigpointdef + CTR S lfigpadd /E lfigpointdef + [ xsize ysize 0.5 lfigpmul /lfigdiamondcircum cvx ] lfigcircumdef + S E N W S +} def + +% shape and labels of the @Ellipse symbol +/lfigellipse +{ + xsize 0 0.5 lfigpmul /S lfigpointdef + 0 ysize 0.5 lfigpmul /W lfigpointdef + S W lfigpadd /CTR lfigpointdef + CTR W lfigpadd /N lfigpointdef + CTR S lfigpadd /E lfigpointdef + CTR xsize 0 0.3536 lfigpmul lfigpadd 0 ysize 0.3536 lfigpmul lfigpadd /NE lfigpointdef + 0 ysize 0.3536 lfigpmul CTR xsize 0 0.3536 lfigpmul lfigpadd lfigpsub /SE lfigpointdef + xsize 0 0.3536 lfigpmul CTR lfigpsub 0 ysize 0.3536 lfigpmul lfigpadd /NW lfigpointdef + 0 ysize 0.3536 lfigpmul xsize 0 0.3536 lfigpmul CTR lfigpsub lfigpsub /SW lfigpointdef + [ xsize ysize 0.5 lfigpmul /lfigellipsecircum cvx ] lfigcircumdef + S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S +} def + +% shape and labels of the @Circle symbol +/lfigcircle +{ + xsize ysize 0.5 lfigpmul /CTR lfigpointdef + CTR xsize 0 ysize 0 lfigpmax 0.5 lfigpmul lfigpadd /E lfigpointdef + CTR 0 0 CTR E lfigdistance 45 lfigatangle lfigpadd /NE lfigpointdef + CTR 0 0 CTR E lfigdistance 90 lfigatangle lfigpadd /N lfigpointdef + CTR 0 0 CTR E lfigdistance 135 lfigatangle lfigpadd /NW lfigpointdef + CTR 0 0 CTR E lfigdistance 180 lfigatangle lfigpadd /W lfigpointdef + CTR 0 0 CTR E lfigdistance 225 lfigatangle lfigpadd /SW lfigpointdef + CTR 0 0 CTR E lfigdistance 270 lfigatangle lfigpadd /S lfigpointdef + CTR 0 0 CTR E lfigdistance 315 lfigatangle lfigpadd /SE lfigpointdef + [ S E lfigpsub /lfigellipsecircum cvx ] lfigcircumdef + S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S +} def + +% shape and labels of the @HLine and @HArrow symbols +/lfighline +{ + 0 ymark lfigprevious /FROM lfigpointdef + xsize ymark lfigprevious /TO lfigpointdef +} def + +% shape and labels of the @VLine and @VArrow symbols +/lfigvline +{ + xmark ysize lfigprevious /FROM lfigpointdef + xmark 0 lfigprevious /TO lfigpointdef +} def + +% points of a polygon around base with given no of sides, vert init angle: +% <sides> <angle> figpolygon <point> ... <point> +/lfigpolygon +{ xsize ysize 0.5 lfigpmul /CTR lfigpointdef + 90 sub CTR 2 copy lfigmax 5 3 roll + [ 4 copy pop /lfigpolycircum cvx ] lfigcircumdef + exch dup 360 exch div exch + 1 1 3 2 roll + { 4 string cvs (P) exch lfigconcat cvn + 6 copy pop pop lfigatangle 2 copy 10 2 roll + 3 2 roll lfigpointdef + dup 3 1 roll add exch + } for + pop lfigatangle +} def + +% next array element: <array> <index> lfiggetnext <array> <index> <any> true +% or <array> <index> false +/lfiggetnext +{ 2 copy exch length ge + { false } + { 2 copy get exch 1 add exch true } ifelse +} def + +% check whether thing is number: <any> lfigisnumbertype <any> <bool> +/lfigisnumbertype +{ dup type dup + /integertype eq exch /realtype eq or +} def + +% check whether thing is an array: <any> lfigisarraytype <any> <bool> +/lfigisarraytype { dup type /arraytype eq } def + +% get next item: <array> <index> lfiggetnextitem <array> <index> 0 +% or <array> <index> <array> 1 +% or <array> <index> <point> 2 +/lfiggetnextitem +{ lfiggetnext + { lfigisarraytype + { 1 + } + { lfigisnumbertype + { 3 1 roll + lfiggetnext + { lfigisnumbertype + { 4 3 roll exch 2 + } + { pop 3 2 roll pop 0 + } ifelse + } + { 3 2 roll pop 0 + } ifelse + } + { pop 0 + } ifelse + } ifelse + } + { 0 + } ifelse +} def + +% set arc path: bool x1 y1 x2 y2 x0 y0 lfigsetarc <angle> <angle> <dist> +% the path goes from x1 y1 to x2 y2 about centre x0 y0, +% anticlockwise if bool is true else clockwise. +% The orientations of backwards pointing and forwards pointing +% arrowheads are returned in the two angles, and +% the length of the arc is returned in <dist>. +/lfigsetarc +{ + 20 dict begin + matrix currentmatrix 8 1 roll + 2 copy translate 2 copy 8 2 roll + 4 2 roll lfigpsub 6 2 roll lfigpsub + dup /y1 exch def dup mul /y1s exch def + dup /x1 exch def dup mul /x1s exch def + dup /y2 exch def dup mul /y2s exch def + dup /x2 exch def dup mul /x2s exch def + + y1s y2s eq + { -1 + } + { y1s x2s mul y2s x1s mul sub y1s y2s sub div + } ifelse + /da exch def + + x1s x2s eq + { -1 + } + { x1s y2s mul x2s y1s mul sub x1s x2s sub div + } ifelse + /db exch def + + da 0 gt db 0 gt and + { /LMax da sqrt db sqrt lfigmax def + /scalex da sqrt LMax div def + /scaley db sqrt LMax div def + scalex scaley scale + 0 0 LMax + 0 0 x1 scalex mul y1 scaley mul lfigangle + 0 0 x2 scalex mul y2 scaley mul lfigangle + 2 copy eq { 360 add } if + 2 copy 8 2 roll + 5 index { arc } { arcn } ifelse + 2 index 1 index + { 90 sub } { 90 add } ifelse + dup sin scaley mul exch cos scalex mul atan + 2 index 2 index + { 90 add } { 90 sub } ifelse + dup sin scaley mul exch cos scalex mul atan + 5 2 roll % res1 res2 ang1 ang2 anticlockwise + { exch sub } { sub } ifelse + dup 0 le { 360 add } if lfigpi mul LMax mul 180 div + } + { 0 0 x1 y1 lfigdistance 0 0 x2 y2 lfigdistance eq + 0 0 x1 y1 lfigdistance 0 gt and + { 0 0 + 0 0 x1 y1 lfigdistance + 0 0 x1 y1 lfigangle + 0 0 x2 y2 lfigangle + 2 copy eq { 360 add } if + 2 copy 8 2 roll + 5 index { arc } { arcn } ifelse + 2 index 1 index + { 90 sub } { 90 add } ifelse + 2 index 2 index + { 90 add } { 90 sub } ifelse + 5 2 roll % res1 res2 ang1 ang2 clockwise + { exch sub } { sub } ifelse + dup 0 le { 360 add } if lfigpi mul 0 0 x1 y1 lfigdistance mul 180 div + } + { x2 y2 lineto pop + x2 y2 x1 y1 lfigangle + x1 y1 x2 y2 lfigangle + x1 y1 x2 y2 lfigdistance + } ifelse + } ifelse + 4 -1 roll setmatrix + end +} def + +% lfigsetcurve: set up a Bezier curve from x0 y0 to x3 y3 +% and return arrowhead angles and length of curve (actually 0) +% x0 y0 x1 y1 x2 y2 x3 y3 lfigsetcurve <angle> <angle> <length> +/lfigsetcurve +{ 8 copy curveto pop pop + lfigangle + 5 1 roll + 4 2 roll lfigangle + exch + 0 +} def + +% lfigpaintpath: paint a path of the given shape +% /paint [ shape ] lfigpaintpath - +/lfigpaintpath +{ + 10 dict begin + 0 newpath + /prevseen false def + /curveseen false def + { lfiggetnextitem + dup 0 eq { pop exit } + { 1 eq + { /curveseen true def + /curve exch def + curve length 0 eq { /curveseen false def } if + } + { /ycurr exch def + /xcurr exch def + prevseen + { curveseen + { curve length 4 eq + { xprev yprev + curve 0 get curve 1 get + curve 2 get curve 3 get + xcurr ycurr + lfigsetcurve pop pop pop + } + { xprev yprev xcurr ycurr + curve length 1 ge { curve 0 get } { 0 } ifelse + curve length 2 ge { curve 1 get } { 0 } ifelse + curve length 3 ge { curve 2 get } { true } ifelse + 7 1 roll + lfigsetarc pop pop pop + } ifelse + } + { xcurr ycurr lineto + } ifelse + } + { xcurr ycurr moveto + } ifelse + /xprev xcurr def + /yprev ycurr def + /prevseen true def + /curveseen false def + } ifelse + } ifelse + } loop pop pop cvx exec + end +} def + +% stroke a path of the given shape in the given linestyle and dash length. +% Return the origin and angle of the backward and forward arrow heads. +% dashlength /linestyle [shape] lfigdopath [<point> <angle>] [<point> <angle>] +/lfigdopath +{ + 10 dict begin + 0 + /prevseen false def + /curveseen false def + /backarrow [] def + /fwdarrow [] def + { + lfiggetnextitem + dup 0 eq { pop exit } + { + 1 eq + { /curveseen true def + /curve exch def + curve length 0 eq { /prevseen false def } if + } + { /ycurr exch def + /xcurr exch def + prevseen + { newpath xprev yprev moveto + curveseen + { curve length 4 eq + { xprev yprev + curve 0 get curve 1 get + curve 2 get curve 3 get + xcurr ycurr lfigsetcurve + } + { xprev yprev xcurr ycurr + curve length 1 ge { curve 0 get } { 0 } ifelse + curve length 2 ge { curve 1 get } { 0 } ifelse + curve length 3 ge { curve 2 get } { true } ifelse + 7 1 roll + lfigsetarc + } ifelse + } + { xcurr ycurr lineto + xcurr ycurr xprev yprev lfigangle dup 180 sub + xprev yprev xcurr ycurr lfigdistance + } ifelse + 6 index 6 index cvx exec + [ xprev yprev 5 -1 roll ] + backarrow length 0 eq + { /backarrow exch def } + { pop } ifelse + [ xcurr ycurr 4 -1 roll ] /fwdarrow exch def + } if + /xprev xcurr def + /yprev ycurr def + /prevseen true def + /curveseen false def + } ifelse + } ifelse + } loop + pop pop pop pop + backarrow length 0 eq { [ 0 0 0 ] } { backarrow } ifelse + fwdarrow length 0 eq { [ 0 0 0 ] } { fwdarrow } ifelse + end +} def + +% lfigdoarrow: draw an arrow head of given form +% dashlength /lstyle /pstyle hfrac height width [ <point> <angle> ] lfigdoarrow - +/lfigdoarrow +{ matrix currentmatrix 8 1 roll + dup 0 get 1 index 1 get translate + 2 get rotate + [ 2 index neg 2 index 0 0 + 3 index 3 index neg + 1 index 10 index mul 0 + 7 index 7 index ] + 4 1 roll pop pop pop + dup 3 1 roll + gsave lfigpaintpath grestore lfigdopath pop pop + setmatrix +} def + +% arrow head styles +/lfigopen 0.0 def +/lfighalfopen 0.5 def +/lfigclosed 1.0 def + +% stroke no arrows, forward, back, and both +/lfignoarrow { pop pop pop pop pop pop pop pop } def +/lfigforward { 7 -1 roll lfigdoarrow pop } def +/lfigback { 8 -2 roll pop lfigdoarrow } def +/lfigboth { 8 -1 roll 7 copy lfigdoarrow pop 7 -1 roll lfigdoarrow } def + +% lfigprevious: return previous point on path +/lfigprevious +{ lfigisnumbertype + { 2 copy } + { lfigisarraytype + { 2 index 2 index } + { 0 0 } + ifelse + } ifelse +} def + +% label a point in 2nd top dictionary: <point> /name lfigpointdef - +/lfigpointdef +{ + % (Entering lfigpointdef) lfigdebugprint + [ 4 2 roll transform + /itransform cvx ] cvx + currentdict end + 3 1 roll + % currentdict length currentdict maxlength lt + % { def } + % { exec moveto (too many labels) show stop } + % ifelse + def + begin + % (Leaving lfigpointdef) lfigdebugprint +} def + +% promote labels from second top to third top dictionary +% <string> lfigpromotelabels - +/lfigpromotelabels +{ + % (Entering lfigpromotelabels) lfigdebugprint + currentdict end exch currentdict end + { exch 20 string cvs 2 index + (@) lfigconcat exch lfigconcat cvn exch def + } forall pop begin + % (Leaving lfigpromotelabels) lfigdebugprint +} def + +% show labels (except CIRCUM): - lfigshowlabels - +/lfigshowlabels +{ + % (Entering lfigshowlabels) lfigdebugprint + currentdict end + currentdict + { 1 index 20 string cvs (CIRCUM) search % if CIRCUM in key + { pop pop pop pop pop } + { pop cvx exec 2 copy + newpath 1.5 pt 0 360 arc + 0 setgray fill + /Times-Roman findfont 8 pt scalefont setfont + moveto 0.2 cm 0.1 cm rmoveto 20 string cvs show + } + ifelse + } forall + begin + % (Leaving lfigshowlabels) lfigdebugprint +} def + +% fix an angle to 0 <= res < 360: <angle> lfigfixangle <angle> +/lfigfixangle +{ + % (Entering lfigfixangle) lfigdebugprint + { dup 0 ge { exit } if + 360 add + } loop + { dup 360 lt { exit } if + 360 sub + } loop + % (Leaving lfigfixangle) lfigdebugprint +} def + +% find point on circumference of box: alpha a b lfigboxcircum x y +/lfigboxcircum +{ + % (Entering lfigboxcircum) lfigdebugprint + 4 dict begin + /b exch def + /a exch def + lfigfixangle /alpha exch def + 0 0 a b lfigangle /theta exch def + + % if alpha <= theta, return (a, a*tan(alpha)) + alpha theta le + { a a alpha sin mul alpha cos div } + { + % else if alpha <= 180 - theta, return (b*cot(alpha), b) + alpha 180 theta sub le + { b alpha cos mul alpha sin div b } + { + % else if alpha <= 180 + theta, return (-a, -a*tan(alpha)) + alpha 180 theta add le + { a neg a neg alpha sin mul alpha cos div } + { + % else if alpha <= 360 - theta, return (-b*cot(alpha), -b) + alpha 360 theta sub le + { b neg alpha cos mul alpha sin div b neg } + { + % else 360 - theta <= alpha, return (a, a*tan(alpha)) + a a alpha sin mul alpha cos div + } ifelse + } ifelse + } ifelse + } ifelse + end + % (Leaving lfigboxcircum) lfigdebugprint +} def + +% find quadratic roots (assume a != 0): a b c lfigqroots x1 x2 2 +% or x2 1 +% or 0 +/lfigqroots +{ + 4 dict begin + /c exch def + /b exch def + /a exch def + /disc b b mul 4 a c mul mul sub def + disc 0 lt + { 0 + } + { disc 0 eq + { b neg 2 a mul div + 1 + } + { b neg disc sqrt add 2 a mul div + b neg disc sqrt sub 2 a mul div + 2 + } + ifelse + } + ifelse + end +} def + +% work our which quadrant: <angle> lfigquadrant <0-3> +/lfigquadrant +{ dup 90 lt + { pop 0 + } + { dup 180 lt + { pop 1 + } + { 270 lt + { 2 + } + { 3 + } ifelse + } ifelse + } ifelse +} def + +% find curvebox circum, assuming upper right quadrant: alpha a b xmk lfigcb x y +/lfigcb +{ + 6 dict begin + /xmk exch def + /b exch def + /a exch def + /alpha exch def + /theta1 0 0 a b xmk sub lfigangle def + /theta2 0 0 a xmk sub b lfigangle def + alpha theta1 le + { % if alpha <= theta1, return (a, a*tan(alpha)) + a a alpha sin mul alpha cos div + } + { alpha theta2 ge + { % else if alpha > theta2, return (b*cot(alpha), b) + b alpha cos mul alpha sin div b + } + { + % else, return the intersection of line and circle + a xmk sub b xmk sub xmk 0 0 alpha lfigcircleintersect + dup 0 eq + { % should never happen, just return any reasonable point + pop + a b 0.5 lfigpmul + } + { 1 eq + { % should never happen, just return the point on top of stack + } + { % the usual case, two points on stack, return the larger + lfigpmax + } ifelse + } ifelse + } ifelse + } ifelse + end +} def + +% find point on circumference of curvebox: alpha a b xmk lfigcurveboxcircum x y +/lfigcurveboxcircum +{ + % (Entering lfigcurveboxcircum) lfigdebugprint + 5 dict begin + /xmk exch def + /b exch def + /a exch def + lfigfixangle /alpha exch def + + % work out which quadrant we are in, and reflect accordingly + /quad alpha lfigquadrant def + quad 0 eq + { alpha a b xmk lfigcb + } + { quad 1 eq + { 180 alpha sub a b xmk lfigcb exch neg exch + } + { quad 2 eq + { alpha 180 sub a b xmk lfigcb neg exch neg exch + } + { 360 alpha sub a b xmk lfigcb neg + } ifelse + } ifelse + } ifelse + end + % (Leaving lfigcurveboxcircum) lfigdebugprint +} def + +% find point on circumference of diamond: alpha a b lfigdiamondcircum x y +/lfigdiamondcircum +{ + % (Entering lfigdiamondcircum) lfigdebugprint + 4 dict begin + /b exch def + /a exch def + lfigfixangle /alpha exch def + b alpha cos abs mul a alpha sin abs mul add /denom exch def + a b mul alpha cos mul denom div + a b mul alpha sin mul denom div + end + % (Leaving lfigdiamondcircum) lfigdebugprint +} def + +% find point on circumference of ellipse: alpha a b lfigellipsecircum x y +/lfigellipsecircum +{ + % (Entering lfigellipsecircum) lfigdebugprint + 4 dict begin + /b exch def + /a exch def + lfigfixangle /alpha exch def + b alpha cos mul dup mul a alpha sin mul dup mul add sqrt /denom exch def + a b mul alpha cos mul denom div + a b mul alpha sin mul denom div + end + % (Leaving lfigellipsecircum) lfigdebugprint +} def + +% find point of intersection of two lines each defined by two points +% x1 y1 x2 y2 x3 y3 x4 y4 lfiglineintersect x y +/lfiglineintersect +{ + % (Entering lfiglineintersect) lfigdebugprint + 13 dict begin + /y4 exch def + /x4 exch def + /y3 exch def + /x3 exch def + /y2 exch def + /x2 exch def + /y1 exch def + /x1 exch def + x2 x1 sub /x21 exch def + x4 x3 sub /x43 exch def + y2 y1 sub /y21 exch def + y4 y3 sub /y43 exch def + y21 x43 mul y43 x21 mul sub /det exch def + + % calculate x + y21 x43 mul x1 mul + y43 x21 mul x3 mul sub + y3 y1 sub x21 mul x43 mul add + det div + + % calculate y + x21 y43 mul y1 mul + x43 y21 mul y3 mul sub + x3 x1 sub y21 mul y43 mul add + det neg div + + end + % (Leaving lfiglineintersect) lfigdebugprint +} def + +% find point on circumference of polygon +% alpha radius num theta lfigpolycircum x y +/lfigpolycircum +{ + % (Entering lfigpolycircum) lfigdebugprint + 13 dict begin + /theta exch def + /num exch def + /radius exch def + /alpha exch def + + % calculate delta, the angle from theta to alpha + alpha theta sub lfigfixangle + + % calculate the angle which is the multiple of 360/num closest to delta + 360 num div div truncate 360 num div mul theta add /anglea exch def + + % calculate the next multiple of 360/num after anglea + anglea 360 num div add /angleb exch def + + % intersect the line through these two points with the alpha line + anglea cos anglea sin angleb cos angleb sin + 0 0 alpha cos 2 mul alpha sin 2 mul + lfiglineintersect radius lfigpmul + + end + % (Leaving lfigpolycircum) lfigdebugprint +} def + +% find point of intersection of a point and a circle +% x0 y0 r x1 y1 theta lfigcircleintersect xa ya xb yb 2 +% or xb yb 1 +% or 0 +/lfigcircleintersect +{ + % (Entering lfigcircleintersect) lfigdebugprint + 15 dict begin + /theta exch def + /y1 exch def + /x1 exch def + /r exch def + /y0 exch def + /x0 exch def + + % if sin(theta) = 0 then line is horizontal and y must be y1 + theta sin abs 0.00001 lt + { + /a 1 def + /b -2 x0 mul def + /c x0 dup mul y1 y0 sub dup mul add r dup mul sub def + a b c lfigqroots dup + 0 eq + { pop + 0 + } + { 1 eq + { y1 1 + } + { y1 exch y1 2 + } ifelse + } ifelse + } + { + /ct theta cos theta sin div def + /a ct ct mul 1 add def + /b ct x1 x0 sub mul y1 add y0 sub 2 mul def + /c x1 x0 sub dup mul y1 y0 sub dup mul add r dup mul sub def + a b c lfigqroots dup + 0 eq + { pop + 0 + } + { 1 eq + { y1 add /yb exch def + yb y1 sub ct mul x1 add /xb exch def + xb yb 1 + } + { y1 add /ya exch def + ya y1 sub ct mul x1 add /xa exch def + y1 add /yb exch def + yb y1 sub ct mul x1 add /xb exch def + xa ya xb yb 2 + } ifelse + } ifelse + } ifelse + end + % (Leaving lfigcircleintersect) lfigdebugprint +} def + +% add CIRCUM operator with this body: <array> lfigcircumdef - +/lfigcircumdef +{ % (Entering lfigcircumdef) lfigdebugprint + /CIRCUM exch cvx + currentdict end + 3 1 roll + % currentdict length currentdict maxlength lt + % { def } + % { exec moveto (too many labels) show stop } + % ifelse + def + begin + % (Leaving lfigcircumdef) lfigdebugprint +} def + +end +%%EndResource diff --git a/include/include/graph b/include/include/graph new file mode 100644 index 0000000..8f6c2a2 --- /dev/null +++ b/include/include/graph @@ -0,0 +1,112 @@ +############################################################################### +# # +# Lout setup file for graph drawing # +# # +# Jeffrey H. Kingston # +# 5 February 1999 # +# 21 June 2013 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# The @SysInclude { graphf } line # +# # +# This line causes Lout to read the definitions for graphs, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { graphf } + + +############################################################################### +# # +# The @GraphSetup @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 { @GraphSetup + + ############################################################################# + # # + # Options for @Graph only # + # # + ############################################################################# + + # style { frame } + # font { } + # named xorigin { none } + # named yorigin { none } + # named xlog { none } + # named ylog { none } + # width { 6.0c } + # height { 4.0c } + # xextra { auto } + # yextra { auto } + # xdecreasing { no } + # ydecreasing { no } + # leftcaption { } + # rightcaption { } + # abovecaption { } + # belowcaption { } + # leftgap { 1.5c } + # rightgap { 0.5c } + # abovegap { 0.5c } + # belowgap { 0.5c } + # hidecaptions { yes } + # xmin { none } + # xmax { none } + # ymin { none } + # ymax { none } + # xticksep { none } + # yticksep { none } + # rticksep { none } + # xticks { auto } + # yticks { auto } + # rticks { } + # xticklength { 0.5f } + # yticklength { 0.5f } + # rticklength { 0.5f } + # objects { } + # save { no } + + ############################################################################# + # # + # Options for @Graph and @Data # + # # + ############################################################################# + + # points { none } + # symbolsize { 0.15f } + # symbollinewidth { currentlinewidth } + # pairs { none } + # dashlength { 0.2f } + # linewidth { currentlinewidth } + # colour { none } + # paint { no } + # texture { solid } + # dataformat { xandy } + + ############################################################################# + # # + # Options for @GraphCross etc. and @GraphNoLine etc. # + # # + # Owing to clashes the names of these options differ slightly from the # + # names of the corresponding options of @GraphCross etc. and @GraphNoLine # + # etc. whose default values they are, in being prefixed by an "o". # + # # + ############################################################################# + + # osymbolsize { 0.15f } + # osymbollinewidth { currentlinewidth } + # odashlength { 0.2f } + # olinewidth { currentlinewidth } + # olength { 1.0f } +} diff --git a/include/include/graphf b/include/include/graphf new file mode 100644 index 0000000..fad552f --- /dev/null +++ b/include/include/graphf @@ -0,0 +1,1097 @@ + +############################################################################### +# # +# Lout @Graph package for drawing graphs (Version 1.1) # +# # +# Version 1.0 (December 1993). # +# Version 1.1 (adds @GraphSetup, June 2013) # +# Jeffrey H. Kingston # +# # +# This package draws graphs, the statistical kind not the graph-theoretical # +# kind. See the User's Guide for user info. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +@SysInclude { graphf.etc } # @GraphMath +@SysInclude { lengths } # @LoutLengths +@SysInclude { coltex } # @ColourCommand and @TextureCommand +@SysPrependGraphic { graphf.lpg } + + +############################################################################### +# # +# @GraphZZZ symbol - not for ordinary use # +# # +############################################################################### + +def @GraphZZZ + left p + named margin { 0c } + named adj { 0 0 } + right x +{ + @BackEnd @Case { + PostScript @Yield { + @Null & # kills previous white space + @HContract @VContract { + //0io ||0io @HContract @VContract + { p "trpoint translate" adj "translate gsave" // "grestore" } + @Graphic { //margin ||margin x ||margin //margin } + ||0io //0io + } + } + # VT: PDF does nothing + PDF @Yield { + @Null & # kills previous white space + @HContract @VContract { + //0io ||0io @HContract @VContract + { "% @GraphZZZ UNIMPLEMENTED" } + @Graphic { //margin ||margin x ||margin //margin } + ||0io //0io + } + } + } +} + + +############################################################################### +# # +# @GraphSetup symbol # +# # +############################################################################### + +export @GraphCross @GraphPlus @GraphSquare @GraphFilledSquare + @GraphDiamond @GraphFilledDiamond @GraphCircle @GraphFilledCircle + @GraphTriangle @GraphFilledTriangle + + @GraphNoLine @GraphSolid @GraphDashed @GraphDotted @GraphDotDashed + @GraphDotDotDashed @GraphDotDotDotDashed + + @Graph + +def @GraphSetup + named style { frame } + named font { } + named xorigin named none { "false" } { none } + named yorigin named none { "false" } { none } + named xlog named none { "0" } { none } + named ylog named none { "0" } { none } + import @LoutLengths named width { 6.0c } + import @LoutLengths named height { 4.0c } + import @PSLengths named xextra { auto } + import @PSLengths named yextra { auto } + named xdecreasing { no } + named ydecreasing { no } + named leftcaption { } + named rightcaption { } + named abovecaption { } + named belowcaption { } + import @LoutLengths named leftgap { 1.5c } + import @LoutLengths named rightgap { 0.5c } + import @LoutLengths named abovegap { 0.5c } + import @LoutLengths named belowgap { 0.5c } + named hidecaptions { yes } + named xmin named none { "false" } { none } + named xmax named none { "false" } { none } + named ymin named none { "false" } { none } + named ymax named none { "false" } { none } + named xticksep named none { "0" } { none } + named yticksep named none { "0" } { none } + named rticksep named none { "0" } { none } + import @GraphMath named xticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { auto } + import @GraphMath named yticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { auto } + import @GraphMath named rticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { } + import @PSLengths named xticklength { 0.5f } + import @PSLengths named yticklength { 0.5f } + import @PSLengths named rticklength { 0.5f } + named objects + named @NW + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "xsize neg ysize" } margin { margin } x } + named @SW + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "xsize neg 0" } margin { margin } x } + named @SE + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "0 0" } margin { margin } x } + named @NE + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "0 ysize" } margin { margin } x } + named @W + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "xsize neg ysize 2 div" } margin { margin } x } + named @S + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "xsize neg 2 div 0" } margin { margin } x } + named @E + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "0 ysize 2 div" } margin { margin } x } + named @N + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "xsize neg 2 div ysize" } margin { margin } x } + named @CTR + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + {at @GraphZZZ adj {"xsize neg 2 div ysize 2 div"} margin {margin} x} + {} + named save { no } + named points named none { "none" } { none } + import @PSLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { "currentlinewidth" } + named pairs named none { "none" } { none } + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + named colour color named none { "none" } { none } + named paint { no } + import @TextureImport named texture { solid } + named dataformat { xandy } + import @LoutLengths named osymbolsize { 0.15f } + import @PSLengths named osymbollinewidth { "currentlinewidth" } + import @PSLengths named odashlength { 0.2f } + import @PSLengths named olinewidth { "currentlinewidth" } + import @LoutLengths named olength { 1.0f } +{ + def @GraphCross + import @LoutLengths named symbolsize { osymbolsize } + import @PSLengths named symbollinewidth { osymbollinewidth } + { + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 0 moveto xsize ysize lineto 0 ysize moveto" + # "xsize 0 lineto [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "docross" + // "end" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + { "n [] 0 d 0 0 m __xsize __ysize l 0 __ysize m __xsize 0 l S"} + # uses S because PostScript version does NOT use closepath + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + } + } + + def @GraphPlus + import @LoutLengths named symbolsize { osymbolsize } + import @PSLengths named symbollinewidth { osymbollinewidth } + { + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath xmark 0 moveto xmark ysize lineto 0 ymark moveto" + # "xsize ymark lineto [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "doplus" + // "end" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + { "n [] 0 d __xmark 0 m __xmark __ysize l 0 __ymark m __xsize __ymark l S"} + # uses S because PostScript version does NOT use closepath + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + } + } + + def @GraphSquare + import @LoutLengths named symbolsize { osymbolsize } + import @PSLengths named symbollinewidth { osymbollinewidth } + { + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" + # "0 ysize lineto closepath [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dosquare" + // "end" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 __xsize __ysize re s"} + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + } + } + + def @GraphFilledSquare + import @LoutLengths named symbolsize { osymbolsize } + import @PSLengths named symbollinewidth { osymbollinewidth } + { + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto 0 ysize" + # "lineto closepath gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" + symbollinewidth "dofilledsquare" // "end" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 __xsize __ysize re b"} + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + } + } + + def @GraphDiamond + import @LoutLengths named symbolsize { osymbolsize } + import @PSLengths named symbollinewidth { osymbollinewidth } + { + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto" + # "xmark ysize lineto closepath [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dodiamond" + // "end" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 __ymark m __xmark 0 l __xsize __ymark l __xmark __ysize l s"} + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + } + } + + def @GraphFilledDiamond + import @LoutLengths named symbolsize { osymbolsize } + import @PSLengths named symbollinewidth { osymbollinewidth } + { + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto" + # "xmark ysize lineto closepath gsave [] 0 setdash stroke + # grestore fill" + "lgraphdict begin xmark ymark xmark" + symbollinewidth "dofilleddiamond" // "end" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 __ymark m __xmark 0 l __xsize __ymark l __xmark __ysize l b" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + } + } + + def @GraphCircle + import @LoutLengths named symbolsize { osymbolsize } + import @PSLengths named symbollinewidth { osymbollinewidth } + { + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath xmark ymark xmark 0 360 arc" + # "[] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "docircle" + // "end" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract +# +# draw a circle whose centre is at (xmark, ymark) and whose radius is xmark units; +# +# for curveto to work, we need to calculate the control points of the Bezier curve +# as well as move the pen to the correct initial point. The circle is drawn as two +# arcs of 180 degrees +# +# pt0 = (xmark + xmark, ymark) +# pt1 = (xmark + xmark, ymark + 4/3 * xmark) +# pt2 = (0, ymark + 4/3 * xmark) +# pt3 = (0, ymark) +# +# pt0 = (0, ymark) +# pt1 = (0, ymark - 4/3 * xmark) +# pt2 = (xmark + xmark, ymark - 4/3 * xmark) +# pt3 = (xmark + xmark, ymark) +# + {"n [] 0 d" + "__mul(2, __xmark) __ymark m" + "__mul(2, __xmark) __add(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "0 __add(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "0 __ymark c" # pt3 + + "0 __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "__mul(2, __xmark) __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "__mul(2, __xmark) __ymark c S" # pt3 + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + } + } + + def @GraphFilledCircle + import @LoutLengths named symbolsize { osymbolsize } + import @PSLengths named symbollinewidth { osymbollinewidth } + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + # "newpath xmark ymark xmark 0 360 arc" + # "gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" + symbollinewidth "dofilledcircle" // "end" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract +# +# draw a filled circle whose centre is at (xmark, ymark) and whose radius is xmark units; +# +# for curveto to work, we need to calculate the control points of the Bezier curve +# as well as move the pen to the correct initial point. The circle is drawn as two +# arcs of 180 degrees +# +# pt0 = (xmark + xmark, ymark) +# pt1 = (xmark + xmark, ymark + 4/3 * xmark) +# pt2 = (0, ymark + 4/3 * xmark) +# pt3 = (0, ymark) +# +# pt0 = (0, ymark) +# pt1 = (0, ymark - 4/3 * xmark) +# pt2 = (xmark + xmark, ymark - 4/3 * xmark) +# pt3 = (xmark + xmark, ymark) +# +# Note: this is not a strict translation because there is a setdash bracketed by +# gsave/grestore in the above PostScript but there is no closepath before it; +# but in PDF, it is not possible to execute a setdash within a path definition. +# + {"n [] 0 d" + "__mul(2, __xmark) __ymark m" + "__mul(2, __xmark) __add(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "0 __add(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "0 __ymark c" # pt3 + + "0 __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "__mul(2, __xmark) __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "__mul(2, __xmark) __ymark c b" # pt3 + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + } + } + + def @GraphTriangle + import @LoutLengths named symbolsize { osymbolsize } + import @PSLengths named symbollinewidth { osymbollinewidth } + { + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto" + # "closepath [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dotriangle" + // "end" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 m __xsize 0 l __xmark __mul(__ysize, 1.25) l s"} + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + } + } + + def @GraphFilledTriangle + import @LoutLengths named symbolsize { osymbolsize } + import @PSLengths named symbollinewidth { osymbollinewidth } + { + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto" + # "closepath gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" + symbollinewidth "dofilledtriangle" // "end" + } + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 m __xsize 0 l __xmark __mul(__ysize, 1.25) l h b"} + @Graphic {symbolsize @High symbolsize @Wide ^| + symbolsize @Wide ^/ symbolsize @High} + } + + } + } + + def @GraphNoLine + import @PSLengths named dashlength { odashlength } + import @PSLengths named linewidth { olinewidth } + import @LoutLengths named length { olength } + { + length @Wide {} + } + + def @GraphSolid + import @PSLengths named dashlength { odashlength } + import @PSLengths named linewidth { olinewidth } + import @LoutLengths named length { olength } + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "solid end" + } @Graphic { length @Wide } + } + # VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphSolid UNIMPLEMENTED" } @Graphic { length @Wide } + } + } + } + + def @GraphDashed + import @PSLengths named dashlength { odashlength } + import @PSLengths named linewidth { olinewidth } + import @LoutLengths named length { olength } + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dashed end" + } @Graphic { length @Wide } + } + # VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDashed UNIMPLEMENTED" } @Graphic { olength @Wide } + } + } + } + + def @GraphDotted + import @PSLengths named dashlength { odashlength } + import @PSLengths named linewidth { olinewidth } + import @LoutLengths named length { olength } + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotted end" + } @Graphic { length @Wide } + } + # VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotted UNIMPLEMENTED" } @Graphic { olength @Wide } + } + } + } + + def @GraphDotDashed + import @PSLengths named dashlength { odashlength } + import @PSLengths named linewidth { olinewidth } + import @LoutLengths named length { olength } + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotdashed end" + } @Graphic { length @Wide } + } + # VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } + } + + def @GraphDotDotDashed + import @PSLengths named dashlength { odashlength } + import @PSLengths named linewidth { olinewidth } + import @LoutLengths named length { olength } + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotdotdashed end" + } @Graphic { length @Wide } + } + # VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotDotDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } + } + + def @GraphDotDotDotDashed + import @PSLengths named dashlength { odashlength } + import @PSLengths named linewidth { olinewidth } + import @LoutLengths named length { olength } + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto /linewidth" + linewidth "def xsize" dashlength "dotdotdotdashed end" + } @Graphic { length @Wide } + } + # VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotDotDotDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } + } + + + export @Data + def @Graph + named style { style } + named font { font } + named xorigin named none { "false" } { xorigin } + named yorigin named none { "false" } { yorigin } + named xlog named none { "0" } { xlog } + named ylog named none { "0" } { ylog } + import @LoutLengths named width { width } + import @LoutLengths named height { height } + import @PSLengths named xextra { xextra } + import @PSLengths named yextra { yextra } + named xdecreasing { xdecreasing } + named ydecreasing { ydecreasing } + named leftcaption { leftcaption } + named rightcaption { rightcaption } + named abovecaption { abovecaption } + named belowcaption { belowcaption } + import @LoutLengths named leftgap { leftgap } + import @LoutLengths named rightgap { rightgap } + import @LoutLengths named abovegap { abovegap } + import @LoutLengths named belowgap { belowgap } + named hidecaptions { hidecaptions } + named xmin named none { "false" } { xmin } + named xmax named none { "false" } { xmax } + named ymin named none { "false" } { ymin } + named ymax named none { "false" } { ymax } + named xticksep named none { "0" } { xticksep } + named yticksep named none { "0" } { yticksep } + named rticksep named none { "0" } { rticksep } + import @GraphMath named xticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { xticks } + import @GraphMath named yticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { yticks } + import @GraphMath named rticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { rticks } + import @PSLengths named xticklength { xticklength } + import @PSLengths named yticklength { yticklength } + import @PSLengths named rticklength { rticklength } + named objects + named @NW + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "xsize neg ysize" } margin { margin } x } + named @SW + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "xsize neg 0" } margin { margin } x } + named @SE + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "0 0" } margin { margin } x } + named @NE + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "0 ysize" } margin { margin } x } + named @W + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "xsize neg ysize 2 div" } margin { margin } x } + named @S + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "xsize neg 2 div 0" } margin { margin } x } + named @E + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "0 ysize 2 div" } margin { margin } x } + named @N + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphZZZ adj { "xsize neg 2 div ysize" } margin { margin } x } + named @CTR + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + {at @GraphZZZ adj {"xsize neg 2 div ysize 2 div"} margin {margin} x} + { objects } + named save { save } + named points named none { "none" } { points } + import @PSLengths named symbolsize { symbolsize } + import @PSLengths named symbollinewidth { symbollinewidth } + named pairs named none { "none" } { pairs } + import @PSLengths named dashlength { dashlength } + import @PSLengths named linewidth { linewidth } + named colour color named none { "none" } { colour } + named paint { paint } + import @TextureImport named texture { texture } + named dataformat { dataformat } + body @Body + { + + def @Above + { + abovecaption @Case { + "" @Yield {} + else @Yield @OneCol { + ||0.5rt clines @Break abovecaption || //abovegap } + } + } + + def @Below + { + belowcaption @Case { + "" @Yield {} + else @Yield @OneCol { + //belowgap ||0.5rt clines @Break belowcaption || } + } + } + + def @Left + { + leftcaption @Case { + "" @Yield {} + else @Yield @OneCol @OneRow { + { //0.5rt @OneRow clines @Break leftcaption // } ^||leftgap } + } + } + + def @Right + { + rightcaption @Case { + "" @Yield {} + else @Yield @OneCol @OneRow { + ||rightgap { //0.5rt @OneRow lines @Break rightcaption // } } + } + } + + def @ZeroWidth + right x + { + hidecaptions @Case { + { No no } @Yield x + { Yes yes } @Yield @OneCol { ||0io x ||0io } + } + } + + def @AddCaptions right x + { + def belowextra + { + xticks @Case { + "" @Yield { 0i } + else @Yield { 1.7f } + } + } + + @HContract @VContract + { + | @Above | + / @ZeroWidth @Left | &0.5rt x | @ZeroWidth @Right + /belowextra | @Below | + } + } + + export pi e sqrt abs ceiling floor truncate round cos sin atan + exp log rand "*" "/" idiv mod "-" "-0" "-1" "-2" "-3" "-4" + "-5" "-6" "-7" "-8" "-9" "-." "+" "=" "!=" "<" "<=" ">" ">=" + not and xor or if xloop yloop zloop + + def @Data + named points named none { "none" } { points } + import @PSLengths named symbolsize { symbolsize } + import @PSLengths named symbollinewidth { symbollinewidth } + named pairs named none { "none" } { pairs } + import @PSLengths named dashlength { dashlength } + import @PSLengths named linewidth { linewidth } + named colour color named none { "none" } { colour } + named paint { paint } + import @TextureImport named texture { texture } + named dataformat { dataformat } + body data + { + def pi { "3.14159" } + def e { "2.71828" } + def sqrt precedence 40 right y { y "sqrt" } + def abs precedence 40 right y { y "abs" } + def ceiling precedence 40 right y { y "ceiling" } + def floor precedence 40 right y { y "floor" } + def truncate precedence 40 right y { y "truncate" } + def round precedence 40 right y { y "round" } + def cos precedence 40 right y { y "cos" } + def sin precedence 40 right y { y "sin" } + def atan precedence 39 left x right y { x y "atan" } + def exp precedence 38 left x right y { x y "exp" } + def log precedence 37 left x right y { x y "dolog" } + def rand precedence 36 left x right y { x y "dorand" } + def "*" precedence 35 left x right y { x y "mul" } + def "/" precedence 34 left x right y { x y "div" } + def idiv precedence 34 left x right y { x y "idiv" } + def mod precedence 34 left x right y { x y "mod" } + def "-" precedence 33 left x right y + { x @Case { "" @Yield {y "neg"} else @Yield { x y "sub" } } } + def "-0" { "-0" } + def "-1" { "-1" } + def "-2" { "-2" } + def "-3" { "-3" } + def "-4" { "-4" } + def "-5" { "-5" } + def "-6" { "-6" } + def "-7" { "-7" } + def "-8" { "-8" } + def "-9" { "-9" } + def "-." { "-." } + def "+" precedence 32 left x right y + { x @Case { "" @Yield { y } else @Yield { x y "add" } } } + def "=" precedence 30 left x right y { x y "eq" } + def "!=" precedence 30 left x right y { x y "ne" } + def "<" precedence 30 left x right y { x y "lt" } + def "<=" precedence 30 left x right y { x y "le" } + def ">" precedence 30 left x right y { x y "gt" } + def ">=" precedence 30 left x right y { x y "ge" } + def not precedence 25 right y { y "not" } + def and precedence 24 left x right y { x y "and" } + def xor precedence 23 left x right y { x y "xor" } + def or precedence 22 left x right y { x y "or" } + def if + named cond { true } + named then {} + named else {} + { cond "{" then "} {" else "} ifelse" } + def xloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named x { "xval" } {} + { from by to "{ /xval exch def" do "} for" } + def yloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named y { "yval" } {} + { from by to "{ /yval exch def" do "} for" } + def zloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named z { "zval" } {} + { from by to "{ /zval exch def" do "} for" } + + def @IfPt + left no + right yes + { + points @Case { + none @Yield no + else @Yield yes + } + } + + def @Points + { + points @Case { + none @Yield "" + plus @Yield "plus" + cross @Yield "cross" + square @Yield "square" + filledsquare @Yield "filledsquare" + diamond @Yield "diamond" + filleddiamond @Yield "filleddiamond" + circle @Yield "circle" + filledcircle @Yield "filledcircle" + triangle @Yield "triangle" + filledtriangle @Yield "filledtriangle" + } + } + + def @Pairs + { + pairs @Case { + none @Yield {} + solid @Yield { "linesetup solid" @IfPt "ilinesetup solid" } + dashed @Yield { "linesetup cdashed" @IfPt "ilinesetup dashed" } + dotted @Yield { "linesetup dotted" @IfPt "ilinesetup dotted" } + dotdashed @Yield { "linesetup dotcdashed" @IfPt + "ilinesetup dotdashed" } + dotdotdashed @Yield { "linesetup dotdotcdashed" @IfPt + "ilinesetup dotdotdashed" } + dotdotdotdashed @Yield { "linesetup dotdotdotcdashed" @IfPt + "ilinesetup dotdotdotdashed" } + surfacexhisto @Yield { "surfacexhisto" } + surfaceyhisto @Yield { "surfaceyhisto" } + xhisto @Yield { "xhisto" } + yhisto @Yield { "yhisto" } + filledxhisto @Yield { "filledxhisto" } + filledyhisto @Yield { "filledyhisto" } + } + } + + def @DataFormat + { + dataformat @Case { + xandy @Yield xandy + swapxandy @Yield swapxandy + yonly @Yield yonly + xonly @Yield xonly + } + } + + def @Paint + { + paint @Case { + { none no No } @Yield "false" + { yes Yes } @Yield "true" + } + } + + "[ [" data "]" dataformat + "{" @Points "}" + "{" @Pairs "}" + "{ /dashlength" dashlength "def" + " /linewidth" linewidth "def" @ColourCommand colour + " /symbolsize" symbolsize "def" + " /symbollinewidth" symbollinewidth "def }" + "{" @Paint "}" + "{" texture "}" + "]" + } + + def @Style + { + style @Case { + frame @Yield { "framestyle" } + grid @Yield { "gridstyle" } + none @Yield { "nonestyle" } + axes @Yield { "axesstyle" } + } + } + + def @XExtra + { + xextra @Case { + "auto" @Yield { + style @Case { + frame @Yield { "0.5 cm" } + grid @Yield { "0" } + none @Yield { "0" } + axes @Yield { "0" } + } + } + else @Yield xextra + } + } + + def @YExtra + { + yextra @Case { + "auto" @Yield { + style @Case { + frame @Yield { "0.5 cm" } + grid @Yield { "0" } + none @Yield { "0" } + axes @Yield { "0" } + } + } + else @Yield yextra + } + } + + def @XDecreasing + { + xdecreasing @Case { + { No no } @Yield "false" + { Yes yes } @Yield "true" + } + } + + def @YDecreasing + { + ydecreasing @Case { + { No no } @Yield "false" + { Yes yes } @Yield "true" + } + } + + font @Font @AddCaptions width @Wide height @High + @BackEnd @Case { + PostScript @Yield { + { + "grestore" + save @Case { { Yes yes } @Yield "save" else @Yield {} } + "gsave xsize ysize lgraphdict begin /ysize exch def" + "/xsize exch def /alldata [" @Body "] def" + xticksep "[" xticks "] 0 alldata" xmin xmax xlog + @XExtra @XDecreasing xorigin xticklength "xset" + yticksep "[" yticks "] 1 alldata" ymin ymax ylog + @YExtra @YDecreasing yorigin yticklength "yset" + + rticks @Case { + + "" @Yield "norset" + + else @Yield { + rticksep "[" rticks "] 1 alldata" ymin ymax ylog + @YExtra @YDecreasing yorigin rticklength "rset" + } + } + + "rundata" @Style // "end" + save @Case { { Yes yes } @Yield "restore" else @Yield {} } + } @Graphic { //1rt objects } + } + PDF @Yield { {"% @Graph UNIMPLEMENTED"} @Graphic { //1rt objects } } + } + + } +} diff --git a/include/include/graphf.etc b/include/include/graphf.etc new file mode 100644 index 0000000..d01734d --- /dev/null +++ b/include/include/graphf.etc @@ -0,0 +1,312 @@ + +############################################################################### +# # +# Lout @GraphMath package for @Graph (Version 1.1) # +# # +# Version 1.0 by Jeffrey H. Kingston, December 1993. # +# Version 1.1 by Jeffrey H. Kingston, October 1996. # +# # +# This package provides mathematics for the @Graph graph drawing package. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export + + "-0" "-1" "-2" "-3" "-4" "-5" "-6" "-7" "-8" "-9" "-." + pi e sqrt abs ceiling floor truncate round cos sin atan + exp log rand "*" "/" idiv mod "+" "-" + "=" "!=" "<" "<=" ">" ">=" not and xor or + if xloop yloop zloop + +def @GraphMath +{ + def "-0" { "-0" } + def "-1" { "-1" } + def "-2" { "-2" } + def "-3" { "-3" } + def "-4" { "-4" } + def "-5" { "-5" } + def "-6" { "-6" } + def "-7" { "-7" } + def "-8" { "-8" } + def "-9" { "-9" } + def "-." { "-." } + + def pi { "3.14159" } + + def e { "2.71828" } + + def sqrt + precedence 40 + right y + { + y "sqrt" + } + + def abs + precedence 40 + right y + { + y "abs" + } + + def ceiling + precedence 40 + right y + { + y "ceiling" + } + + def floor + precedence 40 + right y + { + y "floor" + } + + def truncate + precedence 40 + right y + { + y "truncate" + } + + def round + precedence 40 + right y + { + y "round" + } + + def cos + precedence 40 + right y + { + y "cos" + } + + def sin + precedence 40 + right y + { + y "sin" + } + + def atan + precedence 39 + left x + right y + { + x y "atan" + } + + def exp + precedence 38 + left x + right y + { + x y "exp" + } + + def log + precedence 37 + left x + right y + { + x y "dolog" + } + + def rand + precedence 36 + left x + right y + { + x y "dorand" + } + + def "*" + precedence 35 + left x + right y + { + x y "mul" + } + + def "/" + precedence 35 + left x + right y + { + x y "div" + } + + def "idiv" + precedence 34 + left x + right y + { + x y "idiv" + } + + def "mod" + precedence 34 + left x + right y + { + x y "mod" + } + + def "-" + precedence 33 + left x + right y + { + x @Case { + "" @Yield { y "neg" } + else @Yield { x y "sub" } + } + } + + def "+" + precedence 32 + left x + right y + { + x @Case { + "" @Yield { y } + else @Yield { x y "add" } + } + } + + def "=" + precedence 30 + left x + right y + { + x y "eq" + } + + def "!=" + precedence 30 + left x + right y + { + x y "ne" + } + + def "<" + precedence 30 + left x + right y + { + x y "lt" + } + + def "<=" + precedence 30 + left x + right y + { + x y "le" + } + + def ">" + precedence 30 + left x + right y + { + x y "gt" + } + + def ">=" + precedence 30 + left x + right y + { + x y "ge" + } + + def "not" + precedence 25 + right y + { + y "not" + } + + def "and" + precedence 24 + left x + right y + { + x y "and" + } + + def "xor" + precedence 23 + left x + right y + { + x y "xor" + } + + def "or" + precedence 22 + left x + right y + { + x y "or" + } + + def if + named cond { true } + named then {} + named else {} + { + cond "{" then "} {" else "} ifelse" + } + + def xloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named x { "xval" } {} + { + from by to "{ /xval exch def" do "} for" + } + + def yloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named y { "yval" } {} + { + from by to "{ /yval exch def" do "} for" + } + + def zloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named z { "zval" } {} + { + from by to "{ /zval exch def" do "} for" + } + +} diff --git a/include/include/graphf.lpg b/include/include/graphf.lpg new file mode 100644 index 0000000..a0137a4 --- /dev/null +++ b/include/include/graphf.lpg @@ -0,0 +1,1091 @@ +%%BeginResource: procset LoutGraphPrependGraphic +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Graph (Version 1.0) % +% % +% Version 1.0 by Jeffrey H. Kingston, December 1993. % +% swapxandy added September 2001 by JHK. % +% % +% This file has been placed in the public domain by its author, % +% Jeffrey H. Kingston % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +errordict begin + /handleerror + { + { /Times-Roman findfont 8 pt scalefont setfont + 0 setgray 4 pt 4 pt moveto + $error /errorname get + dup lgraphdict exch known + { lgraphdict exch get } + { 30 string cvs } ifelse + show + ( Command: ) show + $error /command get 30 string cvs show + } stopped {} if + showpage stop + } def +end + +/lgraphdebugposy 432 def +/lgraphdebugposx 72 def + +% - lgraphdebugnextline - +/lgraphdebugnextline +{ + lgraphdebugposy 72 lt + { /lgraphdebugposx lgraphdebugposx 144 add store + /lgraphdebugposy 432 store + } + { + /lgraphdebugposy lgraphdebugposy 12 sub store + } ifelse + lgraphdebugposx lgraphdebugposy moveto +} def + +% - lgraphdebugbeginindent - +/lgraphdebugbeginindent +{ + /lgraphdebugposx lgraphdebugposx 12 add store +} def + +% - lgraphdebugendindent - +/lgraphdebugendindent +{ + /lgraphdebugposx lgraphdebugposx 12 sub store +} def + +% <string> <int> lgraphdebugprint - +% must be defined outside lgraphdict since used in arbitrary places +% print <string> plus count or <int> stack entries, whichever is the smaller +/lgraphdebugprint +{ + exch + gsave + initgraphics + lgraphdebugnextline + /Times-Roman findfont 10 scalefont setfont + 0 setgray show + lgraphdebugbeginindent + count 1 sub 2 copy lt { pop } { exch pop } ifelse 1 sub + 0 exch 1 exch + { + lgraphdebugnextline + index + dup type (dicttype) eq + { + (begin dict) show + lgraphdebugbeginindent + { + lgraphdebugnextline + pop 100 string cvs show + } forall + lgraphdebugendindent + lgraphdebugnextline + (end dict) show + } + { + dup type (arraytype) eq + { + (begin array) show + lgraphdebugbeginindent + { + lgraphdebugnextline + 100 string cvs show + } forall + lgraphdebugendindent + lgraphdebugnextline + (end array) show + } + { + 100 string cvs show + } ifelse + } ifelse + } for + lgraphdebugendindent + grestore +} def + + +/lgraphdict 200 dict def +lgraphdict begin + +% error messages +/dictfull (dictfull error) def +/dictstackoverflow (dictstackoverflow error) def +/execstackoverflow (execstackoverflow error: expression too complex?) def +/limitcheck (limitcheck error: graph too complex or too large?) def +/syntaxerror (syntaxerror error: syntax error in text of graph?) def +/typecheck (typecheck error: syntax error in text of graph?) def +/undefined (undefined error: unknown or misspelt symbol?) def +/rangecheck (rangecheck error: undefined expression (e.g. divide by zero)?) def +/VMError (VMError error: run out of memory?) def + +% random number between x and y inclusive: x y dorand num +/dorand { 1 index sub 1 add rand exch mod add } def + +% log to given base: base num dolog num +/dolog { ln exch ln div } def + +% maximum of two numbers: <num> <num> max <num> +/max { 2 copy gt { pop } { exch pop } ifelse } def + +% add two points: <point> <point> padd <point> +/padd { exch 3 1 roll add 3 1 roll add exch } def + +% subtract first point from second: <point> <point> psub <point> +/psub { 3 2 roll sub 3 1 roll exch sub exch } def + +% distance between two points: <point> <point> distance <length> +/distance { psub dup mul exch dup mul add sqrt } def + +% point at angle and distance: <point> <length> <angle> atangle <point> +/atangle { 2 copy cos mul 3 1 roll sin mul padd } def + +% angle from one point to another: <point> <point> angle <angle> +/angle { psub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def + + +% set up for line +% - linesetup <length> <dashlength> +/linesetup +{ newpath + xcurr ycurr trpoint xprev yprev trpoint + 4 copy moveto lineto distance dashlength +} def + +% set up for icon-avoiding line +% - ilinesetup <length> <dashlength> +/ilinesetup +{ newpath + xprev yprev trpoint xcurr ycurr trpoint 4 copy + 4 copy angle symbolsize 1.5 mul exch 4 2 roll pop pop atangle + 6 2 roll 4 2 roll + 4 copy angle symbolsize 1.5 mul exch 4 2 roll pop pop atangle + 4 copy moveto lineto distance dashlength +} def + + +% stroke a solid line: <length> <dashlength> solid - +/solid +{ pop pop [] 0 setdash linewidth setlinewidth stroke +} def + +% stroke a dashed line: <length> <dashlength> dashed - +/dashed +{ 2 copy 2 mul le 1 index 0 le or + { exch pop 1 pt max [ exch dup ] 0 setdash } + { dup [ exch 4 2 roll 2 copy div + 1 sub 2 div ceiling dup 4 1 roll + 1 add mul sub exch div ] 0 setdash + } ifelse linewidth setlinewidth stroke +} def + +% stroke a cdashed line: <length> <dashlength> cdashed - +/cdashed +{ 2 copy le 1 index 0 le or + { exch pop 1 pt max [ exch dup ] dup 0 get 2 div setdash } + { dup [ 4 2 roll exch 2 copy exch div + 2 div ceiling div 1 index sub + ] exch 2 div setdash + } ifelse linewidth setlinewidth stroke +} def + +% stroke a dotted line: <length> <dashlength> dotted - +/dotted +{ 2 copy le 1 index 0 le or + { exch pop 1 pt max [ exch 0 exch ] 0 setdash } + { 1 index exch div ceiling div 0.99999 mul + [ 0 3 2 roll ] 0 setdash + } ifelse gsave 1 setlinecap linewidth setlinewidth stroke grestore newpath +} def + +% stroke a noline line: <length> <dashlength> noline - +/noline +{ pop pop +} def + +% scale array elements by factor: <array> <factor> scalearray <array> +/scalearray +{ + [ exch 3 2 roll + { exch dup 3 1 roll mul exch } forall + pop ] +} def + +% sum array elements: <array> sumarray <number> +/sumarray +{ + 0 exch { add } forall +} def + +% begin a more complex line: <length> <dashlength> linebegin - +/linebegin +{ + % (Entering linebegin) 2 debugprint + 20 dict begin + /dashlen exch 1 pt max def + /len exch def + /gap dashlen def + /halfgap dashlen 2 div def + /dash dashlen def + /halfdash dashlen 2 div def + /dot 0 def + % (Leaving linebegin) 0 debugprint +} def +% end a more complex line: <linecap> <cycle> <startpos> <stoppos> lineend - +/lineend +{ + % (Entering lineend) 3 debugprint + /stoppos exch def + /startpos exch def + /cycle exch def + /linecap exch def + /stopposlen stoppos sumarray def + /startposlen startpos sumarray def + /cyclelen cycle sumarray def + /effectivelen len startposlen add stopposlen sub def + effectivelen 0 gt cyclelen 0 gt and + { + /repeats effectivelen cyclelen div ceiling def + /factor len repeats cyclelen mul startposlen sub stopposlen add div def + cycle factor scalearray startposlen factor mul setdash + linecap setlinecap stroke + } if + end + % (Leaving lineend) 0 debugprint +} def + +% stroke a dotdashed line: <length> <dashlength> dotdashed - +/dotdashed +{ + linebegin + 1 [dash gap dot gap] [] [dash] + lineend +} def + +% stroke a dotcdashed line: <length> <dashlength> dotcdashed - +/dotcdashed +{ + linebegin + 1 [dash gap dot gap] [halfdash] [halfdash] + lineend +} def + +% stroke a dotdotdashed line: <length> <dashlength> dotdotdashed - +/dotdotdashed +{ + linebegin + 1 [dash gap dot gap dot gap] [] [dash] + lineend +} def + +% stroke a dotdotcdashed line: <length> <dashlength> dotdotcdashed - +/dotdotcdashed +{ + linebegin + 1 [dash gap dot gap dot gap] [halfdash] [halfdash] + lineend +} def + +% stroke a dotdotdotdashed line: <length> <dashlength> dotdotdotdashed - +/dotdotdotdashed +{ + linebegin + 1 [dash gap dot gap dot gap dot gap] [] [dash] + lineend +} def + +% stroke a dotdotdotcdashed line: <length> <dashlength> dotdotdotcdashed - +/dotdotdotcdashed +{ + linebegin + 1 [dash gap dot gap dot gap dot gap] [halfdash] [halfdash] + lineend +} def + + +% stroke a y histogram: - yhisto - +/yhisto +{ xprev yleft trpoint yextra sub moveto + xprev yprev trpoint lineto + xcurr yprev trpoint lineto + xcurr yleft trpoint yextra sub lineto + linewidth setlinewidth stroke +} def + +% stroke an x histogram: - xhisto - +/xhisto +{ xleft yprev trpoint exch xextra sub exch moveto + xcurr yprev trpoint lineto + xcurr ycurr trpoint lineto + xleft ycurr trpoint exch xextra sub exch lineto + linewidth setlinewidth stroke +} def + +% stroke a surface y histogram: - surfaceyhisto - +/surfaceyhisto +{ firstpair + { xprev yleft trpoint yextra sub moveto + xprev yprev trpoint lineto + } + { xprev yprev trpoint moveto + } ifelse + xcurr yprev trpoint lineto + lastpair + { xcurr yleft trpoint yextra sub lineto + } + { xcurr ycurr trpoint lineto + } ifelse + linewidth setlinewidth stroke +} def + +% stroke a surface x histogram: - surfacexhisto - +/surfacexhisto +{ firstpair + { xleft yprev trpoint exch xextra sub exch moveto + } + { xprev yprev trpoint moveto + } ifelse + xcurr yprev trpoint lineto + xcurr ycurr trpoint lineto + lastpair + { xleft ycurr trpoint exch xextra sub exch lineto + } if + linewidth setlinewidth stroke +} def + +% % pre-texture versions +% % stroke a filled y histogram: - filledyhisto - +% /filledyhisto +% { +% linewidth setlinewidth +% xprev yleft trpoint exch currentlinewidth 2 div add exch yextra sub moveto +% xprev yprev trpoint exch currentlinewidth 2 div add exch lineto +% xcurr yprev trpoint exch currentlinewidth 2 div sub exch lineto +% xcurr yleft trpoint exch currentlinewidth 2 div sub exch yextra sub lineto +% closepath fill +% } def + +% % stroke a filled x histogram: - filledxhisto - +% /filledxhisto +% { +% linewidth setlinewidth +% xleft yprev trpoint currentlinewidth 2 div add exch xextra sub exch moveto +% xcurr yprev trpoint currentlinewidth 2 div add lineto +% xcurr ycurr trpoint currentlinewidth 2 div sub lineto +% xleft ycurr trpoint currentlinewidth 2 div sub exch xextra sub exch lineto +% closepath fill +% } def + +% stroke a filled y histogram: - filledyhisto - +/filledyhisto +{ + linewidth setlinewidth + xprev yleft trpoint exch currentlinewidth 1.3 mul add exch yextra sub moveto + xprev yprev trpoint exch currentlinewidth 1.3 mul add exch lineto + xcurr yprev trpoint exch currentlinewidth 1.3 mul sub exch lineto + xcurr yleft trpoint exch currentlinewidth 1.3 mul sub exch yextra sub lineto + gsave texture fill grestore stroke +} def + +% stroke a filled x histogram: - filledxhisto - +/filledxhisto +{ + linewidth setlinewidth + xleft yprev trpoint currentlinewidth 1.3 mul add exch xextra sub exch moveto + xcurr yprev trpoint currentlinewidth 1.3 mul add lineto + xcurr ycurr trpoint currentlinewidth 1.3 mul sub lineto + xleft ycurr trpoint currentlinewidth 1.3 mul sub exch xextra sub exch lineto + gsave texture fill grestore stroke +} def + + +% docross: show a cross with a given symbolsize and symbollinewidth +% <x> <y> <symbolsize> <symbollinewidth> docross - +/docross +{ + setlinewidth + /ss exch def + newpath + moveto + ss neg ss neg rmoveto + ss 2 mul ss 2 mul rlineto + 0 ss -2 mul rmoveto + ss -2 mul ss 2 mul rlineto + [] 0 setdash 0 setlinecap stroke +} def + +% cross: show a cross +% - cross - +/cross { xcurr ycurr trpoint symbolsize symbollinewidth docross } def + +% doplus: show a plus with a given symbolsize and symbollinewidth +% <x> <y> <symbolsize> <symbollinewidth> doplus - +/doplus +{ + setlinewidth + /ss exch def + newpath + moveto + ss neg 0 rmoveto + ss 2 mul 0 rlineto + ss neg ss neg rmoveto + 0 ss 2 mul rlineto + [] 0 setdash 0 setlinecap stroke +} def + +% plus: show a plus +% - plus - +/plus { xcurr ycurr trpoint symbolsize symbollinewidth doplus } def + +% dosquare: show an open square with a given symbolsize and symbollinewidth +% NB symbolsize is reduced by half the line width to get size exactly right +% <x> <y> <symbolsize> <symbollinewidth> dosquare - +/dosquare +{ + dup setlinewidth + 0.5 mul sub 0 max /ss exch def + newpath + moveto + ss neg ss neg rmoveto + ss 2 mul 0 rlineto + 0 ss 2 mul rlineto + ss -2 mul 0 rlineto + closepath [] 0 setdash stroke +} def + +% square: show an open square +% - square - +/square { xcurr ycurr trpoint symbolsize symbollinewidth dosquare } def + +% dofilledsquare: show filled square with given symbolsize and symbollinewidth +% NB symbollinewidth is not used +% <x> <y> <symbolsize> <symbollinewidth> dofilledsquare - +/dofilledsquare +{ + pop /ss exch def + newpath + moveto + ss neg ss neg rmoveto + ss 2 mul 0 rlineto + 0 ss 2 mul rlineto + ss -2 mul 0 rlineto + closepath fill +} def + +% filledsquare: show a filled square +% - filledsquare - +/filledsquare { xcurr ycurr trpoint symbolsize symbollinewidth dofilledsquare } def + +% dodiamond: show an open diamond with a given symbolsize and symbollinewidth +% NB symbolsize is reduced by half the line width to get size exactly right +% <x> <y> <symbolsize> <symbollinewidth> dodiamond - +/dodiamond +{ + dup setlinewidth + 0.5 mul sub 0 max /ss exch def + newpath + moveto + ss neg 0 rmoveto + ss ss neg rlineto + ss ss rlineto + ss neg ss rlineto + closepath [] 0 setdash stroke +} def + +% diamond: show an open diamond +% - diamond - +/diamond { xcurr ycurr trpoint symbolsize symbollinewidth dodiamond } def + +% dofilleddiamond: show filled diamond with given symbolsize and symbollinewidth +% NB symbollinewidth is not used +% <x> <y> <symbolsize> <symbollinewidth> dofilleddiamond - +/dofilleddiamond +{ + pop /ss exch def + newpath + moveto + ss neg 0 rmoveto + ss ss neg rlineto + ss ss rlineto + ss neg ss rlineto + closepath fill +} def + +% filleddiamond: show a filled diamond +% - filleddiamond - +/filleddiamond { xcurr ycurr trpoint symbolsize symbollinewidth dofilleddiamond } def + +% docircle: show an open circle with a given symbolsize and symbollinewidth +% NB symbolsize is reduced by half the line width to get size exactly right +% <x> <y> <symbolsize> <symbollinewidth> docircle - +/docircle +{ + dup setlinewidth + 0.5 mul sub 0 max /ss exch def + newpath + ss 0 360 arc [] 0 setdash stroke +} def + +% circle: show an open circle +% - circle - +/circle { xcurr ycurr trpoint symbolsize symbollinewidth docircle } def + +% dofilledcircle: show filled circle with given symbolsize and symbollinewidth +% NB symbollinewidth is not used +% <x> <y> <symbolsize> <symbollinewidth> dofilledcircle - +/dofilledcircle +{ + pop /ss exch def + newpath + ss 0 360 arc fill +} def + +% filledcircle: show a filled circle +% - filledcircle - +/filledcircle { xcurr ycurr trpoint symbolsize symbollinewidth dofilledcircle } def + +% dotriangle: show an open triangle with a given symbolsize and symbollinewidth +% NB symbolsize is reduced by half the line width to get size exactly right +% <x> <y> <symbolsize> <symbollinewidth> dotriangle - +/dotriangle +{ + dup setlinewidth + 0.5 mul sub 0 max /ss exch def + newpath + moveto + 0 ss 1.5 mul rmoveto + ss neg ss -2.5 mul rlineto + ss 2 mul 0 rlineto + closepath [] 0 setdash stroke +} def + +% triangle: show an open triangle +% - triangle - +/triangle { xcurr ycurr trpoint symbolsize symbollinewidth dotriangle } def + +% dofilledtriangle: show filled triangle with symbolsize and symbollinewidth +% NB symbollinewidth is not used +% <x> <y> <symbolsize> <symbollinewidth> dofilledtriangle - +/dofilledtriangle +{ + pop /ss exch def + newpath + moveto + 0 ss 1.5 mul rmoveto + ss neg ss -2.5 mul rlineto + ss 2 mul 0 rlineto + closepath fill +} def + +% filledtriangle: show a filled triangle +% - filledtriangle - +/filledtriangle { symbolsize symbollinewidth dofilledtriangle } def + + +%plog: like log only with a base, and protected from failing if <= 0 +% base x plog res +/plog { dup 0 le { pop pop 0 } { ln exch ln div } ifelse } def + +% xtr: transform one x value logarithmically if xlog > 1 +% <num> xtr <num> +/xtr +{ xlog 1 gt + { xlog exch plog + } if +} def + +% ytr: transform one y value logarithmically if ylog > 1 +% <num> ytr <num> +/ytr +{ ylog 1 gt + { ylog exch plog + } if +} def + + +% trpoint: transform (x, y) in graph space into (x', y') in print space +% x y trpoint x' y' +/trpoint +{ exch xtr xdecr { trxmax exch sub } { trxmin sub } ifelse + trxmax trxmin sub div xwidth mul xextra add + + exch ytr ydecr { trymax exch sub } { trymin sub } ifelse + trymax trymin sub div ywidth mul yextra add +} def + + +% yonly: interpolate x values 1, 2, ... into data +% [ data ] yonly [ newdata ] +/yonly +{ dup /tmp exch def + length [ exch 1 exch 1 exch + { dup tmp exch 1 sub get + } for + ] +} def + +% xonly: interpolate y values 1, 2, ... into data +% [ data ] yonly [ newdata ] +/xonly +{ dup /tmp exch def + length [ exch 1 exch 1 exch + { dup tmp exch 1 sub get exch + } for + ] +} def + +% xandy: no interpolation of x or y values +% [ data ] xandy [ data ] +/xandy {} def + +% swapxandy: swap x and 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> +/expstringwidth +{ (^) search + { exch pop stringwidth pop exch stringwidth pop 0.7 mul add } + { stringwidth pop } + ifelse +} def + +% expstringshow: show string containing optional exponent +% <string> expstringshow - +/expstringshow +{ (^) search + { exch pop show 0 0.5 ft rmoveto + gsave currentfont 0.7 scalefont setfont show grestore + } + { show + } + ifelse +} def + +% concatenate two strings: <string> <string> strconcat <string> +/strconcat +{ 2 copy length exch length add string + dup 0 4 index putinterval + dup 3 index length 3 index putinterval + 3 1 roll pop pop +} def + +% lgen: generate one label automatically +% num lgen num string +/lgen { dup 20 string cvs } def + +% loglgen: generate one logarithmic label (with exponent) +% <base> <exponent> loglgen <string> +/loglgen +{ 20 string cvs exch 20 string cvs + (^) strconcat exch strconcat +} def + + +% printxtick: print one x tick +% xpos printxtick - +/printxtick +{ newpath + yleft trpoint moveto 0 yextra neg rmoveto + 0 xticklength neg rlineto [] 0 setdash stroke +} def + +% printxgrid: print one x grid line +% xpos printxgrid - +/printxgrid +{ dup newpath + yleft trpoint moveto 0 yextra neg rmoveto + yright trpoint lineto 0 yextra rlineto [] 0 setdash stroke +} def + +% printxlabel: print one x label +% (xlabel) xpos printxlabel - +/printxlabel +{ yleft trpoint moveto 0 yextra neg rmoveto + 0 xticklength neg rmoveto 0 0.9 ft neg rmoveto + xlog 1 gt { 0 0.3 ft neg rmoveto } if + dup expstringwidth -2 div 0 rmoveto expstringshow +} def + +% printytick: print one y tick +% ypos printytick - +/printytick +{ newpath + xleft exch trpoint moveto xextra neg 0 rmoveto + yticklength neg 0 rlineto [] 0 setdash stroke +} def + +% printygrid: print one y grid line +% ypos printygrid - +/printygrid +{ dup newpath + xleft exch trpoint moveto xextra neg 0 rmoveto + xright exch trpoint lineto xextra 0 rlineto [] 0 setdash stroke +} def + +% printylabel: print one y label +% (ylabel) ypos printylabel - +/printylabel +{ xleft exch trpoint moveto xextra neg 0 rmoveto + yticklength neg 0 rmoveto -0.3 ft -0.3 ft rmoveto + dup expstringwidth neg 0 rmoveto expstringshow +} def + +% printrtick: print one r tick +% ypos printrtick - +/printrtick +{ newpath + xright exch trpoint moveto xextra 0 rmoveto + rticklength 0 rlineto [] 0 setdash stroke +} def + +% printrlabel: print one r label +% (rlabel) ypos printrlabel - +/printrlabel +{ xright exch trpoint moveto xextra 0 rmoveto + rticklength 0 rmoveto 0.3 ft -0.3 ft rmoveto + expstringshow +} def + +% printticks: print ticks and labels +% /tickproc /labelproc [ tickandlabeldata ] min printticks - +/printticks +{ /prev exch def + { dup type dup dup /integertype eq exch /realtype eq or + { pop dup /prev exch def 2 index cvx exec + } + { /stringtype eq + { prev 2 index cvx exec + } + { pop + } ifelse + } ifelse + } forall + pop pop +} def + + +% printxaxistick: print one x axis tick +% xpos printxaxistick - +/printxaxistick +{ newpath + yaxis trpoint moveto 0 xticklength -2 div rmoveto + 0 xticklength rlineto [] 0 setdash stroke +} def + +% printxaxislabel: print one x axis label +% (xlabel) xpos printxaxislabel - +/printxaxislabel +{ yaxis trpoint moveto + 0 xticklength -2 div rmoveto 0 0.9 ft neg rmoveto + xlog 1 gt { 0 0.3 ft neg rmoveto } if + dup expstringwidth -2 div 0 rmoveto expstringshow +} def + +% printyaxistick: print one y axis tick +% ypos printyaxistick - +/printyaxistick +{ newpath + xaxis exch trpoint moveto + yticklength -2 div 0 rmoveto + yticklength 0 rlineto [] 0 setdash stroke +} def + +% printyaxislabel: print one y axis label +% (ylabel) ypos printyaxislabel - +/printyaxislabel +{ xaxis exch trpoint moveto + yticklength -2 div 0 rmoveto -0.3 ft -0.3 ft rmoveto + dup expstringwidth neg 0 rmoveto expstringshow +} def + + +% <val> minmax - +% perform minv := min(minv, val); maxv := max(maxv, val) +% allowing for the possibility of minv, maxv, val being false (undefined) +/minmax +{ dup false eq + { pop } + { minv false eq + { dup /minv exch def /maxv exch def } + { dup minv lt + { /minv exch def } + { dup maxv gt + { /maxv exch def } + { pop } + ifelse + } ifelse + } ifelse + } ifelse +} def + +% <ticks> ticksundef <ticks> <bool> +% returns true iff the ticks array is undefined (one false entry) +/ticksundef +{ dup length 1 eq + { dup 0 get false eq + } + { false } + ifelse +} def + +% <number> integral <boolean> +% true if the number has an integral value +/integral { dup round eq } def + +% ticksep ticks xory alldata minval maxval axis base ticksandlimits ticks min max base +% ticksandlimits: sort out value of x or y ticks and limits and log base +/ticksandlimits +{ /base exch def + /minv false def + /maxv false def + + % min and max of user-supplied minval, maxval, and axis + minmax minmax minmax + + % min and max of data points + { 0 get dup dup length 1 sub 3 index exch 2 exch + { get minmax dup + } for pop pop + } forall + pop dup + + % min and max of tick values + { dup type /stringtype eq + { pop } { minmax } ifelse + } forall + + % fix minv and maxv if undefined (false) or equal + minv false eq + { /minv -1 def /maxv 1 def } + { minv maxv eq + { minv 0 lt + { /minv 2 minv mul def /maxv 0 def + } + { minv 0 eq + { /minv -1 def /maxv 1 def + } + { /minv 0 def /maxv 2 maxv mul def + } ifelse + } ifelse + } if + } ifelse + + % invent ticks if undefined + ticksundef + { pop /ticksep exch def + + % if base is reasonable and minv is positive, logarithmic ticks + base 1 gt minv 0 gt and + { + % get integral log of minv and maxv + /logminv base minv plog floor cvi def + /logmaxv base maxv plog ceiling cvi def + + % if minv close to base, make it 1; reset minv and maxv + logminv 1 eq logmaxv 4 ge and { /logminv 0 def } if + /minv base logminv exp def + /maxv base logmaxv exp def + + % ticks := [ base**logminv, ... , base**logmaxv ] + [ logminv 1 logmaxv + { dup base exch exp + exch base exch loglgen + } for + ] + } + { % non-logarithmic ticks + { + % fix tick separation if undefined (0) or too small + /base 0 def + /delta maxv minv sub def + ticksep delta 30 div le + { /ticksep 10 delta log 1 sub ceiling exp def + ticksep delta 2 div ge + { /ticksep ticksep 2 div def } + { ticksep delta 5 div lt + { /ticksep 2 ticksep mul def + } if + } ifelse + } if + + % adjust minv and maxv to be multiples of ticksep + /minv minv ticksep div floor ticksep mul def + /maxv maxv ticksep div ceiling ticksep mul def + /delta maxv minv sub def + + % if minv or maxv near zero, move to zero and redo + minv ticksep eq + { /minv 0 def } + { maxv ticksep neg eq { /maxv 0 def } { exit } ifelse + } ifelse + } loop + + % if minv, maxv, and ticksep are all integral, set "makeint" to true + /makeint minv integral maxv integral ticksep integral and and def + + % ticks := [ minv, minv+ticksep, ... , maxv ] + [ 0 1 delta ticksep div round + { ticksep mul minv add makeint { cvi } if lgen } + for + ] + } ifelse + } + { exch pop + } ifelse + minv maxv base +} def + +% xset: set up all data for x axis, including limits and ticks +% xticksep xticks 0 alldata xmin xmax xlog xextra xdecr xaxis xticklength xset - +/xset +{ /xticklength exch def + /xaxis exch def + /xdecr exch def + /xextra exch def + xaxis exch ticksandlimits + /xlog exch def /xmax exch def /xmin exch def /xticks exch def + /xleft xdecr { xmax } { xmin } ifelse def + /xright xdecr { xmin } { xmax } ifelse def + /xwidth xsize xextra 2 mul sub def + /trxmin xmin xtr def /trxmax xmax xtr def +} def + +% yset: set up all data for y axis, including limits and yticks +% yticksep yticks 0 alldata ymin ymax ylog yextra ydecr yaxis yticklength yset - +/yset +{ /yticklength exch def + /yaxis exch def + /ydecr exch def + /yextra exch def + yaxis exch ticksandlimits + /ylog exch def /ymax exch def /ymin exch def /yticks exch def + /yleft ydecr { ymax } { ymin } ifelse def + /yright ydecr { ymin } { ymax } ifelse def + /ywidth ysize yextra 2 mul sub def + /trymin ymin ytr def /trymax ymax ytr def +} def + +% rset: set up all data for y axis (again), but including limits and rticks +% rticksep rticks 0 alldata ymin ymax ylog yextra ydecr yaxis rticklength rset - +/rset +{ /rticklength exch def + /yaxis exch def + /ydecr exch def + /yextra exch def + yaxis exch ticksandlimits + /ylog exch def /ymax exch def /ymin exch def /rticks exch def + /yleft ydecr { ymax } { ymin } ifelse def + /yright ydecr { ymin } { ymax } ifelse def + /ywidth ysize yextra 2 mul sub def + /trymin ymin ytr def /trymax ymax ytr def +} def + +% norset: set up data for no rticks +% - norset - +/norset +{ /rticklength 0 def + /rticks [] def +} def + +% framestyle: print a frame around the graph +/framestyle +{ 0 0 moveto xsize 0 lineto xsize ysize lineto + 0 ysize lineto closepath stroke + /printxtick /printxlabel xticks xleft printticks + /printytick /printylabel yticks ymin printticks + /printrtick /printrlabel rticks ymin printticks +} def + +% gridstyle: print a frame around the graph, plus a grid +/gridstyle +{ 0 0 moveto xsize 0 lineto xsize ysize lineto + 0 ysize lineto closepath stroke + /printxgrid /printxlabel xticks xleft printticks + /printygrid /printylabel yticks ymin printticks + /printrtick /printrlabel rticks ymin printticks +} def + +% nonestyle: print nothing around the graph +/nonestyle +{ +} def + +% axesstyle: print axes for the graph (unless axis values missing) +/axesstyle +{ + xaxis false eq yaxis false eq or + { framestyle } + { xaxis yaxis trpoint dup 0 exch moveto xsize exch lineto + dup 0 moveto ysize lineto stroke + /printxaxistick /printxaxislabel xticks xleft printticks + /printyaxistick /printyaxislabel yticks ymin printticks + } ifelse +} def + +% rundata: run all data sets +/rundata +{ alldata + { gsave + dup dup dup dup dup + 5 get /texture exch def + 4 get /dopaint exch def + 3 get /initrun exch def + 2 get /pairs exch def + 1 get /points exch def + 0 get /data exch def + dopaint + { data length 4 ge + { + gsave + initrun + newpath + data 0 get ymin trpoint yextra sub moveto + 0 2 data length 2 sub + { dup 1 add + data exch get /ycurr exch def + data exch get /xcurr exch def + xcurr ycurr trpoint lineto + } for + data dup length 2 sub get ymin trpoint yextra sub lineto + closepath texture fill + grestore + } if + } if + initrun + data length 2 ge + { + /xcurr data 0 get def + /ycurr data 1 get def + points + data length 4 ge + { 2 2 data length 2 sub + { /xprev xcurr def + /yprev ycurr def + dup dup 2 eq /firstpair exch def + data length 2 sub eq /lastpair exch def + dup 1 add + data exch get /ycurr exch def + data exch get /xcurr exch def + pairs + points + } for + } if + } if + grestore + } forall +} def + +end +%%EndResource diff --git a/include/include/haskell b/include/include/haskell new file mode 100644 index 0000000..de5e589 --- /dev/null +++ b/include/include/haskell @@ -0,0 +1,118 @@ +############################################################################### +# # +# Lout setup file for Haskell program printing # +# # +# Version 1.0 # +# Thorsten Seitz # +# 17 December 2001 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { haskellf } + + +############################################################################### +# # +# @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 { @HaskellSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # numberedblanks { Yes } # No or Yes + # style { symbol @OrIfPlain 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # spacing mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/haskellf b/include/include/haskellf new file mode 100644 index 0000000..f2b9130 --- /dev/null +++ b/include/include/haskellf @@ -0,0 +1,527 @@ + +############################################################################### +# # +# Lout @HaskellSetup package for formatting Haskell programs # +# # +# Version 1.0 # +# Thorsten Seitz # +# 17 December 2001 # +# # +# Version 1.1 (bug fixes) # +# Gabor Greif # +# 29 June 2007 # +# # +# 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @Haskell +def @HaskellSetup + named pipe { } # pipe through this first + named numbered { No } # want lines numbered? + named blanknumbered { Yes } # blank lines numbered? + named style + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { symbol @OrIfPlain 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + named fixedtabin { 4 } # tab interval + named fixedtabout { 4s } # tab width + + named fixedbraces { Base } # braces face + 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 fixedleftbracesformat right @Body { @Body } # left braces format + named fixedrightbracesformat right @Body { @Body } # right braces format + 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + named varyingtabin { 4 } # tab interval + named varyingtabout { 1.5f } # tab width + + named varyingbraces { Base } # braces face + 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 varyingleftbracesformat right @Body { @Body } # left braces format + named varyingrightbracesformat right @Body { @Body } # right braces format + 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 { 1f } # font size + named symbolline { 1.0vx } # line-space + named symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + named symboltabin { 4 } # tab interval + named symboltabout { 1.7f } # tab width + + named symbolbraces { Base } # braces face + named symbolidentifiers { Slope } # identifier face + named symbolkeywords { Bold } # keyword face + named symboloperators { Slope } # 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 { 0.3s @Space {"" @Body} } # identifier format (with italic correction) + named symbolkeywordsformat right @Body { @Body } # keyword format + named symboloperatorsformat right @Body { 0.5s @Space {"" @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 @PCL @PL @PA @PM @PD + @PLAMBDA @PCIRC @PPLUSPLUS @PCOLON @PDOUBLECOLON + + @A "$>" + + def @Haskell + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + named tabin { dft } # tab interval + named tabout { dft } # tab width + named braces { dft } # braces font + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lHaskell" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lHaskell" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 @A # get characters from the Adobe Symbol font + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + # deleted by JeffK here and in prg2lout.c, who could not see the point + #def @APO + # left sym + # right x + #{ + # @PO sym @A x + #} + + + + 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 @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 @PCnoDelim + 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 @Symb right x { { Symbol Base } @Font @Char x } + + + def @PC # for formatting comments + right x + { + @PCnoDelim { "{"{@Symb minus}x{@Symb minus}"}" } + } + + + def @PCL # for formatting line comments + right x + { + @PCnoDelim { {@Symb minus} &0.5s {@Symb minus}{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 { @Symb asteriskmath } + } + } + + + 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.05f" } + } + } + + + def @PLAMBDA + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char lambda |0.5s } + else @Yield { x } + } + } + + def @PCIRC + right x + { + style @Case { + symbol @Yield { @PO {/0.3fo 0i @Space {"" @Symb degree } } } + else @Yield { @PO x } + } + } + + def @PPLUSPLUS + right x + { + style @Case { + symbol @Yield { @PO {@Symb plus |0.3fo @Symb plus} } + else @Yield { @PO x } + } + } + + def @PCOLON + { + @PO ":" + } + + def @PDOUBLECOLON + right x + { + style @Case { + symbol @Yield { @PO {: |0.8s :} } + else @Yield { @PO x } + } + } + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @Haskell + +@End @HaskellSetup diff --git a/include/include/init b/include/include/init new file mode 100644 index 0000000..3ca62df --- /dev/null +++ b/include/include/init @@ -0,0 +1,37 @@ + +############################################################################### +# # +# init # +# # +# Lout file for initializing run. # +# # +# Jeffrey H. Kingston # +# 21 September 1994 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +@SysInclude { langdefs } # language definitions +@SysInclude { bsf } # BasicSetup package +@SysInclude { dsf } # DocumentSetup package + # including standard.ld +def @TeX +{ + @OneCol { T &0.4fo {-0.2f @VShift E} &0.45fo X } +} + +def @LaTeX +{ + @OneCol { L &0.3fo { +0.1f @VShift 0.8f @Font A } &0.4fo @TeX } +} + +@Use { @BasicSetup } +@Use { @DocumentSetup } + +@SysDatabase @Reference { loutrefs } # references about Lout +@SysDatabase @Reference { oldrefs } # old references about Lout +@SysDatabase @RefStyle { refstyle } # reference printing styles +@SysDatabase @FontDef { fontdefs } # font definitions +@SysDatabase @FontDef { latin2 } # more font definitions diff --git a/include/include/java b/include/include/java new file mode 100644 index 0000000..5a8849c --- /dev/null +++ b/include/include/java @@ -0,0 +1,118 @@ +############################################################################### +# # +# Lout setup file for Java program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 6 April 2001 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @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 + # numberedblanks { Yes } # No or Yes + # 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # spacing mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/javaf b/include/include/javaf new file mode 100644 index 0000000..cd4f944 --- /dev/null +++ b/include/include/javaf @@ -0,0 +1,446 @@ + +############################################################################### +# # +# 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @Java +def @JavaSetup + named pipe { } # pipe through this first + named numbered { No } # want lines numbered? + named blanknumbered { Yes } # blank 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lJava" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lJava" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @Java + +@End @JavaSetup diff --git a/include/include/javascript b/include/include/javascript new file mode 100644 index 0000000..30ef871 --- /dev/null +++ b/include/include/javascript @@ -0,0 +1,118 @@ +############################################################################### +# # +# Lout setup file for JavaScript program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 6 April 2001 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { javascriptf } + + +############################################################################### +# # +# @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 { @JavaScriptSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # numberedblanks { Yes } # No or Yes + # 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # spacing mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/javascriptf b/include/include/javascriptf new file mode 100644 index 0000000..a0bde1e --- /dev/null +++ b/include/include/javascriptf @@ -0,0 +1,446 @@ + +############################################################################### +# # +# Lout @JavaScriptSetup package for formatting JavaScript 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @JavaScript +def @JavaScriptSetup + named pipe { } # pipe through this first + named numbered { No } # want lines numbered? + named blanknumbered { Yes } # blank 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 @JavaScript + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lJavaScript" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lJavaScript" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @JavaScript + +@End @JavaScriptSetup diff --git a/include/include/langdefs b/include/include/langdefs new file mode 100644 index 0000000..4d6e11a --- /dev/null +++ b/include/include/langdefs @@ -0,0 +1,31 @@ +############################################################################### +# # +# Language definitions # +# Jeffrey H. Kingston # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + +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 Esperanto eo { esperanto . : ! ? .) ?) !) .' !' ?' } +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 Programming pr { programming } +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/include/latin2 b/include/include/latin2 new file mode 100644 index 0000000..29883f2 --- /dev/null +++ b/include/include/latin2 @@ -0,0 +1,9 @@ +################################################################# +# # +# latin2 # +# # +# This file includes everything you need for Latin2. # +# # +################################################################# + +@SysDatabase @FontDef { latin2 } diff --git a/include/include/lengths b/include/include/lengths new file mode 100644 index 0000000..3d698de --- /dev/null +++ b/include/include/lengths @@ -0,0 +1,167 @@ + +########################################################################### +# # +# lengths # +# # +# Jeffrey H. Kingston # +# 30 October 2002 # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +# This file offers two symbols for converting between PostScript # +# lengths and Lout lengths. This has been a messy area and the two # +# symbols in this file, @LoutLengths and @PSLengths, are my attempt # +# to put a final end to the mess. # +# # +# A Lout length is, and has always been, a number followed by # +# a one-letter unit of measurement: i c p m s v f d. # +# # +# A PostScript length is, and has always been, a number followed # +# by a space followed by a two-letter unit of measurement, one of # +# in cm pt em sp vs ft dg. # +# # +# To the ordinary user who reads the User's Guide, all lengths # +# now look like Lout lengths. However, internally some of these # +# lengths are used by Lout and others are passed to PostScript. # +# Based on the two symbols @PSLengths and @LoutLengths defined # +# below, an option x which could contain a length of either kind # +# can be classified as one of three types: # +# # +# Type of option How to handle it # +# ------------------------------------------------------------------- # +# Option was never advertised named x { ... } # +# as taking a PostScript length # +# # +# Option was advertised as import @LoutLengths named x { ... } # +# possibly taking a PostScript # +# length, but its value is used # +# by Lout # +# # +# Option whose value has to be import @PSLengths named x { ... } # +# passed to PostScript # +# ------------------------------------------------------------------- # +# # +# Either kind of import allows either kind of length to be given; # +# @LoutLengths makes sure the final result is suitable for passing # +# to Lout, while @PSLengths makes sure the final result is suitable # +# for passing to PostScript. If things had been done right from the # +# start, there would be no need for @LoutLengths, but for backward # +# compatibility we will continue to use it basically forever. # +# # +########################################################################### + + +########################################################################### +# # +# @LoutLengths # +# # +# Convert PostScript lengths into Lout lengths. # +# # +########################################################################### + +export in cm pt em sp vs ft dg +def @LoutLengths +{ + def in left x { x"i" } + def cm left x { x"c" } + def pt left x { x"p" } + def em left x { x"m" } + def sp left x { x"s" } + def vs left x { x"b" } + def ft left x { x"f" } + def dg left x { x"d" } +} + + +########################################################################### +# # +# @PSLengths # +# # +# Convert Lout lengths into PostScript (also PDF) lengths. # +# PDF is no longer supported but this code was there already so # +# it's been carried over. # +# # +########################################################################### + +export i c p m s v f d +def @PSLengths +{ + def i left x { + @BackEnd @Case { + PostScript @Yield { x" in" } + PDF @Yield { "__mul(__in, "x")" } + PlainText @Yield "" + } + } + + def c left x { + @BackEnd @Case { + PostScript @Yield { x" cm" } + PDF @Yield { "__mul(__cm, "x")" } + PlainText @Yield "" + } + } + + def p left x { + @BackEnd @Case { + PostScript @Yield { x" pt" } + PDF @Yield { "__mul(__pt, "x")" } + PlainText @Yield "" + } + } + + def m left x { + @BackEnd @Case { + PostScript @Yield { x" em" } + PDF @Yield { "__mul(__em, "x")" } + PlainText @Yield "" + } + } + + def s left x { + @BackEnd @Case { + PostScript @Yield { x" sp" } + PDF @Yield { "__mul(__louts, "x")" } + PlainText @Yield "" + } + } + + def v left x { + @BackEnd @Case { + PostScript @Yield { x" vs" } + PDF @Yield { "__mul(__loutv, "x")" } + PlainText @Yield "" + } + } + + def f left x { + @BackEnd @Case { + PostScript @Yield { x" ft" } + PDF @Yield { "__mul(__loutf, "x")" } + PlainText @Yield "" + } + } + + def d left x { + @BackEnd @Case { + PostScript @Yield { x" dg" } + PDF @Yield { "__mul(__loutd, "x")" } + PlainText @Yield "" + } + } +} diff --git a/include/include/math b/include/include/math new file mode 100644 index 0000000..345db84 --- /dev/null +++ b/include/include/math @@ -0,0 +1,32 @@ +############################################################################### +# # +# Lout setup file for equation formatting, based on `eq'. # +# # +# Jeffrey H. Kingston # +# 5 February 1999 # +# # +# Ludovic Courtès # +# June 2007 # +# # +# This file has been placed in the public domain by its authors. # +# # +############################################################################### + + +############################################################################### +# # +# The @SysInclude { mathf } line # +# # +# This line causes Lout to read the definitions for equations, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { mathf } + + +############################################################################### +# # +# This package does not offer default options that can be changed. # +# # +############################################################################### diff --git a/include/include/mathf b/include/include/mathf new file mode 100644 index 0000000..523504a --- /dev/null +++ b/include/include/mathf @@ -0,0 +1,2944 @@ + +############################################################################### +# # +# Lout @Math package for formatting mathematics # +# # +# @Math is based on the earlier @Eq package. @Eq revision history: # +# # +# Version 1.0 by Jeffrey H. Kingston, December 1990. # +# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. # +# Version 3.0 by Jeffrey H. Kingston and Robert Marsa, March 1996. # +# # +# @Math revision history: # +# # +# Version 4.0 by Ludovic Courtès, June 2007. # +# Version 5.0 by Jeffrey H. Kingston, September 2008. # +# # +# Acknowledgement: @Eq and @Math are based closely on the Eqn language # +# of B. W. Kernighan and L. L. Cherry; the spacing rules are similar to # +# those of the TeX system by D. E. Knuth. # +# # +# Version 4.0 makes use of `@SetContext' and `@GetContext' (introduced in # +# Lout 3.34) to better honor the typesetting conventions outlined by Knuth. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export + + # Helper symbols + above below wideabove widebelow + "`" "``" "```" non big small vctr + @SuperScriptStyle @SubScriptStyle @NumeratorStyle + @DenominatorStyle @SquareRootStyle + + # Ordinary symbols (Symbol font) + space exclam universal numbersign existential percent + ampersand suchthat parenleft parenright asteriskmath + plus comma minus period slash zero one two three four + five six seven eight nine colon semicolon less equal + greater question congruent Alpha Beta Chi Delta Epsilon + Phi Gamma Eta Iota thetaone Kappa Lambda Mu Nu Omicron + Pi Theta Rho Sigma Tau Upsilon sigmaone Omega Xi Psi Zeta + bracketleft therefore bracketright perpendicular underscore + radicalex alpha beta chi delta epsilon phi gamma eta iota + phione kappa lambda mu nu omicron pi theta rho sigma tau + upsilon omegaone omega xi psi zeta braceleft bar braceright + similar Upsilonone minute lessequal fraction infinity florin + club diamond heart spade arrowboth arrowleft arrowup + arrowright arrowdown degree plusminus second greaterequal + multiply proportional partialdiff bullet divide notequal + equivalence approxequal ellipsis arrowvertex arrowhorizex + carriagereturn aleph Ifraktur Rfraktur weierstrass + circlemultiply circleplus emptyset intersection union + propersuperset reflexsuperset notsubset propersubset + reflexsubset element notelement angle gradient registerserif + copyrightserif trademarkserif product radical dotmath + logicalnot logicaland logicalor arrowdblboth arrowdblleft + arrowdblup arrowdblright arrowdbldown lozenge angleleft + registersans copyrightsans trademarksans summation parenlefttp + parenleftex parenleftbt bracketlefttp bracketleftex + bracketleftbt bracelefttp braceleftmid braceleftbt braceex + angleright integral integraltp integralex integralbt + parenrighttp parenrightex parenrightbt bracketrighttp + bracketrightex bracketrightbt bracerighttp bracerightmid + bracerightbt + + # Ordinary symbols (arrows) + leftarrow longleftarrow dblleftarrow dbllongleftarrow + rightarrow longrightarrow dblrightarrow dbllongrightarrow + leftrightarrow longleftrightarrow dblleftrightarrow + dbllongleftrightarrow mapsto longmapsto hookleftarrow + hookrightarrow leadsto leftharpoonup rightharpoonup + leftharpoondown rightharpoondown rightleftharpoons + uparrow dbluparrow downarrow dbldownarrow updownarrow + dblupdownarrow nearrow searrow swarrow nwarrow + + # Ordinary symbols (to get Roman font) + arccos arcsin arctan arg cos cosh cot coth csc deg det dim exp + gcd hom inf ker lg lim liminf limsup ln log max min Pr sec sin + sinh supr tan tanh mod "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" + "!" "?" "%" "(" ")" "[" "]" + + # Ordinary symbols (for atleft and atright) + lpar blpar rpar brpar lbrack blbrack rbrack brbrack lbrace blbrace + rbrace brbrace lfloor blfloor rfloor brfloor lceil blceil + rceil brceil langle blangle rangle brangle + + # Ordinary symbols (miscellaneous) + hbar Re Im partial infty prime nabla surd top bot dbar triangle + backslash forall exists neg circle filledcircle square ldots cdots + vdots ddots del grad "..." ",...," "'" "''" "'''" "''''" empty + triangleup triangledown half third + + # Variable-building symbols + dot dotdot hat tilde vec dyad overbar underbar + sup sub tsub supp on ton + + # Large operator symbols + largeop sum prod coprod bcap bcup bvee bwedge bodot botimes + boplus buplus int oint + + # Unary operator symbols + sqrt root zroot + matrix pmatrix bmatrix brmatrix fmatrix cmatrix amatrix + + # Binary operator symbols + over frac + bin "+" "-" "+-" "-+" setminus cdot times "*" circ div + cap cup uplus sqcap sqcup triangleleft triangleright + wr bigcirc bigtriangleup bigtriangledown vee wedge oplus ominus + otimes oslash odot dagger daggerdbl amalg + + # Relation symbols + rel "<" ">" "=" "<=" prec preceq "<<" subset subseteq sqsubseteq + in vdash smile frown ">=" succ succeq ">>" supset supseteq + sqsupseteq ni dashv mid parallel "==" "~" "-~" asymp "~~" + "=~" bowtie propto models doteq trieq perp notsub notin "!=" + "<->" "<--" "-->" up down "<=>" "<==" "==>" dblup dbldown + ":" "::" ":=" + # not + + # Punctuation symbols + punct ";" "," col + +def @Math + named symbolfont { Symbol Base } + named basefont { Times Base } + named initialstyle { "display" } + named initiallycramped { "No" } + named initialspace { separate 0.05f } + body @Body +@Begin + + ################################################################### + # # + # Operator Precedences (private) # + # # + # All @Math symbols with parameters have explicit precedences # + # defined by invoking one of the following macros. Symbols # + # that are typically used to build variables have high # + # precedence (84-80), then come unary operators (70), then # + # binary operators (66-60), then relations and the rest. # + # See also http://en.wikipedia.org/wiki/Order_of_operations . # + # # + ################################################################### + + macro @MaxPrec { 100 } + macro @HatPrec { 84 } + macro @SubPrec { 82 } + macro @SupPrec { 80 } + macro @UnaryOpPrec { 70 } + macro @BinaryOpTimesPrec { 64 } + macro @BinaryOpDividePrec { 62 } + macro @BinaryOpPrec { 60 } + macro @RelationPrec { 50 } + macro @PunctuationPrec { 40 } + macro @HelperNonPrec { 26 } + macro @HelperAbovePrec { 24 } + macro @HelperColPrec { 22 } + macro @HelperRowPrec { 20 } + + + ################################################################### + # # + # Context-sensitive format changes (private) # + # # + # Equation formatting (according to Knuth) demands changes in # + # the appearance of equations depending on context. Knuth # + # distinguishes four major styles (the TeXbook, Ch. 17): # + # # + # display formulas displayed on lines by themselves # + # text formulas embedded in the text # + # script formulas used as superscripts or subscripts # + # scriptscript second-order superscripts or subscripts # + # # + # Each style has its own font size and spacing rules. # + # Additionally, each of these styles can be ``cramped'', # + # meaning that exponents are not raised as much. To these # + # four styles @Math adds a fifth: # + # # + # nohspace formulas enclosed in "non" # + # # + # which implements the "non" operator by causing all # + # style-dependent horizontal space to be 0. # + # # + ################################################################### + + macro @CurrStyleVar { "EqCurrStyle" } + macro @CrampedVar { "EqCramped?" } + + def @CurrStyle { @GetContext @CurrStyleVar } + def @Cramped { @GetContext @CrampedVar } + + def @EqDebug + { + # Uncomment the following line to get debugging information. + #{ { Helvetica Base 0.7f } @Font @CurrStyle } |0.2f + @Null + } + + def @WithStyle + named style { "display" } + named cramped { "No" } + right x + { + def @NewFontSize + { + @CurrStyle @Case { + "scriptscript" @Yield 1.0f # can't be smaller + "script" @Yield { + style @Case { + "script" @Yield 1.0f + else @Yield 0.8f } } + "text" @Yield { + style @Case { + "text" @Yield 1.0f + else @Yield 0.7f } } + "display" @Yield { + style @Case { + # display and text styles yield the same font size + { "display" "text" } @Yield 1.0f + else @Yield 0.7f } } + "nohspace" @Yield 1.0f + } + } + + + #{ Helvetica Base 0.4f } @Font { @CurrStyle -> style } |0.2f + @NewFontSize @Font + { @CurrStyleVar @Yield style } @SetContext { + { @CrampedVar @Yield cramped } @SetContext { + # FIXME: Space is not properly inherited, hence this + # `@Space' invocation. + { initialspace @Space x } + } + } + } + + def @CurrSuperScriptGap + { + @Cramped @Case { + "Yes" @Yield 0.23fk + "No" @Yield 0.35fk + } + } + + def @SubScriptGap { 0.35fk } + + # Space around relational operators. + def @CurrRelSpaceGap + { + @CurrStyle @Case { + { "display" "text" } @Yield 0.300fe + "nohspace" @Yield 0i + else @Yield 0.030ce + } + } + + # Space around binary operators. + def @CurrBinarySpaceGap + { + @CurrStyle @Case { + { "display" "text" } @Yield 0.240fe + "nohspace" @Yield 0i + else @Yield 0.024ce + } + } + + # Space around punctuation marks, including matrix braces. + def @CurrPunctSpaceGap + { + @CurrStyle @Case { + { "display" "text" } @Yield 0.180fe + "nohspace" @Yield 0i + else @Yield 0.018ce + } + } + + # Gap above/below math expressions (see, e.g., `to' and `from'). + def @AboveGap { 0.15f } + def @BelowGap { 0.15f } + + def @SkewGap { 0.05f } + def @ColGap { 0.8f } + def @RowGap { 0.5f } + + + ################################################################### + # # + # Miscellaneous helper definitions (private) # + # # + ################################################################### + + def @Base precedence @MaxPrec right x { basefont @Font x } + def @Sym precedence @MaxPrec right x { symbolfont @Font x } + + def @HLine + named line { @BackEnd @Case { PostScript @Yield { "0.05 ft setlinewidth" } PDF @Yield { "__mul(__loutf, 0.05) w" } } } + { + @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto xsize 0 lineto" line "stroke" } @Graphic {} + } + PDF @Yield { # note re-arrangement of commands (setlinewidth (='w') not allowed in a path) + { line "0 0 m __xsize 0 l s" } @Graphic {} + } + } + } + + def @VLine + { + @BackEnd @Case { + PostScript @Yield { + "0 0 moveto 0 ysize lineto 0.05 ft setlinewidth stroke" @Graphic {} + } + PDF @Yield { + "__mul(__loutf, 0.05) w 0 0 m 0 __ysize l s" @Graphic {} + } + } + } + + def @Strut + precedence @MaxPrec + right x + { + @OneCol { x | @OneRow { 0.5f @High ^/ 0.5f @High } } + } + + def @OrDefault + left l + right r + { + l @Case { + "dft" @Yield r + else @Yield l + } + } + + + ################################################################### + # # + # Helper symbols (public, exc @ScriptStyle and @FractionStyle) # + # # + ################################################################### + + def above + precedence @HelperAbovePrec + associativity left + left x + named gap { @BelowGap } + named skew { 0c } + right y + { + @HContract @VContract + { |0.5rt x + //gap |0.5rt &skew y + } + } + + def below + precedence @HelperAbovePrec + associativity left + left x + named gap { @AboveGap } + named skew { 0c } + right y + { + @HContract @VContract + { |0.5rt &skew y + ^//gap |0.5rt x + } + } + + def wideabove + precedence @HelperAbovePrec + associativity left + left x + named gap { @BelowGap } + right y + { + @HContract @VContract + { + x //gap @HScale y + } + } + + def widebelow + precedence @HelperAbovePrec + associativity left + left x + named gap { @AboveGap } + right y + { + @HContract @VContract + { + @HScale y ^//gap x + } + } + + def "`" { &@CurrPunctSpaceGap } + def "``" { &@CurrBinarySpaceGap } + def "```" { &@CurrRelSpaceGap } + + def non + precedence @HelperNonPrec + right x + { + { @CurrStyleVar @Yield "nohspace" } @SetContext x + } + + def big + precedence @MaxPrec + right x + { + 1.3f @Font x + } + + def small + precedence @MaxPrec + right x + { + 0.6f @Font x + } + + def vctr + precedence @MaxPrec + right x + { + 0.5w @VShift x + } + + def @ScriptStyle + named level { "sup" } + right script + { + @WithStyle + style { @CurrStyle @Case { + { "display" "text" } @Yield "script" + { "script" "scriptscript" } @Yield "scriptscript" + "nohspace" @Yield "nohspace" + } } + cramped { level @Case { + "sub" @Yield "Yes" + "sup" @Yield @Cramped + } } + { script } + } + + def @SuperScriptStyle right superscript + { + @ScriptStyle level { "sup" } superscript + } + + def @SubScriptStyle right subscript + { + @ScriptStyle level { "sub" } subscript + } + + def @FractionStyle + named level { "numerator" } + right x + { + @WithStyle + style { @CurrStyle @Case { + "display" @Yield "text" + "text" @Yield "script" + { "script" "scriptscript" } @Yield "scriptscript" + "nohspace" @Yield "nohspace" + } } + cramped { level @Case { + "numerator" @Yield @Cramped + "denominator" @Yield "Yes" + } } + { x } + } + + def @NumeratorStyle right x + { + @FractionStyle level { "numerator" } x + } + + def @DenominatorStyle right x + { + @FractionStyle level { "denominator" } x + } + + def @SquareRootStyle right x + { + @WithStyle style { @CurrStyle } cramped { "Yes" } x + } + + ################################################################### + # # + # Ordinary symbols (Symbol font) # + # # + # These symbols and their names are taken directly from the # + # Adobe Systems Inc. Symbol font (see PostScript Language # + # Reference Manual, pp. 256-257). The only differences are: # + # # + # Adobe: theta1 @Math: thetaone # + # sigma1 sigmaone # + # phi1 phione # + # omega1 omegaone # + # Upsilon1 Upsilonone # + # # + # These were needed since Lout identifiers do not have digits. # + # # + ################################################################### + + def space { @Sym @Char "space" } + def exclam { @Sym @Char "exclam" } + def universal { @Sym @Char "universal" } + def numbersign { @Sym @Char "numbersign" } + def existential { @Sym @Char "existential" } + def percent { @Sym @Char "percent" } + def ampersand { @Sym @Char "ampersand" } + def suchthat { @Sym @Char "suchthat" } + def parenleft { @Sym @Char "parenleft" } + def parenright { @Sym @Char "parenright" } + def asteriskmath { @Sym @Char "asteriskmath" } + def plus { @Sym @Char "plus" } + def comma { @Sym @Char "comma" } + def minus { @Sym @Char "minus" } + def period { @Sym @Char "period" } + def slash { @Sym @Char "slash" } + def zero { @Sym @Char "zero" } + def one { @Sym @Char "one" } + def two { @Sym @Char "two" } + def three { @Sym @Char "three" } + def four { @Sym @Char "four" } + def five { @Sym @Char "five" } + def six { @Sym @Char "six" } + def seven { @Sym @Char "seven" } + def eight { @Sym @Char "eight" } + def nine { @Sym @Char "nine" } + def colon { @Sym @Char "colon" } + def semicolon { @Sym @Char "semicolon" } + def less { @Sym @Char "less" } + def equal { @Sym @Char "equal" } + def greater { @Sym @Char "greater" } + def question { @Sym @Char "question" } + def congruent { @Sym @Char "congruent" } + def Alpha { @Sym @Char "Alpha" } + def Beta { @Sym @Char "Beta" } + def Chi { @Sym @Char "Chi" } + def Delta { @Sym @Char "Delta" } + def Epsilon { @Sym @Char "Epsilon" } + def Phi { @Sym @Char "Phi" } + def Gamma { @Sym @Char "Gamma" } + def Eta { @Sym @Char "Eta" } + def Iota { @Sym @Char "Iota" } + def thetaone { @Sym @Char "theta1" } + def Kappa { @Sym @Char "Kappa" } + + def Lambda { @Sym @Char "Lambda" } + def Mu { @Sym @Char "Mu" } + def Nu { @Sym @Char "Nu" } + def Omicron { @Sym @Char "Omicron" } + def Pi { @Sym @Char "Pi" } + def Theta { @Sym @Char "Theta" } + def Rho { @Sym @Char "Rho" } + def Sigma { @Sym @Char "Sigma" } + def Tau { @Sym @Char "Tau" } + def Upsilon { @Sym @Char "Upsilon" } + def sigmaone { @Sym @Char "sigma1" } + def Omega { @Sym @Char "Omega" } + def Xi { @Sym @Char "Xi" } + def Psi { @Sym @Char "Psi" } + def Zeta { @Sym @Char "Zeta" } + def bracketleft { @Sym @Char "bracketleft" } + def therefore { @Sym @Char "therefore" } + def bracketright { @Sym @Char "bracketright" } + def perpendicular { @Sym @Char "perpendicular" } + def underscore { @Sym @Char "underscore" } + def radicalex { @Sym @Char "radicalex" } + def alpha { @Sym @Char "alpha" } + def beta { @Sym @Char "beta" } + def chi { @Sym @Char "chi" } + def delta { @Sym @Char "delta" } + def epsilon { @Sym @Char "epsilon" } + def phi { @Sym @Char "phi" } + def gamma { @Sym @Char "gamma" } + def eta { @Sym @Char "eta" } + def iota { @Sym @Char "iota" } + def phione { @Sym @Char "phi1" } + def kappa { @Sym @Char "kappa" } + def lambda { @Sym @Char "lambda" } + def mu { @Sym @Char "mu" } + def nu { @Sym @Char "nu" } + + def omicron { @Sym @Char "omicron" } + def pi { @Sym @Char "pi" } + def theta { @Sym @Char "theta" } + def rho { @Sym @Char "rho" } + def sigma { @Sym @Char "sigma" } + def tau { @Sym @Char "tau" } + def upsilon { @Sym @Char "upsilon" } + def omegaone { @Sym @Char "omega1" } + def omega { @Sym @Char "omega" } + def xi { @Sym @Char "xi" } + def psi { @Sym @Char "psi" } + def zeta { @Sym @Char "zeta" } + def braceleft { @Sym @Char "braceleft" } + def bar { @Sym @Char "bar" } + def braceright { @Sym @Char "braceright" } + def similar { @Sym @Char "similar" } + def Upsilonone { @Sym @Char "Upsilon1" } + def minute { @Sym @Char "minute" } + def lessequal { @Sym @Char "lessequal" } + def fraction { @Sym @Char "fraction" } + # For Adobe Symbol, `infinity' used to be "1.2f @Font { ... }" + def infinity { @Sym @Char "infinity" } + def florin { @Sym @Char "florin" } + def club { @Sym @Char "club" } + def diamond { @Sym @Char "diamond" } + def heart { @Sym @Char "heart" } + def spade { @Sym @Char "spade" } + def arrowboth { @Sym @Char "arrowboth" } + def arrowleft { @Sym @Char "arrowleft" } + def arrowup { @Sym @Char "arrowup" } + def arrowright { @Sym @Char "arrowright" } + def arrowdown { @Sym @Char "arrowdown" } + def degree { @Sym @Char "degree" } + def plusminus { @Sym @Char "plusminus" } + def second { @Sym @Char "second" } + def greaterequal { @Sym @Char "greaterequal" } + + def multiply { @Sym @Char "multiply" } + def proportional { @Sym @Char "proportional" } + def partialdiff { @Sym @Char "partialdiff" } + def bullet { @Sym @Char "bullet" } + def divide { @Sym @Char "divide" } + def notequal { @Sym @Char "notequal" } + def equivalence { @Sym @Char "equivalence" } + def approxequal { @Sym @Char "approxequal" } + def ellipsis { @Sym @Char "ellipsis" } + def arrowvertex { @Sym @Char "arrowvertex" } + def arrowhorizex { @Sym @Char "arrowhorizex" } + def carriagereturn { @Sym @Char "carriagereturn" } + def aleph { @Sym @Char "aleph" } + def Ifraktur { @Sym @Char "Ifraktur" } + def Rfraktur { @Sym @Char "Rfraktur" } + def weierstrass { @Sym @Char "weierstrass" } + def circlemultiply { @Sym @Char "circlemultiply" } + def circleplus { @Sym @Char "circleplus" } + def emptyset { @Sym @Char "emptyset" } + def intersection { @Sym @Char "intersection" } + def union { @Sym @Char "union" } + def propersuperset { @Sym @Char "propersuperset" } + def reflexsuperset { @Sym @Char "reflexsuperset" } + def notsubset { @Sym @Char "notsubset" } + def propersubset { @Sym @Char "propersubset" } + def reflexsubset { @Sym @Char "reflexsubset" } + def element { @Sym @Char "element" } + def notelement { @Sym @Char "notelement" } + def angle { @Sym @Char "angle" } + def gradient { @Sym @Char "gradient" } + def registerserif { @Sym @Char "registerserif" } + def copyrightserif { @Sym @Char "copyrightserif" } + def trademarkserif { @Sym @Char "trademarkserif" } + def product { @Sym @Char "product" } + def radical { @Sym @Char "radical" } + def dotmath { @Sym @Char "dotmath" } + def logicalnot { @Sym @Char "logicalnot" } + def logicaland { @Sym @Char "logicaland" } + def logicalor { @Sym @Char "logicalor" } + def arrowdblboth { @Sym @Char "arrowdblboth" } + def arrowdblleft { @Sym @Char "arrowdblleft" } + def arrowdblup { @Sym @Char "arrowdblup" } + def arrowdblright { @Sym @Char "arrowdblright" } + def arrowdbldown { @Sym @Char "arrowdbldown" } + def lozenge { @Sym @Char "lozenge" } + def angleleft { @Sym @Char "angleleft" } + def registersans { @Sym @Char "registersans" } + def copyrightsans { @Sym @Char "copyrightsans" } + def trademarksans { @Sym @Char "trademarksans" } + def summation { @Sym @Char "summation" } + def parenlefttp { @Sym @Char "parenlefttp" } + def parenleftex { @Sym @Char "parenleftex" } + def parenleftbt { @Sym @Char "parenleftbt" } + def bracketlefttp { @Sym @Char "bracketlefttp" } + def bracketleftex { @Sym @Char "bracketleftex" } + def bracketleftbt { @Sym @Char "bracketleftbt" } + def bracelefttp { @Sym @Char "bracelefttp" } + def braceleftmid { @Sym @Char "braceleftmid" } + def braceleftbt { @Sym @Char "braceleftbt" } + def braceex { @Sym @Char "braceex" } + def angleright { @Sym @Char "angleright" } + def integral { @Sym @Char "integral" } + def integraltp { @Sym @Char "integraltp" } + def integralex { @Sym @Char "integralex" } + def integralbt { @Sym @Char "integralbt" } + def parenrighttp { @Sym @Char "parenrighttp" } + def parenrightex { @Sym @Char "parenrightex" } + def parenrightbt { @Sym @Char "parenrightbt" } + def bracketrighttp { @Sym @Char "bracketrighttp" } + def bracketrightex { @Sym @Char "bracketrightex" } + def bracketrightbt { @Sym @Char "bracketrightbt" } + def bracerighttp { @Sym @Char "bracerighttp" } + def bracerightmid { @Sym @Char "bracerightmid" } + def bracerightbt { @Sym @Char "bracerightbt" } + + + ################################################################### + # # + # Ordinary symbols (arrows) # + # # + ################################################################### + + def leftarrow { arrowleft } + def longleftarrow { { 1.6 1 } @Scale arrowleft } + def dblleftarrow { arrowdblleft } + def dbllongleftarrow { { 1.6 1 } @Scale arrowdblleft } + def rightarrow { arrowright } + def longrightarrow { { 1.6 1 } @Scale arrowright } + def dblrightarrow { arrowdblright } + def dbllongrightarrow { { 1.6 1 } @Scale arrowdblright } + def leftrightarrow { arrowboth } + def longleftrightarrow { { 1.6 1 } @Scale arrowboth } + def dblleftrightarrow { arrowdblboth } + def dbllongleftrightarrow { { 1.6 1 } @Scale arrowdblboth } + + def mapsto + { + @HContract @VContract { + @BackEnd @Case { + PostScript @Yield { + "0 ymark 0.16 ft sub moveto 0 ymark 0.16 ft add lineto stroke" + @Graphic arrowright + } + PDF @Yield { + "0 __sub(__ymark, __mul(__loutf, 0.16)) m 0 __add(__ymark, __mul(__loutf, 0.16)) l S" + @Graphic arrowright + } + } + } + } + + def longmapsto + { + @HContract @VContract { + @BackEnd @Case { + PostScript @Yield { + "0 ymark 0.16 ft sub moveto 0 ymark 0.16 ft add lineto stroke" + @Graphic { { 1.6 1 } @Scale arrowright } + } + PDF @Yield { + "0 __sub(__ymark, __mul(__loutf, 0.16)) m 0 __add(__ymark, __mul(__loutf, 0.16)) l S" + @Graphic { { 1.6 1 } @Scale arrowright } + } + } + } + } + + def hookleftarrow + { + @HContract @VContract { + @BackEnd @Case { + + PostScript @Yield { + "xsize ymark moveto xsize ymark 0.1 ft add 0.1 ft -90 90 arc stroke" + @Graphic leftarrow + } + + PDF @Yield { +# +# VT: draws a counterclockwise 180 degree arc from -90 to +90 degree positions +# (straight down to straight up) with centre = (xsize, ymark + 0.1 ft) +# and radius = 0.1 ft +# +# the control points therefore are: +# pt1 = (xsize + (4/3 * 0.1 ft), ymark) and pt2 = (xsize + (4/3 * 0.1 ft), ymark + 0.2 ft) +# + { + "__xsize __ymark m" # pt0 + "__add(__xsize, __div(__mul(0.4, __loutf), 3)) __ymark" # pt1 + "__add(__xsize, __div(__mul(0.4, __loutf), 3)) __add(__ymark, __mul(0.2, __loutf))" # pt2 + "__xsize __add(__ymark, __mul(0.2, __loutf)) c S" # pt3 + } + @Graphic leftarrow + } + + } + } + } + + def hookrightarrow + { + @HContract @VContract { + @BackEnd @Case { + + PostScript @Yield { + "0 ymark moveto 0 0.1 ft ymark add 0.1 ft -90 90 arcn stroke" + @Graphic rightarrow + } + + PDF @Yield { +# +# VT: draws a clockwise 180 degree arc from -90 to +90 degree positions +# (straight down to straight up) with centre = (0, ymark + 0.1 ft) +# and radius = 0.1 ft +# +# the control points therefore are: +# pt1 = (-4/3 * 0.1 ft, ymark) and pt2 = (-4/3 * 0.1 ft, ymark + 0.2 ft) +# + { + "0 __ymark m" # pt0 + "__div(__mul(-0.4, __loutf), 3) __ymark" # pt1 + "__div(__mul(-0.4, __loutf), 3) __add(__ymark, __mul(0.2, __loutf))" # pt2 + "0 __add(__ymark, __mul(0.2, __loutf)) c S" # pt3 + } + @Graphic rightarrow + } + + } + } + } + + def @ClipToSize right x + { + @HContract @VContract + @BackEnd @Case { + PostScript @Yield { + { + "grestore newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" + "0 ysize lineto closepath clip gsave" + } @Graphic x + } + PDF @Yield { + "Q n 0 0 __xsize __ysize re W n q" @Graphic x + } + } + } + + def @ClipAboveMark + left amount + right x + { + @ClipToSize { ^//{{amount}o} x } + } + + def @ClipBelowMark + left amount + right x + { + @ClipToSize { x //{{amount}o} } + } + + def leftharpoonup + { + 0.04f @ClipBelowMark leftarrow + } + + def rightharpoonup + { + 0.04f @ClipBelowMark rightarrow + } + + def leftharpoondown + { + 0.02f @ClipAboveMark leftarrow + } + + def rightharpoondown + { + 0.02f @ClipAboveMark rightarrow + } + + def rightleftharpoons + { + @HContract @VContract { + rightharpoonup + ^//0.1fo + //0.1fo + leftharpoondown + } + } + + def leadsto { @HContract { similar &0.4fo arrowright } } + + def uparrow { arrowup } + def dbluparrow { arrowdblup } + def downarrow { arrowdown } + def dbldownarrow { arrowdbldown } + def updownarrow { @HContract { arrowup &0io arrowdown } } + def dblupdownarrow { @VContract { arrowdblup ^//0.2fo arrowdbldown } } + def nearrow { 0.5w @VShift 0.5w @HShift 45d @Rotate arrowright } + def searrow { 0.5w @VShift 0.5w @HShift 315d @Rotate arrowright } + def swarrow { 0.5w @VShift 0.5w @HShift 225d @Rotate arrowright } + def nwarrow { 0.5w @VShift 0.5w @HShift 135d @Rotate arrowright } + + + ################################################################### + # # + # Ordinary symbols (to get Roman font) # + # # + # These symbols are defined to yield themselves, but in Roman # + # font rather than the Italic that would otherwise be used. # + # See Knuth p. 162 and 132. The definitions of "0" ... "9" # + # should logically appear here, but they have been moved to # + # the end since it is awkward to enter numeric lengths after # + # they are defined. # + # # + ################################################################### + + def arccos { @Base "arccos" } + def arcsin { @Base "arcsin" } + def arctan { @Base "arctan" } + def arg { @Base "arg" } + def cos { @Base "cos" } + def cosh { @Base "cosh" } + def cot { @Base "cot" } + def coth { @Base "coth" } + def csc { @Base "csc" } + def deg { @Base "deg" } + def det { @Base "det" } + def dim { @Base "dim" } + def exp { @Base "exp" } + def gcd { @Base "gcd" } + def hom { @Base "hom" } + def inf { @Base "inf" } + def ker { @Base "ker" } + def lg { @Base "lg" } + def lim { @Base "lim" } + def liminf { @OneCol { @Base "lim" ` @Base "inf" } } + def limsup { @OneCol { @Base "lim" ` @Base "sup" } } + def ln { @Base "ln" } + def log { @Base "log" } + def max { @Base "max" } + def min { @Base "min" } + def Pr { @Base "Pr" } + def sec { @Base "sec" } + def sin { @Base "sin" } + def sinh { @Base "sinh" } + def supr { @Base "sup" } + def tan { @Base "tan" } + def tanh { @Base "tanh" } + def mod { @Base "mod" } + def "!" { exclam } + def "?" { question } + def "%" { percent } + def "(" { parenleft } + def ")" { parenright } + def "[" { bracketleft } + def "]" { bracketright } + + + ################################################################### + # # + # Ordinary symbols (for atleft and atright) # + # These are Knuth's Groups 11 and 12 - openings and closings. # + # # + ################################################################### + + def lpar { parenleft } + def rpar { parenright } + def lbrack { bracketleft } + def rbrack { bracketright } + def lbrace { braceleft } + def rbrace { braceright } + def lfloor { ` "-0.15f" @VShift bracketleftbt } + def rfloor { "-0.15f" @VShift bracketrightbt ` } + def lceil { ` "-0.1f" @VShift bracketlefttp } + def rceil { "-0.1f" @VShift bracketrighttp ` } + def langle { angleleft } + def rangle { angleright } + + def blpar { @OneRow {parenlefttp ^/ parenleftex / parenleftbt } } + def brpar { @OneRow {parenrighttp ^/ parenrightex / parenrightbt } } + def blbrack { @OneRow {bracketlefttp ^/ bracketleftex / bracketleftbt } } + def brbrack { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightbt} } + def blbrace { @OneRow {bracelefttp ^/ braceleftmid / braceleftbt } } + def brbrace { @OneRow {bracerighttp ^/ bracerightmid / bracerightbt } } + def blfloor { @OneRow {bracketleftex ^/ bracketleftex / bracketleftbt } } + def brfloor { @OneRow {bracketrightex ^/ bracketrightex / bracketrightbt} } + def blceil { @OneRow {bracketlefttp ^/ bracketleftex / bracketleftex } } + def brceil { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightex} } + + def blangle + { + @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { "xsize 0 moveto 0 ysize 2 div lineto" + "xsize ysize lineto 0.04 ft setlinewidth stroke" + } @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + PDF @Yield { + { "__mul(__loutf, 0.04) w __xsize 0 m" + "0 __div(__ysize, 2) l __xsize __ysize l S" + } @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + } + } + + def brangle + { + @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto xsize ysize 2 div lineto" + "0 ysize lineto 0.04 ft setlinewidth stroke" + } @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + PDF @Yield { + { "__mul(__loutf, 0.04) w 0 0 m" + "__xsize __div(__ysize, 2) l 0 __ysize l S" + } @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + } + } + + + ################################################################### + # # + # Ordinary symbols (miscellaneous) # + # # + # Not all of Knuth's symbols are available. The four suits # + # (heartsuit, etc.), have definitions above. # + # # + ################################################################### + + def hbar { @HContract @VContract {&0.1f @Base "-" ^/0.30fo h }} + def Re { Rfraktur } + def Im { Ifraktur } + def partial { partialdiff } + def infty { infinity } + def prime { minute } + #def emptyset { defined above } + def nabla { gradient } + def surd { radical } + def top { 180d @Rotate perpendicular } + def bot { perpendicular } + def dbar { @Base "||" } + #def angle { defined above } + def backslash { "\\" } + def forall { universal } + def exists { existential } + def neg { logicalnot } + + def circle + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "xsize ysize 2 div moveto" + "xsize 2 div ysize 2 div xsize 2 div 0 360 arc" + "0.04 ft setlinewidth stroke" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + PDF @Yield { + # + # VT: draws a counterclockwise 360 degree arc from 0 to +360 + # degree positions (straight right to straight right) with + # centre = (xsize/2, ysize/2) and radius = xsize/2, + # implemented as two counterclockwise 180 degree arcs. + # start at (xsize, ysize/2); the control points are: + # + # pt1 = (xsize, ysize/2 + (4/3 * xsize/2)) + # pt2 = (0, ysize/2 + (4/3 * xsize/2)) + # + # end at (0, ysize/2). Then start at (0, ysize/2); control points + # + # pt1 = (0, ysize/2 - (4/3 * xsize/2)) + # pt2 = (xsize, ysize/2 - (4/3 * xsize/2)) + # + # and end at (xsize, ysize/2). + + { + "__mul(0.04, __loutf) w" + "__xsize __div(__ysize, 2) m" + "__xsize __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __div(__ysize, 2) c" + "0 __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __div(__ysize, 2) c S" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + } + } + + def filledcircle + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "xsize ysize 2 div moveto" + "xsize 2 div ysize 2 div xsize 2 div 0 360 arc" + "0.04 ft setlinewidth fill" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + PDF @Yield { + # + # JK: I don't know how to fill in PDF, so this doesn't! + # + # VT: draws a counterclockwise 360 degree arc from 0 to +360 + # degree positions (straight right to straight right) with + # centre = (xsize/2, ysize/2) and radius = xsize/2, + # implemented as two counterclockwise 180 degree arcs. + # start at (xsize, ysize/2); the control points are: + # + # pt1 = (xsize, ysize/2 + (4/3 * xsize/2)) + # pt2 = (0, ysize/2 + (4/3 * xsize/2)) + # + # end at (0, ysize/2). Then start at (0, ysize/2); control points + # + # pt1 = (0, ysize/2 - (4/3 * xsize/2)) + # pt2 = (xsize, ysize/2 - (4/3 * xsize/2)) + # + # and end at (xsize, ysize/2). + + { + "__mul(0.04, __loutf) w" + "__xsize __div(__ysize, 2) m" + "__xsize __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __div(__ysize, 2) c" + "0 __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __div(__ysize, 2) c S" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + } + } + + def square + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "0 0 moveto xsize 0 lineto xsize ysize lineto" + "0 ysize lineto closepath" + "0.04 ft setlinewidth stroke" + } @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High } + } + PDF @Yield { + { + "__mul(__loutf, 0.04) w" + "0 0 m __xsize 0 l __xsize __ysize l" + "0 __ysize l s" + } @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High } + } + } + } + + def triangle + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "0 0 moveto xsize 0 lineto" + "xsize 2 div ysize lineto closepath" + "0.04 ft setlinewidth stroke" + } @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } + } + PDF @Yield { + { + "__mul(__loutf, 0.04) w" + "0 0 m __xsize 0 l" + "__div(__xsize, 2) __ysize l s" + } @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } + } + } + } + + # other symbols taken from TeX + def ldots { . &0.3f . &0.3f . } + def cdots { dotmath &0.3f dotmath &0.3f dotmath } + def vdots { @OneRow { dotmath ^/0.3f dotmath /0.3f dotmath } } + def ddots { @OneCol @OneRow + { dotmath + ^/0.3f |0.3f dotmath + /0.3f | |0.3f dotmath + } + } + + # symbols taken from eqn (Kernighan and Cherry 1975). # + def del { gradient } + def grad { gradient } + def "..." { ellipsis } + def ",...," { , ellipsis ``` , } + def "'" { minute } + def "''" { minute minute } + def "'''" { minute minute minute } + def "''''" { minute minute minute minute } + def empty { emptyset } + + # forget where these are from + def triangleup { 0.8f @Font triangle } + def triangledown { 180d @Rotate 0.8f @Font triangle } + + # half and third defined later, since they use frac + + + ################################################################### + # # + # Variable-building symbols # + # # + # These symbols are essentially those of eqn, with some # + # changes and additions. # + # # + ################################################################### + + def dot + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle . + } + + def dotdot + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle .. + } + + def hat + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle @Base "^" + } + + def tilde + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle @Base "~" + } + + def vec + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle arrowright + } + + def dyad + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle arrowboth + } + + def overbar + precedence @HatPrec + left x + named gap { @AboveGap } + { + { @WithStyle style { @CurrStyle } cramped { "Yes" } x } + widebelow gap { gap } @SuperScriptStyle minus + } + + def underbar + precedence @HatPrec + left x + named gap { @BelowGap } + { + x wideabove gap { gap } @SuperScriptStyle minus + } + + def sup + precedence @SupPrec + associativity left + left x + named gap { "dft" } + right y + { + @HContract @VContract + { | @SuperScriptStyle y + ^/{ gap @OrDefault @CurrSuperScriptGap } x + } + } + + def sub + precedence @SubPrec + associativity left + left x + named gap { @SubScriptGap } + right y + { + @HContract @VContract + { + "." @KernShrink x + /gap | @SubScriptStyle y + } + } + + def tsub + precedence @SubPrec + associativity left + left x + named gap { @SubScriptGap } + right y + { + @HContract @VContract + { + x + /gap | &0io 0.2f @HShift @SubScriptStyle y + } + } + + def supp + precedence @SupPrec + associativity left + left x + named gap { "dft" } + right y + { + @HContract @VContract + { + { ^/{ gap @OrDefault @CurrSuperScriptGap } x + /{ gap @OrDefault @CurrSuperScriptGap } } + | y + } + } + + def on + precedence @SubPrec + associativity left + left x + right y + { + { @SuperScriptStyle x } ^/ / + { @SubScriptStyle y } + } + + def ton + precedence @SubPrec + associativity left + left x + right y + { + @SuperScriptStyle x ^/ / + &0io 0.3f @HShift @SubScriptStyle y + } + + + ################################################################### + # # + # Large operator symbols (Knuth's Group 6 "Large" operators) # + # # + # Layout of large operators differs in several ways, depending # + # on whether they are in display mode or not. # + # # + # 1. The operator itself is larger in display mode. We # + # achieve this by automatically prepending `big' to the # + # operator's symbol when in display mode. # + # # + # 2. The "bounds" of these operators (i.e., `from' and `to') # + # are set as limits (i.e., above and below the operator # + # symbol) when in display mode, and displayed to the # + # right of the symbol otherwise. Integrations are an # + # exception (the only exception?). # + # # + # See ``The TeXbook'', Chapter 17. # + # # + ################################################################### + + def largeop + named symbol { "largeop" } + named limits { "dft" } # whether to set `from' and `to' as limits + named from { "" } + named to { "" } + { + def @Symbol + { + @CurrStyle @Case { + "display" @Yield { big symbol } + else @Yield symbol + } + } + + def @Limits + { + limits @OrDefault { + @CurrStyle @Case { + "display" @Yield "Yes" + else @Yield "No" } + } + } + + def @LimitsBody + { + @Symbol above { @SuperScriptStyle from } + below { @SubScriptStyle to } + } + + def @NoLimitsBody + { + 0.5w @VShift { + 1.0w @VShift @OneRow { + { | 0.3w @VShift @SuperScriptStyle to } + ^/0.0fo { 0w @VShift @Symbol | } + } + + /0.0fo + + { | 0.7w @VShift @SubScriptStyle from } + } + |{ @CurrPunctSpaceGap } + } + + @Limits @Case { + { "Yes" "yes" } @Yield @LimitsBody + { "No" "no" } @Yield @NoLimitsBody + } + } + + # Ludovic's symbol, no longer used + def largeoperator + named symbol { "largeop" } + named from { "" } + named to { "" } + named limits { "Yes" } # whether to set `from' and `to' as limits + { + def @NoLimitsBody { + 0.5w @VShift { + 1.0w @VShift @OneRow { + { | 0.3w @VShift @SuperScriptStyle to } + ^/0.0fo { 0w @VShift symbol | } + } + + /0.0fo + + { | 0.7w @VShift @SubScriptStyle from } + } + |{ @CurrPunctSpaceGap } + } + + def @LimitsBody { + symbol above { @SuperScriptStyle from } + below { @SubScriptStyle to } + } + + limits @Case { + { "Yes" "yes" } @Yield @LimitsBody + { "No" "no" } @Yield @NoLimitsBody + } + } + + # Ludovic's symbol, no longer used + def simplelargeoperator + named symbol { "simplelargeop" } + named limits { "dft" } + named from { } + named to { } + { + largeoperator + symbol { @CurrStyle @Case { + "display" @Yield { big symbol } + else @Yield symbol } + } + limits { limits @OrDefault { + @CurrStyle @Case { + "display" @Yield "Yes" + else @Yield "No" } + } + } + from { from } + to { to } + } + + def sum + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { summation } limits { limits } from { from } to { to } + } + + def prod + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { product } limits { limits } from { from } to { to } + } + + def coprod + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { 180d @Rotate vctr product } + limits { limits } from { from } to { to } + } + + def bcap + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { big intersection } limits { limits } from { from } to { to } + } + + def bcup + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { big union } limits { limits } from { from } to { to } + } + + def bvee + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { big logicalor } limits { limits } from { from } to { to } + } + + def bwedge + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { big logicaland } limits { limits } from { from } to { to } + } + + def circledot + { + def @PureDot # dot with no extra space + { + @HContract { &0io 0.4w @HShift dotmath } + } + + @OneRow @HContract { circle /0io &0.5rt @PureDot /0io circle } + } + + + def bodot + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { circledot } + limits { limits } from { from } to { to } + } + + def botimes + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { circlemultiply } limits { limits } from { from } to { to } + } + + def boplus + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { circleplus } limits { limits } from { from } to { to } + } + + def buplus + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { & big @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union } } + limits { limits } from { from } to { to } + } + + + ################################################################### + # # + # Integrations are slightly different in that, according to # + # Knuth (Chapter 17, p. 144), ``superscripts and subscripts # + # are not set as limits, even in display style''. Still, as # + # in TeX, we give users the possibility to override this. # + # # + ################################################################### + + # Ludovic's symbol, no longer used + def integration + named symbol { "integration" } + named limits { "No" } + named from { } + named to { } + { + largeoperator + symbol { @CurrStyle @Case { + "display" @Yield { big symbol } + else @Yield symbol } + } + limits { limits } from { from } to { to } + } + + def int + named limits { "No" } + named from { } + named to { } + { + largeop + symbol { vctr big integral } limits { limits } from { from } to { to } + } + + def oint + named limits { "No" } + named from { } + named to { } + { + largeop + symbol { @OneCol { vctr degree |0.015fo big integral } } + limits { limits } from { from } to { to } + } + + + ################################################################### + # # + # Unary operator symbols # + # # + ################################################################### + + def sqrt + precedence @UnaryOpPrec + named gap { @AboveGap } + right x + { + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + @VScale surd | @OneRow + { + @HLine line { "0.03 ft setlinewidth 2 setlinecap" } + ^//gap |gap @SquareRootStyle @Strut x # //gap + } + } + } + PDF @Yield { + @HContract @VContract + { +# +# VT: this PDF is correct but it renders badly in Acrobat (?problem +# with scaling by fractional factors) +# In other words, the @VScale value comes through correctly but it +# looks ugly; GhostScript's translation actually expands the +# "draw surd" instruction into raw moveto's and lineto's which +# it presumably gets from the font's definition of the glyph! +# + @VScale surd | @OneRow + { + @HLine line { "__mul(__loutf, 0.03) w 2 J" } + ^//gap |gap @SquareRootStyle @Strut x # //gap + } + } + } + } + } + + def root + precedence @UnaryOpPrec + associativity left + left x + right y + { + "" sup x &0io sqrt y + } + + def zroot + precedence @UnaryOpPrec + associativity left + left x + right y + { + def zsup right x { "+0.3f" @VShift 0.5f @Font x } + + "-0.4f" @HShift { 1w @HShift { zsup x } } &0co sqrt y + } + + export row axisrow col lcol ccol rcol mcol + def matrix + precedence @UnaryOpPrec + named gap { @CurrBinarySpaceGap } + named strut + named no { } + named No { } + named yes { 0.5f } + named Yes { 0.5f } + { No } + named atleft {} + named atright {} + named userow { No } + named shiftdelim { Yes } + body x + { + def @Strut + { + strut @Case { + "" @Yield {} + else @Yield { @OneRow { strut @High ^/ strut @High } } + } + } + + def newrow + precedence @HelperRowPrec + associativity left + left x + right y + { + x @Case { + "" @Yield { y | @Strut } + else @Yield { x /@RowGap y | @Strut } + } + } + + macro row { newrow "" } + + def newaxisrow + precedence @HelperRowPrec + associativity left + left x + right y + { + x @Case { + "" @Yield { y | @Strut } + else @Yield { x ^/@RowGap y | @Strut } + } + } + + macro axisrow { newaxisrow "" } + + def col + precedence @HelperColPrec + associativity left + left x + named indent { 0.5rt } + right y + { + x @Case { + "" @Yield { &indent @OneCol y } + else @Yield { x |@ColGap &indent @OneCol y } + } + } + + def lcol + precedence @HelperColPrec + associativity left + left x + right y + { + x col indent { 0i } y + } + + def ccol + precedence @HelperColPrec + associativity left + left x + right y + { + x col indent { 0.5rt } y + } + + def rcol + precedence @HelperColPrec + associativity left + left x + right y + { + x col indent { 1rt } y + } + + def mcol + precedence @HelperColPrec + associativity left + left x + right y + { + x @Case { + "" @Yield { @OneCol y } + else @Yield { x |@ColGap @OneCol y } + } + } + + def delim right x + { + x @Case + { + "" @Yield @Null + else @Yield + { + shiftdelim @Case { + { Yes yes } @Yield { @VScale x } + else @Yield { @VCover x } + } + } + } + } + + @HContract @VContract { + delim atleft &@CurrPunctSpaceGap + userow @Case { + {Yes yes} @Yield @HContract @VContract {^//gap @OneRow x //gap} + else @Yield vctr @HContract @VContract { //gap x //gap } + } + &@CurrPunctSpaceGap delim atright + } + } + + macro pmatrix { matrix atleft {1.5f @Font (} atright {1.5f @Font )} } + macro bmatrix { matrix atleft { blbrack } atright { brbrack } } + macro brmatrix { matrix atleft { blbrace } atright { brbrace } } + macro fmatrix { matrix atleft { blfloor } atright { brfloor } } + macro cmatrix { matrix atleft { blceil } atright { brceil } } + macro amatrix { matrix atleft { blangle } atright { brangle } } + + + ################################################################### + # # + # Binary operator symbols # + # # + ################################################################### + + ################################################################### + # # + # over and frac (also half and third) # + # # + ################################################################### + + def over + precedence @BinaryOpDividePrec + associativity left + left x + named gap { "dft" } + named belowgap { "dft" } + right y + { + def @AboveLineGap + { + gap @Case { + "dft" @Yield { + @CurrStyle @Case { + "display" @Yield 0.20f + else @Yield 0.10f + } + } + else @Yield gap + } + } + + def @BelowLineGap + { + belowgap @Case { + "dft" @Yield { + @CurrStyle @Case { + "display" @Yield 0.15f + else @Yield 0.09f + } + } + else @Yield belowgap + } + } + + @HContract @VContract + { |0.5rt @OneCol @NumeratorStyle x + ^//@AboveLineGap @HLine + //@BelowLineGap |0.5rt @OneCol @DenominatorStyle @Strut y + } + } + + def frac + precedence @BinaryOpDividePrec + associativity left + left x + named gap { 0.2f } + right y + { + @HContract @VContract + { 1w @VShift { @SuperScriptStyle { x } /gap } + | fraction &0io + | 0w @VShift { |gap @SubScriptStyle { y } } + } + } + + def half { one frac two } + def third { one frac three } + + + ################################################################### + # # + # Knuth's Group 7 (binary operations) # + # # + # All of Knuth's symbols are available except \star, \diamond # + # and \bullet; a few have been given more mnemonic names. # + # # + ################################################################### + + def bin + precedence @BinaryOpPrec + associativity left + left l + named op { "binop" } + right r + { + l &@CurrBinarySpaceGap op &@CurrBinarySpaceGap r + } + + def "+" + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { plus } r + } + + def "-" + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { minus } r + } + + def "+-" + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { plusminus } r + } + + def "-+" + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { 180d @Rotate plusminus } r + } + + def setminus + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { backslash } r + } + + def cdot + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { dotmath } r + } + + def times + precedence @BinaryOpTimesPrec + associativity left + left l + right r + { + l bin op { multiply } r + } + + def "*" + precedence @BinaryOpTimesPrec + associativity left + left l + right r + { + l bin op { asteriskmath } r + } + + #def diamond { name used above } + + def circ + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { circle } r + } + + #def bullet { name used above } + + def div + precedence @BinaryOpDividePrec + associativity left + left l + right r + { + l bin op { divide } r + } + + def cap + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { intersection } r + } + + def cup + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { union } r + } + + def uplus + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op {@OneRow @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union}} r + } + + def sqcapshape + { + @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto 0 ysize lineto xsize ysize lineto" + "xsize 0 lineto 0.04 ft setlinewidth stroke" + } + @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } + } + PDF @Yield { + { "__mul(__loutf, 0.04) w" + "0 0 m 0 __ysize l __xsize __ysize l __xsize 0 l s" + } + @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } + } + } + } + + def sqcap + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { sqcapshape } r + } + + def sqcup + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { "180d" @Rotate sqcapshape } r + } + + def triangleleft + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { "90d" @Rotate 0.8f @Font triangle } r + } + + def triangleright + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { "-90d" @Rotate 0.8f @Font triangle } r + } + + def wr + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { vctr {90d @Rotate similar } } r + } + + def bigcirc + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { 1.2f @Font circle} r + } + + def bigtriangleup + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { 1.2f @Font triangle } r + } + + def bigtriangledown + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { 180d @Rotate 1.2f @Font triangle } r + } + + def vee + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { logicalor } r + } + + def wedge + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { logicaland } r + } + + def oplus + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { circleplus } r + } + + def ominus + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { @OneRow @HContract { circle /0io &0.5rt minus } } r + } + + def otimes + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { circlemultiply } r + } + + def oslash + precedence @BinaryOpPrec + associativity left + left l + right r + { + #l bin op { `vctr 60d @Rotate @HContract {circle /0io &0.5rt minus`} } r + l bin op {@OneRow @HContract {circle /0io &0.5rt "-0.1f" @VShift slash}} r + } + + def odot + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { circledot } r + } + + def dagger + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { @Base @Char "dagger" } r + } + + def daggerdbl + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { @Base @Char "daggerdbl" } r + } + + def amalg + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { 180d @Rotate vctr product } r + } + + + ################################################################### + # # + # Group 8 (relations) # + # # + # All Knuth's operators are available, but many have been # + # given different, more mnemonic names. Also included is # + # a not operator for negating the relations. # + # # + ################################################################### + + # "not" done by an option now + # def not right x { @HContract {@OneCol x /0co &0.5rt slash}} + + def rel + precedence @RelationPrec + associativity left + left l + named op { "relop" } + named neg { "no" } + right r + { + + def @Op + { + neg @Case { + { "No" "no" } @Yield op + { "Yes" "yes" } @Yield + { @HContract {@OneCol { & op } /0co &0.5rt slash} } + } + } + + l &@CurrRelSpaceGap @Op &@CurrRelSpaceGap r + } + + def "<" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { less } r + } + + def ">" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { greater } r + } + + def "=" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { equal } r + } + + def "<=" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { lessequal } r + } + + def precsym + { + 0i @HShift 0.45f @Font "-90d" @Rotate {parenrighttp ^| parenlefttp} + } + + def prec + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { precsym } r + } + + def preceq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @VContract { precsym /0.1f minus } } r + } + + def "<<" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { less less } r + } + + def subset + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { propersubset } r + } + + def subseteq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { reflexsubset } r + } + + def sqsubsetshape + { + @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { "xsize 0 moveto 0 0 lineto 0 ysize lineto" + "xsize ysize lineto 0.04 ft setlinewidth stroke" + } + @Graphic { 0.5f @Wide 0.25f @High ^/ 0.25f @High } + /0.1f minus + } + PDF @Yield { + { "__mul(__loutf, 0.04) w __xsize 0 m 0 0 l" + "0 __ysize l __xsize __ysize l s" + } + @Graphic { 0.5f @Wide 0.25f @High ^/ 0.25f @High } + /0.1f minus + } + } + } + + def sqsubseteq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { sqsubsetshape } r + } + + def in + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { element } r + } + + def vdash + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { vctr {"-90d" @Rotate perpendicular} } r + } + + def smile + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { vctr 90d @Rotate parenleft } r + } + + def frown + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { vctr 90d @Rotate parenright } r + } + + def ">=" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { greaterequal } r + } + + def succsym + { + 0.45f @Font 90d @Rotate { parenrighttp ^| parenlefttp } + } + + def succ + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { succsym } r + } + + def succeq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @OneRow non succ /0.1f minus } r + } + + def ">>" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { greater greater } r + } + + def supset + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { propersuperset } r + } + + def supseteq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { reflexsuperset } r + } + + def sqsupseteqshape + { + @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto xsize 0 lineto xsize ysize lineto" + "0 ysize lineto 0.04 ft setlinewidth stroke" + } @Graphic { 0.5f @Wide 0.25f @High ^/ 0.25f @High } + /0.1f minus + } + PDF @Yield { + { "__mul(__loutf, 0.04) w 0 0 m __xsize 0 l" + "__xsize __ysize l 0 __ysize l s" + } @Graphic { 0.5f @Wide 0.25f @High ^/ 0.25f @High } + /0.1f minus + } + } + } + + def sqsupseteq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { sqsupseteqshape } r + } + + def ni + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { 180d @Rotate element } r + } + + def dashv + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { vctr {90d @Rotate perpendicular} } r + } + + def mid + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @Base "|" } r + } + + def parallel + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @Base "||" } r + } + + def "==" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { equivalence } r + } + + def "~" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { similar } r + } + + def "-~" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @OneRow { similar ^/0.07f /0.07f minus } } r + } + + def asymp + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { l + rel neg { neg } op { 0.7f @Font @OneRow + { 90d @Rotate parenleft ^/0.008f + /0.008f 90d @Rotate parenright } } + r + } + + def "~~" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { approxequal } r + } + + def "=~" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { congruent } r + } + + def bowtie + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { non triangleright non triangleleft } r + } + + def propto + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { proportional } r + } + + def models + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @Base vctr "|" &0.05fo vctr equal } r + } + + def trieqsym + { + @OneRow @HContract {&0.5rt small triangle^/0.15f equal} + } + + def trieq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { trieqsym } r + } + + def doteqsym + { + @OneRow @HContract { &0.5rt dotmath^/0.15f equal } + } + + def doteq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { doteqsym } r + } + + def perp + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { perpendicular } r + } + + def notsub + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { notsubset } r + } + + def notin + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { notelement } r + } + + def "!=" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { notequal } r + } + + def "<->" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowboth } r + } + + def "<--" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowleft } r + } + + def "-->" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowright } r + } + + def up + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowup } r + } + + def down + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdown } r + } + + def "<=>" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdblboth } r + } + + def "<==" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdblleft } r + } + + def "==>" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdblright } r + } + + def dblup + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdblup } r + } + + def dbldown + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdbldown } r + } + + def ":" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { colon } r + } + + def "::" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @OneCol {colon ` colon} } r + } + + def ":=" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { colon{ //0.05fo equal } } r + } + + + ################################################################### + # # + # Punctuation symbols (Knuth's Group 13) # + # # + ################################################################### + + def punct + precedence @PunctuationPrec + associativity left + left l + named symbol { "punct" } + right r + { + l &0.0ce symbol &@CurrPunctSpaceGap r + } + + def ";" + precedence @PunctuationPrec + associativity left + left l + right r + { + l punct symbol { semicolon } r + } + + def "," + precedence @PunctuationPrec + associativity left + left l + right r + { + l punct symbol { comma } r + } + + def col + precedence @PunctuationPrec + associativity left + left l + right r + { + l punct symbol { colon } r + } + + + ################################################################### + # # + # Ordinary symbols (to get Roman font) - continued # + # # + ################################################################### + + def "0" { zero } + def "1" { one } + def "2" { two } + def "3" { three } + def "4" { four } + def "5" { five } + def "6" { six } + def "7" { seven } + def "8" { eight } + def "9" { nine } + + + ################################################################### + # # + # The result object # + # # + ################################################################### + + basefont @Font + { Slope xheight2mark nostrut } @Font { initialspace } @Space + { @CurrStyleVar @Yield initialstyle } @SetContext { + { @CrampedVar @Yield initiallycramped } @SetContext { + @Body + } + } + +@End @Math + + +############################################################################### +# # +# In-line equations # +# # +############################################################################### + +macro @M { @HContract @VContract @Math initialstyle { "text" } } diff --git a/include/include/modula b/include/include/modula new file mode 100644 index 0000000..c6a9a2f --- /dev/null +++ b/include/include/modula @@ -0,0 +1,29 @@ +############################################################################### +# # +# Lout setup file for Modula-2 program printing # +# # +# Jeffrey H. Kingston # +# 5 February 1999 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# The @SysInclude { modulaf } line # +# # +# This line causes Lout to read the definitions for Modula-2, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { modulaf } + + +############################################################################### +# # +# This package does not offer the ability to change default options. # +# # +############################################################################### diff --git a/include/include/modulaf b/include/include/modulaf new file mode 100644 index 0000000..66ffa5e --- /dev/null +++ b/include/include/modulaf @@ -0,0 +1,154 @@ + +############################################################################### +# # +# Lout @Modula package for formatting Modula-2 programs (Version 1.0) # +# # +# Version 1.0 by Jeffrey H. Kingston, September 1993. # +# # +# This package implements the complete Modula-2 language (in a style which # +# claims only to reflect its author's taste) with the following caveats: # +# # +# * The symbol { must be given as lbrace # +# # +# * The symbol } must be given as rbrace # +# # +# * The symbol # must be given as numbersign # +# # +# * Double quotes are used by Lout to delimit literal strings, so they # +# need to be quoted (Modula-2 allows single quoted strings wherever # +# double quoted strings can go; we recommend these be used) # +# # +# * Literal strings should be enclosed in double quotes # +# # +# * The symbols B, H, C, and E as used in numeric literals will appear # +# in italic font # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" + + "*" "/" "~" "+" "-" "=" "<>" ">" ">=" "<" "<=" "(" + ")" "[" "]" "," ";" "." ":" "..." ".." "|" "^" ":=" "'" "`" + "&" + + lbrace rbrace numbersign + + AND ARRAY BEGIN BY CASE CONST DEFINITION DIV DO ELSE ELSIF + END EXPORT EXIT FOR FROM IF IMPLEMENTATION IMPORT IN LOOP + MOD MODULE NOT OF OR POINTER PROCEDURE QUALIFIED RECORD + REPEAT RETURN SET TO THEN TYPE UNTIL VAR WHILE WITH @Com + +def @Modula + body @Body +@Begin + + def @R right x { Base @Font x } + def @B right x { Bold @Font x } + def @S right x { { Symbol Base } @Font x } + + def "0" { @R "0" } + def "1" { @R "1" } + def "2" { @R "2" } + def "3" { @R "3" } + def "4" { @R "4" } + def "5" { @R "5" } + def "6" { @R "6" } + def "7" { @R "7" } + def "8" { @R "8" } + def "9" { @R "9" } + + def "*" { @S @Char "asteriskmath" } + def "/" { @R @Char "fraction" } + def "~" { @R "~" } + def "+" { @S "+" } + def "-" { @S "-" } + def "=" { @S @Char "equal" } + def "<>" { @S @Char "notequal" } + def ">" { @S @Char "greater" } + def ">=" { @S @Char "greaterequal" } + def "<" { @S @Char "less" } + def "<=" { @S @Char "lessequal" } + def "(" { @R "(" } + def ")" { @R ")" } + def "[" { @R "[" } + def "]" { @R "]" } + def "," { @R "," } + def ";" { @R ";" } + def "." { @R "." } + def ":" { @R ":" } + def ".." { @R ".." &0.1f } + def "..." { @R "..." } + def "|" { @R "|" } + def "^" { @S 0.8f @Font @Char "arrowup" } + def ":=" { :{//0.03fo =} } + def "'" { @R "'" } + def "`" { @R "`" } + def "&" { @R "&" } + + def lbrace { @R "{" } + def rbrace { @R "}" } + def numbersign { @R "#" } + + def AND { @B "and" } + def ARRAY { @B "array" } + def BEGIN { @B "begin" } + def BY { @B "by" } + def CASE { @B "case" } + def CONST { @B "const" } + def DEFINITION { @B "definition" } + def DIV { @B "div" } + def DO { @B "do" } + def ELSE { @B "else" } + def ELSIF { @B "elsif" } + def END { @B "end" } + def EXPORT { @B "export" } + def EXIT { @B "exit" } + def FOR { @B "for" } + def FROM { @B "from" } + def IF { @B "if" } + def IMPLEMENTATION { @B "implementation" } + def IMPORT { @B "import" } + def IN { @B "in" } + def LOOP { @B "loop" } + def MOD { @B "mod" } + def MODULE { @B "module" } + def NOT { @B "not" } + def OF { @B "of" } + def OR { @B "or" } + def POINTER { @B "pointer" } + def PROCEDURE { @B "procedure" } + def QUALIFIED { @B "qualified" } + def RECORD { @B "record" } + def REPEAT { @B "repeat" } + def RETURN { @B "return" } + def SET { @B "set" } + def TO { @B "to" } + def THEN { @B "then" } + def TYPE { @B "type" } + def UNTIL { @B "until" } + def VAR { @B "var" } + def WHILE { @B "while" } + def WITH { @B "with" } + + def @Com right x { @R "{" x @R "}" } + + Slope @Font lines @Break @Body + +@End @Modula diff --git a/include/include/mydefs b/include/include/mydefs new file mode 100644 index 0000000..247457e --- /dev/null +++ b/include/include/mydefs @@ -0,0 +1,11 @@ + +############################################################################### +# # +# mydefs # +# # +# This empty Lout file is a placeholder which is read by the standard setup # +# files when there is no mydefs file in the user's current directory. # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### diff --git a/include/include/np b/include/include/np new file mode 100644 index 0000000..716b8ad --- /dev/null +++ b/include/include/np @@ -0,0 +1,117 @@ +############################################################################### +# # +# Lout setup file for Nonpareil program printing # +# # +# Jeffrey H. Kingston # +# 3 December 2002 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { npf } + + +############################################################################### +# # +# @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 { @NonpareilSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # numberedblanks { Yes } # No or Yes + # style { symbol @OrIfPlain 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # varying mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/npf b/include/include/npf new file mode 100644 index 0000000..f7512ad --- /dev/null +++ b/include/include/npf @@ -0,0 +1,460 @@ + +############################################################################### +# # +# Lout @NonpareilSetup package for formatting Nonpareil programs # +# # +# Jeffrey H. Kingston # +# 3 December 2002 # +# # +# 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @Nonpareil +def @NonpareilSetup + named pipe { } # pipe through this + named numbered { No } # numbered lines? + named blanknumbered { Yes } # blanks 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + named fixedtabin { 8 } # tab interval + named fixedtabout { 4s } # 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 @PDD + @A "$>" + + def @Nonpareil + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lNonpareil" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lNonpareil" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 style @Case { + fixed @Yield "." + else @Yield { "1.4f" @Font "+0.04f" @VShift "." &"0.05f" } + } + } + } + + + def @PDD # for formatting double dots, if wanted larger + { + @PO @BackEnd @Case { + PlainText @Yield ".." + else @Yield style @Case { + fixed @Yield ".." + else @Yield { "1.4f" @Font "+0.04f" @VShift ".." &"0.05f" } + } + } + } + + + def @A # get characters from the Adobe Symbol font + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @Nonpareil + +@End @NonpareilSetup diff --git a/include/include/old_graph b/include/include/old_graph new file mode 100644 index 0000000..87ebae3 --- /dev/null +++ b/include/include/old_graph @@ -0,0 +1,29 @@ +############################################################################### +# # +# Lout setup file for graph drawing (old version) # +# # +# Jeffrey H. Kingston # +# 5 February 1999 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# The @SysInclude { old_graphf } line # +# # +# This line causes Lout to read the definitions for graphs, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { old_graphf } + + +############################################################################### +# # +# This package does not offer default options that can be changed. # +# # +############################################################################### diff --git a/include/include/old_graphf b/include/include/old_graphf new file mode 100644 index 0000000..4106555 --- /dev/null +++ b/include/include/old_graphf @@ -0,0 +1,954 @@ + +############################################################################### +# # +# Lout @Graph package for drawing graphs (Version 1.0) # +# # +# Version 1.0 by Jeffrey H. Kingston, December 1993. # +# # +# This package draws graphs, the statistical kind not the graph-theoretical # +# kind. See the User's Guide (Advanced Graphics) for user info. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +@SysInclude { graphf.etc } # @GraphMath +@SysInclude { lengths } # @LoutLengths +@SysInclude { coltex } # @ColourCommand and @TextureCommand +@SysPrependGraphic { graphf.lpg } + + +def @GraphObj + left p + named margin { 0c } + named adj { 0 0 } + right x +{ + @BackEnd @Case { + PostScript @Yield { + @Null & # kills previous white space + @HContract @VContract { + //0io ||0io @HContract @VContract + { p "trpoint translate" adj "translate gsave" // "grestore" } + @Graphic { //margin ||margin x ||margin //margin } + ||0io //0io + } + } +# VT: PDF does nothing + PDF @Yield { + @Null & # kills previous white space + @HContract @VContract { + //0io ||0io @HContract @VContract + { "% @GraphObj UNIMPLEMENTED" } + @Graphic { //margin ||margin x ||margin //margin } + ||0io //0io + } + } + } +} + +def @GraphCross + import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 0 moveto xsize ysize lineto 0 ysize moveto" + # "xsize 0 lineto [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "docross" + // "end" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + { "n [] 0 d 0 0 m __xsize __ysize l 0 __ysize m __xsize 0 l S"} + # uses S because PostScript version does NOT use closepath + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphPlus + import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath xmark 0 moveto xmark ysize lineto 0 ymark moveto" + # "xsize ymark lineto [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "doplus" + // "end" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + { "n [] 0 d __xmark 0 m __xmark __ysize l 0 __ymark m __xsize __ymark l S"} + # uses S because PostScript version does NOT use closepath + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphSquare + import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" + # "0 ysize lineto closepath [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dosquare" + // "end" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 __xsize __ysize re s"} + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphFilledSquare + import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" + # "0 ysize lineto closepath gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dofilledsquare" + // "end" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 __xsize __ysize re b"} + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphDiamond + import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto" + # "xmark ysize lineto closepath [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dodiamond" + // "end" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 __ymark m __xmark 0 l __xsize __ymark l __xmark __ysize l s"} + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphFilledDiamond + import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto" + # "xmark ysize lineto closepath gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dofilleddiamond" + // "end" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 __ymark m __xmark 0 l __xsize __ymark l __xmark __ysize l b" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphCircle + import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath xmark ymark xmark 0 360 arc" + # "[] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "docircle" + // "end" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract +# +# draw a circle whose centre is at (xmark, ymark) and whose radius is xmark units; +# +# for curveto to work, we need to calculate the control points of the Bezier curve +# as well as move the pen to the correct initial point. The circle is drawn as two +# arcs of 180 degrees +# +# pt0 = (xmark + xmark, ymark) +# pt1 = (xmark + xmark, ymark + 4/3 * xmark) +# pt2 = (0, ymark + 4/3 * xmark) +# pt3 = (0, ymark) +# +# pt0 = (0, ymark) +# pt1 = (0, ymark - 4/3 * xmark) +# pt2 = (xmark + xmark, ymark - 4/3 * xmark) +# pt3 = (xmark + xmark, ymark) +# + {"n [] 0 d" + "__mul(2, __xmark) __ymark m" + "__mul(2, __xmark) __add(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "0 __add(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "0 __ymark c" # pt3 + + "0 __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "__mul(2, __xmark) __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "__mul(2, __xmark) __ymark c S" # pt3 + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphFilledCircle + import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { + # "newpath xmark ymark xmark 0 360 arc" + # "gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dofilledcircle" + // "end" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract +# +# draw a filled circle whose centre is at (xmark, ymark) and whose radius is xmark units; +# +# for curveto to work, we need to calculate the control points of the Bezier curve +# as well as move the pen to the correct initial point. The circle is drawn as two +# arcs of 180 degrees +# +# pt0 = (xmark + xmark, ymark) +# pt1 = (xmark + xmark, ymark + 4/3 * xmark) +# pt2 = (0, ymark + 4/3 * xmark) +# pt3 = (0, ymark) +# +# pt0 = (0, ymark) +# pt1 = (0, ymark - 4/3 * xmark) +# pt2 = (xmark + xmark, ymark - 4/3 * xmark) +# pt3 = (xmark + xmark, ymark) +# +# Note: this is not a strict translation because there is a setdash bracketed by +# gsave/grestore in the above PostScript but there is no closepath before it; +# but in PDF, it is not possible to execute a setdash within a path definition. +# + {"n [] 0 d" + "__mul(2, __xmark) __ymark m" + "__mul(2, __xmark) __add(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "0 __add(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "0 __ymark c" # pt3 + + "0 __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "__mul(2, __xmark) __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "__mul(2, __xmark) __ymark c b" # pt3 + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphTriangle + import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto" + # "closepath [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dotriangle" + // "end" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 m __xsize 0 l __xmark __mul(__ysize, 1.25) l s"} + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphFilledTriangle + import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { + # "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto" + # "closepath gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dofilledtriangle" + // "end" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 m __xsize 0 l __xmark __mul(__ysize, 1.25) l h b"} + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphNoLine + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + length @Wide {} +} + +def @GraphSolid + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "solid end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphSolid UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + +def @GraphDashed + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dashed end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + +def @GraphDotted + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotted end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotted UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + +def @GraphDotDashed + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotdashed end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + +def @GraphDotDotDashed + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotdotdashed end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotDotDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + +def @GraphDotDotDotDashed + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotdotdotdashed end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotDotDotDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + + +export @Data +def @Graph + named save { no } + named style { frame } + import @LoutLengths named width { 6.0c } + import @LoutLengths named height { 4.0c } + import @PSLengths named xextra { "none" } + import @PSLengths named yextra { "none" } + named xdecreasing { no } + named ydecreasing { no } + named leftcaption { } + named rightcaption { } + named abovecaption { } + named belowcaption { } + import @LoutLengths named leftgap { 1.5c } + import @LoutLengths named rightgap { 0.5c } + import @LoutLengths named abovegap { 0.5c } + import @LoutLengths named belowgap { 0.5c } + named hidecaptions { yes } + named objects + named @NW + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg ysize" } margin { margin } x } + named @SW + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg 0" } margin { margin } x } + named @SE + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "0 0" } margin { margin } x } + named @NE + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "0 ysize" } margin { margin } x } + named @W + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg ysize 2 div" } margin { margin } x } + named @S + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg 2 div 0" } margin { margin } x } + named @E + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "0 ysize 2 div" } margin { margin } x } + named @N + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg 2 div ysize" } margin { margin } x } + named @CTR + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg 2 div ysize 2 div" } margin {margin} x } + {} + named xorigin named none { "false" } { none } + named yorigin named none { "false" } { none } + named xlog named none { "0" } { none } + named ylog named none { "0" } { none } + named points named none { "none" } { none } + named pairs named none { "none" } { none } + named colour color named none { "none" } { none } + named paint named none { "none" } { none } + import @TextureImport named texture { solid } + named xmin named none { "false" } { none } + named xmax named none { "false" } { none } + named ymin named none { "false" } { none } + named ymax named none { "false" } { none } + named xticksep named none { "0" } { none } + named yticksep named none { "0" } { none } + named rticksep named none { "0" } { none } + import @GraphMath named xticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { false } + import @GraphMath named yticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { false } + import @GraphMath named rticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { } + import @PSLengths named xticklength { 0.5f } + import @PSLengths named yticklength { 0.5f } + import @PSLengths named rticklength { 0.5f } + named dataformat { xandy } + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @PSLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { "currentlinewidth" } + body @Body +@Begin + + def @Above + { + abovecaption @Case { + "" @Yield {} + else @Yield @OneCol { ||0.5rt clines @Break abovecaption || //abovegap } + } + } + + def @Below + { + belowcaption @Case { + "" @Yield {} + else @Yield @OneCol { //belowgap ||0.5rt clines @Break belowcaption || } + } + } + + def @Left + { + leftcaption @Case { + "" @Yield {} + else @Yield @OneCol @OneRow { + { //0.5rt @OneRow clines @Break leftcaption // } ^||leftgap } + } + } + + def @Right + { + rightcaption @Case { + "" @Yield {} + else @Yield @OneCol @OneRow { + ||rightgap { //0.5rt @OneRow lines @Break rightcaption // } } + } + } + + def @ZeroWidth + right x + { + hidecaptions @Case { + { No no } @Yield x + { Yes yes } @Yield @OneCol { ||0io x ||0io } + } + } + + def @AddCaptions right x + { + def belowextra + { + xticks @Case { + "" @Yield { 0i } + else @Yield { 1.7f } + } + } + + @HContract @VContract + { + | @Above | + / @ZeroWidth @Left | &0.5rt x | @ZeroWidth @Right + /belowextra | @Below | + } + } + + export pi e sqrt abs ceiling floor truncate round cos sin atan exp log rand + "*" "/" idiv mod "-" "-0" "-1" "-2" "-3" "-4" "-5" "-6" "-7" "-8" + "-9" "-." "+" "=" "!=" "<" "<=" ">" ">=" not and xor or + if xloop yloop zloop + + def @Data + named points named none { "none" } { points } + named pairs named none { "none" } { pairs } + named colour color named none { "none" } { colour } + named paint named none { "none" } { paint } + import @TextureImport named texture { texture } + import @PSLengths named dashlength { dashlength } + import @PSLengths named linewidth { linewidth } + import @PSLengths named symbolsize { symbolsize } + import @PSLengths named symbollinewidth { symbollinewidth } + named dataformat { dataformat } + body data + { + def pi { "3.14159" } + def e { "2.71828" } + def sqrt precedence 40 right y { y "sqrt" } + def abs precedence 40 right y { y "abs" } + def ceiling precedence 40 right y { y "ceiling" } + def floor precedence 40 right y { y "floor" } + def truncate precedence 40 right y { y "truncate" } + def round precedence 40 right y { y "round" } + def cos precedence 40 right y { y "cos" } + def sin precedence 40 right y { y "sin" } + def atan precedence 39 left x right y { x y "atan" } + def exp precedence 38 left x right y { x y "exp" } + def log precedence 37 left x right y { x y "dolog" } + def rand precedence 36 left x right y { x y "dorand" } + def "*" precedence 35 left x right y { x y "mul" } + def "/" precedence 34 left x right y { x y "div" } + def idiv precedence 34 left x right y { x y "idiv" } + def mod precedence 34 left x right y { x y "mod" } + def "-" precedence 33 left x right y + { x @Case { "" @Yield {y "neg"} else @Yield { x y "sub" } } } + def "-0" { "-0" } + def "-1" { "-1" } + def "-2" { "-2" } + def "-3" { "-3" } + def "-4" { "-4" } + def "-5" { "-5" } + def "-6" { "-6" } + def "-7" { "-7" } + def "-8" { "-8" } + def "-9" { "-9" } + def "-." { "-." } + def "+" precedence 32 left x right y + { x @Case { "" @Yield { y } else @Yield { x y "add" } } } + def "=" precedence 30 left x right y { x y "eq" } + def "!=" precedence 30 left x right y { x y "ne" } + def "<" precedence 30 left x right y { x y "lt" } + def "<=" precedence 30 left x right y { x y "le" } + def ">" precedence 30 left x right y { x y "gt" } + def ">=" precedence 30 left x right y { x y "ge" } + def not precedence 25 right y { y "not" } + def and precedence 24 left x right y { x y "and" } + def xor precedence 23 left x right y { x y "xor" } + def or precedence 22 left x right y { x y "or" } + def if + named cond { true } + named then {} + named else {} + { cond "{" then "} {" else "} ifelse" } + def xloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named x { "xval" } {} + { from by to "{ /xval exch def" do "} for" } + def yloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named y { "yval" } {} + { from by to "{ /yval exch def" do "} for" } + def zloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named z { "zval" } {} + { from by to "{ /zval exch def" do "} for" } + + def @IfPt + left no + right yes + { + points @Case { + none @Yield no + else @Yield yes + } + } + + def @Points + { + points @Case { + none @Yield "" + plus @Yield "plus" + cross @Yield "cross" + square @Yield "square" + filledsquare @Yield "filledsquare" + diamond @Yield "diamond" + filleddiamond @Yield "filleddiamond" + circle @Yield "circle" + filledcircle @Yield "filledcircle" + triangle @Yield "triangle" + filledtriangle @Yield "filledtriangle" + } + } + + def @Pairs + { + pairs @Case { + none @Yield {} + solid @Yield { "linesetup solid" @IfPt "ilinesetup solid" } + dashed @Yield { "linesetup cdashed" @IfPt "ilinesetup dashed" } + dotted @Yield { "linesetup dotted" @IfPt "ilinesetup dotted" } + dotdashed @Yield { "linesetup dotcdashed" @IfPt + "ilinesetup dotdashed" } + dotdotdashed @Yield { "linesetup dotdotcdashed" @IfPt + "ilinesetup dotdotdashed" } + dotdotdotdashed @Yield { "linesetup dotdotdotcdashed" @IfPt + "ilinesetup dotdotdotdashed" } + surfacexhisto @Yield { "surfacexhisto" } + surfaceyhisto @Yield { "surfaceyhisto" } + xhisto @Yield { "xhisto" } + yhisto @Yield { "yhisto" } + filledxhisto @Yield { "filledxhisto" } + filledyhisto @Yield { "filledyhisto" } + } + } + + def @DataFormat + { + dataformat @Case { + xandy @Yield xandy + swapxandy @Yield swapxandy + yonly @Yield yonly + xonly @Yield xonly + } + } + + def @Paint + { + paint @Case { + { none no No } @Yield "false" + { yes Yes } @Yield "true" + } + } + + "[ [" data "]" dataformat + "{" @Points "}" + "{" @Pairs "}" + "{ /dashlength" dashlength "def" + " /linewidth" linewidth "def" @ColourCommand colour + " /symbolsize" symbolsize "def" + " /symbollinewidth" symbollinewidth "def }" + "{" @Paint "}" + "{" texture "}" + "]" + } + + def @Style + { + style @Case { + frame @Yield { "framestyle" } + grid @Yield { "gridstyle" } + none @Yield { "nonestyle" } + axes @Yield { "axesstyle" } + } + } + + def @XExtra + { + xextra @Case { + "none" @Yield { + style @Case { + frame @Yield { "0.5 cm" } + grid @Yield { "0" } + none @Yield { "0" } + axes @Yield { "0" } + } + } + else @Yield xextra + } + } + + def @YExtra + { + yextra @Case { + "none" @Yield { + style @Case { + frame @Yield { "0.5 cm" } + grid @Yield { "0" } + none @Yield { "0" } + axes @Yield { "0" } + } + } + else @Yield yextra + } + } + + def @XDecreasing + { + xdecreasing @Case { + { No no } @Yield "false" + { Yes yes } @Yield "true" + } + } + + def @YDecreasing + { + ydecreasing @Case { + { No no } @Yield "false" + { Yes yes } @Yield "true" + } + } + + @AddCaptions width @Wide height @High + @BackEnd @Case { + PostScript @Yield { + { + "grestore" + save @Case { { Yes yes } @Yield "save" else @Yield {} } + "gsave xsize ysize lgraphdict begin /ysize exch def /xsize exch def" + "/alldata [" @Body "] def" + xticksep "[" xticks "] 0 alldata" xmin xmax xlog + @XExtra @XDecreasing xorigin xticklength "xset" + yticksep "[" yticks "] 1 alldata" ymin ymax ylog + @YExtra @YDecreasing yorigin yticklength "yset" + + rticks @Case { + + "" @Yield "norset" + + else @Yield { + rticksep "[" rticks "] 1 alldata" ymin ymax ylog + @YExtra @YDecreasing yorigin rticklength "rset" + } + } + + "rundata" @Style // "end" + save @Case { { Yes yes } @Yield "restore" else @Yield {} } + } @Graphic { //1rt objects } + } + PDF @Yield { {"% @Graph UNIMPLEMENTED"} @Graphic { //1rt objects } } + } + +@End @Graph diff --git a/include/include/pas b/include/include/pas new file mode 100644 index 0000000..0154ed5 --- /dev/null +++ b/include/include/pas @@ -0,0 +1,29 @@ +############################################################################### +# # +# Lout setup file for Pascal program printing # +# # +# Jeffrey H. Kingston # +# 5 February 1999 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# The @SysInclude { pasf } line # +# # +# This line causes Lout to read the definitions for Pascal, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { pasf } + + +############################################################################### +# # +# This package does not offer default options that can be changed. # +# # +############################################################################### diff --git a/include/include/pasf b/include/include/pasf new file mode 100644 index 0000000..34ebd29 --- /dev/null +++ b/include/include/pasf @@ -0,0 +1,127 @@ + +############################################################################### +# # +# Lout @Pas package for formatting Pascal programs (Version 2.0) # +# # +# Version 1.0 by Jeffrey H. Kingston, June 1991. # +# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. # +# # +# See "Eq - a Lout package for typesetting mathematics" for user # +# information. # +# # +# Reference: Jensen, K. and Wirth, N. Pascal User Manual and Report. # +# Second Edition, Springer-Verlag, 1975. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" + "." "," ":" ";" "'" "`" "+" "-" "*" "/" "(" ")" + "[" "]" "^" ".." "=" "<" ">" "<>" "<=" ">=" ":=" + + and array begin case const div do downto else end + file for forward function goto if in label mod nil not + of or otherwise packed procedure program record repeat + set then to type until var while with @Com + +def @Pas + body @Body +@Begin + + def @R right x { Base @Font x } + def @B right x { Bold @Font x } + def @S right x { { Symbol Base } @Font x } + + def "0" { @R "0" } + def "1" { @R "1" } + def "2" { @R "2" } + def "3" { @R "3" } + def "4" { @R "4" } + def "5" { @R "5" } + def "6" { @R "6" } + def "7" { @R "7" } + def "8" { @R "8" } + def "9" { @R "9" } + def "." { @R "." } + def "," { @R "," } + def ":" { @R ":" } + def ";" { @R ";" } + def "'" { @R "'" } + def "`" { @R "`" } + def "+" { @S "+" } + def "-" { @S "-" } + def "*" { @S @Char "asteriskmath" } + def "/" { @R @Char "fraction" } + def "(" { @R "(" } + def ")" { @R ")" } + def "[" { @R "[" } + def "]" { @R "]" } + def "^" { @S 0.8f @Font @Char "arrowup" } + def ".." { @R ".." &0.1f } + def "=" { @S @Char "equal" } + def "<" { @S @Char "less" } + def ">" { @S @Char "greater" } + def "<>" { @S @Char "notequal" } + def "<=" { @S @Char "lessequal" } + def ">=" { @S @Char "greaterequal" } + def ":=" { :{//0.03fo &0.1f =} } + + def and { @B "and" } + def array { @B "array" } + def begin { @B "begin" } + def case { @B "case" } + def const { @B "const" } + def div { @B "div" } + def do { @B "do" } + def downto { @B "downto" } + def else { @B "else" } + def end { @B "end" } + def file { @B "file" } + def for { @B "for" } + def forward { @B "forward" } + def function { @B "function" } + def goto { @B "goto" } + def if { @B "if" } + def in { @B "in" } + def label { @B "label" } + def mod { @B "mod" } + def nil { @B "nil" } + def not { @B "not" } + def of { @B "of" } + def or { @B "or" } + def otherwise { @B "otherwise" } + def packed { @B "packed" } + def procedure { @B "procedure" } + def program { @B "program" } + def record { @B "record" } + def repeat { @B "repeat" } + def set { @B "set" } + def then { @B "then" } + def to { @B "to" } + def type { @B "type" } + def until { @B "until" } + def var { @B "var" } + def while { @B "while" } + def with { @B "with" } + + def @Com right x { @R "{" x @R "}" } + + Slope @Font lines @Break @Body + +@End @Pas diff --git a/include/include/perl b/include/include/perl new file mode 100644 index 0000000..7544e3f --- /dev/null +++ b/include/include/perl @@ -0,0 +1,136 @@ +############################################################################### +# # +# Lout setup file for Perl program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 10 April 2000 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude { pod } # +# # +# This line causes Lout to read the default setup file for the Pod # +# documentation language that goes with Perl. If you want your own # +# Pod setup file, it is probably best to delete this line and place # +# # +# @Include { mypod } # +# @Include { myperl } # +# # +# at the start of your document in the usual way. # +# # +############################################################################### + +@SysInclude { pod } + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { perlf } + + +############################################################################### +# # +# @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 { @PerlSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # numberedblanks { Yes } # No or Yes + # 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingtabin { 8 } # tab interval + # varyingspace { lout } # spacing mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/perlf b/include/include/perlf new file mode 100644 index 0000000..7e5d414 --- /dev/null +++ b/include/include/perlf @@ -0,0 +1,446 @@ + +############################################################################### +# # +# Lout @PerlSetup package for formatting Perl programs # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 10 April 2000 # +# # +# 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @Perl +def @PerlSetup + named pipe { } # pipe through this + named numbered { No } # numbered lines? + named blanknumbered { Yes } # blanks 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 @Perl + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lPerl" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lPerl" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @Perl + +@End @PerlSetup diff --git a/include/include/picture b/include/include/picture new file mode 100644 index 0000000..ab889ab --- /dev/null +++ b/include/include/picture @@ -0,0 +1,352 @@ +############################################################################### +# # +# Lout setup file for stand-alone illustrations # +# # +# Jeffrey H. Kingston # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude commands for standard packages. # +# # +############################################################################### + + @SysInclude { langdefs } # language definitions + @SysInclude { bsf } # BasicSetup package + @SysInclude { dsf } # DocumentSetup package + @SysInclude { picturef } # IllustrationSetup extension + + +############################################################################### +# # +# @Include command for reading personal definitions from current directory. # +# # +############################################################################### + + @Include { mydefs } + + +############################################################################### +# # +# The @BasicSetup @Use clause - basics, lists, paragraphs, displays. # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@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 + # @InitialBackgroundColour { white } # initial background 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 + # @DisplayIndent { 2.00f @OrIfPlain 5s } # @IndentedDisplay indent + # @DefaultIndent { 0.5rt } # @Display indent + # @DisplayNumStyle { (num) } # style of display numbers + # @WideIndent { 4.00f @OrIfPlain 10s } # @WideTaggedList indent + # @VeryWideIndent { 8.00f @OrIfPlain 20s } # @VeryWideTaggedList indent + # @ListOuterGap { 1.00v @OrIfPlain 1f } # gap before, after lists + # @ListGap { 1.00v @OrIfPlain 1f } # gap between list items + # @ListIndent { 0s } # indent of list items + # @ListRightIndent { 0s } # right indent of list items + # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags + # @ListLabelRight { No } # right-adjust list labels + # @ListLabelRightGap { 2s } # gap when right-adjusting + # @ListFont { } # font of list items + # @ListBreak { } # break style of list items + # @NumberSeparator { . } # separates nums like 2.3.7 + # @CrossLinkFormat { @Body } # format of cross links + # @ExternalLinkFormat { @Body } # format of external links +} + + +############################################################################### +# # +# The @DocumentSetup @Use clause - page layout plus figures, tables, etc. # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@Use { @DocumentSetup + # @PageType { A4 @OrIfPlain Other} # page type (width, height) + # @PageWidth { 80s } # page width if type Other + # @PageHeight { 66f } # page height if type Other + # @PageOrientation { Portrait } # Portrait, Landscape, etc. + # @PageBackground { } # background of each page + # @TopMargin { 2.5c @OrIfPlain 6f } # top margin of all pages + # @FootMargin { 2.5c @OrIfPlain 6f } # bottom margin of all pages + # @OddLeftMargin { 2.5c @OrIfPlain 10s } # left margin of odd pages + # @OddRightMargin { 2.5c @OrIfPlain 10s } # right margin of odd pages + # @EvenLeftMargin { 2.5c @OrIfPlain 10s } # left margin of even pages + # @EvenRightMargin { 2.5c @OrIfPlain 10s } # right margin of even pages + # @OddLeftBodyMargin { 0c } # extra margin for page body + # @OddRightBodyMargin { 0c } # extra margin for page body + # @EvenLeftBodyMargin { 0c } # extra margin for page body + # @EvenRightBodyMargin{ 0c } # extra margin for page body + # @PageBoxType { None } # None Box CurveBox ShadowBox + # @PageBoxMargin { 1.00c } # page box margin + # @PageBoxLineWidth { } # page box line thickness + # @PageBoxPaint { none } # page box paint + # @PageBoxShadow { 0.60c } # shadow margin if ShadowBox + # @PageEnclose { @Body } # enclose every page in this + # @ColumnNumber { 1 } # number of columns (1 to 10) + # @ColumnGap { 1.00c @OrIfPlain 6s } # column gap + + # @FigureLocation { PageTop } # default figure location + # @FigureFormat { @CC @Body } # default figure format + # @FigureWord { figure } # "Figure" word else anything + # @FigureNumbers { Arabic } # method of numbering figures + # @FigureCaptionPos { Below } # Above or Below + # @FigureCaptionFont { -2p } # figure caption font + # @FigureCaptionBreak { adjust hyphen 1.2fx } # figure caption break + # @FigureCaptionFormat{ {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeFigureContents { No } # list of figures at start + + # @TableLocation { PageTop } # default table location + # @TableFormat { @CC @Body } # default table format + # @TableWord { table } # "Table" word else anything + # @TableNumbers { Arabic } # method of numbering tables + # @TableCaptionPos { Below } # Above or Below + # @TableCaptionFont { -2p } # table caption font + # @TableCaptionBreak { adjust hyphen 1.2fx } # table caption break + # @TableCaptionFormat { {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeTableContents { No } # list of tables at start + + # @FloaterLocation { PageTop } # default floater location + # @FloaterFormat { @CC @Body } # default floater format + # @FloaterWord { floater } # "Floater" word else anything + # @FloaterNumbers { Arabic } # method of numbering floaters + # @FloaterCaptionPos { Below } # Above or Below + # @FloaterCaptionFont { -2p } # floater caption font + # @FloaterCaptionBreak{ adjust hyphen 1.2fx } # floater caption break + # @FloaterCaptionFormat{ {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeFloaterContents{ No } # list of floaters at start + + # @MakeContents { No } # make contents? Yes or No + # @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry + # @ContentsGapAbove { 0.80v @OrIfPlain 1f } # extra gap above major entry + # @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry + # @ContentsFont { Bold } # font for major entry + # @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above `part' entry + # @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below `part' entry + # @ContentsFormat { number @DotSep title } # contents entry format + # @ContentsLeader { .. } # leader symbol in contents + # @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders + # @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width + + # @MakeReferences { Yes } # make references? Yes or No + # @RefCiteStyle { [cite] } # citation style + # @RefCiteLabels { @RefNum } # citation items + # @RefNumbers { Arabic } # reference numbers + # @RefListFormat { Labels } # NoLabels, Labels, etc. + # @RefListLabels { [@RefNum] } # ref list label format + # @RefListTitle { references } # title of reference list + # @ChapRefListTitle { references } # title of chapter ref list + # @RefListIndent { 0s } # indent to left of labels + # @RefListRightIndent { 0s } # indent to right of items + # @RefListGap { @ListGap } # gap between ref list items + # @RefListFont { } # font used in reference list + # @RefListBreak { } # break style of ref list + # @RefListLabelWidth { @ListLabelWidth } # Labels column width + # @RefListSortKey { @Tag } # sorting key + + # @MakeGlossary { No } # make glossary? Yes or No + # @GlossaryText { @Null } # glossary initial text + # @GlossaryFont { } # glossary entries font + # @GlossaryBreak { } # glossary entries break + # @GlossaryFormat { +3p @Font @S @Name # glossary entries format + # @Right @I { @Word&&page @PageNum } + # @DP @RawIndentedDisplay @Body } + # @GlossaryGap { @DisplayGap } # gap between glossary entries + # @GlossaryColumnNumber{ 2 } # glossary columns (1 to 10) + # @GlossaryColumnGap { 1.00c @OrIfPlain 6s } # glossary column gap + # @InGlossaryFont { smallcaps } # font for @InGlossary + # @InGlossaryFormat { @Body } # format for @InGlossary + + # @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 + # @IndexFormat { @Body } # @Index format + # @SubIndexFormat { {1f @Wide}@Body } # @SubIndex format + # @SubSubIndexFormat { {2f @Wide}@Body } # @SubSubIndex format + # @IndexTypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexTypeMain { @B @PageNum } # Main pagenum format + # @IndexTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexRangeFormat { @From--@To } # index page range format + # @IndexColumnNumber { 2 } # index columns (1 to 10) + # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap + # @IndexCtd { Yes } # include (ctd.) lines + # @IndexCtdWord { continued } # "ctd." in current lang. + # @IndexCtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexSpacerAbove { 2v } # space above index spacer + # @IndexSpacerBelow { 1v } # space below index spacer + # @IndexSpacerFont { +3p } # font of index spacer + # @IndexSpacerFormat { @Body } # format of index spacer + + # @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 + # @IndexAFormat { @Body } # @IndexA format + # @SubIndexAFormat { {1f @Wide}@Body } # @SubIndexA format + # @SubSubIndexAFormat { {2f @Wide}@Body } # @SubSubIndexA format + # @IndexATypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexATypeMain { @B @PageNum } # Main pagenum format + # @IndexATypeSpecial { @I @PageNum } # Special pagenum format + # @IndexARangeFormat { @From--@To } # index page range format + # @IndexAColumnNumber { 2 } # index A columns (1 to 10) + # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap + # @IndexACtd { Yes } # include (ctd.) lines + # @IndexACtdWord { continued } # "ctd." in current lang. + # @IndexACtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexASpacerAbove { 2v } # space above index A spacer + # @IndexASpacerBelow { 1v } # space below index A spacer + # @IndexASpacerFont { +3p } # font of index A spacer + # @IndexASpacerFormat { @Body } # format of index A spacer + + # @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 + # @IndexBFormat { @Body } # @IndexB format + # @SubIndexBFormat { {1f @Wide}@Body } # @SubIndexB format + # @SubSubIndexBFormat { {2f @Wide}@Body } # @SubSubIndexB format + # @IndexBTypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexBTypeMain { @B @PageNum } # Main pagenum format + # @IndexBTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexBRangeFormat { @From--@To } # index page range format + # @IndexBColumnNumber { 2 } # index B columns (1 to 10) + # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap + # @IndexBCtd { Yes } # include (ctd.) lines + # @IndexBCtdWord { continued } # "ctd." in current lang. + # @IndexBCtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexBSpacerAbove { 2v } # space above index B spacer + # @IndexBSpacerBelow { 1v } # space below index B spacer + # @IndexBSpacerFont { +3p } # font of index B spacer + # @IndexBSpacerFormat { @Body } # format of index B spacer + + # @TopGap { 0.75c @OrIfPlain 2f } # gap between figures + # @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text + + # @FootNoteNumbers { Arabic } # footnote numbers + # @FootNoteThrough { No } # numbered through chapter? + # @FootNoteLocation { ColFoot } # where the footnote appears + # @FootNoteFont { 0.80f } # font for footnotes + # @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes + # @FootNoteFormat { { number &0.05f } @Insert body } # footnote format + # @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line + # @FootAboveGap { @DisplayGap } # gap above footnote line + # @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes + # @MarginNoteFont { 0.80f } # font of margin notes + # @MarginNoteBreak { ragged 1.10fx } # break style of margin notes + # @MarginNoteHGap { 0.5c } # horizontal gap to notes + # @MarginNoteVGap { @DisplayGap } # min vertical gap between + # @MarginNoteWidth { 1.50c } # width of margin notes + # @EndNoteNumbers { Arabic } # endnote numbers + # @EndNoteFont { 0.80f } # font of endnotes + # @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes + # @EndNoteFormat { { number &0.05f } @Insert body } # endnote format + # @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes + + # @TheoremWord { theorem } # "Theorem" word, etc. + # @TheoremTitleFormat { (title) } # only if title present + # @TheoremFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @DefinitionWord { definition } # "Definition" word, etc. + # @DefinitionTitleFormat { (title) } # only if title present + # @DefinitionFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ClaimWord { claim } # "Claim" word, etc. + # @ClaimTitleFormat { (title) } # only if title present + # @ClaimFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @PropositionWord { proposition } # "Proposition" word, etc. + # @PropositionTitleFormat { (title) } # only if title present + # @PropositionFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @LemmaWord { lemma } # "Lemma" word, etc. + # @LemmaTitleFormat { (title) } # only if title present + # @LemmaFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @CorollaryWord { corollary } # "Corollary" word, etc. + # @CorollaryTitleFormat { (title) } # only if title present + # @CorollaryFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ExampleWord { example } # "Example" word, etc. + # @ExampleTitleFormat { (title) } # only if title present + # @ExampleFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ProofWord { proof } # "Proof" word, etc. + + # @PageHeaders { Simple } # None Simple Titles NoTitles + # @PageNumbers { Arabic } # page numbers + # @FirstPageNumber { 1 } # number of first page + # @IntroPageNumbers { Roman } # intro page numbers + # @IntroFirstPageNumber{ 1 } # number of first intro page + # @StructPageNums { No } # make structured page numbers + # @PageNumberFormat { number } # format of all page numbers + + # @OddTop { @Centre{- @PageNum -} } # Simple page headers + # @OddFoot { @Null } + # @EvenTop { @Centre{- @PageNum -} } + # @EvenFoot { @Null } + # @StartOddTop { @Null } + # @StartOddFoot { @Null } + # @StartEvenTop { @Null } + # @StartEvenFoot { @Null } + # @IntroOddTop { @Null } + # @IntroOddFoot { @Centre @PageNum } + # @IntroEvenTop { @Null } + # @IntroEvenFoot { @Centre @PageNum } + # @IntroStartOddTop { @Null } + # @IntroStartOddFoot { @Null } + # @IntroStartEvenTop { @Null } + # @IntroStartEvenFoot { @Null } + + # Titles, NoTitles headers + # @RunningOddTop { @I {@MinorNum @DotSep @MinorTitle} @Right @B @PageNum } + # @RunningOddFoot { @Null } + # @RunningEvenTop { @B @PageNum @Right @I {@MajorNum @DotSep @MajorTitle} } + # @RunningEvenFoot { @Null } + # @RunningStartOddTop { @Null } + # @RunningStartOddFoot { @Centre { Bold 0.8f } @Font @PageNum } + # @RunningStartEvenTop { @Null } + # @RunningStartEvenFoot { @Centre { Bold 0.8f } @Font @PageNum } + # @RunningIntroOddTop { @Null } + # @RunningIntroOddFoot { @Right @PageNum } + # @RunningIntroEvenTop { @Null } + # @RunningIntroEvenFoot { @PageNum } + # @RunningIntroStartOddTop { @Null } + # @RunningIntroStartOddFoot { @Null } + # @RunningIntroStartEvenTop { @Null } + # @RunningIntroStartEvenFoot { @Null } +} + + +############################################################################### +# # +# The @IllustrationSetup @Use clause - there are no options for this. # +# # +############################################################################### + +@Use { @IllustrationSetup +} + + +############################################################################### +# # +# @Database (and @SysDatabase) clauses go here. # +# # +############################################################################### + +@SysDatabase @FontDef { fontdefs } # font definitions +@SysDatabase @RefStyle { refstyle } # reference printing styles diff --git a/include/include/picturef b/include/include/picturef new file mode 100644 index 0000000..8f8fc26 --- /dev/null +++ b/include/include/picturef @@ -0,0 +1,55 @@ + +########################################################################### +# # +# @IllustrationSetup extension to @DocumentSetup. # +# # +# Jeffrey H. Kingston # +# # +# This package extends DocumentSetup for illustrations. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +########################################################################### + +extend @BasicSetup @DocumentSetup +export @Illustration +def @IllustrationSetup +@Begin + + ####################################################################### + # # + # @Illustration # + # # + ####################################################################### + + 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 setoutdent @InitialOutdent } @Break + @InitialLanguage @Language @InitialSpace @Space + { @ColourCommand @InitialColour } @SetColour + @OneCol @OneRow x + } + +@End @IllustrationSetup diff --git a/include/include/pie b/include/include/pie new file mode 100644 index 0000000..a688feb --- /dev/null +++ b/include/include/pie @@ -0,0 +1,111 @@ +############################################################################### +# # +# Lout setup file for pie charts # +# # +# Jeffrey H. Kingston # +# 16 October 2002 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# The @SysInclude { pief } line # +# # +# This line causes Lout to read the definitions for pie charts, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { pief } + + +############################################################################### +# # +# The @PieSetup @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 { @PieSetup + + ############################################################################# + # # + # General options # + # # + ############################################################################# + + # save { no } + # totalweight { 100 } + # radius { 2.5c } + # initialangle { 0d } + # leftextra { 0i } + # rightextra { 0i } + # aboveextra { 0i } + # belowextra { 0i } + + ############################################################################# + # # + # Caption options # + # # + ############################################################################# + + # leftcaption { } + # rightcaption { } + # abovecaption { } + # belowcaption { } + # leftgap { 0.5c } + # rightgap { 0.5c } + # abovegap { 0.5c } + # belowgap { 0.5c } + # hidecaptions { yes } + + ############################################################################# + # # + # Slice options # + # # + ############################################################################# + + # weight { 1 } + # paint { none } + # texture { solid } + # outlinestyle { solid } + # outlinedashlength { 0.2f } + # outlinewidth { thin } + # detach { no } + + ############################################################################# + # # + # Label options # + # # + ############################################################################# + + # label { } + # labelfont { -2p } + # labelbreak { clines } + # labelmargin { 0.2f } + # labelformat { @Body } + # labelradius { internal } + # labeladjust { 0 0 } + + ############################################################################# + # # + # finger options # + # # + ############################################################################# + + # finger { no } + # fingerstyle { solid } + # fingerdashlength { 0.2f } + # fingerwidth { thin } + # fingerradius { 0.7 } + # fingeradjust { 0 0 } + # fingerarrow { no } + # fingerarrowlength { 0.6f } + # fingerarrowwidth { 0.45f } + +} diff --git a/include/include/pief b/include/include/pief new file mode 100644 index 0000000..2bb0001 --- /dev/null +++ b/include/include/pief @@ -0,0 +1,426 @@ + +############################################################################### +# # +# Lout @Pie package for drawing pie charts # +# Version 1.0 (October 2002) # +# Jeffrey H. Kingston # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +@SysPrependGraphic { pief.lpg } +@SysInclude { lengths } # @PSLengths and @LoutLengths +@SysInclude { coltex } # @ColourCommand and @TextureCommand + + +############################################################################### +# # +# @PieSetup symbol # +# # +############################################################################### + +export @Pie +def @PieSetup + named save { no } + named totalweight { 100 } + named radius { 2.5c } + import @PSLengths named initialangle{ 0d } + named leftextra { 0i } + named rightextra { 0i } + named aboveextra { 0i } + named belowextra { 0i } + named leftcaption { } + named rightcaption { } + named abovecaption { } + named belowcaption { } + named leftgap { 0.5c } + named rightgap { 0.5c } + named abovegap { 0.5c } + named belowgap { 0.5c } + named hidecaptions { yes } + named weight { 1 } + named paint { none } + import @TextureImport named texture { solid } + named outlinestyle + named solid { "/lpiesolid" } + named dashed { "/lpiedashed" } + named cdashed { "/lpiecdashed" } + named dotted { "/lpiedotted" } + named noline { "/lpienoline" } + { solid } + import @PSLengths named outlinedashlength { 0.2f } + import @PSLengths named outlinewidth + named thin { 0.04f } + named medium { 0.08f } + named thick { 0.12f } + { thin } + named detach + named yes Yes { 0.5 } + named no No { 0.0 } + { no } + named label { } + named labelfont { -2p } + named labelbreak { clines } + named labelmargin { 0.2f } + named labelformat right @Body { @Body } + named labelradius + named internal { 0.6 } + named external { 1.4 } + { internal } + import @PSLengths named labeladjust { 0 0 } + named finger { no } + named fingerstyle + named solid { "/lpiesolid" } + named dashed { "/lpiedashed" } + named cdashed { "/lpiecdashed" } + named dotted { "/lpiedotted" } + named noline { "/lpienoline" } + { solid } + import @PSLengths named fingerdashlength { 0.2f } + import @PSLengths named fingerwidth + named thin { 0.04f } + named medium { 0.08f } + named thick { 0.12f } + { thin } + named fingerradius { 0.7 } + import @PSLengths named fingeradjust{ 0 0 } + named fingerarrow { no } + import @PSLengths named fingerarrowlength { 0.6f } + import @PSLengths named fingerarrowwidth { 0.45f } +{ + + ########################################################################### + # # + # @Pie symbol # + # # + ########################################################################### + + export @Slice + def @Pie + named save { save } + named totalweight { totalweight } + named radius { radius } + import @PSLengths named initialangle { initialangle } + named leftextra { leftextra } + named rightextra { rightextra } + named aboveextra { aboveextra } + named belowextra { belowextra } + named leftcaption { leftcaption } + named rightcaption { rightcaption } + named abovecaption { abovecaption } + named belowcaption { belowcaption } + named leftgap { leftgap } + named rightgap { rightgap } + named abovegap { abovegap } + named belowgap { belowgap } + named hidecaptions { hidecaptions } + named weight { weight } + named paint { paint } + import @TextureImport named texture { texture } + named outlinestyle + named solid { "/lpiesolid" } + named dashed { "/lpiedashed" } + named cdashed { "/lpiecdashed" } + named dotted { "/lpiedotted" } + named noline { "/lpienoline" } + { outlinestyle } + import @PSLengths named outlinedashlength{ outlinedashlength } + import @PSLengths named outlinewidth + named thin { 0.04f } + named medium { 0.08f } + named thick { 0.12f } + { outlinewidth } + named detach + named yes Yes { 0.5 } + named no No { 0.0 } + { detach } + named label { label } + named labelfont { labelfont } + named labelbreak { labelbreak } + named labelmargin { labelmargin } + named labelformat right @Body { labelformat @Body } + named labelradius + named internal { 0.6 } + named external { 1.4 } + { labelradius } + import @PSLengths named labeladjust { labeladjust } + named finger { finger } + named fingerstyle + named solid { "/lpiesolid" } + named dashed { "/lpiedashed" } + named cdashed { "/lpiecdashed" } + named dotted { "/lpiedotted" } + named noline { "/lpienoline" } + { fingerstyle } + import @PSLengths named fingerdashlength{ fingerdashlength } + import @PSLengths named fingerwidth + named thin { 0.04f } + named medium { 0.08f } + named thick { 0.12f } + { fingerwidth } + named fingerradius { fingerradius } + import @PSLengths named fingeradjust { fingeradjust } + named fingerarrow { fingerarrow } + import @PSLengths named fingerarrowlength { fingerarrowlength } + import @PSLengths named fingerarrowwidth { fingerarrowwidth } + + body @Body + { + + + ####################################################################### + # # + # Miscellaneous helper definitions # + # # + ####################################################################### + + def @AddPaint left col right texture + { + col @Case { + { "no" "none" "nopaint" } @Yield "{}" + else @Yield { "{" @ColourCommand col texture "fill }" } + } + } + + # Like @Graphic, but affects the graphics state of right parameter + def @InnerGraphic + left ps + right x + { + { ps gsave // grestore } @Graphic x + } + + def @ZeroWidth right x + { + @HContract @VContract { + ^|0io @HContract @VContract x |0io + } + } + + def @ZeroSize right x + { + @HContract @VContract { + ^/0io ^|0io @HContract @VContract x |0io /0io + } + } + + + ####################################################################### + # # + # @Slice # + # # + ####################################################################### + + def @Slice + named weight { weight } + named paint { paint } + import @TextureImport named texture { texture } + named outlinestyle + named solid { "/lpiesolid" } + named dashed { "/lpiedashed" } + named cdashed { "/lpiecdashed" } + named dotted { "/lpiedotted" } + named noline { "/lpienoline" } + { outlinestyle } + import @PSLengths named outlinedashlength { outlinedashlength } + import @PSLengths named outlinewidth + named thin { 0.04f } + named medium { 0.08f } + named thick { 0.12f } + { outlinewidth } + named detach + named yes Yes { 0.5 } + named no No { 0.0 } + { detach } + named label { label } + named labelfont { labelfont } + named labelbreak { labelbreak } + named labelmargin { labelmargin } + named labelformat right @Body { labelformat @Body } + named labelradius + named internal { 0.6 } + named external { 1.4 } + { labelradius } + import @PSLengths named labeladjust { labeladjust } + named finger { finger } + named fingerstyle + named solid { "/lpiesolid" } + named dashed { "/lpiedashed" } + named cdashed { "/lpiecdashed" } + named dotted { "/lpiedotted" } + named noline { "/lpienoline" } + { fingerstyle } + import @PSLengths named fingerdashlength { fingerdashlength } + import @PSLengths named fingerwidth + named thin { 0.04 ft } + named medium { 0.08 ft } + named thick { 0.12 ft } + { fingerwidth } + named fingerradius { fingerradius } + import @PSLengths named fingeradjust{ fingeradjust } + named fingerarrow { fingerarrow } + import @PSLengths named fingerarrowlength { fingerarrowlength } + import @PSLengths named fingerarrowwidth { fingerarrowwidth } + { + + def @DrawSlice + { + outlinedashlength "[" outlinestyle "]" + outlinewidth paint @AddPaint texture + weight detach + "lpiebeginslice" + // + "lpieendslice" + } + + def @TranslateLabelAndDrawFinger + { labeladjust labelradius "lpietranslatelabel" + finger @Case { + { no No } @Yield "" + { yes Yes } @Yield { + fingerdashlength "[" fingerstyle "]" + fingerwidth fingeradjust fingerradius + "lpiedrawfinger" + fingerarrow @Case { + { no No } @Yield "" + { yes Yes } @Yield { + fingerarrowlength fingerarrowwidth + "lpiedrawarrowhead" + } + } + } + } + } + + def @AddMargins right x + { + @HContract @VContract { + //labelmargin ||labelmargin x ||labelmargin //labelmargin + } + } + + @Null @ZeroSize @DrawSlice @Graphic + @TranslateLabelAndDrawFinger @InnerGraphic { + @AddMargins labelfont @Font labelbreak @Break labelformat label + } @Null + + } + + def @Above + { + abovecaption @Case { + "" @Yield "" + else @Yield @OneCol { + ||0.5rt clines @Break abovecaption || //abovegap + } + } + } + + def @Below + { + belowcaption @Case { + "" @Yield "" + else @Yield @OneCol { + //belowgap ||0.5rt clines @Break belowcaption || + } + } + } + + def @Left + { + leftcaption @Case { + "" @Yield "" + else @Yield @OneRow { + { //0.5rt clines @Break leftcaption // } ^||leftgap + } + } + } + + def @Right + { + rightcaption @Case { + "" @Yield "" + else @Yield @OneRow { + ||rightgap { //0.5rt lines @Break rightcaption // } + } + } + } + + def @HideWidth right x + { + hidecaptions @Case { + { No no } @Yield x + { Yes yes } @Yield @OneCol { ||0io x ||0io } + } + } + + def @AddCaptions right x + { + + @HContract @VContract + { + | @Above | + / @HideWidth @Left | &0.5rt x | @HideWidth @Right + / | @Below | + } + } + + def @AddExtra right x + { + @HContract @VContract + { + /aboveextra |leftextra x |rightextra /belowextra + } + } + + def @GraphicSetup right x + { + { + save @Case { + { yes Yes } @Yield { + "grestore save gsave" totalweight initialangle "lpiebegin" + // + "lpieend restore" + } + { no No } @Yield { + totalweight initialangle "lpiebegin" + // + "lpieend" + } + } + } @Graphic x + } + + def @Base right x + { + def @Square { radius @Wide radius @High {} } + + @HContract @VContract { + @Square ^| @Square + ^/ + @Square | @Square + / + x + } + } + + @AddCaptions @AddExtra @GraphicSetup @Base @Body + + } +} diff --git a/include/include/pief.lpg b/include/include/pief.lpg new file mode 100644 index 0000000..8350659 --- /dev/null +++ b/include/include/pief.lpg @@ -0,0 +1,488 @@ +%%BeginResource: procset LoutPiePrependGraphic +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Pie Jeffrey H. Kingston % +% Version 1.0 % +% % +% Jeffrey H. Kingston % +% October 2002 % +% % +% This file has been placed in the public domain by its author, % +% Jeffrey H. Kingston % +% % +% To assist in avoiding name clashes, the names of all symbols % +% defined here begin with "lpie". % +% % +% <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 % +% % +% The following invariant is maintained from the end of the % +% call to lpiebegin to the beginning of the call to lpieend: % +% % +% lpiecentre is an executable function which leaves the two % +% coordinates of the centre of the pie on the % +% operand stack (signature - lpiectr <x> <y>) % +% % +% lpieradius is the radius of the pie % +% % +% lpieinitangle is the initial angle % +% % +% lpietotalweight is the total weight of all slices % +% % +% lpiecurrentweight is the total weight of all slices so far % +% % +% The first four are constants set by lpiebegin; the last is % +% updated as each slice is printed. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% install error handler into error dictionary +errordict begin + /handleerror + { + { /Times-Roman findfont 8 pt scalefont setfont + 0 setgray 4 pt 4 pt moveto + $error /errorname get + dup lpiedict exch known + { lpiedict exch get } + { 100 string cvs } ifelse + show + ( Command: ) show + $error /command get 100 string cvs show + } stopped {} if + showpage stop + } def +end + +% initial coordinates of debug output +/lpiedebugposy 432 def +/lpiedebugposx 72 def + +% <string> <int> lpiedebugprint - +% must be defined outside lpiedict since used in arbitrary places +% print <string> plus count or <int> stack entries, whichever is the smaller +/lpiedebugprint +{ + exch + gsave + initgraphics + lpiedebugposy 72 lt + { /lpiedebugposx lpiedebugposx 144 add store + /lpiedebugposy 432 store + } + { + /lpiedebugposy lpiedebugposy 12 sub store + } ifelse + lpiedebugposx lpiedebugposy 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 + { + /lpiedebugposy lpiedebugposy 12 sub store + lpiedebugposx 12 add lpiedebugposy moveto + index + dup type (dicttype) eq + { + (begin dict) show + { + /lpiedebugposy lpiedebugposy 12 sub store + lpiedebugposx 24 add lpiedebugposy moveto + pop 100 string cvs show + } forall + /lpiedebugposy lpiedebugposy 12 sub store + lpiedebugposx 12 add lpiedebugposy moveto + (end dict) show + } + { + dup type (arraytype) eq + { + dup xcheck { (executable array) } { (literal array) } ifelse show + { + /lpiedebugposy lpiedebugposy 12 sub store + lpiedebugposx 24 add lpiedebugposy moveto + 100 string cvs show + } forall + /lpiedebugposy lpiedebugposy 12 sub store + lpiedebugposx 12 add lpiedebugposy moveto + (end array) show + } + { + dup xcheck { (ex: ) } { (lit: ) } ifelse show + 100 string cvs show + } ifelse + } ifelse + } for + grestore +} def + +% name lpiedebugpoint - +/lpieshowpoint +{ + dup cvx exec moveto 20 string cvs show newpath +} def + +% begin pie: <totalweight> <initialangle> lpiebegin - +% must be defined outside lpiedict since it loads it +/lpiebegin +{ lpiedict begin + 20 dict begin + xmark ymark /lpiecentre lpiepointdef + /lpieradius xmark def + /lpieinitialangle exch def + /lpietotalweight exch def + /lpiecurrentweight 0 def +} def + +% end pie: - lpieend - +/lpieend +{ + end + end +} def + +% pie dictionary +/lpiedict 200 dict def + +% subsequent definitions are held within the pie dictionary +lpiedict begin + +% error messages +/syntaxerror (syntaxerror error: syntax error in text of pie chart?) def +/typecheck (typecheck error: syntax error in text of pie chart?) def +/undefined (undefined error: unknown or misspelt label?) def +/VMError (VMError error: run out of memory?) def + +% maximum of two numbers: <num> <num> lpiemax <num> +/lpiemax { 2 copy gt { pop } { exch pop } ifelse } def + +% minimum of two numbers: <num> <num> lpiemin <num> +/lpiemin { 2 copy lt { pop } { exch pop } ifelse } def + +% add two points: <point> <point> lpiepadd <point> +/lpiepadd +{ + % (Entering padd) 4 lpiedebugprint + exch 3 1 roll add 3 1 roll add exch + % (Leaving padd) 2 lpiedebugprint +} def + +% subtract first point from second: <point> <point> lpiepsub <point> +/lpiepsub { 3 2 roll sub 3 1 roll exch sub exch } def + +% max two points: <point> <point> lpiepmax <point> +/lpiepmax { exch 3 1 roll lpiemax 3 1 roll lpiemax exch } def + +% min two points: <point> <point> lpiepmin <point> +/lpiepmin { exch 3 1 roll lpiemin 3 1 roll lpiemin exch } def + +% scalar multiplication: <point> <num> lpiepmul <point> +/lpiepmul { dup 3 1 roll mul 3 1 roll mul exch } def + +% distance between two points: <point> <point> lpiedistance <length> +/lpiedistance { lpiepsub dup mul exch dup mul add sqrt } def + +% point at angle and distance +% <point> <length> <angle> lpieatangle <point> +/lpieatangle { 2 copy cos mul 3 1 roll sin mul lpiepadd } def + +% stroke a solid line: <length> <dashlength> lpiesolid - +/lpiesolid +{ % (Entering lpiesolid) 2 lpiedebugprint + gsave pop pop [] 0 setdash 1 setlinecap stroke grestore newpath + % (Leaving lpiesolid) 0 lpiedebugprint +} def + +% stroke a dashed line: <length> <dashlength> lpiedashed - +/lpiedashed +{ gsave + 2 copy div 2 le 1 index 0 le or + { exch pop 1 pt lpiemax [ 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 + grestore newpath +} def + +% stroke a cdashed line: <length> <dashlength> lpiecdashed - +/lpiecdashed +{ % (Entering lpiecdashed) 2 lpiedebugprint + gsave + 2 copy le 1 index 0 le or + { exch pop 1 pt lpiemax [ 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 + grestore newpath + % (Leaving lpiecdashed) 0 lpiedebugprint +} def + +% stroke a dotted line: <length> <dashlength> lpiedotted - +/lpiedotted +{ gsave + 2 copy le 1 index 0 le or + { exch pop 1 pt lpiemax [ exch 0 exch ] 0 setdash } + { 1 index exch div ceiling div + [ 0 3 2 roll ] 0 setdash + } ifelse 1 setlinecap stroke + grestore newpath +} def + +% stroke a noline line: <length> <dashlength> lpienoline - +/lpienoline +{ pop pop +} def + +% label a point in current dictionary: <point> /name lpiepointdef - +/lpiepointdef +{ + % (Entering lpiepointdef) 3 lpiedebugprint + [ 4 2 roll transform /itransform cvx ] cvx def + % (Leaving lpiepointdef) 0 lpiedebugprint +} def + +% find the angle that the current slice starts at +% - lpiesliceangle1 <angle> +/lpiesliceangle1 +{ lpiecurrentweight lpietotalweight div 360 mul lpieinitialangle add +} def + +% find the angle that the current slice stops at +% - lpiesliceangle2 <angle> +/lpiesliceangle2 +{ weight lpiecurrentweight add lpietotalweight div 360 mul lpieinitialangle add +} def + +% find the angle that bisects the current slice +% - lpieslicemidangle <angle> +/lpieslicemidangle +{ weight 2 div lpiecurrentweight add lpietotalweight div 360 mul lpieinitialangle add +} def + +% update the total weight +% - lpieupdateweight - +/lpieupdateweight +{ weight lpiecurrentweight add /lpiecurrentweight exch def +} def + +% find the apex of the slice +% - lpiesliceapex <x> <y> +/lpiesliceapex +{ lpiecentre lpieradius detach mul lpieslicemidangle lpieatangle +} def + +% find the end of the first arm of the slice +% - lpieslicearm1 <x> <y> +/lpieslicearm1 +{ lpiesliceapex lpieradius lpiesliceangle1 lpieatangle +} def + +% find the end of the second arm of the slice +% - lpieslicearm2 <x> <y> +/lpieslicearm2 +{ lpiesliceapex lpieradius lpiesliceangle2 lpieatangle +} def + +% set the whole closed path for the current slice +% - lpiesetslicepath - +/lpiesetslicepath +{ newpath lpiesliceapex moveto + currentpoint lpieradius lpiesliceangle1 lpiesliceangle2 arc + closepath +} def + +% set the first segment of the current slice and return its length +% - lpiesetsegment1 <length> +/lpiesetsegment1 +{ newpath lpiesliceapex moveto lpieslicearm1 lineto + lpieradius +} def + +% set the second segment of the current slice and return its length +% - lpiesetsegment2 <length> +/lpiesetsegment2 +{ newpath lpiesliceapex moveto lpieslicearm2 lineto + lpieradius +} def + +% set the arc segment of the current slice and return its length +% - lpiesetarcsegment <length> +/lpiesetarcsegment +{ newpath + lpiesliceapex lpieradius lpiesliceangle1 lpiesliceangle2 arc + lpiesliceangle2 lpiesliceangle1 sub 180 div 3.14159 mul lpieradius mul +} def + +% draw one slice +% <dashlength> [ <outlinecommand> ] <outlinewidth> { <paintcommand> } +% <weight> <detach> lpiedrawslice - +/lpiebeginslice +{ + % (Entering lpiebeginslice) 6 lpiedebugprint + /detach exch def + /weight exch def + + % paint the slice + gsave lpiesetslicepath exec grestore + + % set the line width + setlinewidth + + % stroke each segment separately to get dashes right + 2 copy lpiesetsegment1 3 1 roll + dup length 0 exch mod get cvx + % (Stroking segment1) count 1 sub lpiedebugprint + exec + + 2 copy lpiesetarcsegment 3 1 roll + dup length 1 exch mod get cvx + % (Stroking arc segment) count 1 sub lpiedebugprint + exec + + lpiesetsegment2 3 1 roll + dup length 2 exch mod get cvx + % (Stroking segment2) count 1 sub lpiedebugprint + exec + + % (Leaving lpiebeginslice) 0 lpiedebugprint +} def + +% finish off one slice +/lpieendslice +{ + % (Entering lpieendslice) 0 lpiedebugprint + + % update current weight ready for next slice + lpieupdateweight + + % (Leaving lpieendslice) 0 lpiedebugprint +} def + +% translate label +% <xadjust> <yadjust> <labelradius> lpietranslatelabel - +/lpietranslatelabel +{ + % (Entering lpietranslatelabel) 3 lpiedebugprint + /labelradius exch def + % lpiecentre (lpiecentre:) 2 lpiedebugprint pop pop + % lpieradius (lpieradius:) 1 lpiedebugprint pop + % labelradius (labelradius:) 1 lpiedebugprint pop + % lpieslicemidangle (lpieslicemidangle:) 1 lpiedebugprint pop + xsize 2 div ysize 2 div /labelcentre lpiepointdef + labelcentre + lpiesliceapex lpieradius labelradius mul lpieslicemidangle lpieatangle lpiepsub + lpiepadd + translate + % (Leaving lpietranslatelabel) 0 lpiedebugprint +} def + +% fix an angle to 0 <= res < 360: <angle> lpiefixangle <angle> +/lpiefixangle +{ + % (Entering lpiefixangle) 1 lpiedebugprint + { dup 0 ge { exit } if + 360 add + } loop + { dup 360 lt { exit } if + 360 sub + } loop + % (Leaving lpiefixangle) 1 lpiedebugprint +} def + +% angle from one point to another +% <point> <point> lpieangleto <angle> +/lpieangleto { + lpiepsub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse +} def + +% find point on circumference of box: alpha a b lpieboxcircum x y +/lpieboxcircum +{ + % (Entering lpieboxcircum) 3 lpiedebugprint + 4 dict begin + /b exch def + /a exch def + lpiefixangle /alpha exch def + 0 0 a b lpieangleto /theta exch def + % a (a:) 1 lpiedebugprint pop + % b (b:) 1 lpiedebugprint pop + % theta (theta:) 1 lpiedebugprint pop + % alpha (alpha:) 1 lpiedebugprint pop + + % 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 lpieboxcircum) 2 lpiedebugprint +} def + + +% draw finger (will immediately follow lpietranslatelabel) +% <fingerdashlength> "[" <fingerstyle> "]" fingerwidth +% <fingeradjustx> <fingeradjusty> <fingerradius> lpiedrawfinger - +/lpiedrawfinger +{ + % (Entering lpidrawfinger) 6 lpiedebugprint + % find inner endpoint of finger + /fingerradius exch def + lpiesliceapex lpieradius fingerradius mul + lpieslicemidangle lpieatangle lpiepadd + /fingerinner lpiepointdef + xsize 2 div ysize 2 div /labelcentre lpiepointdef + 0 0 /labelorigin lpiepointdef + + % find outer endpoint of finger, on circumference of label + labelcentre fingerinner lpieangleto + xsize 2 div ysize 2 div + lpieboxcircum labelcentre lpiepadd + /fingerouter lpiepointdef + + % set the line width + setlinewidth + + % draw line + newpath fingerinner moveto fingerouter lineto + fingerinner fingerouter lpiedistance 3 1 roll 0 get cvx exec + % (Leaving lpiedrawfinger) 0 lpiedebugprint +} def + +% draw arrowhead (will immediately follow lpiedrawfinger if reqd) +% <headlength> <headwidth> lpiedrawarrowhead +/lpiedrawarrowhead +{ + gsave + /headwidth exch def + /headlength exch def + fingerinner translate + fingerouter fingerinner lpieangleto rotate + 0 0 moveto + headlength neg headwidth 2 div lineto + 0 headwidth neg rlineto + closepath fill + grestore +} def +end +%%EndResource diff --git a/include/include/pod b/include/include/pod new file mode 100644 index 0000000..9bfd373 --- /dev/null +++ b/include/include/pod @@ -0,0 +1,178 @@ +############################################################################### +# # +# Lout setup file for Pod documentation printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +# This file has been placed in the public domain by its author. # +# # +# Note: although Pod is treated like a programming language in some # +# respects, the setup file options below are largely unrelated to # +# the setup file options for other languages. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { podf } + + +############################################################################### +# # +# @Use clause # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +# Pod has two quite different kinds of paragraphs: verbatim and non- # +# verbatim. When we say "verbatim" and "text" below we refer to these. # +# There is no paragraph breaking option for verbatim since line breaks # +# are honoured. # +# # +# As you can see below, we have been obliged to give "Times Base" as # +# the default text font for varying style, rather than the usual empty, # +# to get a varying-width font when Pod is embedded in fixed-width Perl. If # +# you are using a different text font family in your document you will have # +# to change this option if you want your varying-width Pod in that family. # +# # +############################################################################### + +@Use { @PodSetup + # pipe { } # pipe source through this + # style { varying @OrIfPlain fixed } # fixed, varying, or symbol + + # the following options apply when style is "fixed" + + # fixedtextfont { Courier Base -1p } # text font + # fixedtextbreak { adjust 1.0vx hyphen } # text para breaking + # fixedverbatimfont { Courier Base } # verbatim font + # fixedtabin { 8 } # tab interval + # fixedtabout { 8s } # tab width + # fixedlinenumbersfont { } # line numbers font + # fixedlinenumbersformat { @Body } # line numbers format + + # fixedparagap { 1.0v } # gap between paras + # fixedlistgap { 1.0v } # gap within lists + # fixedlistindent { 0s } # list label indent + # fixedlistrightindent { 0s } # list right indent + # fixedlistlabelwidth { 2.0f } # default label space + # fixedlistlabelfont { } # list label font + # fixedlistlabelformat { @Body } # list label format + + # fixedaheadfont { Bold +4p } # =head1 font + # fixedaheadbreak { lines 1.1vx } # =head1 para break + # fixedaheadformat { @DP @Body } # =head1 format + # fixedbheadfont { Bold +2p } # =head2 font + # fixedbheadbreak { lines 1.1vx } # =head2 para break + # fixedbheadformat { @Body } # =head2 format + # fixedcheadfont { Bold } # =head3 font + # fixedcheadbreak { lines 1.1vx } # =head3 para break + # fixedcheadformat { @Body } # =head3 format + + # fixeditalicfont { Slope } # font of I<> + # fixeditalicformat { @Body } # format of I<> + # fixedboldfont { Bold } # font of B<> + # fixedboldformat { @Body } # format of B<> + # fixedcodefont { Base } # font of C<> + # fixedcodeformat { @Body } # format of C<> + # fixedfilefont { Slope } # font of F<> + # fixedfileformat { @Body } # format of F<> + # fixedlinkfont { Slope } # font of L<> + # fixedlinkformat { @Underline @Body } # format of L<> + # fixedindexfont { Slope } # font of X<> + # fixedindexformat { @Body } # format of X<> + + + # the following options apply when style is "varying" + + # varyingtextfont { Times Base } # text font + # varyingtextbreak { adjust 1.0vx hyphen } # text para breaking + # varyingverbatimfont { Courier Base -1p } # verbatim font + # varyingtabin { 8 } # tab interval + # varyingtabout { 8s } # tab width + # varyinglinenumbersfont { } # line numbers font + # varyinglinenumbersformat { @Body } # line numbers format + + # varyingparagap { 1.0v } # gap between paras + # varyinglistgap { 1.0v } # gap within lists + # varyinglistindent { 0s } # list label indent + # varyinglistrightindent { 0s } # list right indent + # varyinglistlabelwidth { 2.0f } # default label space + # varyinglistlabelfont { } # list label font + # varyinglistlabelformat { @Body } # list label format + + # varyingaheadfont { Bold +4p } # =head1 font + # varyingaheadbreak { lines 1.1vx } # =head1 para break + # varyingaheadformat { @DP @Body } # =head1 format + # varyingbheadfont { Bold +2p } # =head2 font + # varyingbheadbreak { lines 1.1vx } # =head2 para break + # varyingbheadformat { @Body } # =head2 format + # varyingcheadfont { Bold } # =head3 font + # varyingcheadbreak { lines 1.1vx } # =head3 para break + # varyingcheadformat { @Body } # =head3 format + + # varyingitalicfont { Slope } # font of I<> + # varyingitalicformat { @Body } # format of I<> + # varyingboldfont { Bold } # font of B<> + # varyingboldformat { @Body } # format of B<> + # varyingcodefont { Courier Base -1p } # font of C<> + # varyingcodeformat { @Body } # format of C<> + # varyingfilefont { Slope } # font of F<> + # varyingfileformat { @Body } # format of F<> + # varyinglinkfont { Slope } # font of L<> + # varyinglinkformat { @Underline @Body } # format of L<> + # varyingindexfont { Slope } # font of X<> + # varyingindexformat { @Body } # format of X<> + + # the following options apply when style is "symbol" + + # symboltextfont { Times Base } # text font + # symboltextbreak { adjust 1.0vx hyphen } # text para breaking + # symbolverbatimfont { Courier Base -1p } # verbatim font + # symboltabin { 8 } # tab interval + # symboltabout { 8s } # tab width + # symbollinenumbersfont { } # line numbers font + # symbollinenumbersformat { @Body } # line numbers format + + # symbolparagap { 1.0v } # gap between paras + # symbollistgap { 1.0v } # gap within lists + # symbollistindent { 0s } # list label indent + # symbollistrightindent { 0s } # list right indent + # symbollistlabelwidth { 2.0f } # default label space + # symbollistlabelfont { } # list label font + # symbollistlabelformat { @Body } # list label format + + # symbolaheadfont { Bold +4p } # =head1 font + # symbolaheadbreak { lines 1.1vx } # =head1 para break + # symbolaheadformat { @DP @Body } # =head1 format + # symbolbheadfont { Bold +2p } # =head2 font + # symbolbheadbreak { lines 1.1vx } # =head2 para break + # symbolbheadformat { @Body } # =head2 format + # symbolcheadfont { Bold } # =head3 font + # symbolcheadbreak { lines 1.1vx } # =head3 para break + # symbolcheadformat { @Body } # =head3 format + + # symbolitalicfont { Slope } # font of I<> + # symbolitalicformat { @Body } # format of I<> + # symbolboldfont { Bold } # font of B<> + # symbolboldformat { @Body } # format of B<> + # symbolcodefont { Courier Base -1p } # font of C<> + # symbolcodeformat { @Body } # format of C<> + # symbolfilefont { Slope } # font of F<> + # symbolfileformat { @Body } # format of F<> + # symbollinkfont { Slope } # font of L<> + # symbollinkformat { @Underline @Body } # format of L<> + # symbolindexfont { Slope } # font of X<> + # symbolindexformat { @Body } # format of X<> + +} diff --git a/include/include/podf b/include/include/podf new file mode 100644 index 0000000..062c09b --- /dev/null +++ b/include/include/podf @@ -0,0 +1,567 @@ + +############################################################################### +# # +# Lout @PodSetup package for formatting Pod programs # +# # +# Jeffrey H. Kingston # +# 25 March 2000 # +# # +# This package uses a filtered body parameter to convert Pod 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @Pod +def @PodSetup + named pipe { } # pipe through this first + named style + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { varying @OrIfPlain fixed } # print style + + + # the following options apply when style is "fixed" + + named fixedtextfont { Courier Base -1p } # text font + named fixedtextbreak { adjust 1.0vx hyphen } # text para breaking + named fixedverbatimfont { Courier Base } # verbatim font + named fixedtabin { 8 } # tab interval + named fixedtabout { 8s } # tab width + named fixedlinenumbersfont { } # line numbers font + named fixedlinenumbersformat right @Body{ @Body } # line numbers format + + named fixedparagap { 1.0v } # gap between paras + named fixedlistgap { 1.0v } # gap within lists + named fixedlistindent { 0s } # list label indent + named fixedlistrightindent { 0s } # list right indent + named fixedlistlabelwidth { 2.0f } # default label space + named fixedlistlabelfont { } # list label font + named fixedlistlabelformat right @Body { @Body } # list label format + + named fixedaheadfont { Bold +4p } # =head1 font + named fixedaheadbreak { lines 1.1vx } # =head1 para break + named fixedaheadformat right @Body { //1v @Body } # =head1 format + named fixedbheadfont { Bold +2p } # =head2 font + named fixedbheadbreak { lines 1.1vx } # =head2 para break + named fixedbheadformat right @Body { @Body } # =head2 format + named fixedcheadfont { Bold } # =head3 font + named fixedcheadbreak { lines 1.1vx } # =head3 para break + named fixedcheadformat right @Body { @Body } # =head3 format + + named fixeditalicfont { Slope } # font of I<> + named fixeditalicformat right @Body { @Body } # format of I<> + named fixedboldfont { Bold } # font of B<> + named fixedboldformat right @Body { @Body } # format of B<> + named fixedcodefont { Base } # font of C<> + named fixedcodeformat right @Body { @Body } # format of C<> + named fixedfilefont { Slope } # font of F<> + named fixedfileformat right @Body { @Body } # format of F<> + named fixedlinkfont { Slope } # font of L<> + named fixedlinkformat right @Body { @Underline @Body } # format of L<> + named fixedindexfont { Slope } # font of X<> + named fixedindexformat right @Body { @Body } # format of X<> + + + # the following options apply when style is "varying" + + named varyingtextfont { Times Base } # text font + named varyingtextbreak { adjust 1.0vx hyphen } # text para breaking + named varyingverbatimfont { Courier Base -1p } # verbatim font + named varyingtabin { 8 } # tab interval + named varyingtabout { 8s } # tab width + named varyinglinenumbersfont { } # line numbers font + named varyinglinenumbersformat right @Body{ @Body } # line numbers format + + named varyingparagap { 1.0v } # gap between paras + named varyinglistgap { 1.0v } # gap within lists + named varyinglistindent { 0s } # list label indent + named varyinglistrightindent { 0s } # list right indent + named varyinglistlabelwidth { 2.0f } # default label space + named varyinglistlabelfont { } # list label font + named varyinglistlabelformat right @Body { @Body } # list label format + + named varyingaheadfont { Bold +4p } # =head1 font + named varyingaheadbreak { lines 1.1vx } # =head1 para break + named varyingaheadformat right @Body{ //1v @Body } # =head1 format + named varyingbheadfont { Bold +2p } # =head2 font + named varyingbheadbreak { lines 1.1vx } # =head2 para break + named varyingbheadformat right @Body{ @Body } # =head2 format + named varyingcheadfont { Bold } # =head3 font + named varyingcheadbreak { lines 1.1vx } # =head3 para break + named varyingcheadformat right @Body{ @Body } # =head3 format + + named varyingitalicfont { Slope } # font of I<> + named varyingitalicformat right @Body { @Body } # format of I<> + named varyingboldfont { Bold } # font of B<> + named varyingboldformat right @Body { @Body } # format of B<> + named varyingcodefont { Courier Base -1p } # font of C<> + named varyingcodeformat right @Body { @Body } # format of C<> + named varyingfilefont { Slope } # font of F<> + named varyingfileformat right @Body { @Body } # format of F<> + named varyinglinkfont { Slope } # font of L<> + named varyinglinkformat right @Body { @Underline @Body } # format of L<> + named varyingindexfont { Slope } # font of X<> + named varyingindexformat right @Body{ @Body } # format of X<> + + # the following options apply when style is "symbol" + + named symboltextfont { Times Base } # text font + named symboltextbreak { adjust 1.0vx hyphen } # text para breaking + named symbolverbatimfont { Courier Base -1p } # verbatim font + named symboltabin { 8 } # tab interval + named symboltabout { 8s } # tab width + named symbollinenumbersfont { } # line numbers font + named symbollinenumbersformat right @Body { @Body } # line numbers format + + named symbolparagap { 1.0v } # gap between paras + named symbollistgap { 1.0v } # gap within lists + named symbollistindent { 0s } # list label indent + named symbollistrightindent { 0s } # list right indent + named symbollistlabelwidth { 2.0f } # default label space + named symbollistlabelfont { } # list label font + named symbollistlabelformat right @Body { @Body } # list label format + + named symbolaheadfont { Bold +4p } # =head1 font + named symbolaheadbreak { lines 1.1vx } # =head1 para break + named symbolaheadformat right @Body { //1v @Body } # =head1 format + named symbolbheadfont { Bold +2p } # =head2 font + named symbolbheadbreak { lines 1.1vx } # =head2 para break + named symbolbheadformat right @Body { @Body } # =head2 format + named symbolcheadfont { Bold } # =head3 font + named symbolcheadbreak { lines 1.1vx } # =head3 para break + named symbolcheadformat right @Body { @Body } # =head3 format + + named symbolitalicfont { Slope } # font of I<> + named symbolitalicformat right @Body{ @Body } # format of I<> + named symbolboldfont { Bold } # font of B<> + named symbolboldformat right @Body { @Body } # format of B<> + named symbolcodefont { Courier Base -1p } # font of C<> + named symbolcodeformat right @Body { @Body } # format of C<> + named symbolfilefont { Slope } # font of F<> + named symbolfileformat right @Body { @Body } # format of F<> + named symbollinkfont { Slope } # font of L<> + named symbollinkformat right @Body { @Underline @Body } # format of L<> + named symbolindexfont { Slope } # font of X<> + named symbolindexformat right @Body { @Body } # format of X<> + +@Begin + + + export + + @PV @PPG @PLG @PLI @PLRI @PLLW @PLL @PHA @PHB @PHC + @PFI @PFB @PFC @PFF @PFL @PFX @A "$>" @PL + + def @Pod + named style { style } # style + named pipe { pipe } # pipe through this + named textfont { dft } # text font + named textbreak { dft } # text para breaking + named verbatimfont { dft } # verbatim font + named tabin { dft } # tab interval + named tabout { dft } # tab width + named linenumbersfont { dft } # line numbers font + named paragap { dft } # gap between paras + named listgap { dft } # gap within lists + named listindent { dft } # list label indent + named listrightindent { dft } # list right indent + named listlabelwidth { dft } # default label space + named listlabelfont { dft } # list label font + named aheadfont { dft } # =head1 font + named aheadbreak { dft } # =head1 para break + named bheadfont { dft } # =head2 font + named bheadbreak { dft } # =head2 para break + named cheadfont { dft } # =head3 font + named cheadbreak { dft } # =head3 para break + named italicfont { dft } # font of I<> + named boldfont { dft } # font of B<> + named codefont { dft } # font of C<> + named filefont { dft } # font of F<> + named linkfont { dft } # font of L<> + named indexfont { dft } # font of X<> + 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 + { + pipe @Case { + "" @Yield { + "prg2lout -r -lPod" -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lPod" -o{@FilterOut} + -e{@FilterErr} -t{@InitTab} -T{@InitTabWidth} + } + } + } + + + def @InitFont + { + textfont @Test + iffixed { fixedtextfont } + ifvarying { varyingtextfont } + ifsymbol { symboltextfont } + } + + + + def @InitBreak + { + textbreak @Test + iffixed { fixedtextbreak } + ifvarying { varyingtextbreak } + ifsymbol { symboltextbreak } + } + + + def printverbatim + right x + { + def verbfont + { + verbatimfont @Test + iffixed { fixedverbatimfont } + ifvarying { varyingverbatimfont } + ifsymbol { symbolverbatimfont } + } + + def verbatimstrut { @VContract { 0.5v @High ^/ / 0.5v @High } } + + @OneCol verbfont @Font x |0io verbatimstrut + } + + + macro @PV { // printverbatim } + + + def paragraphgap + { + paragap @Test + iffixed { fixedparagap } + ifvarying { varyingparagap } + ifsymbol { symbolparagap } + } + + + macro @PPG { //paragraphgap } + + + def @PLG + { + listgap @Test + iffixed { fixedlistgap } + ifvarying { varyinglistgap } + ifsymbol { symbollistgap } + } + + + def @PLI + { + listindent @Test + iffixed { fixedlistindent } + ifvarying { varyinglistindent } + ifsymbol { symbollistindent } + } + + + def @PLRI + { + listrightindent @Test + iffixed { fixedlistrightindent } + ifvarying { varyinglistrightindent } + ifsymbol { symbollistrightindent } + } + + + def @PLLW right x + { + def defaultwidth + { + listlabelwidth @Test + iffixed { fixedlistlabelwidth } + ifvarying { varyinglistlabelwidth } + ifsymbol { symbollistlabelwidth } + } + + def givenwidth + { + style @Case { + fixed @Yield { x"s" } + varying @Yield { x"f" } + symbol @Yield { x"f" } + } + } + + x @Case { + "" @Yield defaultwidth + else @Yield givenwidth + } + } + + + def @PLL right x + { + def bullet + { + @BackEnd @Case { + PlainText @Yield "*" + else @Yield @Char "bullet" + } + } + + def value + { + x @Case { + "*" @Yield bullet + else @Yield x + } + } + + style @Case { + fixed @Yield fixedlistlabelformat { + { listlabelfont @Else fixedlistlabelfont } @Font value } + varying @Yield varyinglistlabelformat { + { listlabelfont @Else varyinglistlabelfont } @Font value } + symbol @Yield symbollistlabelformat { + { listlabelfont @Else symbollistlabelfont } @Font value } + } + } + + + def @PHA right x + { + style @Case { + fixed @Yield fixedaheadformat { + { aheadfont @Else fixedaheadfont } @Font + { aheadbreak @Else fixedaheadbreak } @Break x } + varying @Yield varyingaheadformat { + { aheadfont @Else varyingaheadfont } @Font + { aheadbreak @Else varyingaheadbreak } @Break x } + symbol @Yield symbolaheadformat { + { aheadfont @Else symbolaheadfont } @Font + { aheadbreak @Else varyingaheadbreak } @Break x } + } + } + + + def @PHB right x + { + style @Case { + fixed @Yield fixedbheadformat { + { bheadfont @Else fixedbheadfont } @Font + { bheadbreak @Else fixedbheadbreak } @Break x } + varying @Yield varyingbheadformat { + { bheadfont @Else varyingbheadfont } @Font + { bheadbreak @Else varyingbheadbreak } @Break x } + symbol @Yield symbolbheadformat { + { bheadfont @Else symbolbheadfont } @Font + { bheadbreak @Else varyingbheadbreak } @Break x } + } + } + + + def @PHC right x + { + style @Case { + fixed @Yield fixedcheadformat { + { cheadfont @Else fixedcheadfont } @Font + { cheadbreak @Else fixedcheadbreak } @Break x } + varying @Yield varyingcheadformat { + { cheadfont @Else varyingcheadfont } @Font + { cheadbreak @Else varyingcheadbreak } @Break x } + symbol @Yield symbolcheadformat { + { cheadfont @Else symbolcheadfont } @Font + { cheadbreak @Else varyingcheadbreak } @Break x } + } + } + + + def @PFI right x + { + style @Case { + fixed @Yield fixeditalicformat { + { italicfont @Else fixeditalicfont } @Font x } + varying @Yield varyingitalicformat { + { italicfont @Else varyingitalicfont } @Font x } + symbol @Yield symbolitalicformat { + { italicfont @Else symbolitalicfont } @Font x } + } + } + + + def @PFB right x + { + style @Case { + fixed @Yield fixedboldformat { + { boldfont @Else fixedboldfont } @Font x } + varying @Yield varyingboldformat { + { boldfont @Else varyingboldfont } @Font x } + symbol @Yield symbolboldformat { + { boldfont @Else symbolboldfont } @Font x } + } + } + + + def @PFC right x + { + style @Case { + fixed @Yield fixedcodeformat { + { codefont @Else fixedcodefont } @Font x } + varying @Yield varyingcodeformat { + { codefont @Else varyingcodefont } @Font x } + symbol @Yield symbolcodeformat { + { codefont @Else symbolcodefont } @Font x } + } + } + + + def @PFF right x + { + style @Case { + fixed @Yield fixedfileformat { + { filefont @Else fixedfilefont } @Font x } + varying @Yield varyingfileformat { + { filefont @Else varyingfilefont } @Font x } + symbol @Yield symbolfileformat { + { filefont @Else symbolfilefont } @Font x } + } + } + + + def @PFL right x + { + style @Case { + fixed @Yield fixedlinkformat { + { linkfont @Else fixedlinkfont } @Font x } + varying @Yield varyinglinkformat { + { linkfont @Else varyinglinkfont } @Font x } + symbol @Yield symbollinkformat { + { linkfont @Else symbollinkfont } @Font x } + } + } + + + def @PFX right x + { + style @Case { + fixed @Yield fixedindexformat { + { indexfont @Else fixedindexfont } @Font x } + varying @Yield varyingindexformat { + { indexfont @Else varyingindexfont } @Font x } + symbol @Yield symbolindexformat { + { indexfont @Else symbolindexfont } @Font x } + } + } + + + def @A # get characters from the Adobe Symbol font + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + def pl # for formatting line numbers + right x + { + def strut { @VContract { 0.5v @High ^/ / 0.5v @High } } + + strut & style @Case { + fixed @Yield fixedlinenumbersformat { + { linenumbersfont @Else fixedlinenumbersfont } @Font x + } + varying @Yield varyinglinenumbersformat { + { linenumbersfont @Else varyinglinenumbersfont } @Font x + } + symbol @Yield symbollinenumbersformat { + { linenumbersfont @Else symbollinenumbersfont } @Font x + } + } + } + + + macro @PL { // pl } + + + @InitFont @Font @InitBreak @Break @Body + + @End @Pod + +@End @PodSetup diff --git a/include/include/python b/include/include/python new file mode 100644 index 0000000..c39284c --- /dev/null +++ b/include/include/python @@ -0,0 +1,118 @@ +############################################################################### +# # +# Lout setup file for Python program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { pythonf } + + +############################################################################### +# # +# @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 { @PythonSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # numberedblanks { Yes } # No or Yes + # style { varying @OrIfPlain 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # spacing mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/pythonf b/include/include/pythonf new file mode 100644 index 0000000..2d3f77f --- /dev/null +++ b/include/include/pythonf @@ -0,0 +1,450 @@ + +############################################################################### +# # +# Lout @PythonSetup package for formatting Python programs # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +# 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @Python +def @PythonSetup + named pipe { } # pipe through this first + named numbered { No } # want lines numbered? + named blanknumbered { Yes } # blank lines numbered? + named style + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { varying @OrIfPlain 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 @Python + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lPython" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lPython" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 + } + } + } + + + export "'''" + def @PS # for formatting strings + body x + { + def "'''" { "'''" } + + 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 + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + def "''" { "''" } + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @Python + +@End @PythonSetup diff --git a/include/include/report b/include/include/report new file mode 100644 index 0000000..9f58ae5 --- /dev/null +++ b/include/include/report @@ -0,0 +1,506 @@ +############################################################################### +# # +# Lout setup file for technical reports # +# # +# Jeffrey H. Kingston # +# # +# This file has been placed in the public domain by its author. # +# # +# Note: this version, released with Lout Version 3.13, is not upwardly # +# compatible with previous versions: the @Abstract symbol must now # +# be placed before the //, not after. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude commands for standard packages. # +# # +############################################################################### + + @SysInclude { langdefs } # language definitions + @SysInclude { bsf } # BasicSetup package + @SysInclude { dsf } # DocumentSetup package + @SysInclude { reportf } # ReportSetup extension + + +############################################################################### +# # +# @Include command for reading personal definitions from current directory. # +# # +############################################################################### + + @Include { mydefs } + + +############################################################################### +# # +# The @BasicSetup @Use clause - basics, lists, paragraphs, displays. # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@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 + # @InitialBackgroundColour { white } # initial background 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 + # @DisplayIndent { 2.00f @OrIfPlain 5s } # @IndentedDisplay indent + # @DefaultIndent { 0.5rt } # @Display indent + # @DisplayNumStyle { (num) } # style of display numbers + # @WideIndent { 4.00f @OrIfPlain 10s } # @WideTaggedList indent + # @VeryWideIndent { 8.00f @OrIfPlain 20s } # @VeryWideTaggedList indent + # @ListOuterGap { 1.00v @OrIfPlain 1f } # gap before, after lists + # @ListGap { 1.00v @OrIfPlain 1f } # gap between list items + # @ListIndent { 0s } # indent of list items + # @ListRightIndent { 0s } # right indent of list items + # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags + # @ListLabelRight { No } # right-adjust list labels + # @ListLabelRightGap { 2s } # gap when right-adjusting + # @ListFont { } # font of list items + # @ListBreak { } # break style of list items + # @NumberSeparator { . } # separates nums like 2.3.7 + # @CrossLinkFormat { @Body } # format of cross links + # @ExternalLinkFormat { @Body } # format of external links +} + + +############################################################################### +# # +# The @DocumentSetup @Use clause - page layout plus figures, tables, etc. # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@Use { @DocumentSetup + # @PageType { A4 @OrIfPlain Other} # page type (width, height) + # @PageWidth { 80s } # page width if type Other + # @PageHeight { 66f } # page height if type Other + # @PageOrientation { Portrait } # Portrait, Landscape, etc. + # @PageBackground { } # background of each page + # @TopMargin { 2.5c @OrIfPlain 6f } # top margin of all pages + # @FootMargin { 2.5c @OrIfPlain 6f } # bottom margin of all pages + # @OddLeftMargin { 2.5c @OrIfPlain 10s } # left margin of odd pages + # @OddRightMargin { 2.5c @OrIfPlain 10s } # right margin of odd pages + # @EvenLeftMargin { 2.5c @OrIfPlain 10s } # left margin of even pages + # @EvenRightMargin { 2.5c @OrIfPlain 10s } # right margin of even pages + # @OddLeftBodyMargin { 0c } # extra margin for page body + # @OddRightBodyMargin { 0c } # extra margin for page body + # @EvenLeftBodyMargin { 0c } # extra margin for page body + # @EvenRightBodyMargin{ 0c } # extra margin for page body + # @PageBoxType { None } # None Box CurveBox ShadowBox + # @PageBoxMargin { 1.00c } # page box margin + # @PageBoxLineWidth { } # page box line thickness + # @PageBoxPaint { none } # page box paint + # @PageBoxShadow { 0.60c } # shadow margin if ShadowBox + # @PageEnclose { @Body } # enclose every page in this + # @ColumnNumber { 1 } # number of columns (1 to 10) + # @ColumnGap { 1.00c @OrIfPlain 6s } # column gap + + # @FigureLocation { PageTop } # default figure location + # @FigureFormat { @CC @Body } # default figure format + # @FigureWord { figure } # "Figure" word else anything + # @FigureNumbers { Arabic } # method of numbering figures + # @FigureCaptionPos { Below } # Above or Below + # @FigureCaptionFont { -2p } # figure caption font + # @FigureCaptionBreak { adjust hyphen 1.2fx } # figure caption break + # @FigureCaptionFormat{ {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeFigureContents { No } # list of figures at start + + # @TableLocation { PageTop } # default table location + # @TableFormat { @CC @Body } # default table format + # @TableWord { table } # "Table" word else anything + # @TableNumbers { Arabic } # method of numbering tables + # @TableCaptionPos { Below } # Above or Below + # @TableCaptionFont { -2p } # table caption font + # @TableCaptionBreak { adjust hyphen 1.2fx } # table caption break + # @TableCaptionFormat { {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeTableContents { No } # list of tables at start + + # @FloaterLocation { PageTop } # default floater location + # @FloaterFormat { @CC @Body } # default floater format + # @FloaterWord { floater } # "Floater" word else anything + # @FloaterNumbers { Arabic } # method of numbering floaters + # @FloaterCaptionPos { Below } # Above or Below + # @FloaterCaptionFont { -2p } # floater caption font + # @FloaterCaptionBreak{ adjust hyphen 1.2fx } # floater caption break + # @FloaterCaptionFormat{ {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeFloaterContents{ No } # list of floaters at start + + # @MakeContents { No } # make contents? Yes or No + # @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry + # @ContentsGapAbove { 0.80v @OrIfPlain 1f } # extra gap above major entry + # @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry + # @ContentsFont { Bold } # font for major entry + # @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above `part' entry + # @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below `part' entry + # @ContentsFormat { number @DotSep title } # contents entry format + # @ContentsLeader { .. } # leader symbol in contents + # @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders + # @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width + + # @MakeReferences { Yes } # make references? Yes or No + # @RefCiteStyle { [cite] } # citation style + # @RefCiteLabels { @RefNum } # citation items + # @RefNumbers { Arabic } # reference numbers + # @RefListFormat { Labels } # NoLabels, Labels, etc. + # @RefListLabels { [@RefNum] } # ref list label format + # @RefListTitle { references } # title of reference list + # @ChapRefListTitle { references } # title of chapter ref list + # @RefListIndent { 0s } # indent to left of labels + # @RefListRightIndent { 0s } # indent to right of items + # @RefListGap { @ListGap } # gap between ref list items + # @RefListFont { } # font used in reference list + # @RefListBreak { } # break style of ref list + # @RefListLabelWidth { @ListLabelWidth } # Labels column width + # @RefListSortKey { @Tag } # sorting key + + # @MakeGlossary { No } # make glossary? Yes or No + # @GlossaryText { @Null } # glossary initial text + # @GlossaryFont { } # glossary entries font + # @GlossaryBreak { } # glossary entries break + # @GlossaryFormat { +3p @Font @S @Name # glossary entries format + # @Right @I { @Word&&page @PageNum } + # @DP @RawIndentedDisplay @Body } + # @GlossaryGap { @DisplayGap } # gap between glossary entries + # @GlossaryColumnNumber{ 2 } # glossary columns (1 to 10) + # @GlossaryColumnGap { 1.00c @OrIfPlain 6s } # glossary column gap + # @InGlossaryFont { smallcaps } # font for @InGlossary + # @InGlossaryFormat { @Body } # format for @InGlossary + + # @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 + # @IndexFormat { @Body } # @Index format + # @SubIndexFormat { {1f @Wide}@Body } # @SubIndex format + # @SubSubIndexFormat { {2f @Wide}@Body } # @SubSubIndex format + # @IndexTypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexTypeMain { @B @PageNum } # Main pagenum format + # @IndexTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexRangeFormat { @From--@To } # index page range format + # @IndexColumnNumber { 2 } # index columns (1 to 10) + # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap + # @IndexCtd { Yes } # include (ctd.) lines + # @IndexCtdWord { continued } # "ctd." in current lang. + # @IndexCtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexSpacerAbove { 2v } # space above index spacer + # @IndexSpacerBelow { 1v } # space below index spacer + # @IndexSpacerFont { +3p } # font of index spacer + # @IndexSpacerFormat { @Body } # format of index spacer + + # @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 + # @IndexAFormat { @Body } # @IndexA format + # @SubIndexAFormat { {1f @Wide}@Body } # @SubIndexA format + # @SubSubIndexAFormat { {2f @Wide}@Body } # @SubSubIndexA format + # @IndexATypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexATypeMain { @B @PageNum } # Main pagenum format + # @IndexATypeSpecial { @I @PageNum } # Special pagenum format + # @IndexARangeFormat { @From--@To } # index page range format + # @IndexAColumnNumber { 2 } # index A columns (1 to 10) + # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap + # @IndexACtd { Yes } # include (ctd.) lines + # @IndexACtdWord { continued } # "ctd." in current lang. + # @IndexACtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexASpacerAbove { 2v } # space above index A spacer + # @IndexASpacerBelow { 1v } # space below index A spacer + # @IndexASpacerFont { +3p } # font of index A spacer + # @IndexASpacerFormat { @Body } # format of index A spacer + + # @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 + # @IndexBFormat { @Body } # @IndexB format + # @SubIndexBFormat { {1f @Wide}@Body } # @SubIndexB format + # @SubSubIndexBFormat { {2f @Wide}@Body } # @SubSubIndexB format + # @IndexBTypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexBTypeMain { @B @PageNum } # Main pagenum format + # @IndexBTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexBRangeFormat { @From--@To } # index page range format + # @IndexBColumnNumber { 2 } # index B columns (1 to 10) + # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap + # @IndexBCtd { Yes } # include (ctd.) lines + # @IndexBCtdWord { continued } # "ctd." in current lang. + # @IndexBCtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexBSpacerAbove { 2v } # space above index B spacer + # @IndexBSpacerBelow { 1v } # space below index B spacer + # @IndexBSpacerFont { +3p } # font of index B spacer + # @IndexBSpacerFormat { @Body } # format of index B spacer + + # @TopGap { 0.75c @OrIfPlain 2f } # gap between figures + # @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text + + # @FootNoteNumbers { Arabic } # footnote numbers + # @FootNoteThrough { No } # numbered through chapter? + # @FootNoteLocation { ColFoot } # where the footnote appears + # @FootNoteFont { 0.80f } # font for footnotes + # @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes + # @FootNoteFormat { { number &0.05f } @Insert body } # footnote format + # @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line + # @FootAboveGap { @DisplayGap } # gap above footnote line + # @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes + # @MarginNoteFont { 0.80f } # font of margin notes + # @MarginNoteBreak { ragged 1.10fx } # break style of margin notes + # @MarginNoteHGap { 0.5c } # horizontal gap to notes + # @MarginNoteVGap { @DisplayGap } # min vertical gap between + # @MarginNoteWidth { 1.50c } # width of margin notes + # @EndNoteNumbers { Arabic } # endnote numbers + # @EndNoteFont { 0.80f } # font of endnotes + # @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes + # @EndNoteFormat { { number &0.05f } @Insert body } # endnote format + # @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes + + # @TheoremWord { theorem } # "Theorem" word, etc. + # @TheoremTitleFormat { (title) } # only if title present + # @TheoremFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @DefinitionWord { definition } # "Definition" word, etc. + # @DefinitionTitleFormat { (title) } # only if title present + # @DefinitionFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ClaimWord { claim } # "Claim" word, etc. + # @ClaimTitleFormat { (title) } # only if title present + # @ClaimFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @PropositionWord { proposition } # "Proposition" word, etc. + # @PropositionTitleFormat { (title) } # only if title present + # @PropositionFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @LemmaWord { lemma } # "Lemma" word, etc. + # @LemmaTitleFormat { (title) } # only if title present + # @LemmaFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @CorollaryWord { corollary } # "Corollary" word, etc. + # @CorollaryTitleFormat { (title) } # only if title present + # @CorollaryFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ExampleWord { example } # "Example" word, etc. + # @ExampleTitleFormat { (title) } # only if title present + # @ExampleFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ProofWord { proof } # "Proof" word, etc. + + # @PageHeaders { Simple } # None Simple Titles NoTitles + # @PageNumbers { Arabic } # page numbers + # @FirstPageNumber { 1 } # number of first page + # @IntroPageNumbers { Roman } # intro page numbers + # @IntroFirstPageNumber{ 1 } # number of first intro page + # @StructPageNums { No } # make structured page numbers + # @PageNumberFormat { number } # format of all page numbers + + # @OddTop { @Centre{- @PageNum -} } # Simple page headers + # @OddFoot { @Null } + # @EvenTop { @Centre{- @PageNum -} } + # @EvenFoot { @Null } + # @StartOddTop { @Null } + # @StartOddFoot { @Null } + # @StartEvenTop { @Null } + # @StartEvenFoot { @Null } + # @IntroOddTop { @Null } + # @IntroOddFoot { @Centre @PageNum } + # @IntroEvenTop { @Null } + # @IntroEvenFoot { @Centre @PageNum } + # @IntroStartOddTop { @Null } + # @IntroStartOddFoot { @Null } + # @IntroStartEvenTop { @Null } + # @IntroStartEvenFoot { @Null } + + # Titles, NoTitles headers + # @RunningOddTop { @I {@MinorNum @DotSep @MinorTitle} @Right @B @PageNum } + # @RunningOddFoot { @Null } + # @RunningEvenTop { @B @PageNum @Right @I {@MajorNum @DotSep @MajorTitle} } + # @RunningEvenFoot { @Null } + # @RunningStartOddTop { @Null } + # @RunningStartOddFoot { @Centre { Bold 0.8f } @Font @PageNum } + # @RunningStartEvenTop { @Null } + # @RunningStartEvenFoot { @Centre { Bold 0.8f } @Font @PageNum } + # @RunningIntroOddTop { @Null } + # @RunningIntroOddFoot { @Right @PageNum } + # @RunningIntroEvenTop { @Null } + # @RunningIntroEvenFoot { @PageNum } + # @RunningIntroStartOddTop { @Null } + # @RunningIntroStartOddFoot { @Null } + # @RunningIntroStartEvenTop { @Null } + # @RunningIntroStartEvenFoot { @Null } +} + + +############################################################################### +# # +# The @ReportSetup @Use clause - options specific to technical reports. # +# # +############################################################################### + +@Use { @ReportSetup + # @CoverSheet { Yes } # make cover sheet + # @ContentsSeparate { No } # contents on separate pages + # @DateLine { No } # Yes, No, or a date + # @AboveTitleGap { 1i } # space above title + # @TitleFont { Bold } # title font + # @TitleBreak { clines 1.4vx } # title break + # @AuthorFont { Slope } # author font + # @AuthorBreak { clines } # author break + # @InstitutionFont { } # institution font + # @InstitutionBreak { clines } # institution break + # @DateLineFont { } # dateline font + # @DateLineBreak { } # dateline break + # @AbstractDisplay { No } # abstract full width display + # @AbstractFont { } # font of abstract + # @AbstractBreak { } # break style of abstract + # @AbstractFormat { @Centre @Title @DP @Body } # abstract format + # @AbstractTitle { dft } # abstract title (dft is @AbstractWord) + # @ReferencesBeforeAppendices { No } # references before appendices + # @AbstractWord { abstract } # word for "Abstract" + # @ContentsWord { contents } # word for "Contents" + # @AppendixWord { appendix } # word for "Appendix" + # @GlossaryWord { glossary } # word for "Glossary" + # @IndexWord { index } # word for "Index" + # @IndexAWord { index } # word for "Index" (A) + # @IndexBWord { index } # word for "Index" (B) + # @SectionNumbers { Arabic } # kind of section numbers + # @FirstSectionNumber { 1 } # first section num (Arabic) + # @SubSectionNumbers { Arabic } # kind of subsection numbers + # @FirstSubSectionNumber { 1 } # first subsect num (Arabic) + # @SubSubSectionNumbers { Arabic } # kind of sub-subsect numbers + # @FirstSubSubSectionNumber { 1 } # first subsub. num (Arabic) + # @AppendixNumbers { UCAlpha } # kind of appendix numbers + # @FirstAppendixNumber { 1 } # first appendix num (Arabic) + # @SubAppendixNumbers { Arabic } # kind of subappendix numbers + # @FirstSubAppendixNumber { 1 } # first sub-app. num (Arabic) + # @SubSubAppendixNumbers { Arabic } # kind of sub-subapp. numbers + # @FirstSubSubAppendixNumber { 1 } # first sub-sub. num (Arabic) + # @AbstractHeadingFont { Bold } # abstract head font + # @AbstractHeadingBreak { ragged 1.2fx nohyphen } # abstract head break + # @AbstractHeadingFormat { @Centre title } # abstract head fmt + # @ContentsHeadingFont { Bold } # contents head font + # @ContentsHeadingBreak { ragged 1.2fx nohyphen } # contents head break + # @ContentsHeadingFormat { title } # contents head fmt + # @SectionHeadingFont { Bold } # section head font + # @SectionHeadingBreak { ragged 1.2fx nohyphen } # section head break + # @SectionHeadingFormat { number @DotSep title } # section head fmt + # @SubSectionHeadingFont { Bold } # subsection head font + # @SubSectionHeadingBreak { ragged 1.2fx nohyphen } # subsection head break + # @SubSectionHeadingFormat { number @DotSep title } # subsection head fmt + # @SubSubSectionHeadingFont { Slope } # sub-subs. head font + # @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen } # sub-subs. head break + # @SubSubSectionHeadingFormat { number @DotSep title } # sub-subs. head fmt + # @AppendixHeadingFont { Bold } # appendix head font + # @AppendixHeadingBreak { ragged 1.2fx nohyphen } # appendix head break + # @AppendixHeadingFormat { number @DotSep title } # appendix head fmt + # @SubAppendixHeadingFont { Bold } # subapp. head font + # @SubAppendixHeadingBreak { ragged 1.2fx nohyphen } # subapp. head break + # @SubAppendixHeadingFormat { number @DotSep title } # subapp. head fmt + # @SubSubAppendixHeadingFont { Slope } # sub-subapp. head font + # @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen } # sub-subapp head break + # @SubSubAppendixHeadingFormat{ number @DotSep title } # sub-subapp. head fmt + # @ReferencesHeadingFont { Bold } # references head font + # @ReferencesHeadingBreak { ragged 1.2fx nohyphen } # references head break + # @ReferencesHeadingFormat { title } # references head fmt + # @GlossaryHeadingFont { Bold } # glossary head font + # @GlossaryHeadingBreak { ragged 1.2fx nohyphen } # glossary head break + # @GlossaryHeadingFormat { title } # glossary head fmt + # @IndexHeadingFont { Bold } # index head font + # @IndexHeadingBreak { ragged 1.2fx nohyphen } # index head break + # @IndexHeadingFormat { title } # index head fmt + # @IndexAHeadingFont { Bold } # index A head font + # @IndexAHeadingBreak { ragged 1.2fx nohyphen } # index A head break + # @IndexAHeadingFormat { title } # index A head fmt + # @IndexBHeadingFont { Bold } # index B head font + # @IndexBHeadingBreak { ragged 1.2fx nohyphen } # index B head break + # @IndexBHeadingFormat { title } # index B head fmt + # @SectionGap { 2.0v @OrIfPlain 3f } # between sections + # @SubSectionGap { 1.5v @OrIfPlain 2f } # between subsects + # @SubSubSectionGap { 1.5v @OrIfPlain 2f } # between sub-subs. + # @AppendixGap { 2.0v @OrIfPlain 3f } # between appendices + # @SubAppendixGap { 1.5v @OrIfPlain 2f } # between subappendices + # @SubSubAppendixGap { 1.5v @OrIfPlain 2f } # between sub-subapps + # @SectionInContents { Yes } # add sections to contents + # @SubSectionInContents { Yes } # add subsections to contents + # @SubSubSectionInContents { No } # add sub-subsects to contents + # @AppendixInContents { Yes } # add appendices to contents + # @SubAppendixInContents { Yes } # add subappendices to contents + # @SubSubAppendixInContents { No } # add sub-subapps to contents + # @ReferencesInContents { Yes } # add references to contents + # @GlossaryInContents { Yes } # add glossary to contents + # @IndexInContents { Yes } # add index to contents + # @IndexAInContents { Yes } # add index A to contents + # @IndexBInContents { Yes } # add index B to contents + # @SectionContentsIndent { 0f } # contents indent of sections + # @SubSectionContentsIndent { 3f } # contents indent of subsections + # @SubSubSectionContentsIndent{ 6f } # contents indent of sub-subsections + # @AppendixContentsIndent { 0f } # contents indent of appendices + # @SubAppendixContentsIndent { 3f } # contents indent of sub-appendices + # @SubSubAppendixContentsIndent { 6f } # contents indent of sub-sub-appendices + # @ReferencesContentsIndent { 0f } # contents indent of references + # @GlossaryContentsIndent { 0f } # contents indent of glossary + # @IndexContentsIndent { 0f } # contents indent of index + # @IndexAContentsIndent { 0f } # contents indent of index A + # @IndexBContentsIndent { 0f } # contents indent of index B + # @SectionNumInTheorems { No } # theorem num has section num + # @SubSectionNumInTheorems { No } # theorem num has subsect num + # @SubSubSectionNumInTheorems { No } # theorem num has sub-ss. num + # @AppendixNumInTheorems { No } # theorem num has appendix num + # @SubAppendixNumInTheorems { No } # theorem num has sub-app num + # @SubSubAppendixNumInTheorems{ No } # theorem num has sub-sa. num + # @SectionNumInDisplays { Yes } # display num has section num + # @SubSectionNumInDisplays { No } # display num has subsect num + # @SubSubSectionNumInDisplays { No } # display num has sub-ss. num + # @AppendixNumInDisplays { Yes } # display num has appendix num + # @SubAppendixNumInDisplays { No } # display num has sub-app num + # @SubSubAppendixNumInDisplays{ No } # display num has sub-sa. num + # @SectionNumInFigures { No } # figure num has section num + # @SubSectionNumInFigures { No } # figure num has subsect num + # @SubSubSectionNumInFigures { No } # figure num has sub-ss. num + # @AppendixNumInFigures { No } # figure num has appendix num + # @SubAppendixNumInFigures { No } # figure num has sub-app num + # @SubSubAppendixNumInFigures { No } # figure num has sub-sa. num + # @SectionNumInTables { No } # table num has section num + # @SubSectionNumInTables { No } # table num has subsect num + # @SubSubSectionNumInTables { No } # table num has sub-ss. num + # @AppendixNumInTables { No } # table num has appendix num + # @SubAppendixNumInTables { No } # table num has sub-app num + # @SubSubAppendixNumInTables { No } # table num has sub-sa. num + # @SectionNumInFloaters { No } # floater num has section num + # @SubSectionNumInFloaters { No } # floater num has subsect num + # @SubSubSectionNumInFloaters { No } # floater num has sub-ss. num + # @AppendixNumInFloaters { No } # floater num has appendix num + # @SubAppendixNumInFloaters { No } # floater num has sub-app num + # @SubSubAppendixNumInFloaters{ No } # floater num has sub-sa. num + # @SectionNumInRunners { Yes } # runners have section num + # @SubSectionNumInRunners { No } # runners have subsect num + # @SubSubSectionNumInRunners { No } # runners have sub-ss. num + # @AppendixNumInRunners { Yes } # runners have appendix num + # @SubAppendixNumInRunners { No } # runners have sub-app num + # @SubSubAppendixNumInRunners { No } # runners have sub-sa. num + # @FigureContentsPrefix { } # for structured page nums + # @TableContentsPrefix { } # for structured page nums + # @FloaterContentsPrefix { } # for structured page nums + # @SectionPrefix { } # for structured page nums + # @AppendixPrefix { } # for structured page nums + # @ReferencesPrefix { } # for structured page nums + # @GlossaryPrefix { } # for structured page nums + # @IndexPrefix { } # for structured page nums + # @IndexAPrefix { } # for structured page nums + # @IndexBPrefix { } # for structured page nums +} + + +############################################################################### +# # +# @Database (and @SysDatabase) clauses go here. # +# # +############################################################################### + +@SysDatabase @FontDef { fontdefs } # font definitions +@SysDatabase @RefStyle { refstyle } # reference printing styles diff --git a/include/include/reportf b/include/include/reportf new file mode 100644 index 0000000..fceb63a --- /dev/null +++ b/include/include/reportf @@ -0,0 +1,1030 @@ + +########################################################################### +# # +# @ReportSetup extension to @DocumentSetup. # +# # +# Jeffrey H. Kingston # +# # +# This package extends DocumentSetup with definitions for reports. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +########################################################################### + +extend @BasicSetup @DocumentSetup +export @Report @Section @Appendix +def @ReportSetup + named @CoverSheet { Yes } + named @ContentsSeparate { No } + named @DateLine { No } + named @AboveTitleGap { 1i } + named @TitleFont { Bold } + named @TitleBreak { clines 1.4vx } + named @AuthorFont { Slope } + named @AuthorBreak { clines } + named @InstitutionFont { } + named @InstitutionBreak { clines } + named @DateLineFont { } + named @DateLineBreak { } + named @AbstractDisplay { No } + named @AbstractFont { } + named @AbstractBreak { } + named @AbstractFormat + left @Title + right @Body { @Centre @Title @DP @Body } + named @AbstractTitle { dft } + named @ReferencesBeforeAppendices { No } + + named @AbstractWord { abstract } + named @ContentsWord { contents } + named @AppendixWord { appendix } + named @GlossaryWord { glossary } + named @IndexWord { index } + named @IndexAWord { index } + named @IndexBWord { index } + + named @SectionNumbers { Arabic } + named @FirstSectionNumber { 1 } + named @SubSectionNumbers { Arabic } + named @FirstSubSectionNumber { 1 } + named @SubSubSectionNumbers { Arabic } + named @FirstSubSubSectionNumber { 1 } + named @AppendixNumbers { UCAlpha } + named @FirstAppendixNumber { 1 } + named @SubAppendixNumbers { Arabic } + named @FirstSubAppendixNumber { 1 } + named @SubSubAppendixNumbers { Arabic } + named @FirstSubSubAppendixNumber { 1 } + + named @AbstractHeadingFont { Bold } + named @AbstractHeadingBreak { ragged 1.2fx nohyphen } + named @AbstractHeadingFormat + right title { @Centre title } + + named @ContentsHeadingFont { Bold } + named @ContentsHeadingBreak { ragged 1.2fx nohyphen } + named @ContentsHeadingFormat + right title { title } + + named @SectionHeadingFont { Bold } + named @SectionHeadingBreak { ragged 1.2fx nohyphen } + named @SectionHeadingFormat + left number right title { number @DotSep title } + + named @SubSectionHeadingFont { Bold } + named @SubSectionHeadingBreak { ragged 1.2fx nohyphen } + named @SubSectionHeadingFormat + left number right title { number @DotSep title } + + named @SubSubSectionHeadingFont { Slope } + named @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen } + named @SubSubSectionHeadingFormat + left number right title { number @DotSep title } + + named @AppendixHeadingFont { Bold } + named @AppendixHeadingBreak { ragged 1.2fx nohyphen } + named @AppendixHeadingFormat + left number right title { number @DotSep title } + + named @SubAppendixHeadingFont { Bold } + named @SubAppendixHeadingBreak { ragged 1.2fx nohyphen } + named @SubAppendixHeadingFormat + left number right title { number @DotSep title } + + named @SubSubAppendixHeadingFont { Slope } + named @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen } + named @SubSubAppendixHeadingFormat + left number right title { number @DotSep title } + + named @ReferencesHeadingFont { Bold } + named @ReferencesHeadingBreak { ragged 1.2fx nohyphen } + named @ReferencesHeadingFormat + right title { title } + + named @GlossaryHeadingFont { Bold } + named @GlossaryHeadingBreak { ragged 1.2fx nohyphen } + named @GlossaryHeadingFormat + right title { title } + + named @IndexHeadingFont { Bold } + named @IndexHeadingBreak { ragged 1.2fx nohyphen } + named @IndexHeadingFormat + right title { title } + + named @IndexAHeadingFont { Bold } + named @IndexAHeadingBreak { ragged 1.2fx nohyphen } + named @IndexAHeadingFormat + right title { title } + + named @IndexBHeadingFont { Bold } + named @IndexBHeadingBreak { ragged 1.2fx nohyphen } + named @IndexBHeadingFormat + right title { title } + + named @SectionGap { 2.0v @OrIfPlain 3f } + named @SubSectionGap { 1.5v @OrIfPlain 2f } + named @SubSubSectionGap { 1.5v @OrIfPlain 2f } + named @AppendixGap { 2.0v @OrIfPlain 3f } + named @SubAppendixGap { 1.5v @OrIfPlain 2f } + named @SubSubAppendixGap { 1.5v @OrIfPlain 2f } + + named @SectionInContents { Yes } + named @SubSectionInContents { Yes } + named @SubSubSectionInContents { No } + named @AppendixInContents { Yes } + named @SubAppendixInContents { Yes } + named @SubSubAppendixInContents { No } + named @ReferencesInContents { Yes } + named @GlossaryInContents { Yes } + named @IndexInContents { Yes } + named @IndexAInContents { Yes } + named @IndexBInContents { Yes } + + named @SectionContentsIndent { 0f } + named @SubSectionContentsIndent { 3f } + named @SubSubSectionContentsIndent { 6f } + named @AppendixContentsIndent { 0f } + named @SubAppendixContentsIndent { 3f } + named @SubSubAppendixContentsIndent { 6f } + named @ReferencesContentsIndent { 0f } + named @GlossaryContentsIndent { 0f } + named @IndexContentsIndent { 0f } + named @IndexAContentsIndent { 0f } + named @IndexBContentsIndent { 0f } + + named @SectionNumInTheorems { No } + named @SubSectionNumInTheorems { No } + named @SubSubSectionNumInTheorems { No } + named @AppendixNumInTheorems { No } + named @SubAppendixNumInTheorems { No } + named @SubSubAppendixNumInTheorems { No } + + named @SectionNumInDisplays { Yes } + named @SubSectionNumInDisplays { No } + named @SubSubSectionNumInDisplays { No } + named @AppendixNumInDisplays { Yes } + named @SubAppendixNumInDisplays { No } + named @SubSubAppendixNumInDisplays { No } + + named @SectionNumInFigures { No } + named @SubSectionNumInFigures { No } + named @SubSubSectionNumInFigures { No } + named @AppendixNumInFigures { No } + named @SubAppendixNumInFigures { No } + named @SubSubAppendixNumInFigures { No } + + named @SectionNumInTables { No } + named @SubSectionNumInTables { No } + named @SubSubSectionNumInTables { No } + named @AppendixNumInTables { No } + named @SubAppendixNumInTables { No } + named @SubSubAppendixNumInTables { No } + + named @SectionNumInFloaters { No } + named @SubSectionNumInFloaters { No } + named @SubSubSectionNumInFloaters { No } + named @AppendixNumInFloaters { No } + named @SubAppendixNumInFloaters { No } + named @SubSubAppendixNumInFloaters { No } + + named @SectionNumInRunners { Yes } + named @SubSectionNumInRunners { No } + named @SubSubSectionNumInRunners { No } + named @AppendixNumInRunners { Yes } + named @SubAppendixNumInRunners { No } + named @SubSubAppendixNumInRunners { No } + + named @FigureContentsPrefix { } + named @TableContentsPrefix { } + named @FloaterContentsPrefix { } + named @SectionPrefix { } + named @AppendixPrefix { } + named @ReferencesPrefix { } + named @GlossaryPrefix { } + named @IndexPrefix { } + named @IndexAPrefix { } + named @IndexBPrefix { } +@Begin + + ####################################################################### + # # + # Lists of sections, subsections, etc. # + # # + ####################################################################### + + export num + def @SectionList named @Tag {} right num + { + @Galley + //@SectionGap @SectionList @Next num + } + + export num + def @SubSectionList named @Tag {} right num + { + @Galley + //@SubSectionGap @SubSectionList @Next num + } + + export num + def @SubSubSectionList named @Tag {} right num + { + @Galley + //@SubSubSectionGap @SubSubSectionList @Next num + } + + export num + def @AppendixList named @Tag {} right num + { + @Galley + //@AppendixGap @AppendixList @Next num + } + + export num + def @SubAppendixList named @Tag {} right num + { + @Galley + //@SubAppendixGap @SubAppendixList @Next num + } + + export num + def @SubSubAppendixList named @Tag {} right num + { + @Galley + //@SubSubAppendixGap @SubSubAppendixList @Next num + } + + + ####################################################################### + # # + # @Full - this sends text to a full-width place. # + # # + ####################################################################### + + def @Full force into { @FullPlace&&following } right x + { + x + } + + def @NoForceFull into { @FullPlace&&following } right x + { + x + } + + + ####################################################################### + # # + # @Report # + # # + ####################################################################### + + def @Report + named @Title {} + named @Author {} + named @Institution {} + named @DateLine { @DateLine } + named @CoverSheet { @CoverSheet } + named @ContentsSeparate { @ContentsSeparate } + named @AtEnd { dft } + named @InitialFont { @InitialFont } + named @InitialBreak { @InitialBreak } + named @InitialOutdent { @InitialOutdent } + named @InitialSpace { @InitialSpace } + named @InitialLanguage { @InitialLanguage } + named @PageOrientation { @PageOrientation } + named @PageHeaders { @PageHeaders } + named @ColumnNumber { @ColumnNumber } + named @FirstPageNumber { @FirstPageNumber } + named @OptimizePages { @OptimizePages } + named @AbstractDisplay { @AbstractDisplay } + named @AbstractTitle { @AbstractTitle } + named @Abstract {} + named @GlossaryText { @GlossaryText } + named @IndexText { @IndexText } + named @IndexAText { @IndexAText } + named @IndexBText { @IndexBText } + { + + def @Cntr right x + { + x @Case { + "" @Yield @Null + else @Yield { |0.5rt x | } + } + } + + def @DateValue right indent + { + @DateLine @Case { + No @Yield @Null + Yes @Yield @Date + else @Yield @DateLine + } + } + + def @TitleMaterial + { + //@AboveTitleGap + @TitleFont @Font @TitleBreak @Break @Cntr @Title + //1.00v @AuthorFont @Font @AuthorBreak @Break @Cntr @Author + //1.00v @InstitutionFont @Font @InstitutionBreak @Break @Cntr @Institution + //1.00v @DateLineFont @Font @DateLineBreak @Break @Cntr @DateValue + } + + def @AbstractPart + { + def @Title + { + @AbstractHeadingFont @Font @AbstractHeadingBreak @Break + @AbstractHeadingFormat { + @AbstractTitle @Dft { abstract @WordVal @AbstractWord } + } + } + + @Abstract @Case { + + "" @Yield @Null + + else @Yield + { + @AbstractFont @Font @AbstractBreak @Break + @AbstractDisplay @Case { + + No @Yield { @Title @AbstractFormat @Abstract } + + Yes @Yield { |@DisplayIndent + @Title @AbstractFormat @Abstract |@DisplayIndent } + } + } + } + } + + def @ContentsPart + { + // |0.5rt @ContentsHeadingFont @Font @ContentsHeadingBreak @Break + @ContentsHeadingFormat { contents @WordVal @ContentsWord } | + //@DisplayGap @ContentsSection + // NonStart @Runner @MajorTitle {contents @WordVal @ContentsWord} + } + + def @ReferencesPart + named @Tag {} + { + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { @RefHeading @RefListTitle } + sendheader { @Body } + headingfont { @ReferencesHeadingFont } + headingbreak { @ReferencesHeadingBreak } + headingformat { @ReferencesHeadingFormat @Body } + incontents { @ReferencesInContents } + contentsindent { @ReferencesContentsIndent } + majornum {} + majortitle {} + minornum {} + minortitle { @RefHeading @RefListTitle } + prefix { @ReferencesPrefix } + inrunners { Yes } + { //@RefListGap @ReferencesSection } + } + + def @GlossaryPart + named @Tag {} + { + + def @Run + { + NonStart @Runner + @MajorNum {} + @MajorTitle { glossary @WordVal @GlossaryWord } + @MinorNum {} + @MinorTitle {} + @Owner { @Tag } + @Prefix { @GlossaryPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { glossary @WordVal @GlossaryWord } + headingfont { @GlossaryHeadingFont } + headingbreak { @GlossaryHeadingBreak } + headingformat { @GlossaryHeadingFormat @Body } + headingtext { @GlossaryText } + incontents { @GlossaryInContents } + contentsindent { @GlossaryContentsIndent } + prefix { @GlossaryPrefix } + inrunners { Yes } + majornum {} + majortitle {} + minornum {} + minortitle { glossary @WordVal @GlossaryWord } + sendheader { @Full @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @GlossarySection @Run + + } + + def @IndexPart + named @Tag {} + { + + def @Run + { + NonStart @Runner + @MajorNum {} + @MajorTitle { index @WordVal @IndexWord } + @MinorNum {} + @MinorTitle {} + @Owner { @Tag } + @Prefix { @IndexPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { index @WordVal @IndexWord } + headingfont { @IndexHeadingFont } + headingbreak { @IndexHeadingBreak } + headingformat { @IndexHeadingFormat @Body } + headingtext { @IndexText } + incontents { @IndexInContents } + contentsindent { @IndexContentsIndent } + prefix { @IndexPrefix } + inrunners { Yes } + majornum {} + majortitle {} + minornum {} + minortitle { index @WordVal @IndexWord } + sendheader { @Full @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @IndexSection @Run + + } + + def @IndexAPart + named @Tag {} + { + def @Run + { + NonStart @Runner + @MajorNum {} + @MajorTitle { index @WordVal @IndexAWord } + @MinorNum {} + @MinorTitle {} + @Owner { @Tag } + @Prefix { @IndexAPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { index @WordVal @IndexAWord } + headingfont { @IndexAHeadingFont } + headingbreak { @IndexAHeadingBreak } + headingformat { @IndexAHeadingFormat @Body } + headingtext { @IndexAText } + incontents { @IndexAInContents } + contentsindent { @IndexAContentsIndent } + prefix { @IndexAPrefix } + inrunners { Yes } + majornum {} + majortitle {} + minornum {} + minortitle { index @WordVal @IndexAWord } + sendheader { @Full @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @IndexASection @Run + + } + + def @IndexBPart + named @Tag {} + { + def @Run + { + NonStart @Runner + @MajorNum {} + @MajorTitle { index @WordVal @IndexBWord } + @MinorNum {} + @MinorTitle {} + @Owner { @Tag } + @Prefix { @IndexBPrefix } + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { index @WordVal @IndexBWord } + headingfont { @IndexBHeadingFont } + headingbreak { @IndexBHeadingBreak } + headingformat { @IndexBHeadingFormat @Body } + headingtext { @IndexBText } + incontents { @IndexBInContents } + contentsindent { @IndexBContentsIndent } + prefix { @IndexBPrefix } + inrunners { Yes } + majornum {} + majortitle {} + minornum {} + minortitle { index @WordVal @IndexBWord } + sendheader { @Full @Body } + innergap { @SectionGap } + wantindefinite { Yes } + @IndexBSection @Run + + } + + def @ContentsGap + { + @ContentsSeparate @Case { + No @Yield @SectionGap + Yes @Yield 2b + } + } + + def @ReportBodyWithoutCoverSheet force into { @ColPlace&&following } + named @Optimize { @OptimizePages } + { + + Start @Runner + // @AbstractDisplay @NoDo @AbstractPart + //@ContentsGap @ContentsPart + //@ContentsGap @SectionList @FirstSectionNumber + //@SectionGap @ReferencesBeforeAppendices @Do { + @MakeReferences @Do @ReferencesPart + } + //@AppendixGap @AppendixList @FirstAppendixNumber + //@SectionGap @EndFigureList + //@SectionGap @EndNoteList 1 + //@SectionGap @ReferencesBeforeAppendices @NoDo { + @MakeReferences @Do @ReferencesPart + } + // @MakeGlossary @Do @GlossaryPart + // @MakeIndexA @Do @IndexAPart + // @MakeIndexB @Do @IndexBPart + // @MakeIndex @Do @IndexPart + } + + def @ReportCoverSheet into { @IntroColPlace&&preceding } + named @Optimize { @OptimizePages } + { + // Start @Runner + // @TitleMaterial + //@DisplayGap @DP @AbstractPart + } + + def @ReportBodyWithCoverSheet force into { @ColPlace&&preceding } + named @Optimize { @OptimizePages } + { + + Start @Runner + //@ContentsGap @ContentsPart + //@ContentsGap @SectionList @FirstSectionNumber + //@SectionGap @ReferencesBeforeAppendices @Do { + @MakeReferences @Do @ReferencesPart + } + //@AppendixGap @AppendixList @FirstAppendixNumber + //@SectionGap @ReferencesBeforeAppendices @NoDo { + @MakeReferences @Do @ReferencesPart + } + //@SectionGap @EndFigureList + //@SectionGap @EndNoteList 1 + // @MakeGlossary @Do @GlossaryPart + // @MakeIndexA @Do @IndexAPart + // @MakeIndexB @Do @IndexBPart + // @MakeIndex @Do @IndexPart + } + + @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break + @InitialLanguage @Language @InitialSpace @Space + { @ColourCommand @InitialColour } @SetColour + { + @CoverSheet @Case { + + No @Yield { + @FootNoteThrough @Do @BeginFootNoteCounter + // Yes @BeginAllCounters {} + // Yes @BeginDisplayCounter {} + // Yes @BeginFigureCounter {} + // Yes @BeginTableCounter {} + // Yes @BeginFloaterCounter {} + // @AbstractDisplay @Do { @NoForceFull @AbstractPart } + // @ReportBodyWithoutCoverSheet + // @PageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @PageOrientation } + # extra { Yes } + @AtTop { @TitleMaterial } + @FirstPageNumber + // NonStart @Runner + // @AtEnd @Case { + dft @Yield @Null + else @Yield + @EvenPage @Orient { @PageOrientation } @AtEnd + } + } + + Yes @Yield { + @FootNoteThrough @Do @BeginFootNoteCounter + // Yes @BeginAllCounters {} + // Yes @BeginDisplayCounter {} + // Yes @BeginFigureCounter {} + // Yes @BeginTableCounter {} + // Yes @BeginFloaterCounter {} + // @SimpleOddOrEvenIntroPageList + @ColumnNumber { 1 } + @PageHeaders { Simple } + @Orient { @PageOrientation } + 1 + // @ReportCoverSheet + // @PageList + @ColumnNumber { @ColumnNumber } + @PageHeaders { @PageHeaders } + @Orient { @PageOrientation } + # extra { Yes } + @AtTop { @TitleMaterial } + @FirstPageNumber + // @ReportBodyWithCoverSheet + // NonStart @Runner + // @AtEnd @Case { + dft @Yield @Null + else @Yield + @EvenPage @Orient { @PageOrientation } @AtEnd + } + } + } + } + } + + + ####################################################################### + # # + # Sections. # + # # + ####################################################################### + + export @BeginSubSections @EndSubSections @SubSection + def @Section force into { @SectionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage {} + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @EndSubSectionsPlace { @Galley } + + def @EndSubSections force into { @EndSubSectionsPlace&&preceding } + {} + + macro @BeginSubSections + { + //@SubSectionGap @SubSectionList @FirstSubSectionNumber + // @EndSubSectionsPlace // + } + + def @SectionShortNum + { + @SectionNumbers @Then { + @BypassNumber @Dft { + @SectionNumbers @Num @SectionList&&@Tag @Open { num } + } + } + } + + export @BeginSubSubSections @EndSubSubSections @SubSubSection + def @SubSection force into { @SubSectionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @EndSubSubSectionsPlace { @Galley } + + def @EndSubSubSections force into + { @EndSubSubSectionsPlace&&preceding } + {} + + macro @BeginSubSubSections + { + //@SubSubSectionGap @SubSubSectionList @FirstSubSubSectionNumber + // @EndSubSubSectionsPlace // + } + + def @SubSectionShortNum + { + @SubSectionNumbers @Then { + @BypassNumber @Dft { + @SectionShortNum @Join @SubSectionNumbers @Num + { @SubSectionList&&@Tag @Open { num } } + } + } + } + + def @SubSubSection force into { @SubSubSectionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubSubSectionHeadingFont } + headingbreak { @SubSubSectionHeadingBreak } + headingformat { @Num @SubSubSectionHeadingFormat @Body } + incontents { @SubSubSectionInContents } + contentsindent { @SubSubSectionContentsIndent } + numbers { @SubSubSectionNumbers } + attachnum { @SubSubSectionList&&preceding @Tagged @Tag } + retrievenum { @SubSubSectionList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @SubSectionShortNum } + majornum {} + majortitle {} + intheorems { @SubSubSectionNumInTheorems } + indisplays { @SubSubSectionNumInDisplays } + infigures { @SubSubSectionNumInFigures } + intables { @SubSubSectionNumInTables } + infloaters { @SubSubSectionNumInFloaters } + inrunners { @SubSubSectionNumInRunners } + newpage { @NewPage } + @Body + + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubSectionHeadingFont } + headingbreak { @SubSectionHeadingBreak } + headingformat { @Num @SubSectionHeadingFormat @Body } + incontents { @SubSectionInContents } + contentsindent { @SubSectionContentsIndent } + numbers { @SubSectionNumbers } + attachnum { @SubSectionList&&preceding @Tagged @Tag } + retrievenum { @SubSectionList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @SectionShortNum } + majornum {} + majortitle {} + intheorems { @SubSectionNumInTheorems } + indisplays { @SubSectionNumInDisplays } + infigures { @SubSectionNumInFigures } + intables { @SubSectionNumInTables } + infloaters { @SubSectionNumInFloaters } + inrunners { @SubSectionNumInRunners } + newpage { @NewPage } + @Body + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SectionHeadingFont } + headingbreak { @SectionHeadingBreak } + headingformat { @Num @SectionHeadingFormat @Body } + incontents { @SectionInContents } + contentsindent { @SectionContentsIndent } + numbers { @SectionNumbers } + attachnum { @SectionList&&preceding @Tagged @Tag } + retrievenum { @SectionList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @SectionPrefix } + majornum {} + majortitle {} + intheorems { @SectionNumInTheorems } + indisplays { @SectionNumInDisplays } + infigures { @SectionNumInFigures } + intables { @SectionNumInTables } + infloaters { @SectionNumInFloaters } + inrunners { @SectionNumInRunners } + newpage { @NewPage } + @Body + + } + + + ####################################################################### + # # + # Appendices. # + # # + ####################################################################### + + export @BeginSubAppendices @EndSubAppendices @SubAppendix + def @Appendix force into { @AppendixList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage {} + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + def @EndSubAppendicesPlace { @Galley } + + def @EndSubAppendices force into { @EndSubAppendicesPlace&&preceding } + {} + + macro @BeginSubAppendices + { + //@SubAppendixGap @SubAppendixList @FirstSubAppendixNumber + // @EndSubAppendicesPlace // + } + + def @AppendixShortNum + { + @AppendixNumbers @Then { + @BypassNumber @Dft { + @AppendixNumbers @Num @AppendixList&&@Tag @Open { num } + } + } + } + + def @AppendixLongNum + { + @AppendixNumbers @Then { + @InitialLanguage @Language { + appendix @WordVal @AppendixWord @AppendixShortNum + } + } + } + + export @BeginSubSubAppendices @EndSubSubAppendices @SubSubAppendix + def @SubAppendix force into { @SubAppendixList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + def @EndSubSubAppendicesPlace { @Galley } + + def @EndSubSubAppendices force into + { @EndSubSubAppendicesPlace&&preceding } + {} + + macro @BeginSubSubAppendices + { + //@SubSubAppendixGap + @SubSubAppendixList @FirstSubSubAppendixNumber + // @EndSubSubAppendicesPlace // + } + + def @SubAppendixShortNum + { + @SubAppendixNumbers @Then { + @BypassNumber @Dft { + @AppendixShortNum @Join @SubAppendixNumbers @Num + { @SubAppendixList&&@Tag @Open { num } } + } + } + } + + def @SubSubAppendix force into { @SubSubAppendixList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + named @NewPage { No } + body @Body + { + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubSubAppendixHeadingFont } + headingbreak { @SubSubAppendixHeadingBreak } + headingformat { @Num @SubSubAppendixHeadingFormat @Body } + incontents { @SubSubAppendixInContents } + contentsindent { @SubSubAppendixContentsIndent } + numbers { @SubSubAppendixNumbers } + attachnum { @SubSubAppendixList&&preceding @Tagged @Tag } + retrievenum { @SubSubAppendixList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @SubAppendixShortNum } + majornum {} + majortitle {} + intheorems { @SubSubAppendixNumInTheorems } + indisplays { @SubSubAppendixNumInDisplays } + infigures { @SubSubAppendixNumInFigures } + intables { @SubSubAppendixNumInTables } + infloaters { @SubSubAppendixNumInFloaters } + inrunners { @SubSubAppendixNumInRunners } + newpage { @NewPage } + @Body + + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubAppendixHeadingFont } + headingbreak { @SubAppendixHeadingBreak } + headingformat { @Num @SubAppendixHeadingFormat @Body } + incontents { @SubAppendixInContents } + contentsindent { @SubAppendixContentsIndent } + numbers { @SubAppendixNumbers } + attachnum { @SubAppendixList&&preceding @Tagged @Tag } + retrievenum { @SubAppendixList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @AppendixShortNum } + majornum {} + majortitle {} + intheorems { @SubAppendixNumInTheorems } + indisplays { @SubAppendixNumInDisplays } + infigures { @SubAppendixNumInFigures } + intables { @SubAppendixNumInTables } + infloaters { @SubAppendixNumInFloaters } + inrunners { @SubAppendixNumInRunners } + newpage { @NewPage } + @Body + + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @AppendixHeadingFont } + headingbreak { @AppendixHeadingBreak } + headingformat { @Num @AppendixHeadingFormat @Body } + incontents { @AppendixInContents } + contentsindent { @AppendixContentsIndent } + word { appendix @WordVal @AppendixWord } + numbers { @AppendixNumbers } + attachnum { @AppendixList&&preceding @Tagged @Tag } + retrievenum { @AppendixList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @AppendixPrefix } + majornum {} + majortitle {} + intheorems { @AppendixNumInTheorems } + indisplays { @AppendixNumInDisplays } + infigures { @AppendixNumInFigures } + intables { @AppendixNumInTables } + infloaters { @AppendixNumInFloaters } + inrunners { Yes } + newpage { @NewPage } + @Body + } + +@End @ReportSetup diff --git a/include/include/rsl b/include/include/rsl new file mode 100644 index 0000000..0bfa138 --- /dev/null +++ b/include/include/rsl @@ -0,0 +1,119 @@ +# Hey Emacs, this is -*- lout -*- ! +############################################################################### +# # +# Lout setup file for RSL program printing # +# # +# Version 1.0 # +# Darren Bane # +# 18 February 2003 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { rslf } + + +############################################################################### +# # +# @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 { @RSLSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # numberedblanks { Yes } # No or Yes + # style { symbol @OrIfPlain 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # spacing mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/rslf b/include/include/rslf new file mode 100644 index 0000000..1d8e937 --- /dev/null +++ b/include/include/rslf @@ -0,0 +1,504 @@ +# Hey Emacs, this is -*- lout -*- ! +############################################################################### +# # +# Lout @RSLSetup package for formatting RSL programs # +# # +# Version 1.0 # +# Darren Bane # +# 18 February 2003 # +# # +# 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @RSL +def @RSLSetup + named pipe { } # pipe through this first + named numbered { No } # want lines numbered? + named blanknumbered { Yes } # blank lines numbered? + named style + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { symbol @OrIfPlain 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 + @FA @A @PartialFn @Map @PartialMap @IntChoice @ExtChoice @InfList @Interlock "$>" + + def @RSL + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lRSL" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lRSL" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 + { + x @Case { + "is" @Yield @Sym equivalence + "exists" @Yield @Sym existential + "all" @Yield @Sym universal + else @Yield 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 @FA # for formatting characters from the Adobe Symbol font + left sym + right x + { + style @Case { + symbol @Yield { sym } + else @Yield { x } + } + } + + + def @A # get characters from the Adobe Symbol font + named sym {} + right x + { + { { Symbol Base } @Font @Char sym } @FA x + } + + + # the following are any sizeable symbols for RSL + # i figure they're easier to maintain here than in prg2lout.c + def @PartialFn # -~-> + { + @OneRow { &0.2fo @Sym similar ^/0.07f @Sym arrowright } + } + + + def @Map # -m-> + { + @OneRow { @Sym arrowright ^/0.07f &0.2fo 0.7f @Font @I m } + } + + + def @PartialMap # -~m-> + { + @OneRow { &0.2fo @Sym similar ^/0.07f @Sym arrowright /0.07f &0.2fo 0.7f @Font @I m } + } + + + def @IntChoice # |^| + { + @Sym bracketlefttp &0.5wo @Sym bracketrighttp + } + + + def @ExtChoice # |=| + { + { @Sym bracketlefttp &0.0fo @Sym bracketleftbt } &0.5wo + { @Sym bracketrighttp &0.0fo @Sym bracketrightbt } + } + + + def @InfList # -inflist + { + @Sup { @Sym omega } + } + + + def @Interlock # ++ + { + { -- } &0.1fo { "||" } + } + + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @RSL + +@End @RSLSetup diff --git a/include/include/ruby b/include/include/ruby new file mode 100644 index 0000000..76ae107 --- /dev/null +++ b/include/include/ruby @@ -0,0 +1,118 @@ +############################################################################### +# # +# Lout setup file for Ruby program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { rubyf } + + +############################################################################### +# # +# @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 { @RubySetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # numberedblanks { Yes } # No or Yes + style { fixed @OrIfPlain fixed } # fixed, varying, or symbol + + # the following options apply when style is "fixed" + + # fixedfont { LetterGothic } # font family + # fixedsize { -1.0p } # font size + # fixedline { 1.0vx } # line-space + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # fixedtabin { 8 } # tab interval + # fixedtabout { 8s } # tab width + + # fixedidentifiers { Base } # identifier face + # fixedkeywords { Bold } # keyword face + # fixedoperators { Base } # operator face + # fixednumbers { Base } # number face + # fixedstrings { Base } # string face + # fixedcomments { Slope } # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # spacing mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/rubyf b/include/include/rubyf new file mode 100644 index 0000000..e4636d7 --- /dev/null +++ b/include/include/rubyf @@ -0,0 +1,449 @@ + +############################################################################### +# # +# Lout @RubySetup package for formatting Ruby programs # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +# 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @Ruby +def @RubySetup + named pipe { } # pipe through this first + named numbered { No } # want lines numbered? + named blanknumbered { Yes } # blank lines numbered? + named style + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { varying @OrIfPlain 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + named fixedtabin { 8 } # tab interval + named fixedtabout { 8s } # tab width + + named fixedidentifiers { Base } # identifier face + named fixedkeywords { Bold } # keyword face + named fixedoperators { Base } # operator face + named fixednumbers { Base } # number face + named fixedstrings { Base } # string face + named fixedcomments { Slope } # 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 @Ruby + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lRuby" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lRuby" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 + } + } + } + + + export "'''" + def @PS # for formatting strings + body x + { + def "'''" { "'''" } + + 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 + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @Ruby + +@End @RubySetup diff --git a/include/include/russian b/include/include/russian new file mode 100644 index 0000000..0652a61 --- /dev/null +++ b/include/include/russian @@ -0,0 +1,12 @@ +################################################################# +# # +# russian # +# # +# This file includes everything you need for Russian. # +# # +# This file has been placed in the public domain. # +# # +################################################################# + +# Commented out because these fonts are not distributed with Lout. +# @SysInclude { russian.fd } diff --git a/include/include/russian.fd b/include/include/russian.fd new file mode 100644 index 0000000..5a790cb --- /dev/null +++ b/include/include/russian.fd @@ -0,0 +1,40 @@ +################################################################################################################## +# # +# Russian font definitions. Use a very wide window to see them clearly. # +# # +# This file has been placed in the public domain by its author. # +# # +# Lout font Lout font PostScript PostScript font metrics Lout character Recode/ # +# family name face name font name (formerly .AFM) file name mapping file NoRecode # +# # +################################################################################################################## + +fontdef Academy Base { Academy Aca koi8r.LCM Recode } +fontdef Academy Slope { Academy-Italic Aca-It koi8r.LCM Recode } +fontdef Academy Bold { Academy-Bold Aca-Bd koi8r.LCM Recode } +fontdef Academy BoldSlope { Academy-Italic Aca-It koi8r.LCM Recode } +fontdef Academy Italic { Academy-Italic Aca-It koi8r.LCM Recode } + +fontdef Antiqua Base { Antiqua Ant koi8r.LCM Recode } +fontdef Antiqua Slope { Antiqua-Italic Ant-It koi8r.LCM Recode } +fontdef Antiqua Bold { Antiqua-Bold Ant-Bd koi8r.LCM Recode } +fontdef Antiqua BoldSlope { Antiqua-Italic Ant-It koi8r.LCM Recode } +fontdef Antiqua Italic { Antiqua-Italic Ant-It koi8r.LCM Recode } + +fontdef College Base { College Col koi8r.LCM Recode } +fontdef College Slope { College-Italic Col-It koi8r.LCM Recode } +fontdef College Bold { College-Bold Col-Bd koi8r.LCM Recode } +fontdef College BoldSlope { College-Italic Col-It koi8r.LCM Recode } +fontdef College Italic { College-Italic Col-It koi8r.LCM Recode } + +fontdef Magazine Base { Magazine Mag koi8r.LCM Recode } +fontdef Magazine Slope { Magazine-Italic Mag-It koi8r.LCM Recode } +fontdef Magazine Bold { Magazine-Bold Mag-Bd koi8r.LCM Recode } +fontdef Magazine BoldSlope { Magazine-Italic Mag-It koi8r.LCM Recode } +fontdef Magazine Italic { Magazine-Italic Mag-It koi8r.LCM Recode } + +fontdef Textbook Base { Textbook Txt koi8r.LCM Recode } +fontdef Textbook Slope { Textbook-Italic Txt-It koi8r.LCM Recode } +fontdef Textbook Bold { Textbook-Bold Txt-Bd koi8r.LCM Recode } +fontdef Textbook BoldSlope { Textbook-Italic Txt-It koi8r.LCM Recode } +fontdef Textbook Italic { Textbook-Italic Txt-It koi8r.LCM Recode } diff --git a/include/include/slides b/include/include/slides new file mode 100644 index 0000000..d1136fb --- /dev/null +++ b/include/include/slides @@ -0,0 +1,412 @@ +############################################################################### +# # +# Lout setup file for overhead transparencies # +# # +# Jeffrey H. Kingston # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude commands for standard packages. # +# # +############################################################################### + + @SysInclude { langdefs } # language definitions + @SysInclude { bsf } # BasicSetup package + @SysInclude { dsf } # DocumentSetup package + @SysInclude { slidesf } # OverheadSetup extension + + +############################################################################### +# # +# @Include command for reading personal definitions from current directory. # +# # +############################################################################### + + @Include { mydefs } + + +############################################################################### +# # +# The @BasicSetup @Use clause - basics, lists, paragraphs, displays. # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@Use { @BasicSetup + # @InitialFont { Times Base 12p } # initial font + @InitialFont { Times Base 20p } # initial font + # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}} + @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 + # @InitialBackgroundColour { white } # initial background 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 + # @DisplayIndent { 2.00f @OrIfPlain 5s } # @IndentedDisplay indent + # @DefaultIndent { 0.5rt } # @Display indent + # @DisplayNumStyle { (num) } # style of display numbers + # @WideIndent { 4.00f @OrIfPlain 10s } # @WideTaggedList indent + # @VeryWideIndent { 8.00f @OrIfPlain 20s } # @VeryWideTaggedList indent + # @ListOuterGap { 1.00v @OrIfPlain 1f } # gap before, after lists + # @ListGap { 1.00v @OrIfPlain 1f } # gap between list items + # @ListIndent { 0s } # indent of list items + # @ListRightIndent { 0s } # right indent of list items + # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags + # @ListLabelRight { No } # right-adjust list labels + # @ListLabelRightGap { 2s } # gap when right-adjusting + # @ListFont { } # font of list items + # @ListBreak { } # break style of list items + # @NumberSeparator { . } # separates nums like 2.3.7 + # @CrossLinkFormat { @Body } # format of cross links + # @ExternalLinkFormat { @Body } # format of external links +} + + +############################################################################### +# # +# The @DocumentSetup @Use clause - page layout plus figures, tables, etc. # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@Use { @DocumentSetup + # @PageType { A4 @OrIfPlain Other} # page type (width, height) + # @PageWidth { 80s } # page width if type Other + # @PageHeight { 66f } # page height if type Other + # @PageOrientation { Portrait } # Portrait, Landscape, etc. + # @PageBackground { } # background of each page + # @TopMargin { 2.5c @OrIfPlain 6f } # top margin of all pages + # @FootMargin { 2.5c @OrIfPlain 6f } # bottom margin of all pages + @FootMargin { 5.00c } # bottom margin of all pages + # @OddLeftMargin { 2.5c @OrIfPlain 10s } # left margin of odd pages + # @OddRightMargin { 2.5c @OrIfPlain 10s } # right margin of odd pages + # @EvenLeftMargin { 2.5c @OrIfPlain 10s } # left margin of even pages + # @EvenRightMargin { 2.5c @OrIfPlain 10s } # right margin of even pages + # @OddLeftBodyMargin { 0c } # extra margin for page body + # @OddRightBodyMargin { 0c } # extra margin for page body + # @EvenLeftBodyMargin { 0c } # extra margin for page body + # @EvenRightBodyMargin{ 0c } # extra margin for page body + # @PageBoxType { None } # None Box CurveBox ShadowBox + # @PageBoxMargin { 1.00c } # page box margin + # @PageBoxLineWidth { } # page box line thickness + # @PageBoxPaint { none } # page box paint + # @PageBoxShadow { 0.60c } # shadow margin if ShadowBox + # @PageEnclose { @Body } # enclose every page in this + # @ColumnNumber { 1 } # number of columns (1 to 10) + # @ColumnGap { 1.00c @OrIfPlain 6s } # column gap + + # @FigureLocation { PageTop } # default figure location + # @FigureFormat { @CC @Body } # default figure format + # @FigureWord { figure } # "Figure" word else anything + # @FigureNumbers { Arabic } # method of numbering figures + # @FigureCaptionPos { Below } # Above or Below + # @FigureCaptionFont { -2p } # figure caption font + # @FigureCaptionBreak { adjust hyphen 1.2fx } # figure caption break + # @FigureCaptionFormat{ {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeFigureContents { No } # list of figures at start + + # @TableLocation { PageTop } # default table location + # @TableFormat { @CC @Body } # default table format + # @TableWord { table } # "Table" word else anything + # @TableNumbers { Arabic } # method of numbering tables + # @TableCaptionPos { Below } # Above or Below + # @TableCaptionFont { -2p } # table caption font + # @TableCaptionBreak { adjust hyphen 1.2fx } # table caption break + # @TableCaptionFormat { {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeTableContents { No } # list of tables at start + + # @FloaterLocation { PageTop } # default floater location + # @FloaterFormat { @CC @Body } # default floater format + # @FloaterWord { floater } # "Floater" word else anything + # @FloaterNumbers { Arabic } # method of numbering floaters + # @FloaterCaptionPos { Below } # Above or Below + # @FloaterCaptionFont { -2p } # floater caption font + # @FloaterCaptionBreak{ adjust hyphen 1.2fx } # floater caption break + # @FloaterCaptionFormat{ {@B { word @NumSep number. &2s }} @Insert caption } + # @MakeFloaterContents{ No } # list of floaters at start + + # @MakeContents { No } # make contents? Yes or No + # @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry + @ContentsGapAbove { 0.00v @OrIfPlain 1f } # extra gap above major entry + # @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry + @ContentsFont { Base } # font for major entry + # @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above `part' entry + # @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below `part' entry + # @ContentsFormat { number @DotSep title } # contents entry format + # @ContentsLeader { .. } # leader symbol in contents + # @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders + # @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width + + # @MakeReferences { Yes } # make references? Yes or No + # @RefCiteStyle { [cite] } # citation style + # @RefCiteLabels { @RefNum } # citation items + # @RefNumbers { Arabic } # reference numbers + # @RefListFormat { Labels } # NoLabels, Labels, etc. + # @RefListLabels { [@RefNum] } # ref list label format + # @RefListTitle { references } # title of reference list + # @ChapRefListTitle { references } # title of chapter ref list + # @RefListIndent { 0s } # indent to left of labels + # @RefListRightIndent { 0s } # indent to right of items + # @RefListGap { @ListGap } # gap between ref list items + # @RefListFont { } # font used in reference list + # @RefListBreak { } # break style of ref list + # @RefListLabelWidth { @ListLabelWidth } # Labels column width + # @RefListSortKey { @Tag } # sorting key + + # @MakeGlossary { No } # make glossary? Yes or No + # @GlossaryText { @Null } # glossary initial text + # @GlossaryFont { } # glossary entries font + # @GlossaryBreak { } # glossary entries break + # @GlossaryFormat { +3p @Font @S @Name # glossary entries format + # @Right @I { @Word&&page @PageNum } + # @DP @RawIndentedDisplay @Body } + # @GlossaryGap { @DisplayGap } # gap between glossary entries + # @GlossaryColumnNumber{ 2 } # glossary columns (1 to 10) + # @GlossaryColumnGap { 1.00c @OrIfPlain 6s } # glossary column gap + # @InGlossaryFont { smallcaps } # font for @InGlossary + # @InGlossaryFormat { @Body } # format for @InGlossary + + # @MakeIndex { No } # make index? Yes or No + # @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 + # @IndexFormat { @Body } # @Index format + # @SubIndexFormat { {1f @Wide}@Body } # @SubIndex format + # @SubSubIndexFormat { {2f @Wide}@Body } # @SubSubIndex format + # @IndexTypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexTypeMain { @B @PageNum } # Main pagenum format + # @IndexTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexRangeFormat { @From--@To } # index page range format + # @IndexColumnNumber { 2 } # index columns (1 to 10) + # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap + # @IndexCtd { Yes } # include (ctd.) lines + # @IndexCtdWord { continued } # "ctd." in current lang. + # @IndexCtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexSpacerAbove { 2v } # space above index spacer + # @IndexSpacerBelow { 1v } # space below index spacer + # @IndexSpacerFont { +3p } # font of index spacer + # @IndexSpacerFormat { @Body } # format of index spacer + + # @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 + # @IndexAFormat { @Body } # @IndexA format + # @SubIndexAFormat { {1f @Wide}@Body } # @SubIndexA format + # @SubSubIndexAFormat { {2f @Wide}@Body } # @SubSubIndexA format + # @IndexATypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexATypeMain { @B @PageNum } # Main pagenum format + # @IndexATypeSpecial { @I @PageNum } # Special pagenum format + # @IndexARangeFormat { @From--@To } # index page range format + # @IndexAColumnNumber { 2 } # index A columns (1 to 10) + # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap + # @IndexACtd { Yes } # include (ctd.) lines + # @IndexACtdWord { continued } # "ctd." in current lang. + # @IndexACtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexASpacerAbove { 2v } # space above index A spacer + # @IndexASpacerBelow { 1v } # space below index A spacer + # @IndexASpacerFont { +3p } # font of index A spacer + # @IndexASpacerFormat { @Body } # format of index A spacer + + # @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 + # @IndexBFormat { @Body } # @IndexB format + # @SubIndexBFormat { {1f @Wide}@Body } # @SubIndexB format + # @SubSubIndexBFormat { {2f @Wide}@Body } # @SubSubIndexB format + # @IndexBTypeOrdinary { @PageNum } # Ordinary pagenum format + # @IndexBTypeMain { @B @PageNum } # Main pagenum format + # @IndexBTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexBRangeFormat { @From--@To } # index page range format + # @IndexBColumnNumber { 2 } # index B columns (1 to 10) + # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap + # @IndexBCtd { Yes } # include (ctd.) lines + # @IndexBCtdWord { continued } # "ctd." in current lang. + # @IndexBCtdFormat { @Body @I (@CtdWord) } # format of ctd. + # @IndexBSpacerAbove { 2v } # space above index B spacer + # @IndexBSpacerBelow { 1v } # space below index B spacer + # @IndexBSpacerFont { +3p } # font of index B spacer + # @IndexBSpacerFormat { @Body } # format of index B spacer + + # @TopGap { 0.75c @OrIfPlain 2f } # gap between figures + # @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text + + # @FootNoteNumbers { Arabic } # footnote numbers + # @FootNoteThrough { No } # numbered through chapter? + # @FootNoteLocation { ColFoot } # where the footnote appears + # @FootNoteFont { 0.80f } # font for footnotes + # @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes + # @FootNoteFormat { { number &0.05f } @Insert body } # footnote format + # @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line + # @FootAboveGap { @DisplayGap } # gap above footnote line + # @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes + # @MarginNoteFont { 0.80f } # font of margin notes + # @MarginNoteBreak { ragged 1.10fx } # break style of margin notes + # @MarginNoteHGap { 0.5c } # horizontal gap to notes + # @MarginNoteVGap { @DisplayGap } # min vertical gap between + # @MarginNoteWidth { 1.50c } # width of margin notes + # @EndNoteNumbers { Arabic } # endnote numbers + # @EndNoteFont { 0.80f } # font of endnotes + # @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes + # @EndNoteFormat { { number &0.05f } @Insert body } # endnote format + # @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes + + # @TheoremWord { theorem } # "Theorem" word, etc. + # @TheoremTitleFormat { (title) } # only if title present + # @TheoremFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @DefinitionWord { definition } # "Definition" word, etc. + # @DefinitionTitleFormat { (title) } # only if title present + # @DefinitionFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ClaimWord { claim } # "Claim" word, etc. + # @ClaimTitleFormat { (title) } # only if title present + # @ClaimFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @PropositionWord { proposition } # "Proposition" word, etc. + # @PropositionTitleFormat { (title) } # only if title present + # @PropositionFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @LemmaWord { lemma } # "Lemma" word, etc. + # @LemmaTitleFormat { (title) } # only if title present + # @LemmaFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @CorollaryWord { corollary } # "Corollary" word, etc. + # @CorollaryTitleFormat { (title) } # only if title present + # @CorollaryFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ExampleWord { example } # "Example" word, etc. + # @ExampleTitleFormat { (title) } # only if title present + # @ExampleFormat { {@B { word @NumSep number title: } &2s} @Insert body } + # @ProofWord { proof } # "Proof" word, etc. + + # @PageHeaders { Simple } # None Simple Titles NoTitles + @PageHeaders { Titles } # None Simple Titles NoTitles + # @PageNumbers { Arabic } # page numbers + # @FirstPageNumber { 1 } # number of first page + # @IntroPageNumbers { Roman } # intro page numbers + # @IntroFirstPageNumber{ 1 } # number of first intro page + # @StructPageNums { No } # make structured page numbers + # @PageNumberFormat { number } # format of all page numbers + + # @OddTop { @Centre{- @PageNum -} } # Simple page headers + # @OddFoot { @Null } + # @EvenTop { @Centre{- @PageNum -} } + # @EvenFoot { @Null } + # @StartOddTop { @Null } + # @StartOddFoot { @Null } + # @StartEvenTop { @Null } + # @StartEvenFoot { @Null } + # @IntroOddTop { @Null } + # @IntroOddFoot { @Centre @PageNum } + # @IntroEvenTop { @Null } + # @IntroEvenFoot { @Centre @PageNum } + # @IntroStartOddTop { @Null } + # @IntroStartOddFoot { @Null } + # @IntroStartEvenTop { @Null } + # @IntroStartEvenFoot { @Null } + + # Titles, NoTitles headers + # @RunningOddTop { @I {@MinorNum @DotSep @MinorTitle} @Right @B @PageNum } + @RunningOddTop { 8p @Font {@MajorTitle @MinorNum @Right @PageNum} } + # @RunningOddFoot { @Null } + @RunningOddFoot { @Null } + # @RunningEvenTop { @B @PageNum @Right @I {@MajorNum @DotSep @MajorTitle} } + @RunningEvenTop { 8p @Font {@MajorTitle @MinorNum @Right @PageNum} } + # @RunningEvenFoot { @Null } + @RunningEvenFoot { @Null } + # @RunningStartOddTop { @Null } + @RunningStartOddTop { 8p @Font { @MajorTitle @MinorNum @Right @PageNum } } + # @RunningStartOddFoot { @Centre { Bold 0.8f } @Font @PageNum } + @RunningStartOddFoot { @Null } + # @RunningStartEvenTop { @Null } + @RunningStartEvenTop { 8p @Font { @MajorTitle @MinorNum @Right @PageNum } } + # @RunningStartEvenFoot { @Centre { Bold 0.8f } @Font @PageNum } + @RunningStartEvenFoot { @Null } + # @RunningIntroOddTop { @Null } + # @RunningIntroOddFoot { @Right @PageNum } + # @RunningIntroEvenTop { @Null } + # @RunningIntroEvenFoot { @PageNum } + # @RunningIntroStartOddTop { @Null } + # @RunningIntroStartOddFoot { @Null } + # @RunningIntroStartEvenTop { @Null } + # @RunningIntroStartEvenFoot { @Null } +} + + +############################################################################### +# # +# The @OverheadSetup @Use clause - options specific to overheads. # +# # +############################################################################### + +@Use { @OverheadSetup + # @DateLine { No } # No, Yes, or a date + # @ContentsWord { contents } # word for "Contents" + # @LectureWord { lecture } # word for "Lecture" + # @OverheadWord { } # word for "Overhead" + # @LectureNumbers { Arabic } # kind of lecture numbers + # @FirstLectureNumber { 1 } # first lecture num + # @OverheadNumbers { Arabic } # kind of overhead numbers + # @FirstOverheadNumber { 1 } # first overhead num + # @TitlePageFont { Helvetica Base 1.5f } # title page font + # @TitleFormat { @Center clines @Break title } # title line + # @AuthorFormat { @Center clines @Break author } # author line + # @InstitutionFormat { @Center clines @Break @I institution } # inst + # @DateLineFormat { @Center date } # date line + # @AboveTitleGap { 0.5i } # gap above title + # @AboveAuthorGap { 1.0i } # gap above author + # @AboveInstitutionGap { 0.5i } # gap above inst + # @AboveDateLineGap { 0.5i } # gap above date + # @LectureHeadingFont { Bold 1.2f } # lecture head font + # @LectureHeadingBreak { clines 1.2fx nohyphen } # lecture head break + # @LectureHeadingFormat { @Centre number @DP @Centre title @DP } + # @AboveLectureGap { 3.0f } # gap above lec head + # @OverheadHeadingFont { Bold } # overhead head font + # @OverheadHeadingBreak { 1.2fx nohyphen } # overhead head break + # @OverheadHeadingFormat { @Centre title @DP } # overhead head format + # @OverheadFormat { @Body } # overhead body format + # @AboveOverheadGap { 1.0f } # gap above over head + # @LectureInContents { Yes } # add lectures to contents + # @OverheadInContents { No } # add overheads to contents + # @ReferencesInContents { Yes } # add references to contents + # @LectureContentsIndent { 0f } # contents indent of lectures + # @OverheadInLectureContentsIndent { 2f } # .. of overhead within lec + # @OverheadContentsIndent { 0f } # .. of stand-alone overhead + # @ReferencesContentsIndent { 0f } # .. of references + # @LectureNumInTheorems { Yes } # theorem num has lecture num + # @OverheadNumInTheorems { No } # theorem num has overhead num + # @LectureNumInDisplays { Yes } # display num has lecture num + # @OverheadNumInDisplays { No } # display num has overhead num + # @LectureNumInFigures { Yes } # figure num has lecture num + # @OverheadNumInFigures { No } # figure num has overhead num + # @LectureNumInTables { Yes } # table num has lecture num + # @OverheadNumInTables { No } # table num has overhead num + # @LectureNumInFloaters { Yes } # floater num has lecture num + # @OverheadNumInFloaters { No } # floater num has overhead num + # @LectureNumInRunners { Yes } # running head has lecture num + # @OverheadNumInRunners { Yes } # running head has overhd num + # @LecturePrefix { } # for structured page nums + # @OverheadPrefix { } # for structured page nums +} + + +############################################################################### +# # +# @Database (and @SysDatabase) clauses go here. # +# # +############################################################################### + +@SysDatabase @FontDef { fontdefs } # font definitions +@SysDatabase @RefStyle { refstyle } # reference printing styles diff --git a/include/include/slidesf b/include/include/slidesf new file mode 100644 index 0000000..0759817 --- /dev/null +++ b/include/include/slidesf @@ -0,0 +1,414 @@ + +########################################################################### +# # +# @OverheadSetup extension to @DocumentSetup. # +# # +# Jeffrey H. Kingston # +# # +# This package extends DocumentSetup with definitions for overheads. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +########################################################################### + +extend @BasicSetup @DocumentSetup +export @OverheadTransparencies @Lecture @Overhead +def @OverheadSetup + named @DateLine { No } + named @ContentsWord { contents } + named @LectureWord { lecture } + named @OverheadWord { } + named @LectureNumbers { Arabic } + named @FirstLectureNumber { 1 } + named @OverheadNumbers { Arabic } + named @FirstOverheadNumber { 1 } + named @TitlePageFont { Helvetica Base } + named @TitleFormat + right title { @Center clines @Break title } + named @AuthorFormat + right author { @Center clines @Break author } + named @InstitutionFormat + right institution { @Center clines @Break @I institution } + named @DateLineFormat + right date { @Center date } + named @AboveTitleGap { 0.5i } + named @AboveAuthorGap { 1.0i } + named @AboveInstitutionGap { 0.5i } + named @AboveDateLineGap { 0.5i } + named @LectureHeadingFont { Bold 1.2f } + named @LectureHeadingBreak { 1.2fx nohyphen } + named @LectureHeadingFormat + left number right title { @Centre number @DP @Centre title @DP } + named @AboveLectureGap { 3.0f } + named @OverheadHeadingFont { Bold } + named @OverheadHeadingBreak { 1.2fx nohyphen } + named @OverheadHeadingFormat + left number right title { @Centre title @DP } + named @OverheadFormat + named @II right x { |@DisplayIndent x | } + named @QQ right x { |@DisplayIndent x |@DisplayIndent } + named @CC right x { |0.5rt x | } + named @RR right x { |1.0rt x | } + right @Body + { @Body } + named @AboveOverheadGap { 1.0f } + named @LectureInContents { Yes } + named @OverheadInContents { No } + named @ReferencesInContents { Yes } + named @LectureContentsIndent { 0f } + named @OverheadContentsIndent { 0f } + named @OverheadInLectureContentsIndent { 2f } + named @ReferencesContentsIndent { 0f } + named @LectureNumInTheorems { Yes } + named @OverheadNumInTheorems { No } + named @LectureNumInDisplays { Yes } + named @OverheadNumInDisplays { No } + named @LectureNumInFigures { Yes } + named @OverheadNumInFigures { No } + named @LectureNumInTables { Yes } + named @OverheadNumInTables { No } + named @LectureNumInFloaters { Yes } + named @OverheadNumInFloaters { No } + named @LectureNumInRunners { Yes } + named @OverheadNumInRunners { Yes } + named @LecturePrefix { } + named @OverheadPrefix { } +@Begin + + ####################################################################### + # # + # Symbols for passing full title to running headers. # + # # + ####################################################################### + + export @Val + def @StoreTitle left @Tag named @Val {} { @Null } + + def @SaveTitle right x { save @StoreTitle @Val { x } } + + def @GetTitle { @StoreTitle&&save @Open { @Val } } + + + ####################################################################### + # # + # Lists of lectures and overheads. # + # # + ####################################################################### + + export num + def @LectureList named @Tag {} named num {} + { + @Galley + //1.1b @LectureList num { @Next num } + } + + export num + def @OverheadsList named @Tag {} named num {} + { + @Galley + //1.1b @OverheadsList num { @Next num } + } + + export num + def @LecOverheadsList named @Tag {} right num + { + @Galley + //1.1b @LecOverheadsList @Next num + } + + + ####################################################################### + # # + # @Full - this sends text to a full-width place. # + # # + ####################################################################### + + def @Full force into { @FullPlace&&following } right x { x } + + + ####################################################################### + # # + # @OverheadTransparencies. # + # # + ####################################################################### + + def @OverheadTransparencies + named @Title {} + named @RunningTitle { dft } + named @Author {} + named @Institution {} + named @DateLine { @DateLine } + named @InitialFont { @InitialFont } + named @InitialBreak { @InitialBreak } + named @InitialOutdent { @InitialOutdent } + named @InitialSpace { @InitialSpace } + named @InitialLanguage { @InitialLanguage } + named @PageOrientation { @PageOrientation } + named @PageHeaders { @PageHeaders } + named @FirstPageNumber { @FirstPageNumber } + named @FirstOverheadNumber { @FirstOverheadNumber } + named @FirstLectureNumber { @FirstLectureNumber } + named @OptimizePages { @OptimizePages } + { + + def @DatePart + { + @DateLine @Case { + No @Yield { @Null } + Yes @Yield { @Date } + else @Yield { @DateLine } + } + } + + def @TitlePart + { + @TitlePageFont @Font @InitialBreak @Break + @InitialSpace @Space clines @Break { + //0.5i + //@AboveTitleGap 1.5f @Font @InitialBreak @Break + @InitialSpace @Space @TitleFormat @Title | + //@AboveAuthorGap @AuthorFormat @Author | + //@AboveInstitutionGap @InstitutionFormat @Institution | + //@AboveDateLineGap @DateLineFormat @DatePart | + } + } + + def @ContentsPart + { + @DP |0.5rt @LectureHeadingFont @Font @LectureHeadingBreak @Break + @LectureHeadingFormat { contents @WordVal @ContentsWord } | + @DP @ContentsSection + } + + def @ReferencesPart + named @Tag {} + { + @DP |0.5rt @LectureHeadingFont @Font @LectureHeadingBreak @Break + @LectureHeadingFormat { @RefHeading @RefListTitle } | + // @PageMark @Tag + // @ReferencesInContents @ContentsEntry + indent { @ReferencesContentsIndent } + title { @RefHeading @RefListTitle } + pagenum { @PageOf @Tag } + // Start @Runner @MajorTitle { @GetTitle } + @DP @ReferencesSection + // NonStart @Runner @MajorTitle { @GetTitle } + } + + def @OverheadsBody force into { @ColPlace&&preceding } + named @Optimize { @OptimizePages } + { + @Title @Case { + "" @Yield @Null + else @Yield @TitlePart + } + //1.1b @MakeContents @Case { + { Yes Bypass } @Yield @ContentsPart + else @Yield @Null + } + // Start @Runner @MajorTitle { @GetTitle } + //1.1b @OverheadsList num { @FirstOverheadNumber } + //1.1b @LectureList num { @FirstLectureNumber } + //1.1b @ReferencesPart + } + + @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break + @InitialLanguage @Language @InitialSpace @Space + { @ColourCommand @InitialColour } @SetColour + { + @SaveTitle { + @InitialLanguage @Language { @RunningTitle @Dft @Title } + } + + // Yes @BeginAllCounters {} + // Yes @BeginDisplayCounter {} + // Yes @BeginFigureCounter {} + // Yes @BeginFigureCounter {} + // @PageList + @ColumnNumber { 1 } + @PageHeaders { @PageHeaders } + @Orient { @PageOrientation } + extra { Yes } + @FirstPageNumber + // @OverheadsBody + // Start @Runner + } + } + + + ####################################################################### + # # + # Overheads. # + # # + ####################################################################### + + def @Overhead force into { @OverheadsList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @Format + named @II right x { |@DisplayIndent x | } + named @QQ right x { |@DisplayIndent x |@DisplayIndent } + named @CC right x { |0.5rt x | } + named @RR right x { |1.0rt x | } + right @Body { @OverheadFormat @Body } + named @InitialLanguage {} + named @BypassNumber { dft } + body @Body + { + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { @Title } + majortitle { @GetTitle } + runningtitle { @RunningTitle } + aboveheadinggap { @AboveOverheadGap } + headingfont { @OverheadHeadingFont } + headingbreak { @OverheadHeadingBreak } + headingformat { @Num @OverheadHeadingFormat @Body } + incontents { @OverheadInContents } + contentsindent { @OverheadContentsIndent } + numbers { @OverheadNumbers } + attachnum { @OverheadsList&&preceding @Tagged @Tag } + retrievenum { @OverheadsList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + pnprefix { @OverheadPrefix } + intheorems { @OverheadNumInTheorems } + indisplays { @OverheadNumInDisplays } + infigures { @OverheadNumInFigures } + intables { @OverheadNumInTables } + infloaters { @OverheadNumInFloaters } + sendheader { @Full @Body } + innergap { @DisplayGap } + inrunners { @OverheadNumInRunners } + @Format @Body + } + + + ####################################################################### + # # + # Lectures containing overheads. # + # # + ####################################################################### + + export @BeginOverheads @EndOverheads @Overhead + def @Lecture force into { @LectureList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage {} + named @BypassNumber { dft } + body @Body + { + def @SaveTitle { @Title } + + def @EndOverheadsPlace { @Galley } + + def @EndOverheads force into { @EndOverheadsPlace&&preceding } + {} + + macro @BeginOverheads + { //1.1b @LecOverheadsList 1 + // @EndOverheadsPlace // + } + + def @LectureNum + { + @LectureNumbers @Then { + @BypassNumber @Dft { + @LectureNumbers @Num @LectureList&&@Tag @Open { num } + } + } + } + + def @Overhead force into { @LecOverheadsList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @Format + named @II right x { |@DisplayIndent x | } + named @QQ right x { |@DisplayIndent x |@DisplayIndent } + named @CC right x { |0.5rt x | } + named @RR right x { |1.0rt x | } + right @Body { @OverheadFormat @Body } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + body @Body + { + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @OverheadHeadingFont } + headingbreak { @OverheadHeadingBreak } + headingformat { @Num @OverheadHeadingFormat @Body } + incontents { @OverheadInContents } + contentsindent { @OverheadInLectureContentsIndent } + numbers { @OverheadNumbers } + attachnum { @LecOverheadsList&&preceding @Tagged @Tag } + retrievenum { @LecOverheadsList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @LectureNum } + majornum { @LectureNum } + majortitle { @GetTitle } + minortitle { @SaveTitle } + intheorems { @OverheadNumInTheorems } + indisplays { @OverheadNumInDisplays } + infigures { @OverheadNumInFigures } + inrunners { @OverheadNumInRunners } + @Format @Body + + } + + @LargeScaleStructure + tag { @Tag } + type { Major } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + aboveheadinggap { @AboveLectureGap } + headingfont { @LectureHeadingFont } + headingbreak { @LectureHeadingBreak } + headingformat { @Num @LectureHeadingFormat @Body } + incontents { @LectureInContents } + contentsindent { @LectureContentsIndent } + word { lecture @WordVal @LectureWord } + numbers { @LectureNumbers } + attachnum { @LectureList&&preceding @Tagged @Tag } + retrievenum { @LectureList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + pnprefix { @LecturePrefix } + majortitle { @GetTitle } + intheorems { @LectureNumInTheorems } + indisplays { @LectureNumInDisplays } + infigures { @LectureNumInFigures } + intables { @LectureNumInTables } + infloaters { @LectureNumInFloaters } + sendheader { @Full @Body } + innergap { @DisplayGap } + inrunners { @LectureNumInRunners } + @Body + + } + +@End @OverheadSetup diff --git a/include/include/tab b/include/include/tab new file mode 100644 index 0000000..3c30de5 --- /dev/null +++ b/include/include/tab @@ -0,0 +1,31 @@ +############################################################################### +# # +# Lout setup file for table printing # +# # +# Jeffrey H. Kingston # +# 5 February 1999 # +# # +# This file has been placed in the public domain by its author. # +# # +# This package is OBSOLETE; use tbl instead. # +# # +############################################################################### + + +############################################################################### +# # +# The @SysInclude { tabf } line # +# # +# This line causes Lout to read the definitions for tables, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { tabf } + + +############################################################################### +# # +# This package does not offer default options that can be changed. # +# # +############################################################################### diff --git a/include/include/tabf b/include/include/tabf new file mode 100644 index 0000000..219afd0 --- /dev/null +++ b/include/include/tabf @@ -0,0 +1,953 @@ + +############################################################################### +# # +# Lout @Tab package for formatting tables (Version 2.0) # +# # +# Version 1.0 by Jeffrey H. Kingston, September 1991. # +# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. # +# Version 3.0 by Jeffrey H. Kingston, 13 September 1993. # +# # +# The only change between Versions 2 and 3 is to make the linewidth # +# option accept a Lout length rather than a Fig length. See the User's # +# Guide for user information. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +@SysPrependGraphic { "tabf.lpg" } + +export @CC @RR @Rule @DoubleRule @Line @DoubleLine @NP + @Rowa @Rowb @Rowc @Rowd @Rowe @Rowf @Rowg @Rowh @Rowi @Rowj + @MarkRowa @MarkRowb @MarkRowc @MarkRowd @MarkRowe @MarkRowf + @MarkRowg @MarkRowh @MarkRowi @MarkRowj + @FirstRowa @FirstRowb @FirstRowc @FirstRowd @FirstRowe @FirstRowf + @FirstRowg @FirstRowh @FirstRowi @FirstRowj + +def @Tab + + named above { no } + named below { no } + named between { no } + named side { no } + named hmargin { 0.3c } + named vmargin { + @BackEnd @Case { + PostScript @Yield 0.2v + PDF @Yield 0.2v # VT: PDF case added + PlainText @Yield 0.5v + } + } + + named linewidth + named c left x { + @BackEnd @Case { + PostScript @Yield { x" cm" } + PDF @Yield { "__mul(__cm, "x")" } + } + } + named i left x { + @BackEnd @Case { + PostScript @Yield { x" in" } + PDF @Yield { "__mul(__in, "x")" } + } + } + named e left x { + @BackEnd @Case { + PostScript @Yield { x" em" } + PDF @Yield { "__mul(__em, "x")" } + } + } + named p left x { + @BackEnd @Case { + PostScript @Yield { x" pt" } + PDF @Yield { "__mul(__pt, "x")" } + } + } + named f left x { + @BackEnd @Case { + PostScript @Yield { x" ft" } + PDF @Yield { "__mul(__loutf, "x")" } + } + } + named s left x { + @BackEnd @Case { + PostScript @Yield { x" sp" } + PDF @Yield { "__mul(__louts, "x")" } + } + } + named v left x { + @BackEnd @Case { + PostScript @Yield { x" vs" } + PDF @Yield { "__mul(__loutv, "x")" } + } + } + { 0.5p } + + named @Fmta + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named "!" precedence 10 left x named between { dft } right y {} + named "!!" precedence 10 left x right y {} + named "!!!" precedence 10 left x right y {} + named "@Over" precedence 11 left x right y { x // y } + named "," precedence 12 left x right y {} + named @Col precedence 12 right x {} + named @CC right x { clines @Break { & x & } } + named @RR right x { rlines @Break { & x & } } + {} + + named @Fmtb + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named "!" precedence 10 left x named between { dft } right y {} + named "!!" precedence 10 left x right y {} + named "!!!" precedence 10 left x right y {} + named "@Over" precedence 11 left x right y { x // y } + named "," precedence 12 left x right y {} + named @Col precedence 12 right x {} + named @CC right x { clines @Break { & x & } } + named @RR right x { rlines @Break { & x & } } + {} + + named @Fmtc + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named "!" precedence 10 left x named between { dft } right y {} + named "!!" precedence 10 left x right y {} + named "!!!" precedence 10 left x right y {} + named "@Over" precedence 11 left x right y { x // y } + named "," precedence 12 left x right y {} + named @Col precedence 12 right x {} + named @CC right x { clines @Break { & x & } } + named @RR right x { rlines @Break { & x & } } + {} + + named @Fmtd + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named "!" precedence 10 left x named between { dft } right y {} + named "!!" precedence 10 left x right y {} + named "!!!" precedence 10 left x right y {} + named "@Over" precedence 11 left x right y { x // y } + named "," precedence 12 left x right y {} + named @Col precedence 12 right x {} + named @CC right x { clines @Break { & x & } } + named @RR right x { rlines @Break { & x & } } + {} + + named @Fmte + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named "!" precedence 10 left x named between { dft } right y {} + named "!!" precedence 10 left x right y {} + named "!!!" precedence 10 left x right y {} + named "@Over" precedence 11 left x right y { x // y } + named "," precedence 12 left x right y {} + named @Col precedence 12 right x {} + named @CC right x { clines @Break { & x & } } + named @RR right x { rlines @Break { & x & } } + {} + + named @Fmtf + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named "!" precedence 10 left x named between { dft } right y {} + named "!!" precedence 10 left x right y {} + named "!!!" precedence 10 left x right y {} + named "@Over" precedence 11 left x right y { x // y } + named "," precedence 12 left x right y {} + named @Col precedence 12 right x {} + named @CC right x { clines @Break { & x & } } + named @RR right x { rlines @Break { & x & } } + {} + + named @Fmtg + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named "!" precedence 10 left x named between { dft } right y {} + named "!!" precedence 10 left x right y {} + named "!!!" precedence 10 left x right y {} + named "@Over" precedence 11 left x right y { x // y } + named "," precedence 12 left x right y {} + named @Col precedence 12 right x {} + named @CC right x { clines @Break { & x & } } + named @RR right x { rlines @Break { & x & } } + {} + + named @Fmth + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named "!" precedence 10 left x named between { dft } right y {} + named "!!" precedence 10 left x right y {} + named "!!!" precedence 10 left x right y {} + named "@Over" precedence 11 left x right y { x // y } + named "," precedence 12 left x right y {} + named @Col precedence 12 right x {} + named @CC right x { clines @Break { & x & } } + named @RR right x { rlines @Break { & x & } } + {} + + named @Fmti + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named "!" precedence 10 left x named between { dft } right y {} + named "!!" precedence 10 left x right y {} + named "!!!" precedence 10 left x right y {} + named "@Over" precedence 11 left x right y { x // y } + named "," precedence 12 left x right y {} + named @Col precedence 12 right x {} + named @CC right x { clines @Break { & x & } } + named @RR right x { rlines @Break { & x & } } + {} + + named @Fmtj + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named "!" precedence 10 left x named between { dft } right y {} + named "!!" precedence 10 left x right y {} + named "!!!" precedence 10 left x right y {} + named "@Over" precedence 11 left x right y { x // y } + named "," precedence 12 left x right y {} + named @Col precedence 12 right x {} + named @CC right x { clines @Break { & x & } } + named @RR right x { rlines @Break { & x & } } + {} + + body @Body + +@Begin + + macro @NP { /1.1b } + + def @CC right x { clines @Break { & x & } } + def @RR right x { rlines @Break { & x & } } +# +# VT: these definitions have been modified for PDF support +# + def @HSingle { + @BackEnd @Case { + PostScript @Yield { linewidth ltabhs } + PDF @Yield { "0 0 m __xsize 0 l" linewidth "w 0 J S" } + } + } + + def @HSingleProject { + @BackEnd @Case { + PostScript @Yield { linewidth ltabhsp } + PDF @Yield { "0 0 m __xsize 0 l" linewidth "w 2 J S" } + } + } + + def @HDouble { + @BackEnd @Case { + PostScript @Yield { linewidth ltabhd } + PDF @Yield { # dup dup + "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto + "0 __mul(3, " linewidth ") m __xsize __mul(3, " linewidth ") l" # 0 exch 3 mul moveto xsize exch 3 mul lineto + linewidth "w 0 J S" # setlinewidth 0 setlinecap stroke + } + } + } + + def @HDoubleBelow { + @BackEnd @Case { + PostScript @Yield { linewidth ltabhdb } + PDF @Yield { # dup dup + "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto + "0 __mul(-3, "linewidth") m __xsize __mul(-3, "linewidth") l" # 0 exch -3 mul moveto xsize exch -3 mul lineto + linewidth "w 0 J S" # setlinewidth 0 setlinecap stroke + } + } + } + + def @HDoubleNW { + @BackEnd @Case { + PostScript @Yield { linewidth ltabhdnw } + PDF @Yield { # dup dup dup dup + "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto + "__xsize __mul(3, "linewidth") m" # xsize exch 3 mul moveto + "__mul(-3, "linewidth") __mul(3, "linewidth") l" # -3 mul exch 3 mul lineto + "__mul(-3, "linewidth") 0 l" # -3 mul 0 lineto + linewidth "w 0 j 2 J S" # setlinewidth 0 setlinejoin 2 setlinecap stroke + } + } + } + + def @HDoubleNE { + @BackEnd @Case { + PostScript @Yield { linewidth ltabhdne } + PDF @Yield { # dup dup dup dup + "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto + "0 __mul(3, "linewidth") m" # 0 exch 3 mul moveto + "__add(__xsize, __mul(3, "linewidth")) __mul(3, "linewidth") l" # 3 mul xsize add exch 3 mul lineto + "__add(__xsize, __mul(3, "linewidth")) 0 l" # 3 mul xsize add 0 lineto + linewidth "w 0 j 2 J S" # setlinewidth 0 setlinejoin 2 setlinecap stroke + } + } + } + + def @HDoubleSW { + @BackEnd @Case { + PostScript @Yield { linewidth ltabhdsw } + PDF @Yield { # dup dup dup dup + "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto + "__xsize __mul(-3, "linewidth") m" # xsize exch -3 mul moveto + "__mul(-3, "linewidth") __mul(-3, "linewidth") l" # -3 mul exch -3 mul lineto + "__mul(-3, "linewidth") 0 l" # -3 mul 0 lineto + linewidth "w 0 j 2 J S" # setlinewidth 0 setlinejoin 2 setlinecap stroke + } + } + } + + def @HDoubleSE { + @BackEnd @Case { + PostScript @Yield { linewidth ltabhdse } + PDF @Yield { # dup dup dup dup + "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto + "0 __mul(-3, "linewidth") m" # 0 exch -3 mul moveto + "__add(__xsize, __mul(-3, "linewidth")) __mul(-3, "linewidth") l" # 3 mul xsize add exch -3 mul lineto + "__add(__xsize, __mul( 3, "linewidth")) 0 l" # 3 mul xsize add 0 lineto + linewidth "w 0 j 2 J S" # setlinewidth 0 setlinejoin 2 setlinecap stroke + } + } + } + + def @VSingle { + @BackEnd @Case { + PostScript @Yield { linewidth ltabvs } + PDF @Yield { + "0 0 m 0 __ysize l" # 0 0 moveto 0 ysize lineto + linewidth "w 0 J S" # setlinewidth 0 setlinecap stroke + } + } + } + + def @VDouble { + @BackEnd @Case { + PostScript @Yield { linewidth ltabvd } + PDF @Yield { # dup dup + "0 0 m 0 __ysize l" # 0 0 moveto 0 ysize lineto + "__mul(-3, "linewidth") 0 m __mul(-3, "linewidth") __ysize l" # -3 mul 0 moveto -3 mul ysize lineto + linewidth "w 0 J S" # setlinewidth 0 setlinecap stroke + } + } + } + + def @VDoubleRight { + @BackEnd @Case { + PostScript @Yield { linewidth ltabvdr } + PDF @Yield { # dup dup + "0 0 m 0 __ysize l" # 0 0 moveto 0 ysize lineto + "__mul(3, "linewidth") 0 m __mul(3, "linewidth") __ysize l" # 3 mul 0 moveto 3 mul ysize lineto + linewidth "w 0 J S" # setlinewidth 0 setlinecap stroke + } + } + } + + def @MidHRule + left rule + right x + { + rule @Case + { + no @Yield { @OneCol x } + { yes single } @Yield { @HSingle @Graphic x } + { double doubleboxabove } @Yield { @HDouble @Graphic x } + doubleboxbelow @Yield { @HDoubleBelow @Graphic x } + } + } + + def @LeftHRule + left rule + right x + { + rule @Case + { + no @Yield { @OneCol x } + { yes single } @Yield { @HSingleProject @Graphic x } + double @Yield { @HDouble @Graphic x } + doubleboxabove @Yield { @HDoubleNW @Graphic x } + doubleboxbelow @Yield { @HDoubleSW @Graphic x } + } + } + + def @RightHRule + left rule + right x + { + rule @Case + { + no @Yield { @OneCol x } + { yes single } @Yield { @HSingleProject @Graphic x } + double @Yield { @HDouble @Graphic x } + doubleboxabove @Yield { @HDoubleNE @Graphic x } + doubleboxbelow @Yield { @HDoubleSE @Graphic x } + } + } + + def @HSRule + left rule + { + rule @Case + { + no @Yield {} + { yes single } @Yield { @HSingle @Graphic {} } + double @Yield { @HDouble @Graphic {} } + doubleboxabove @Yield { @HDouble @Graphic {} } + doubleboxbelow @Yield { @HDoubleBelow @Graphic {} } + } + } + + def @ZeroWidth + right x + { @OneCol { |0io x |0io } + } + + def @Line + { single @HSRule + } + + def @DoubleLine + { double @HSRule + } + + def @Rule + { + @OneRow + { + @ZeroWidth @HSingle @Graphic { ^|hmargin } + / @Line / + &1rt @ZeroWidth @HSingle @Graphic { |hmargin } + } + } + + def @DoubleRule + { + @OneRow + { + @ZeroWidth @HDouble @Graphic { ^|hmargin } + / @DoubleLine / + &1rt @ZeroWidth @HDouble @Graphic { |hmargin } + } + } + + def @VRule + left rule + right x + { + rule @Case + { + no @Yield {} + { yes single } @Yield @OneRow { /0io @VSingle @Graphic x /0io } + double @Yield @OneRow { /0io @VDouble @Graphic x /0io } + } + } + + def @VRuleRight + left rule + right x + { + rule @Case + { + no @Yield {} + {yes single} @Yield @OneRow { /0io @VSingle @Graphic x /0io } + double @Yield @OneRow { /0io @VDoubleRight @Graphic x /0io } + } + } + + def @VSRule + left rule + { + rule @Case + { + no @Yield {} + { yes single } @Yield { @VSingle @Graphic {} } + double @Yield { @VDouble @Graphic {} } + } + } + + def @VSRuleRight + left rule + { + rule @Case + { + no @Yield {} + {yes single} @Yield { @VSingle @Graphic {} } + double @Yield { @VDoubleRight @Graphic {} } + } + } + + def @Wrap + named ur { no } # Rule up above entry + named dr { no } # Rule down below entry + named vm { vmargin } # Vertical margin + right x # The object to be wrapped + { + ur @HSRule + ^/vm @OneCol @OneRow x + /vm dr @HSRule + } + + def @Sep + left x + named ur { no } # Rule up above entry + named dr { no } # Rule down below entry + named sr { no } # Rule separating x from y + named hm { hmargin } # Horizontal margin + named vm { vmargin } # Vertical margin + right y + { + def vr + { + sr @Case + { dft @Yield between + else @Yield sr + } + } + + x | @OneCol + { ur @MidHRule {|hm} + /vm + /vm dr @MidHRule {|hm} + } + | @OneCol + { vr @VRule { /vm } | ur @MidHRule {|hm} + /vm vr @VSRule | + /vm vr @VRule {^/vm } | dr @MidHRule {|hm} + } + | y + } + + def @NSep + left x + named hm { hmargin } + right y + { + x | @OneCol { |hm } | @OneCol { |hm } | y + } + + def @LeftEdge + named ur { no } # Rule up above entry + named dr { no } # Rule down below entry + named sr { no } # Rule separating x from y + named hm { hmargin } # Horizontal margin + named vm { vmargin } # Vertical margin + right x + { + sr @Case + { + no @Yield { x } + else @Yield + { @OneCol + { + sr @VRule { /vm } | ur @LeftHRule { |hm } + ^/vm sr @VSRule | + /vm sr @VRule { ^/vm } | dr @LeftHRule { |hm } + } + | x + } + } + } + + def @RightEdge + left x + named ur { no } # Rule up above entry + named dr { no } # Rule down below entry + named sr { no } # Rule separating x from y + named hm { hmargin } # Horizontal margin + named vm { vmargin } # Vertical margin + { + sr @Case + { + no @Yield { x } + else @Yield + { + x | @OneCol + { + ur @RightHRule { |hm } + /vm + /vm dr @RightHRule { |hm } + } + | @OneCol + { + sr @VRuleRight { /vm } + /vm sr @VSRuleRight + /vm sr @VRuleRight { ^/vm } + } + } + } + } + + def @DoRowa + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named above { above } + named below { below } + named side { side } + named vmargin { vmargin } + { + @LeftEdge ur { above } dr { below } sr { side } vm { vmargin } + @Fmta + A { A } B { B } C { C } D { D } E { E } + F { F } G { G } H { H } I { I } J { J } + K { K } L { L } M { M } N { N } O { O } + P { P } Q { Q } R { R } S { S } T { T } + U { U } V { V } W { W } X { X } Y { Y } + Z { Z } + @Col { @Wrap ur {above} dr {below} vm {vmargin} x} + ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y} + !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y} + !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y} + , { x @NSep y } + @RightEdge ur { above } dr { below } sr { side } vm { vmargin } + } + + def @DoRowb + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named above { above } + named below { below } + named side { side } + named vmargin { vmargin } + { + @LeftEdge ur { above } dr { below } sr { side } vm { vmargin } + @Fmtb + A { A } B { B } C { C } D { D } E { E } + F { F } G { G } H { H } I { I } J { J } + K { K } L { L } M { M } N { N } O { O } + P { P } Q { Q } R { R } S { S } T { T } + U { U } V { V } W { W } X { X } Y { Y } + Z { Z } + @Col { @Wrap ur {above} dr {below} vm {vmargin} x} + ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y} + !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y} + !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y} + , { x @NSep y } + @RightEdge ur { above } dr { below } sr { side } vm { vmargin } + } + + def @DoRowc + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named above { above } + named below { below } + named side { side } + named vmargin { vmargin } + { + @LeftEdge ur { above } dr { below } sr { side } vm { vmargin } + @Fmtc + A { A } B { B } C { C } D { D } E { E } + F { F } G { G } H { H } I { I } J { J } + K { K } L { L } M { M } N { N } O { O } + P { P } Q { Q } R { R } S { S } T { T } + U { U } V { V } W { W } X { X } Y { Y } + Z { Z } + @Col { @Wrap ur {above} dr {below} vm {vmargin} x} + ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y} + !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y} + !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y} + , { x @NSep y } + @RightEdge ur { above } dr { below } sr { side } vm { vmargin } + } + + def @DoRowd + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named above { above } + named below { below } + named side { side } + named vmargin { vmargin } + { + @LeftEdge ur { above } dr { below } sr { side } vm { vmargin } + @Fmtd + A { A } B { B } C { C } D { D } E { E } + F { F } G { G } H { H } I { I } J { J } + K { K } L { L } M { M } N { N } O { O } + P { P } Q { Q } R { R } S { S } T { T } + U { U } V { V } W { W } X { X } Y { Y } + Z { Z } + @Col { @Wrap ur {above} dr {below} vm {vmargin} x} + ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y} + !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y} + !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y} + , { x @NSep y } + @RightEdge ur { above } dr { below } sr { side } vm { vmargin } + } + + def @DoRowe + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named above { above } + named below { below } + named side { side } + named vmargin { vmargin } + { + @LeftEdge ur { above } dr { below } sr { side } vm { vmargin } + @Fmte + A { A } B { B } C { C } D { D } E { E } + F { F } G { G } H { H } I { I } J { J } + K { K } L { L } M { M } N { N } O { O } + P { P } Q { Q } R { R } S { S } T { T } + U { U } V { V } W { W } X { X } Y { Y } + Z { Z } + @Col { @Wrap ur {above} dr {below} vm {vmargin} x} + ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y} + !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y} + !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y} + , { x @NSep y } + @RightEdge ur { above } dr { below } sr { side } vm { vmargin } + } + + def @DoRowf + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named above { above } + named below { below } + named side { side } + named vmargin { vmargin } + { + @LeftEdge ur { above } dr { below } sr { side } vm { vmargin } + @Fmtf + A { A } B { B } C { C } D { D } E { E } + F { F } G { G } H { H } I { I } J { J } + K { K } L { L } M { M } N { N } O { O } + P { P } Q { Q } R { R } S { S } T { T } + U { U } V { V } W { W } X { X } Y { Y } + Z { Z } + @Col { @Wrap ur {above} dr {below} vm {vmargin} x} + ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y} + !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y} + !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y} + , { x @NSep y } + @RightEdge ur { above } dr { below } sr { side } vm { vmargin } + } + + def @DoRowg + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named above { above } + named below { below } + named side { side } + named vmargin { vmargin } + { + @LeftEdge ur { above } dr { below } sr { side } vm { vmargin } + @Fmtg + A { A } B { B } C { C } D { D } E { E } + F { F } G { G } H { H } I { I } J { J } + K { K } L { L } M { M } N { N } O { O } + P { P } Q { Q } R { R } S { S } T { T } + U { U } V { V } W { W } X { X } Y { Y } + Z { Z } + @Col { @Wrap ur {above} dr {below} vm {vmargin} x} + ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y} + !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y} + !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y} + , { x @NSep y } + @RightEdge ur { above } dr { below } sr { side } vm { vmargin } + } + + def @DoRowh + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named above { above } + named below { below } + named side { side } + named vmargin { vmargin } + { + @LeftEdge ur { above } dr { below } sr { side } vm { vmargin } + @Fmth + A { A } B { B } C { C } D { D } E { E } + F { F } G { G } H { H } I { I } J { J } + K { K } L { L } M { M } N { N } O { O } + P { P } Q { Q } R { R } S { S } T { T } + U { U } V { V } W { W } X { X } Y { Y } + Z { Z } + @Col { @Wrap ur {above} dr {below} vm {vmargin} x} + ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y} + !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y} + !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y} + , { x @NSep y } + @RightEdge ur { above } dr { below } sr { side } vm { vmargin } + } + + def @DoRowi + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named above { above } + named below { below } + named side { side } + named vmargin { vmargin } + { + @LeftEdge ur { above } dr { below } sr { side } vm { vmargin } + @Fmti + A { A } B { B } C { C } D { D } E { E } + F { F } G { G } H { H } I { I } J { J } + K { K } L { L } M { M } N { N } O { O } + P { P } Q { Q } R { R } S { S } T { T } + U { U } V { V } W { W } X { X } Y { Y } + Z { Z } + @Col { @Wrap ur {above} dr {below} vm {vmargin} x} + ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y} + !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y} + !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y} + , { x @NSep y } + @RightEdge ur { above } dr { below } sr { side } vm { vmargin } + } + + def @DoRowj + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named above { above } + named below { below } + named side { side } + named vmargin { vmargin } + { + @LeftEdge ur { above } dr { below } sr { side } vm { vmargin } + @Fmtj + A { A } B { B } C { C } D { D } E { E } + F { F } G { G } H { H } I { I } J { J } + K { K } L { L } M { M } N { N } O { O } + P { P } Q { Q } R { R } S { S } T { T } + U { U } V { V } W { W } X { X } Y { Y } + Z { Z } + @Col { @Wrap ur {above} dr {below} vm {vmargin} x} + ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y} + !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y} + !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y} + , { x @NSep y } + @RightEdge ur { above } dr { below } sr { side } vm { vmargin } + } + + macro @Rowa { / @DoRowa } + macro @Rowb { / @DoRowb } + macro @Rowc { / @DoRowc } + macro @Rowd { / @DoRowd } + macro @Rowe { / @DoRowe } + macro @Rowf { / @DoRowf } + macro @Rowg { / @DoRowg } + macro @Rowh { / @DoRowh } + macro @Rowi { / @DoRowi } + macro @Rowj { / @DoRowj } + + macro @FirstRowa { @DoRowa } + macro @FirstRowb { @DoRowb } + macro @FirstRowc { @DoRowc } + macro @FirstRowd { @DoRowd } + macro @FirstRowe { @DoRowe } + macro @FirstRowf { @DoRowf } + macro @FirstRowg { @DoRowg } + macro @FirstRowh { @DoRowh } + macro @FirstRowi { @DoRowi } + macro @FirstRowj { @DoRowj } + + macro @MarkRowa { ^/ @DoRowa } + macro @MarkRowb { ^/ @DoRowb } + macro @MarkRowc { ^/ @DoRowc } + macro @MarkRowd { ^/ @DoRowd } + macro @MarkRowe { ^/ @DoRowe } + macro @MarkRowf { ^/ @DoRowf } + macro @MarkRowg { ^/ @DoRowg } + macro @MarkRowh { ^/ @DoRowh } + macro @MarkRowi { ^/ @DoRowi } + macro @MarkRowj { ^/ @DoRowj } + + + @Body + +@End @Tab diff --git a/include/include/tabf.lpg b/include/include/tabf.lpg new file mode 100644 index 0000000..0094114 --- /dev/null +++ b/include/include/tabf.lpg @@ -0,0 +1,118 @@ +%%BeginResource: procset LoutTabPrependGraphic +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Tab % +% % +% This file has been placed in the public domain % +% by its author, Jeffrey H. Kingston % +% % +% To assist in avoiding name clashes, the names % +% of all these symbols begin with "ltab". % +% % +% Jeffrey H. Kingston % +% 24 September 1991 % +% 22 December 1992 % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% linewidth ltabhs - +% horizontal single line +/ltabhs +{ 0 0 moveto xsize 0 lineto + setlinewidth 0 setlinecap stroke +} def + +% linewidth ltabhsp - +% horizontal single line with projecting ends +/ltabhsp +{ 0 0 moveto xsize 0 lineto + setlinewidth 2 setlinecap stroke +} def + +% linewidth ltabhd - +% horizontal double line +/ltabhd +{ dup dup + 0 0 moveto xsize 0 lineto + 0 exch 3 mul moveto xsize exch 3 mul lineto + setlinewidth 0 setlinecap stroke +} def + +% linewidth ltabhdb - +% horizontal double line below mark +/ltabhdb +{ dup dup + 0 0 moveto xsize 0 lineto + 0 exch -3 mul moveto xsize exch -3 mul lineto + setlinewidth 0 setlinecap stroke +} def + +% linewidth ltabhdnw - +% horizontal double line with northwest corner +/ltabhdnw +{ dup dup dup dup + 0 0 moveto xsize 0 lineto + xsize exch 3 mul moveto + -3 mul exch 3 mul lineto + -3 mul 0 lineto + setlinewidth 0 setlinejoin 2 setlinecap stroke +} def + +% linewidth ltabhdne - +% horizontal double line with northeast corner +/ltabhdne +{ dup dup dup dup + 0 0 moveto xsize 0 lineto + 0 exch 3 mul moveto + 3 mul xsize add exch 3 mul lineto + 3 mul xsize add 0 lineto + setlinewidth 0 setlinejoin 2 setlinecap stroke +} def + +% linewidth ltabhdsw - +% horizontal double line with southwest corner +/ltabhdsw +{ dup dup dup dup + 0 0 moveto xsize 0 lineto + xsize exch -3 mul moveto + -3 mul exch -3 mul lineto + -3 mul 0 lineto + setlinewidth 0 setlinejoin 2 setlinecap stroke +} def + +% linewidth ltabhdse - +% horizontal double line with southeast corner +/ltabhdse +{ dup dup dup dup + 0 0 moveto xsize 0 lineto + 0 exch -3 mul moveto + 3 mul xsize add exch -3 mul lineto + 3 mul xsize add 0 lineto + setlinewidth 0 setlinejoin 2 setlinecap stroke +} def + +% linewidth ltabvs - +% vertical single line +/ltabvs +{ 0 0 moveto 0 ysize lineto + setlinewidth 0 setlinecap stroke +} def + +% linewidth ltabvd - +% vertical double line +/ltabvd +{ dup dup + 0 0 moveto 0 ysize lineto + -3 mul 0 moveto -3 mul ysize lineto + setlinewidth 0 setlinecap stroke +} def + +% linewidth ltabvdr - +% vertical double line to right of mark +/ltabvdr +{ dup dup + 0 0 moveto 0 ysize lineto + 3 mul 0 moveto 3 mul ysize lineto + setlinewidth 0 setlinecap stroke +} def +%%EndResource diff --git a/include/include/tbl b/include/include/tbl new file mode 100644 index 0000000..4e73092 --- /dev/null +++ b/include/include/tbl @@ -0,0 +1,82 @@ + +############################################################################### +# # +# Lout setup file for table printing # +# # +# Jeffrey H. Kingston # +# 5 February 1999 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + +############################################################################### +# # +# The @SysInclude { tblf } line # +# # +# This line causes Lout to read the definitions for tables, and should # +# not be touched. # +# # +############################################################################### + +@SysInclude { tblf } + + +############################################################################### +# # +# The @TbleSetup @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 { @TblSetup + # paint { none } # colour of background + # texture { solid } # texture of paint background + # background { } # object in background + # font { } # font + # break { } # paragraph breaking style + # width { } # fixed width or "expand" + # height { } # fixed height + # indent { } # horizontal indent + # indentvertical { } # vertical indent + # strut { yes } # vertical strut + # struthorizontal { no } # horizontal strut + # margin { } # margin all round + # marginhorizontal { 0.6f @OrIfPlain 2s } # margin left, right of entry + # marginleft { } # margin left of entry + # marginright { } # margin right of entry + # marginvertical { 0.3f @OrIfPlain 2f } # margin above, below entry + # marginabove { } # margin above entry + # marginbelow { } # margin below entry + # rule { no } # rule all round cell + # rulehorizontal { } # rule above and below cell + # ruleabove { } # rule above cell + # rulebelow { } # rule below cell + # rulevertical { } # rule left and right of cell + # ruleleft { } # rule left of cell + # ruleright { } # rule right of cell + # rulewidth { 0.05f } # width (thickness) of rule + # rulehorizontalwidth { {} @OrIfPlain 1f } # width of above, below rules + # ruleabovewidth { } # width of above rule + # rulebelowwidth { } # width of below rule + # ruleverticalwidth { {} @OrIfPlain 1s } # width of left, right rules + # ruleleftwidth { } # width of left rule + # rulerightwidth { } # width of right rule + # rulegap { 0.15f } # gap between double rules + # rulehorizontalgap { {} @OrIfPlain 0f } # gap between dbl a&b rules + # ruleabovegap { } # gap between dbl above rules + # rulebelowgap { } # gap between dbl below rules + # ruleverticalgap { {} @OrIfPlain 0s } # gap between dbl l&r rules + # ruleleftgap { } # gap between dbl left rules + # rulerightgap { } # gap between dbl right rules + # rulecolour { black } # color of rules + # rulehorizontalcolour { } # color of above, below rules + # ruleabovecolour { } # color of above rules + # rulebelowcolour { } # color of below rules + # ruleverticalcolour { } # color of left, right rules + # ruleleftcolour { } # color of left rules + # rulerightcolour { } # color of right rules + # ruleplainchar { . } # plain text rule characters +} diff --git a/include/include/tblf b/include/include/tblf new file mode 100644 index 0000000..e01fd16 --- /dev/null +++ b/include/include/tblf @@ -0,0 +1,3218 @@ + +############################################################################### +# # +# 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). # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +@SysInclude { coltex } + +export @OrIfPlain +def @TOIP { + + def @OrIfPlain + left ps + right plain + { + @BackEnd @Case { + PlainText @Yield plain + else @Yield ps + } + } +} + +export @Tbl +def @TblSetup + import @TOIP named paint p { none } + import @TextureImport named texture t { solid } + import @TOIP named background bg {} + import @TOIP named font f {} + import @TOIP named break b {} + import @TOIP named width w {} + import @TOIP named height h {} + import @TOIP named indent i {} + import @TOIP named indentvertical iv {} + import @TOIP named strut s { yes } + import @TOIP named struthorizontal sh { no } + import @TOIP named margin m {} + import @TOIP named marginhorizontal mh { 0.6f @OrIfPlain 2s } + import @TOIP named marginleft ml {} + import @TOIP named marginright mr {} + import @TOIP named marginvertical mv { 0.3f @OrIfPlain 2f } + import @TOIP named marginabove ma {} + import @TOIP named marginbelow mb {} + import @TOIP named rule r { no } + import @TOIP named rulehorizontal rh {} + import @TOIP named ruleabove ra {} + import @TOIP named rulebelow rb {} + import @TOIP named rulevertical rv {} + import @TOIP named ruleleft rl {} + import @TOIP named ruleright rr {} + import @TOIP named rulewidth rw { 0.05f } + import @TOIP named rulehorizontalwidth rhw { {} @OrIfPlain 1f } + import @TOIP named ruleabovewidth raw {} + import @TOIP named rulebelowwidth rbw {} + import @TOIP named ruleverticalwidth rvw { {} @OrIfPlain 1s } + import @TOIP named ruleleftwidth rlw {} + import @TOIP named rulerightwidth rrw {} + import @TOIP named rulegap rg { 0.15f } + import @TOIP named rulehorizontalgap rhg { {} @OrIfPlain 0f } + import @TOIP named ruleabovegap rag {} + import @TOIP named rulebelowgap rbg {} + import @TOIP named ruleverticalgap rvg { {} @OrIfPlain 0s } + import @TOIP named ruleleftgap rlg {} + import @TOIP named rulerightgap rrg {} + import @TOIP named rulecolour rulecolor rc { black } + import @TOIP named rulehorizontalcolour rulehorizontalcolor rhc {} + import @TOIP named ruleabovecolour ruleabovecolor rac {} + import @TOIP named rulebelowcolour rulebelowcolor rbc {} + import @TOIP named ruleverticalcolour ruleverticalcolor rvc {} + import @TOIP named ruleleftcolour ruleleftcolor rlc {} + import @TOIP named rulerightcolour rulerightcolor rrc {} + import @TOIP named ruleplainchar rpc { . } + +@Begin + + def @Else + precedence 20 + associativity right + left x + right y + { + x @Case { + "" @Yield y + else @Yield x + } + } + + + ########################################################################### + # # + # Specific option values as the setup file knows them (i.e. Level 1) # + # # + ########################################################################### + + def setupp { p } + def setupt { t } + def setupbg { bg } + def setupf { f } + def setupb { b } + def setupw { w } + def setuph { h } + def setupi { i } + def setupiv { iv } + def setups { s } + def setupsh { sh } + def setupml { ml @Else mh @Else m } + def setupmr { mr @Else mh @Else m } + def setupma { ma @Else mv @Else m } + def setupmb { mb @Else mv @Else m } + def setupra { ra @Else rh @Else r } + def setuprb { rb @Else rh @Else r } + def setuprl { rl @Else rv @Else r } + def setuprr { rr @Else rv @Else r } + def setupraw { raw @Else rhw @Else rw } + def setuprbw { rbw @Else rhw @Else rw } + def setuprlw { rlw @Else rvw @Else rw } + def setuprrw { rrw @Else rvw @Else rw } + def setuprag { rag @Else rhg @Else rg } + def setuprbg { rbg @Else rhg @Else rg } + def setuprlg { rlg @Else rvg @Else rg } + def setuprrg { rrg @Else rvg @Else rg } + def setuprac { rac @Else rhc @Else rc } + def setuprbc { rbc @Else rhc @Else rc } + def setuprlc { rlc @Else rvc @Else rc } + def setuprrc { rrc @Else rvc @Else rc } + def setuprpc { rpc } + + + ########################################################################### + # # + # @Tbl symbol # + # # + ########################################################################### + + export + + @Row + @Rowa + @Rowb + @Rowc + @Rowd + @Rowe + @Rowf + @Rowg + @Rowh + + @FirstRow + @FirstRowa + @FirstRowb + @FirstRowc + @FirstRowd + @FirstRowe + @FirstRowf + @FirstRowg + @FirstRowh + + @MarkRow + @MarkRowa + @MarkRowb + @MarkRowc + @MarkRowd + @MarkRowe + @MarkRowf + @MarkRowg + @MarkRowh + + @NoBreakRow + @NoBreakRowa + @NoBreakRowb + @NoBreakRowc + @NoBreakRowd + @NoBreakRowe + @NoBreakRowf + @NoBreakRowg + @NoBreakRowh + + @HeaderRow + @HeaderRowa + @HeaderRowb + @HeaderRowc + @HeaderRowd + @HeaderRowe + @HeaderRowf + @HeaderRowg + @HeaderRowh + + @HeaderFirstRow + @HeaderFirstRowa + @HeaderFirstRowb + @HeaderFirstRowc + @HeaderFirstRowd + @HeaderFirstRowe + @HeaderFirstRowf + @HeaderFirstRowg + @HeaderFirstRowh + + @EndHeaderRow + + @NP + + def @Tbl + + # parameters for formatting the entire table + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + + # parameters for formatting @Rowa rows + named apaint ap {} + import @TextureImport named atexture at {} + named abackground abg {} + named afont af {} + named abreak ab {} + named awidth aw {} + named aheight ah {} + named aindent ai {} + named aindentvertical aiv {} + named astrut as {} + named astruthorizontal ash {} + named amargin am {} + named amarginhorizontal amh {} + named amarginleft aml {} + named amarginright amr {} + named amarginvertical amv {} + named amarginabove ama {} + named amarginbelow amb {} + named arule ar {} + named arulehorizontal arh {} + named aruleabove ara {} + named arulebelow arb {} + named arulevertical arv {} + named aruleleft arl {} + named aruleright arr {} + named arulewidth arw {} + named arulehorizontalwidth arhw {} + named aruleabovewidth araw {} + named arulebelowwidth arbw {} + named aruleverticalwidth arvw {} + named aruleleftwidth arlw {} + named arulerightwidth arrw {} + named arulegap arg {} + named arulehorizontalgap arhg {} + named aruleabovegap arag {} + named arulebelowgap arbg {} + named aruleverticalgap arvg {} + named aruleleftgap arlg {} + named arulerightgap arrg {} + named arulecolour arulecolor arc {} + named arulehorizontalcolour arulehorizontalcolor arhc {} + named aruleabovecolour aruleabovecolor arac {} + named arulebelowcolour arulebelowcolor arbc {} + named aruleverticalcolour aruleverticalcolor arvc {} + named aruleleftcolour aruleleftcolor arlc {} + named arulerightcolour arulerightcolor arrc {} + named aruleplainchar arpc {} + named aformat + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named @Cell + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + right x + {} + {} + + # parameters for formatting @Rowb rows + named bpaint bp {} + import @TextureImport named btexture bt {} + named bbackground bbg {} + named bfont bf {} + named bbreak bb {} + named bwidth bw {} + named bheight bh {} + named bindent bi {} + named bindentvertical biv {} + named bstrut bs {} + named bstruthorizontal bsh {} + named bmargin bm {} + named bmarginhorizontal bmh {} + named bmarginleft bml {} + named bmarginright bmr {} + named bmarginvertical bmv {} + named bmarginabove bma {} + named bmarginbelow bmb {} + named brule br {} + named brulehorizontal brh {} + named bruleabove bra {} + named brulebelow brb {} + named brulevertical brv {} + named bruleleft brl {} + named bruleright brr {} + named brulewidth brw {} + named brulehorizontalwidth brhw {} + named bruleabovewidth braw {} + named brulebelowwidth brbw {} + named bruleverticalwidth brvw {} + named bruleleftwidth brlw {} + named brulerightwidth brrw {} + named brulegap brg {} + named brulehorizontalgap brhg {} + named bruleabovegap brag {} + named brulebelowgap brbg {} + named bruleverticalgap brvg {} + named bruleleftgap brlg {} + named brulerightgap brrg {} + named brulecolour brulecolor brc {} + named brulehorizontalcolour brulehorizontalcolor brhc {} + named bruleabovecolour bruleabovecolor brac {} + named brulebelowcolour brulebelowcolor brbc {} + named bruleverticalcolour bruleverticalcolor brvc {} + named bruleleftcolour bruleleftcolor brlc {} + named brulerightcolour brulerightcolor brrc {} + named bruleplainchar brpc {} + named bformat + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named @Cell + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + right x + {} + {} + + # parameters for formatting @Rowc rows + named cpaint cp {} + import @TextureImport named ctexture ct {} + named cbackground cbg {} + named cfont cf {} + named cbreak cb {} + named cwidth cw {} + named cheight ch {} + named cindent ci {} + named cindentvertical civ {} + named cstrut cs {} + named cstruthorizontal csh {} + named cmargin cm {} + named cmarginhorizontal cmh {} + named cmarginleft cml {} + named cmarginright cmr {} + named cmarginvertical cmv {} + named cmarginabove cma {} + named cmarginbelow cmb {} + named crule cr {} + named crulehorizontal crh {} + named cruleabove cra {} + named crulebelow crb {} + named crulevertical crv {} + named cruleleft crl {} + named cruleright crr {} + named crulewidth crw {} + named crulehorizontalwidth crhw {} + named cruleabovewidth craw {} + named crulebelowwidth crbw {} + named cruleverticalwidth crvw {} + named cruleleftwidth crlw {} + named crulerightwidth crrw {} + named crulegap crg {} + named crulehorizontalgap crhg {} + named cruleabovegap crag {} + named crulebelowgap crbg {} + named cruleverticalgap crvg {} + named cruleleftgap crlg {} + named crulerightgap crrg {} + named crulecolour crulecolor crc {} + named crulehorizontalcolour crulehorizontalcolor crhc {} + named cruleabovecolour cruleabovecolor crac {} + named crulebelowcolour crulebelowcolor crbc {} + named cruleverticalcolour cruleverticalcolor crvc {} + named cruleleftcolour cruleleftcolor crlc {} + named crulerightcolour crulerightcolor crrc {} + named cruleplainchar crpc {} + named cformat + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named @Cell + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + right x + {} + {} + + # parameters for formatting @Rowd rows + named dpaint dp {} + import @TextureImport named dtexture dt {} + named dbackground dbg {} + named dfont df {} + named dbreak db {} + named dwidth dw {} + named dheight dh {} + named dindent di {} + named dindentvertical div {} + named dstrut ds {} + named dstruthorizontal dsh {} + named dmargin dm {} + named dmarginhorizontal dmh {} + named dmarginleft dml {} + named dmarginright dmr {} + named dmarginvertical dmv {} + named dmarginabove dma {} + named dmarginbelow dmb {} + named drule dr {} + named drulehorizontal drh {} + named druleabove dra {} + named drulebelow drb {} + named drulevertical drv {} + named druleleft drl {} + named druleright drr {} + named drulewidth drw {} + named drulehorizontalwidth drhw {} + named druleabovewidth draw {} + named drulebelowwidth drbw {} + named druleverticalwidth drvw {} + named druleleftwidth drlw {} + named drulerightwidth drrw {} + named drulegap drg {} + named drulehorizontalgap drhg {} + named druleabovegap drag {} + named drulebelowgap drbg {} + named druleverticalgap drvg {} + named druleleftgap drlg {} + named drulerightgap drrg {} + named drulecolour drulecolor drc {} + named drulehorizontalcolour drulehorizontalcolor drhc {} + named druleabovecolour druleabovecolor drac {} + named drulebelowcolour drulebelowcolor drbc {} + named druleverticalcolour druleverticalcolor drvc {} + named druleleftcolour druleleftcolor drlc {} + named drulerightcolour drulerightcolor drrc {} + named druleplainchar drpc {} + named dformat + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named @Cell + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + right x + {} + {} + + # parameters for formatting @Rowe rows + named epaint ep {} + import @TextureImport named etexture et {} + named ebackground ebg {} + named efont ef {} + named ebreak eb {} + named ewidth ew {} + named eheight eh {} + named eindent ei {} + named eindentvertical eiv {} + named estrut es {} + named estruthorizontal esh {} + named emargin em {} + named emarginhorizontal emh {} + named emarginleft eml {} + named emarginright emr {} + named emarginvertical emv {} + named emarginabove ema {} + named emarginbelow emb {} + named erule er {} + named erulehorizontal erh {} + named eruleabove era {} + named erulebelow erb {} + named erulevertical erv {} + named eruleleft erl {} + named eruleright err {} + named erulewidth erw {} + named erulehorizontalwidth erhw {} + named eruleabovewidth eraw {} + named erulebelowwidth erbw {} + named eruleverticalwidth ervw {} + named eruleleftwidth erlw {} + named erulerightwidth errw {} + named erulegap erg {} + named erulehorizontalgap erhg {} + named eruleabovegap erag {} + named erulebelowgap erbg {} + named eruleverticalgap ervg {} + named eruleleftgap erlg {} + named erulerightgap errg {} + named erulecolour erulecolor erc {} + named erulehorizontalcolour erulehorizontalcolor erhc {} + named eruleabovecolour eruleabovecolor erac {} + named erulebelowcolour erulebelowcolor erbc {} + named eruleverticalcolour eruleverticalcolor ervc {} + named eruleleftcolour eruleleftcolor erlc {} + named erulerightcolour erulerightcolor errc {} + named eruleplainchar erpc {} + named eformat + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named @Cell + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + right x + {} + {} + + # parameters for formatting @Rowf rows + named fpaint fp {} + import @TextureImport named ftexture ft {} + named fbackground fbg {} + named ffont ff {} + named fbreak fb {} + named fwidth fw {} + named fheight fh {} + named findent fi {} + named findentvertical fiv {} + named fstrut fs {} + named fstruthorizontal fsh {} + named fmargin fm {} + named fmarginhorizontal fmh {} + named fmarginleft fml {} + named fmarginright fmr {} + named fmarginvertical fmv {} + named fmarginabove fma {} + named fmarginbelow fmb {} + named frule fr {} + named frulehorizontal frh {} + named fruleabove fra {} + named frulebelow frb {} + named frulevertical frv {} + named fruleleft frl {} + named fruleright frr {} + named frulewidth frw {} + named frulehorizontalwidth frhw {} + named fruleabovewidth fraw {} + named frulebelowwidth frbw {} + named fruleverticalwidth frvw {} + named fruleleftwidth frlw {} + named frulerightwidth frrw {} + named frulegap frg {} + named frulehorizontalgap frhg {} + named fruleabovegap frag {} + named frulebelowgap frbg {} + named fruleverticalgap frvg {} + named fruleleftgap frlg {} + named frulerightgap frrg {} + named frulecolour frulecolor frc {} + named frulehorizontalcolour frulehorizontalcolor frhc {} + named fruleabovecolour fruleabovecolor frac {} + named frulebelowcolour frulebelowcolor frbc {} + named fruleverticalcolour fruleverticalcolor frvc {} + named fruleleftcolour fruleleftcolor frlc {} + named frulerightcolour frulerightcolor frrc {} + named fruleplainchar frpc {} + named fformat + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named @Cell + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + right x + {} + {} + + # parameters for formatting @Rowg rows + named gpaint gp {} + import @TextureImport named gtexture gt {} + named gbackground gbg {} + named gfont gf {} + named gbreak gb {} + named gwidth gw {} + named gheight gh {} + named gindent gi {} + named gindentvertical giv {} + named gstrut gs {} + named gstruthorizontal gsh {} + named gmargin gm {} + named gmarginhorizontal gmh {} + named gmarginleft gml {} + named gmarginright gmr {} + named gmarginvertical gmv {} + named gmarginabove gma {} + named gmarginbelow gmb {} + named grule gr {} + named grulehorizontal grh {} + named gruleabove gra {} + named grulebelow grb {} + named grulevertical grv {} + named gruleleft grl {} + named gruleright grr {} + named grulewidth grw {} + named grulehorizontalwidth grhw {} + named gruleabovewidth graw {} + named grulebelowwidth grbw {} + named gruleverticalwidth grvw {} + named gruleleftwidth grlw {} + named grulerightwidth grrw {} + named grulegap grg {} + named grulehorizontalgap grhg {} + named gruleabovegap grag {} + named grulebelowgap grbg {} + named gruleverticalgap grvg {} + named gruleleftgap grlg {} + named grulerightgap grrg {} + named grulecolour grulecolor grc {} + named grulehorizontalcolour grulehorizontalcolor grhc {} + named gruleabovecolour gruleabovecolor grac {} + named grulebelowcolour grulebelowcolor grbc {} + named gruleverticalcolour gruleverticalcolor grvc {} + named gruleleftcolour gruleleftcolor grlc {} + named grulerightcolour grulerightcolor grrc {} + named gruleplainchar grpc {} + named gformat + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named @Cell + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + right x + {} + {} + + # parameters for formatting @Rowh rows + named hpaint hp {} + import @TextureImport named htexture ht {} + named hbackground hbg {} + named hfont hf {} + named hbreak hb {} + named hwidth hw {} + named hheight hh {} + named hindent hi {} + named hindentvertical hiv {} + named hstrut hs {} + named hstruthorizontal hsh {} + named hmargin hm {} + named hmarginhorizontal hmh {} + named hmarginleft hml {} + named hmarginright hmr {} + named hmarginvertical hmv {} + named hmarginabove hma {} + named hmarginbelow hmb {} + named hrule hr {} + named hrulehorizontal hrh {} + named hruleabove hra {} + named hrulebelow hrb {} + named hrulevertical hrv {} + named hruleleft hrl {} + named hruleright hrr {} + named hrulewidth hrw {} + named hrulehorizontalwidth hrhw {} + named hruleabovewidth hraw {} + named hrulebelowwidth hrbw {} + named hruleverticalwidth hrvw {} + named hruleleftwidth hrlw {} + named hrulerightwidth hrrw {} + named hrulegap hrg {} + named hrulehorizontalgap hrhg {} + named hruleabovegap hrag {} + named hrulebelowgap hrbg {} + named hruleverticalgap hrvg {} + named hruleleftgap hrlg {} + named hrulerightgap hrrg {} + named hrulecolour hrulecolor hrc {} + named hrulehorizontalcolour hrulehorizontalcolor hrhc {} + named hruleabovecolour hruleabovecolor hrac {} + named hrulebelowcolour hrulebelowcolor hrbc {} + named hruleverticalcolour hruleverticalcolor hrvc {} + named hruleleftcolour hruleleftcolor hrlc {} + named hrulerightcolour hrulerightcolor hrrc {} + named hruleplainchar hrpc {} + named hformat + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named @Cell + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + right x + {} + {} + + body @Body # this is the right parameter of @Tbl + + { + + ####################################################################### + # # + # Specific option values as @Tbl knows them (i.e. Level 2) # + # # + ####################################################################### + + def tblp { p @Else setupp } + def tblt { t @Else setupt } + def tblbg { bg @Else setupbg } + def tblf { f @Else setupf } + def tblb { b @Else setupb } + def tblw { w @Else setupw } + def tblh { h @Else setuph } + def tbli { i @Else setupi } + def tbliv { iv @Else setupiv } + def tbls { s @Else setups } + def tblsh { sh @Else setupsh } + def tblml { ml @Else mh @Else m @Else setupml } + def tblmr { mr @Else mh @Else m @Else setupmr } + def tblma { ma @Else mv @Else m @Else setupma } + def tblmb { mb @Else mv @Else m @Else setupmb } + def tblra { ra @Else rh @Else r @Else setupra } + def tblrb { rb @Else rh @Else r @Else setuprb } + def tblrl { rl @Else rv @Else r @Else setuprl } + def tblrr { rr @Else rv @Else r @Else setuprr } + def tblraw { raw @Else rhw @Else rw @Else setupraw } + def tblrbw { rbw @Else rhw @Else rw @Else setuprbw } + def tblrlw { rlw @Else rvw @Else rw @Else setuprlw } + def tblrrw { rrw @Else rvw @Else rw @Else setuprrw } + def tblrag { rag @Else rhg @Else rg @Else setuprag } + def tblrbg { rbg @Else rhg @Else rg @Else setuprbg } + def tblrlg { rlg @Else rvg @Else rg @Else setuprlg } + def tblrrg { rrg @Else rvg @Else rg @Else setuprrg } + def tblrac { rac @Else rhc @Else rc @Else setuprac } + def tblrbc { rbc @Else rhc @Else rc @Else setuprbc } + def tblrlc { rlc @Else rvc @Else rc @Else setuprlc } + def tblrrc { rrc @Else rvc @Else rc @Else setuprrc } + def tblrpc { rpc @Else setuprpc } + + + def @DoCell + named compulsory p {} + named compulsory t {} + named compulsory bg {} + named compulsory f {} + named compulsory b {} + named compulsory w {} + named compulsory h {} + named compulsory i {} + named compulsory iv {} + named compulsory s {} + named compulsory sh {} + named compulsory ml {} + named compulsory mr {} + named compulsory ma {} + named compulsory mb {} + named compulsory ra {} + named compulsory rb {} + named compulsory rl {} + named compulsory rr {} + named compulsory raw {} + named compulsory rbw {} + named compulsory rlw {} + named compulsory rrw {} + named compulsory rag {} + named compulsory rbg {} + named compulsory rlg {} + named compulsory rrg {} + named compulsory rac {} + named compulsory rbc {} + named compulsory rlc {} + named compulsory rrc {} + named compulsory rpc {} + right @Body + { + + def @ZeroWidth right x + { + @OneCol { |0io x |0io } + } + + def @ZeroHeight right x + { + @OneRow { /0io x /0io } + } + + def @PDFBox + { + "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h" + } + + def @PDFAddPaint right col + { + col @Case { + none @Yield "" + 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" @PSAddPaint col } @Graphic x } + PDF @Yield { { @PDFBox @PDFAddPaint col "S" } @Graphic x } + PlainText @Yield { rpc @PlainGraphic x } + } + } + + def @HRule left col right thick + { + @ZeroHeight thick @High col @FillBox {} + # thick @High col @FillBox {} + } + + def @VRule left col right thick + { + @ZeroWidth thick @Wide col @FillBox {} + # thick @Wide col @FillBox {} + } + + def @DoubleHRule + left col + named gap {} + right thick + { + @OneCol { col @HRule thick /gap col @HRule thick } + } + + def @DoubleVRule + left col + named gap {} + right thick + { + @OneRow { col @VRule thick |gap col @VRule thick } + } + + def @MakeHRule + left col + named thick {} + named gap {} + right type + { + type @Case { + { none "" no } @Yield {} + { yes single } @Yield col @HRule thick + { double } @Yield col @DoubleHRule gap { gap } thick + } + } + + def @MakeVRule + left col + named thick {} + named gap {} + right type + { + type @Case { + { none "" no } @Yield {} + { yes single } @Yield col @VRule thick + { double } @Yield col @DoubleVRule gap { gap } thick + } + } + + def @RuleBox + left col + named hthick {} + named vthick {} + named htype {} + named vtype {} + { + htype @Case { + { none "" no } @Yield {} + else @Yield vtype @Case { + { none "" no } @Yield {} + else @Yield { + @ZeroWidth @ZeroHeight hthick @Wide vthick @High + col @FillBox {} + } + } + } + } + + def @AddRules + right x + { + { + rlc @MakeVRule thick { rlw } gap { rlg } rl + |0rt |1rt + rrc @MakeVRule thick { rrw } gap { rrg } rr + } @Background + { rac @MakeHRule thick { raw } gap { rag } ra + /0rt + /1rt + rbc @MakeHRule thick { rbw } gap { rbg } rb + } @Background + { + |1rt rac @RuleBox hthick { rrw } vthick { raw } htype { rr } vtype { ra } + /0rt + /1rt |1rt + rbc @RuleBox hthick { rrw } vthick { rbw } htype { rr } vtype { rb } + } @Background x + + } + + def @AddMargins + right x + { + @OneCol @OneRow { + ^|ml |mr + ^/ma | x | + /mb | | + } + } + + def @PaintBox right x + { + @BackEnd @Case { + PostScript @Yield { {"LoutBox" @ColourCommand p t "fill"} @Graphic x } + PDF @Yield { { @PDFBox @PDFAddPaint col "S" } @Graphic x } + PlainText @Yield { x } + } + } + + def @AddPaint + right x + { + p @Case { + { none nopaint no } @Yield x + else @Yield { @PaintBox x } + } + } + + def @Strut right x + { + def strutval right x + { + x @Case { + { no No "" } @Yield "0.0f" + { yes Yes } @Yield "1.0f" + else @Yield x + } + } + + def vs { "0.5w" @VShift { { strutval s } @High } } + def hs { { strutval sh } @Wide } + + @OneCol @OneRow { ^| hs ^/ vs | x } + } + + def @VSize right x + { + h @Case { + "" @Yield x + else @Yield { h @High x } + } + } + + def @HSize right x + { + w @Case { + "" @Yield x + "expand" @Yield { "40c" @Wide x } + else @Yield { w @Wide x } + } + } + + def @HIndent right x + { + i @Case { + left @Yield @OneCol { | x } + ctr @Yield @OneCol { |"0.5rt" x } + right @Yield @OneCol { |"1.0rt" x } + mctr @Yield @OneCol { |"0.5bx" x } + align @Yield @OneCol x + else @Yield @OneCol { |i x } + } + } + + def @VIndent right x + { + # note: the default value "" gives top alignment, + # but that is not a problem because we are by + # default putting in a vertical strut + + iv @Case { + top @Yield @OneRow { / x } + ctr @Yield @OneRow { /"0.5rt" x } + foot @Yield @OneRow { /"1.0rt" x } + mctr @Yield @OneRow { /"0.5bx" x } + align @Yield @OneRow x + else @Yield @OneRow { /iv x } + } + } + + @HSize @VSize @AddPaint bg @Background @AddRules + @HIndent @VIndent @AddMargins f @Font b @Break @Strut @Body + } + + # symbol for producing @Row rows + def @DoRow + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + named compulsory format + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + named @Cell + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + right x + {} + {} + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + { + + ################################################################### + # # + # Specific option values as @Row knows them (i.e. Level 6) # + # # + ################################################################### + + def rowp { p @Else tblp } + def rowt { t @Else tblt } + def rowbg { bg @Else tblbg } + def rowf { f @Else tblf } + def rowb { b @Else tblb } + def roww { w @Else tblw } + def rowh { h @Else tblh } + def rowi { i @Else tbli } + def rowiv { iv @Else tbliv } + def rows { s @Else tbls } + def rowsh { sh @Else tblsh } + def rowml { ml @Else mh @Else m @Else tblml } + def rowmr { mr @Else mh @Else m @Else tblmr } + def rowma { ma @Else mv @Else m @Else tblma } + def rowmb { mb @Else mv @Else m @Else tblmb } + def rowra { ra @Else rh @Else r @Else tblra } + def rowrb { rb @Else rh @Else r @Else tblrb } + def rowrl { rl @Else rv @Else r @Else tblrl } + def rowrr { rr @Else rv @Else r @Else tblrr } + def rowraw { raw @Else rhw @Else rw @Else tblraw } + def rowrbw { rbw @Else rhw @Else rw @Else tblrbw } + def rowrlw { rlw @Else rvw @Else rw @Else tblrlw } + def rowrrw { rrw @Else rvw @Else rw @Else tblrrw } + def rowrag { rag @Else rhg @Else rg @Else tblrag } + def rowrbg { rbg @Else rhg @Else rg @Else tblrbg } + def rowrlg { rlg @Else rvg @Else rg @Else tblrlg } + def rowrrg { rrg @Else rvg @Else rg @Else tblrrg } + def rowrac { rac @Else rhc @Else rc @Else tblrac } + def rowrbc { rbc @Else rhc @Else rc @Else tblrbc } + def rowrlc { rlc @Else rvc @Else rc @Else tblrlc } + def rowrrc { rrc @Else rvc @Else rc @Else tblrrc } + def rowrpc { rpc @Else tblrpc } + + format + A { A } B { B } C { C } D { D } E { E } F { F } + G { G } H { H } I { I } J { J } K { K } L { L } + M { M } N { N } O { O } P { P } Q { Q } R { R } + S { S } T { T } U { U } V { V } W { W } X { X } + Y { Y } Z { Z } + @Cell { + + @DoCell + + ####################################################### + # # + # Specific option values to @Cell (i.e. Level 7) # + # # + ####################################################### + + p { p @Else rowp } + t { t @Else rowt } + bg { bg @Else rowbg } + f { f @Else rowf } + b { b @Else rowb } + w { w @Else roww } + h { h @Else rowh } + i { i @Else rowi } + iv { iv @Else rowiv } + s { s @Else rows } + sh { sh @Else rowsh } + ml { ml @Else mh @Else m @Else rowml } + mr { mr @Else mh @Else m @Else rowmr } + ma { ma @Else mv @Else m @Else rowma } + mb { mb @Else mv @Else m @Else rowmb } + ra { ra @Else rh @Else r @Else rowra } + rb { rb @Else rh @Else r @Else rowrb } + rl { rl @Else rv @Else r @Else rowrl } + rr { rr @Else rv @Else r @Else rowrr } + raw { raw @Else rhw @Else rw @Else rowraw } + rbw { rbw @Else rhw @Else rw @Else rowrbw } + rlw { rlw @Else rvw @Else rw @Else rowrlw } + rrw { rrw @Else rvw @Else rw @Else rowrrw } + rag { rag @Else rhg @Else rg @Else rowrag } + rbg { rbg @Else rhg @Else rg @Else rowrbg } + rlg { rlg @Else rvg @Else rg @Else rowrlg } + rrg { rrg @Else rvg @Else rg @Else rowrrg } + rac { rac @Else rhc @Else rc @Else rowrac } + rbc { rbc @Else rhc @Else rc @Else rowrbc } + rlc { rlc @Else rvc @Else rc @Else rowrlc } + rrc { rrc @Else rvc @Else rc @Else rowrrc } + rpc { rpc @Else rowrpc } + + x + } + } + + # symbol for producing @Rowa rows + def @DoRowa + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + { + + ################################################################### + # # + # Specific option values at "aoption" level (i.e. Level 3) # + # # + ################################################################### + + def tbxp { ap @Else tblp } + def tbxt { at @Else tblt } + def tbxbg { abg @Else tblbg } + def tbxf { af @Else tblf } + def tbxb { ab @Else tblb } + def tbxw { aw @Else tblw } + def tbxh { ah @Else tblh } + def tbxi { ai @Else tbli } + def tbxiv { aiv @Else tbliv } + def tbxs { as @Else tbls } + def tbxsh { ash @Else tblsh } + def tbxml { aml @Else amh @Else am @Else tblml } + def tbxmr { amr @Else amh @Else am @Else tblmr } + def tbxma { ama @Else amv @Else am @Else tblma } + def tbxmb { amb @Else amv @Else am @Else tblmb } + def tbxra { ara @Else arh @Else ar @Else tblra } + def tbxrb { arb @Else arh @Else ar @Else tblrb } + def tbxrl { arl @Else arv @Else ar @Else tblrl } + def tbxrr { arr @Else arv @Else ar @Else tblrr } + def tbxraw { araw @Else arhw @Else arw @Else tblraw } + def tbxrbw { arbw @Else arhw @Else arw @Else tblrbw } + def tbxrlw { arlw @Else arvw @Else arw @Else tblrlw } + def tbxrrw { arrw @Else arvw @Else arw @Else tblrrw } + def tbxrag { arag @Else arhg @Else arg @Else tblrag } + def tbxrbg { arbg @Else arhg @Else arg @Else tblrbg } + def tbxrlg { arlg @Else arvg @Else arg @Else tblrlg } + def tbxrrg { arrg @Else arvg @Else arg @Else tblrrg } + def tbxrac { arac @Else arhc @Else arc @Else tblrac } + def tbxrbc { arbc @Else arhc @Else arc @Else tblrbc } + def tbxrlc { arlc @Else arvc @Else arc @Else tblrlc } + def tbxrrc { arrc @Else arvc @Else arc @Else tblrrc } + def tbxrpc { arpc @Else tblrpc } + + ################################################################### + # # + # Specific option values at @Rowa level (i.e. Level 4) # + # # + ################################################################### + + def rowp { p @Else tbxp } + def rowt { t @Else tblt } + def rowbg { bg @Else tbxbg } + def rowf { f @Else tbxf } + def rowb { b @Else tbxb } + def roww { w @Else tbxw } + def rowh { h @Else tbxh } + def rowi { i @Else tbxi } + def rowiv { iv @Else tbxiv } + def rows { s @Else tbxs } + def rowsh { sh @Else tbxsh } + def rowml { ml @Else mh @Else m @Else tbxml } + def rowmr { mr @Else mh @Else m @Else tbxmr } + def rowma { ma @Else mv @Else m @Else tbxma } + def rowmb { mb @Else mv @Else m @Else tbxmb } + def rowra { ra @Else rh @Else r @Else tbxra } + def rowrb { rb @Else rh @Else r @Else tbxrb } + def rowrl { rl @Else rv @Else r @Else tbxrl } + def rowrr { rr @Else rv @Else r @Else tbxrr } + def rowraw { raw @Else rhw @Else rw @Else tbxraw } + def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw } + def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw } + def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw } + def rowrag { rag @Else rhg @Else rg @Else tbxrag } + def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg } + def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg } + def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg } + def rowrac { rac @Else rhc @Else rc @Else tbxrac } + def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc } + def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc } + def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc } + def rowrpc { rpc @Else tbxrpc } + + aformat + A { A } B { B } C { C } D { D } E { E } F { F } + G { G } H { H } I { I } J { J } K { K } L { L } + M { M } N { N } O { O } P { P } Q { Q } R { R } + S { S } T { T } U { U } V { V } W { W } X { X } + Y { Y } Z { Z } + @Cell { + + @DoCell + + ####################################################### + # # + # Specific option values to @Cell (i.e. Level 5) # + # # + ####################################################### + + p { p @Else rowp } + t { t @Else rowt } + bg { bg @Else rowbg } + f { f @Else rowf } + b { b @Else rowb } + w { w @Else roww } + h { h @Else rowh } + i { i @Else rowi } + iv { iv @Else rowiv } + s { s @Else rows } + sh { sh @Else rowsh } + ml { ml @Else mh @Else m @Else rowml } + mr { mr @Else mh @Else m @Else rowmr } + ma { ma @Else mv @Else m @Else rowma } + mb { mb @Else mv @Else m @Else rowmb } + ra { ra @Else rh @Else r @Else rowra } + rb { rb @Else rh @Else r @Else rowrb } + rl { rl @Else rv @Else r @Else rowrl } + rr { rr @Else rv @Else r @Else rowrr } + raw { raw @Else rhw @Else rw @Else rowraw } + rbw { rbw @Else rhw @Else rw @Else rowrbw } + rlw { rlw @Else rvw @Else rw @Else rowrlw } + rrw { rrw @Else rvw @Else rw @Else rowrrw } + rag { rag @Else rhg @Else rg @Else rowrag } + rbg { rbg @Else rhg @Else rg @Else rowrbg } + rlg { rlg @Else rvg @Else rg @Else rowrlg } + rrg { rrg @Else rvg @Else rg @Else rowrrg } + rac { rac @Else rhc @Else rc @Else rowrac } + rbc { rbc @Else rhc @Else rc @Else rowrbc } + rlc { rlc @Else rvc @Else rc @Else rowrlc } + rrc { rrc @Else rvc @Else rc @Else rowrrc } + rpc { rpc @Else rowrpc } + + x + } + } + + # symbol for producing @Rowb rows + def @DoRowb + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + { + + ################################################################### + # # + # Specific option values at "boption" level (i.e. Level 3) # + # # + ################################################################### + + def tbxp { bp @Else tblp } + def tbxt { bt @Else tblt } + def tbxbg { bbg @Else tblbg } + def tbxf { bf @Else tblf } + def tbxb { bb @Else tblb } + def tbxw { bw @Else tblw } + def tbxh { bh @Else tblh } + def tbxi { bi @Else tbli } + def tbxiv { biv @Else tbliv } + def tbxs { bs @Else tbls } + def tbxsh { bsh @Else tblsh } + def tbxml { bml @Else bmh @Else bm @Else tblml } + def tbxmr { bmr @Else bmh @Else bm @Else tblmr } + def tbxma { bma @Else bmv @Else bm @Else tblma } + def tbxmb { bmb @Else bmv @Else bm @Else tblmb } + def tbxra { bra @Else brh @Else br @Else tblra } + def tbxrb { brb @Else brh @Else br @Else tblrb } + def tbxrl { brl @Else brv @Else br @Else tblrl } + def tbxrr { brr @Else brv @Else br @Else tblrr } + def tbxraw { braw @Else brhw @Else brw @Else tblraw } + def tbxrbw { brbw @Else brhw @Else brw @Else tblrbw } + def tbxrlw { brlw @Else brvw @Else brw @Else tblrlw } + def tbxrrw { brrw @Else brvw @Else brw @Else tblrrw } + def tbxrag { brag @Else brhg @Else brg @Else tblrag } + def tbxrbg { brbg @Else brhg @Else brg @Else tblrbg } + def tbxrlg { brlg @Else brvg @Else brg @Else tblrlg } + def tbxrrg { brrg @Else brvg @Else brg @Else tblrrg } + def tbxrac { brac @Else brhc @Else brc @Else tblrac } + def tbxrbc { brbc @Else brhc @Else brc @Else tblrbc } + def tbxrlc { brlc @Else brvc @Else brc @Else tblrlc } + def tbxrrc { brrc @Else brvc @Else brc @Else tblrrc } + def tbxrpc { brpc @Else tblrpc } + + ################################################################### + # # + # Specific option values at @Rowb level (i.e. Level 4) # + # # + ################################################################### + + def rowp { p @Else tbxp } + def rowt { t @Else tblt } + def rowbg { bg @Else tbxbg } + def rowf { f @Else tbxf } + def rowb { b @Else tbxb } + def roww { w @Else tbxw } + def rowh { h @Else tbxh } + def rowi { i @Else tbxi } + def rowiv { iv @Else tbxiv } + def rows { s @Else tbxs } + def rowsh { sh @Else tbxsh } + def rowml { ml @Else mh @Else m @Else tbxml } + def rowmr { mr @Else mh @Else m @Else tbxmr } + def rowma { ma @Else mv @Else m @Else tbxma } + def rowmb { mb @Else mv @Else m @Else tbxmb } + def rowra { ra @Else rh @Else r @Else tbxra } + def rowrb { rb @Else rh @Else r @Else tbxrb } + def rowrl { rl @Else rv @Else r @Else tbxrl } + def rowrr { rr @Else rv @Else r @Else tbxrr } + def rowraw { raw @Else rhw @Else rw @Else tbxraw } + def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw } + def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw } + def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw } + def rowrag { rag @Else rhg @Else rg @Else tbxrag } + def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg } + def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg } + def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg } + def rowrac { rac @Else rhc @Else rc @Else tbxrac } + def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc } + def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc } + def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc } + def rowrpc { rpc @Else tbxrpc } + + bformat + A { A } B { B } C { C } D { D } E { E } F { F } + G { G } H { H } I { I } J { J } K { K } L { L } + M { M } N { N } O { O } P { P } Q { Q } R { R } + S { S } T { T } U { U } V { V } W { W } X { X } + Y { Y } Z { Z } + @Cell { + + @DoCell + + ####################################################### + # # + # Specific option values to @Cell (i.e. Level 5) # + # # + ####################################################### + + p { p @Else rowp } + t { t @Else rowt } + bg { bg @Else rowbg } + f { f @Else rowf } + b { b @Else rowb } + w { w @Else roww } + h { h @Else rowh } + i { i @Else rowi } + iv { iv @Else rowiv } + s { s @Else rows } + sh { sh @Else rowsh } + ml { ml @Else mh @Else m @Else rowml } + mr { mr @Else mh @Else m @Else rowmr } + ma { ma @Else mv @Else m @Else rowma } + mb { mb @Else mv @Else m @Else rowmb } + ra { ra @Else rh @Else r @Else rowra } + rb { rb @Else rh @Else r @Else rowrb } + rl { rl @Else rv @Else r @Else rowrl } + rr { rr @Else rv @Else r @Else rowrr } + raw { raw @Else rhw @Else rw @Else rowraw } + rbw { rbw @Else rhw @Else rw @Else rowrbw } + rlw { rlw @Else rvw @Else rw @Else rowrlw } + rrw { rrw @Else rvw @Else rw @Else rowrrw } + rag { rag @Else rhg @Else rg @Else rowrag } + rbg { rbg @Else rhg @Else rg @Else rowrbg } + rlg { rlg @Else rvg @Else rg @Else rowrlg } + rrg { rrg @Else rvg @Else rg @Else rowrrg } + rac { rac @Else rhc @Else rc @Else rowrac } + rbc { rbc @Else rhc @Else rc @Else rowrbc } + rlc { rlc @Else rvc @Else rc @Else rowrlc } + rrc { rrc @Else rvc @Else rc @Else rowrrc } + rpc { rpc @Else rowrpc } + + x + } + } + + # symbol for producing @Rowc rows + def @DoRowc + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + { + + ################################################################### + # # + # Specific option values at "coption" level (i.e. Level 3) # + # # + ################################################################### + + def tbxp { cp @Else tblp } + def tbxt { ct @Else tblt } + def tbxbg { cbg @Else tblbg } + def tbxf { cf @Else tblf } + def tbxb { cb @Else tblb } + def tbxw { cw @Else tblw } + def tbxh { ch @Else tblh } + def tbxi { ci @Else tbli } + def tbxiv { civ @Else tbliv } + def tbxs { cs @Else tbls } + def tbxsh { csh @Else tblsh } + def tbxml { cml @Else cmh @Else cm @Else tblml } + def tbxmr { cmr @Else cmh @Else cm @Else tblmr } + def tbxma { cma @Else cmv @Else cm @Else tblma } + def tbxmb { cmb @Else cmv @Else cm @Else tblmb } + def tbxra { cra @Else crh @Else cr @Else tblra } + def tbxrb { crb @Else crh @Else cr @Else tblrb } + def tbxrl { crl @Else crv @Else cr @Else tblrl } + def tbxrr { crr @Else crv @Else cr @Else tblrr } + def tbxraw { craw @Else crhw @Else crw @Else tblraw } + def tbxrbw { crbw @Else crhw @Else crw @Else tblrbw } + def tbxrlw { crlw @Else crvw @Else crw @Else tblrlw } + def tbxrrw { crrw @Else crvw @Else crw @Else tblrrw } + def tbxrag { crag @Else crhg @Else crg @Else tblrag } + def tbxrbg { crbg @Else crhg @Else crg @Else tblrbg } + def tbxrlg { crlg @Else crvg @Else crg @Else tblrlg } + def tbxrrg { crrg @Else crvg @Else crg @Else tblrrg } + def tbxrac { crac @Else crhc @Else crc @Else tblrac } + def tbxrbc { crbc @Else crhc @Else crc @Else tblrbc } + def tbxrlc { crlc @Else crvc @Else crc @Else tblrlc } + def tbxrrc { crrc @Else crvc @Else crc @Else tblrrc } + def tbxrpc { crpc @Else tblrpc } + + ################################################################### + # # + # Specific option values at @Rowc level (i.e. Level 4) # + # # + ################################################################### + + def rowp { p @Else tbxp } + def rowt { t @Else tblt } + def rowbg { bg @Else tbxbg } + def rowf { f @Else tbxf } + def rowb { b @Else tbxb } + def roww { w @Else tbxw } + def rowh { h @Else tbxh } + def rowi { i @Else tbxi } + def rowiv { iv @Else tbxiv } + def rows { s @Else tbxs } + def rowsh { sh @Else tbxsh } + def rowml { ml @Else mh @Else m @Else tbxml } + def rowmr { mr @Else mh @Else m @Else tbxmr } + def rowma { ma @Else mv @Else m @Else tbxma } + def rowmb { mb @Else mv @Else m @Else tbxmb } + def rowra { ra @Else rh @Else r @Else tbxra } + def rowrb { rb @Else rh @Else r @Else tbxrb } + def rowrl { rl @Else rv @Else r @Else tbxrl } + def rowrr { rr @Else rv @Else r @Else tbxrr } + def rowraw { raw @Else rhw @Else rw @Else tbxraw } + def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw } + def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw } + def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw } + def rowrag { rag @Else rhg @Else rg @Else tbxrag } + def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg } + def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg } + def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg } + def rowrac { rac @Else rhc @Else rc @Else tbxrac } + def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc } + def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc } + def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc } + def rowrpc { rpc @Else tbxrpc } + + cformat + A { A } B { B } C { C } D { D } E { E } F { F } + G { G } H { H } I { I } J { J } K { K } L { L } + M { M } N { N } O { O } P { P } Q { Q } R { R } + S { S } T { T } U { U } V { V } W { W } X { X } + Y { Y } Z { Z } + @Cell { + + @DoCell + + ####################################################### + # # + # Specific option values to @Cell (i.e. Level 5) # + # # + ####################################################### + + p { p @Else rowp } + t { t @Else rowt } + bg { bg @Else rowbg } + f { f @Else rowf } + b { b @Else rowb } + w { w @Else roww } + h { h @Else rowh } + i { i @Else rowi } + iv { iv @Else rowiv } + s { s @Else rows } + sh { sh @Else rowsh } + ml { ml @Else mh @Else m @Else rowml } + mr { mr @Else mh @Else m @Else rowmr } + ma { ma @Else mv @Else m @Else rowma } + mb { mb @Else mv @Else m @Else rowmb } + ra { ra @Else rh @Else r @Else rowra } + rb { rb @Else rh @Else r @Else rowrb } + rl { rl @Else rv @Else r @Else rowrl } + rr { rr @Else rv @Else r @Else rowrr } + raw { raw @Else rhw @Else rw @Else rowraw } + rbw { rbw @Else rhw @Else rw @Else rowrbw } + rlw { rlw @Else rvw @Else rw @Else rowrlw } + rrw { rrw @Else rvw @Else rw @Else rowrrw } + rag { rag @Else rhg @Else rg @Else rowrag } + rbg { rbg @Else rhg @Else rg @Else rowrbg } + rlg { rlg @Else rvg @Else rg @Else rowrlg } + rrg { rrg @Else rvg @Else rg @Else rowrrg } + rac { rac @Else rhc @Else rc @Else rowrac } + rbc { rbc @Else rhc @Else rc @Else rowrbc } + rlc { rlc @Else rvc @Else rc @Else rowrlc } + rrc { rrc @Else rvc @Else rc @Else rowrrc } + rpc { rpc @Else rowrpc } + + x + } + } + + # symbol for producing @Rowd rows + def @DoRowd + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + { + + ################################################################### + # # + # Specific option values at "doption" level (i.e. Level 3) # + # # + ################################################################### + + def tbxp { dp @Else tblp } + def tbxt { dt @Else tblt } + def tbxbg { dbg @Else tblbg } + def tbxf { df @Else tblf } + def tbxb { db @Else tblb } + def tbxw { dw @Else tblw } + def tbxh { dh @Else tblh } + def tbxi { di @Else tbli } + def tbxiv { div @Else tbliv } + def tbxs { ds @Else tbls } + def tbxsh { dsh @Else tblsh } + def tbxml { dml @Else dmh @Else dm @Else tblml } + def tbxmr { dmr @Else dmh @Else dm @Else tblmr } + def tbxma { dma @Else dmv @Else dm @Else tblma } + def tbxmb { dmb @Else dmv @Else dm @Else tblmb } + def tbxra { dra @Else drh @Else dr @Else tblra } + def tbxrb { drb @Else drh @Else dr @Else tblrb } + def tbxrl { drl @Else drv @Else dr @Else tblrl } + def tbxrr { drr @Else drv @Else dr @Else tblrr } + def tbxraw { draw @Else drhw @Else drw @Else tblraw } + def tbxrbw { drbw @Else drhw @Else drw @Else tblrbw } + def tbxrlw { drlw @Else drvw @Else drw @Else tblrlw } + def tbxrrw { drrw @Else drvw @Else drw @Else tblrrw } + def tbxrag { drag @Else drhg @Else drg @Else tblrag } + def tbxrbg { drbg @Else drhg @Else drg @Else tblrbg } + def tbxrlg { drlg @Else drvg @Else drg @Else tblrlg } + def tbxrrg { drrg @Else drvg @Else drg @Else tblrrg } + def tbxrac { drac @Else drhc @Else drc @Else tblrac } + def tbxrbc { drbc @Else drhc @Else drc @Else tblrbc } + def tbxrlc { drlc @Else drvc @Else drc @Else tblrlc } + def tbxrrc { drrc @Else drvc @Else drc @Else tblrrc } + def tbxrpc { drpc @Else tblrpc } + + ################################################################### + # # + # Specific option values at @Rowd level (i.e. Level 4) # + # # + ################################################################### + + def rowp { p @Else tbxp } + def rowt { t @Else tblt } + def rowbg { bg @Else tbxbg } + def rowf { f @Else tbxf } + def rowb { b @Else tbxb } + def roww { w @Else tbxw } + def rowh { h @Else tbxh } + def rowi { i @Else tbxi } + def rowiv { iv @Else tbxiv } + def rows { s @Else tbxs } + def rowsh { sh @Else tbxsh } + def rowml { ml @Else mh @Else m @Else tbxml } + def rowmr { mr @Else mh @Else m @Else tbxmr } + def rowma { ma @Else mv @Else m @Else tbxma } + def rowmb { mb @Else mv @Else m @Else tbxmb } + def rowra { ra @Else rh @Else r @Else tbxra } + def rowrb { rb @Else rh @Else r @Else tbxrb } + def rowrl { rl @Else rv @Else r @Else tbxrl } + def rowrr { rr @Else rv @Else r @Else tbxrr } + def rowraw { raw @Else rhw @Else rw @Else tbxraw } + def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw } + def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw } + def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw } + def rowrag { rag @Else rhg @Else rg @Else tbxrag } + def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg } + def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg } + def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg } + def rowrac { rac @Else rhc @Else rc @Else tbxrac } + def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc } + def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc } + def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc } + def rowrpc { rpc @Else tbxrpc } + + dformat + A { A } B { B } C { C } D { D } E { E } F { F } + G { G } H { H } I { I } J { J } K { K } L { L } + M { M } N { N } O { O } P { P } Q { Q } R { R } + S { S } T { T } U { U } V { V } W { W } X { X } + Y { Y } Z { Z } + @Cell { + + @DoCell + + ####################################################### + # # + # Specific option values to @Cell (i.e. Level 5) # + # # + ####################################################### + + p { p @Else rowp } + t { t @Else rowt } + bg { bg @Else rowbg } + f { f @Else rowf } + b { b @Else rowb } + w { w @Else roww } + h { h @Else rowh } + i { i @Else rowi } + iv { iv @Else rowiv } + s { s @Else rows } + sh { sh @Else rowsh } + ml { ml @Else mh @Else m @Else rowml } + mr { mr @Else mh @Else m @Else rowmr } + ma { ma @Else mv @Else m @Else rowma } + mb { mb @Else mv @Else m @Else rowmb } + ra { ra @Else rh @Else r @Else rowra } + rb { rb @Else rh @Else r @Else rowrb } + rl { rl @Else rv @Else r @Else rowrl } + rr { rr @Else rv @Else r @Else rowrr } + raw { raw @Else rhw @Else rw @Else rowraw } + rbw { rbw @Else rhw @Else rw @Else rowrbw } + rlw { rlw @Else rvw @Else rw @Else rowrlw } + rrw { rrw @Else rvw @Else rw @Else rowrrw } + rag { rag @Else rhg @Else rg @Else rowrag } + rbg { rbg @Else rhg @Else rg @Else rowrbg } + rlg { rlg @Else rvg @Else rg @Else rowrlg } + rrg { rrg @Else rvg @Else rg @Else rowrrg } + rac { rac @Else rhc @Else rc @Else rowrac } + rbc { rbc @Else rhc @Else rc @Else rowrbc } + rlc { rlc @Else rvc @Else rc @Else rowrlc } + rrc { rrc @Else rvc @Else rc @Else rowrrc } + rpc { rpc @Else rowrpc } + + x + } + } + + # symbol for producing @Rowe rows + def @DoRowe + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + { + + ################################################################### + # # + # Specific option values at "eoption" level (i.e. Level 3) # + # # + ################################################################### + + def tbxp { ep @Else tblp } + def tbxt { et @Else tblt } + def tbxbg { ebg @Else tblbg } + def tbxf { ef @Else tblf } + def tbxb { eb @Else tblb } + def tbxw { ew @Else tblw } + def tbxh { eh @Else tblh } + def tbxi { ei @Else tbli } + def tbxiv { eiv @Else tbliv } + def tbxs { es @Else tbls } + def tbxsh { esh @Else tblsh } + def tbxml { eml @Else emh @Else em @Else tblml } + def tbxmr { emr @Else emh @Else em @Else tblmr } + def tbxma { ema @Else emv @Else em @Else tblma } + def tbxmb { emb @Else emv @Else em @Else tblmb } + def tbxra { era @Else erh @Else er @Else tblra } + def tbxrb { erb @Else erh @Else er @Else tblrb } + def tbxrl { erl @Else erv @Else er @Else tblrl } + def tbxrr { err @Else erv @Else er @Else tblrr } + def tbxraw { eraw @Else erhw @Else erw @Else tblraw } + def tbxrbw { erbw @Else erhw @Else erw @Else tblrbw } + def tbxrlw { erlw @Else ervw @Else erw @Else tblrlw } + def tbxrrw { errw @Else ervw @Else erw @Else tblrrw } + def tbxrag { erag @Else erhg @Else erg @Else tblrag } + def tbxrbg { erbg @Else erhg @Else erg @Else tblrbg } + def tbxrlg { erlg @Else ervg @Else erg @Else tblrlg } + def tbxrrg { errg @Else ervg @Else erg @Else tblrrg } + def tbxrac { erac @Else erhc @Else erc @Else tblrac } + def tbxrbc { erbc @Else erhc @Else erc @Else tblrbc } + def tbxrlc { erlc @Else ervc @Else erc @Else tblrlc } + def tbxrrc { errc @Else ervc @Else erc @Else tblrrc } + def tbxrpc { erpc @Else tblrpc } + + ################################################################### + # # + # Specific option values at @Rowe level (i.e. Level 4) # + # # + ################################################################### + + def rowp { p @Else tbxp } + def rowt { t @Else tblt } + def rowbg { bg @Else tbxbg } + def rowf { f @Else tbxf } + def rowb { b @Else tbxb } + def roww { w @Else tbxw } + def rowh { h @Else tbxh } + def rowi { i @Else tbxi } + def rowiv { iv @Else tbxiv } + def rows { s @Else tbxs } + def rowsh { sh @Else tbxsh } + def rowml { ml @Else mh @Else m @Else tbxml } + def rowmr { mr @Else mh @Else m @Else tbxmr } + def rowma { ma @Else mv @Else m @Else tbxma } + def rowmb { mb @Else mv @Else m @Else tbxmb } + def rowra { ra @Else rh @Else r @Else tbxra } + def rowrb { rb @Else rh @Else r @Else tbxrb } + def rowrl { rl @Else rv @Else r @Else tbxrl } + def rowrr { rr @Else rv @Else r @Else tbxrr } + def rowraw { raw @Else rhw @Else rw @Else tbxraw } + def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw } + def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw } + def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw } + def rowrag { rag @Else rhg @Else rg @Else tbxrag } + def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg } + def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg } + def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg } + def rowrac { rac @Else rhc @Else rc @Else tbxrac } + def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc } + def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc } + def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc } + def rowrpc { rpc @Else tbxrpc } + + eformat + A { A } B { B } C { C } D { D } E { E } F { F } + G { G } H { H } I { I } J { J } K { K } L { L } + M { M } N { N } O { O } P { P } Q { Q } R { R } + S { S } T { T } U { U } V { V } W { W } X { X } + Y { Y } Z { Z } + @Cell { + + @DoCell + + ####################################################### + # # + # Specific option values to @Cell (i.e. Level 5) # + # # + ####################################################### + + p { p @Else rowp } + t { t @Else rowt } + bg { bg @Else rowbg } + f { f @Else rowf } + b { b @Else rowb } + w { w @Else roww } + h { h @Else rowh } + i { i @Else rowi } + iv { iv @Else rowiv } + s { s @Else rows } + sh { sh @Else rowsh } + ml { ml @Else mh @Else m @Else rowml } + mr { mr @Else mh @Else m @Else rowmr } + ma { ma @Else mv @Else m @Else rowma } + mb { mb @Else mv @Else m @Else rowmb } + ra { ra @Else rh @Else r @Else rowra } + rb { rb @Else rh @Else r @Else rowrb } + rl { rl @Else rv @Else r @Else rowrl } + rr { rr @Else rv @Else r @Else rowrr } + raw { raw @Else rhw @Else rw @Else rowraw } + rbw { rbw @Else rhw @Else rw @Else rowrbw } + rlw { rlw @Else rvw @Else rw @Else rowrlw } + rrw { rrw @Else rvw @Else rw @Else rowrrw } + rag { rag @Else rhg @Else rg @Else rowrag } + rbg { rbg @Else rhg @Else rg @Else rowrbg } + rlg { rlg @Else rvg @Else rg @Else rowrlg } + rrg { rrg @Else rvg @Else rg @Else rowrrg } + rac { rac @Else rhc @Else rc @Else rowrac } + rbc { rbc @Else rhc @Else rc @Else rowrbc } + rlc { rlc @Else rvc @Else rc @Else rowrlc } + rrc { rrc @Else rvc @Else rc @Else rowrrc } + rpc { rpc @Else rowrpc } + + x + } + } + + # symbol for producing @Rowf rows + def @DoRowf + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + { + + ################################################################### + # # + # Specific option values at "foption" level (i.e. Level 3) # + # # + ################################################################### + + def tbxp { fp @Else tblp } + def tbxt { ft @Else tblt } + def tbxbg { fbg @Else tblbg } + def tbxf { ff @Else tblf } + def tbxb { fb @Else tblb } + def tbxw { fw @Else tblw } + def tbxh { fh @Else tblh } + def tbxi { fi @Else tbli } + def tbxiv { fiv @Else tbliv } + def tbxs { fs @Else tbls } + def tbxsh { fsh @Else tblsh } + def tbxml { fml @Else fmh @Else fm @Else tblml } + def tbxmr { fmr @Else fmh @Else fm @Else tblmr } + def tbxma { fma @Else fmv @Else fm @Else tblma } + def tbxmb { fmb @Else fmv @Else fm @Else tblmb } + def tbxra { fra @Else frh @Else fr @Else tblra } + def tbxrb { frb @Else frh @Else fr @Else tblrb } + def tbxrl { frl @Else frv @Else fr @Else tblrl } + def tbxrr { frr @Else frv @Else fr @Else tblrr } + def tbxraw { fraw @Else frhw @Else frw @Else tblraw } + def tbxrbw { frbw @Else frhw @Else frw @Else tblrbw } + def tbxrlw { frlw @Else frvw @Else frw @Else tblrlw } + def tbxrrw { frrw @Else frvw @Else frw @Else tblrrw } + def tbxrag { frag @Else frhg @Else frg @Else tblrag } + def tbxrbg { frbg @Else frhg @Else frg @Else tblrbg } + def tbxrlg { frlg @Else frvg @Else frg @Else tblrlg } + def tbxrrg { frrg @Else frvg @Else frg @Else tblrrg } + def tbxrac { frac @Else frhc @Else frc @Else tblrac } + def tbxrbc { frbc @Else frhc @Else frc @Else tblrbc } + def tbxrlc { frlc @Else frvc @Else frc @Else tblrlc } + def tbxrrc { frrc @Else frvc @Else frc @Else tblrrc } + def tbxrpc { frpc @Else tblrpc } + + ################################################################### + # # + # Specific option values at @Rowf level (i.e. Level 4) # + # # + ################################################################### + + def rowp { p @Else tbxp } + def rowt { t @Else tblt } + def rowbg { bg @Else tbxbg } + def rowf { f @Else tbxf } + def rowb { b @Else tbxb } + def roww { w @Else tbxw } + def rowh { h @Else tbxh } + def rowi { i @Else tbxi } + def rowiv { iv @Else tbxiv } + def rows { s @Else tbxs } + def rowsh { sh @Else tbxsh } + def rowml { ml @Else mh @Else m @Else tbxml } + def rowmr { mr @Else mh @Else m @Else tbxmr } + def rowma { ma @Else mv @Else m @Else tbxma } + def rowmb { mb @Else mv @Else m @Else tbxmb } + def rowra { ra @Else rh @Else r @Else tbxra } + def rowrb { rb @Else rh @Else r @Else tbxrb } + def rowrl { rl @Else rv @Else r @Else tbxrl } + def rowrr { rr @Else rv @Else r @Else tbxrr } + def rowraw { raw @Else rhw @Else rw @Else tbxraw } + def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw } + def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw } + def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw } + def rowrag { rag @Else rhg @Else rg @Else tbxrag } + def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg } + def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg } + def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg } + def rowrac { rac @Else rhc @Else rc @Else tbxrac } + def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc } + def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc } + def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc } + def rowrpc { rpc @Else tbxrpc } + + fformat + A { A } B { B } C { C } D { D } E { E } F { F } + G { G } H { H } I { I } J { J } K { K } L { L } + M { M } N { N } O { O } P { P } Q { Q } R { R } + S { S } T { T } U { U } V { V } W { W } X { X } + Y { Y } Z { Z } + @Cell { + + @DoCell + + ####################################################### + # # + # Specific option values to @Cell (i.e. Level 5) # + # # + ####################################################### + + p { p @Else rowp } + t { t @Else rowt } + bg { bg @Else rowbg } + f { f @Else rowf } + b { b @Else rowb } + w { w @Else roww } + h { h @Else rowh } + i { i @Else rowi } + iv { iv @Else rowiv } + s { s @Else rows } + sh { sh @Else rowsh } + ml { ml @Else mh @Else m @Else rowml } + mr { mr @Else mh @Else m @Else rowmr } + ma { ma @Else mv @Else m @Else rowma } + mb { mb @Else mv @Else m @Else rowmb } + ra { ra @Else rh @Else r @Else rowra } + rb { rb @Else rh @Else r @Else rowrb } + rl { rl @Else rv @Else r @Else rowrl } + rr { rr @Else rv @Else r @Else rowrr } + raw { raw @Else rhw @Else rw @Else rowraw } + rbw { rbw @Else rhw @Else rw @Else rowrbw } + rlw { rlw @Else rvw @Else rw @Else rowrlw } + rrw { rrw @Else rvw @Else rw @Else rowrrw } + rag { rag @Else rhg @Else rg @Else rowrag } + rbg { rbg @Else rhg @Else rg @Else rowrbg } + rlg { rlg @Else rvg @Else rg @Else rowrlg } + rrg { rrg @Else rvg @Else rg @Else rowrrg } + rac { rac @Else rhc @Else rc @Else rowrac } + rbc { rbc @Else rhc @Else rc @Else rowrbc } + rlc { rlc @Else rvc @Else rc @Else rowrlc } + rrc { rrc @Else rvc @Else rc @Else rowrrc } + rpc { rpc @Else rowrpc } + + x + } + } + + # symbol for producing @Rowg rows + def @DoRowg + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + { + + ################################################################### + # # + # Specific option values at "doption" level (i.e. Level 3) # + # # + ################################################################### + + def tbxp { gp @Else tblp } + def tbxt { gt @Else tblt } + def tbxbg { gbg @Else tblbg } + def tbxf { gf @Else tblf } + def tbxb { gb @Else tblb } + def tbxw { gw @Else tblw } + def tbxh { gh @Else tblh } + def tbxi { gi @Else tbli } + def tbxiv { giv @Else tbliv } + def tbxs { gs @Else tbls } + def tbxsh { gsh @Else tblsh } + def tbxml { gml @Else gmh @Else gm @Else tblml } + def tbxmr { gmr @Else gmh @Else gm @Else tblmr } + def tbxma { gma @Else gmv @Else gm @Else tblma } + def tbxmb { gmb @Else gmv @Else gm @Else tblmb } + def tbxra { gra @Else grh @Else gr @Else tblra } + def tbxrb { grb @Else grh @Else gr @Else tblrb } + def tbxrl { grl @Else grv @Else gr @Else tblrl } + def tbxrr { grr @Else grv @Else gr @Else tblrr } + def tbxraw { graw @Else grhw @Else grw @Else tblraw } + def tbxrbw { grbw @Else grhw @Else grw @Else tblrbw } + def tbxrlw { grlw @Else grvw @Else grw @Else tblrlw } + def tbxrrw { grrw @Else grvw @Else grw @Else tblrrw } + def tbxrag { grag @Else grhg @Else grg @Else tblrag } + def tbxrbg { grbg @Else grhg @Else grg @Else tblrbg } + def tbxrlg { grlg @Else grvg @Else grg @Else tblrlg } + def tbxrrg { grrg @Else grvg @Else grg @Else tblrrg } + def tbxrac { grac @Else grhc @Else grc @Else tblrac } + def tbxrbc { grbc @Else grhc @Else grc @Else tblrbc } + def tbxrlc { grlc @Else grvc @Else grc @Else tblrlc } + def tbxrrc { grrc @Else grvc @Else grc @Else tblrrc } + def tbxrpc { grpc @Else tblrpc } + + ################################################################### + # # + # Specific option values at @Rowg level (i.e. Level 4) # + # # + ################################################################### + + def rowp { p @Else tbxp } + def rowt { t @Else tblt } + def rowbg { bg @Else tbxbg } + def rowf { f @Else tbxf } + def rowb { b @Else tbxb } + def roww { w @Else tbxw } + def rowh { h @Else tbxh } + def rowi { i @Else tbxi } + def rowiv { iv @Else tbxiv } + def rows { s @Else tbxs } + def rowsh { sh @Else tbxsh } + def rowml { ml @Else mh @Else m @Else tbxml } + def rowmr { mr @Else mh @Else m @Else tbxmr } + def rowma { ma @Else mv @Else m @Else tbxma } + def rowmb { mb @Else mv @Else m @Else tbxmb } + def rowra { ra @Else rh @Else r @Else tbxra } + def rowrb { rb @Else rh @Else r @Else tbxrb } + def rowrl { rl @Else rv @Else r @Else tbxrl } + def rowrr { rr @Else rv @Else r @Else tbxrr } + def rowraw { raw @Else rhw @Else rw @Else tbxraw } + def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw } + def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw } + def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw } + def rowrag { rag @Else rhg @Else rg @Else tbxrag } + def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg } + def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg } + def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg } + def rowrac { rac @Else rhc @Else rc @Else tbxrac } + def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc } + def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc } + def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc } + def rowrpc { rpc @Else tbxrpc } + + gformat + A { A } B { B } C { C } D { D } E { E } F { F } + G { G } H { H } I { I } J { J } K { K } L { L } + M { M } N { N } O { O } P { P } Q { Q } R { R } + S { S } T { T } U { U } V { V } W { W } X { X } + Y { Y } Z { Z } + @Cell { + + @DoCell + + ####################################################### + # # + # Specific option values to @Cell (i.e. Level 5) # + # # + ####################################################### + + p { p @Else rowp } + t { t @Else rowt } + bg { bg @Else rowbg } + f { f @Else rowf } + b { b @Else rowb } + w { w @Else roww } + h { h @Else rowh } + i { i @Else rowi } + iv { iv @Else rowiv } + s { s @Else rows } + sh { sh @Else rowsh } + ml { ml @Else mh @Else m @Else rowml } + mr { mr @Else mh @Else m @Else rowmr } + ma { ma @Else mv @Else m @Else rowma } + mb { mb @Else mv @Else m @Else rowmb } + ra { ra @Else rh @Else r @Else rowra } + rb { rb @Else rh @Else r @Else rowrb } + rl { rl @Else rv @Else r @Else rowrl } + rr { rr @Else rv @Else r @Else rowrr } + raw { raw @Else rhw @Else rw @Else rowraw } + rbw { rbw @Else rhw @Else rw @Else rowrbw } + rlw { rlw @Else rvw @Else rw @Else rowrlw } + rrw { rrw @Else rvw @Else rw @Else rowrrw } + rag { rag @Else rhg @Else rg @Else rowrag } + rbg { rbg @Else rhg @Else rg @Else rowrbg } + rlg { rlg @Else rvg @Else rg @Else rowrlg } + rrg { rrg @Else rvg @Else rg @Else rowrrg } + rac { rac @Else rhc @Else rc @Else rowrac } + rbc { rbc @Else rhc @Else rc @Else rowrbc } + rlc { rlc @Else rvc @Else rc @Else rowrlc } + rrc { rrc @Else rvc @Else rc @Else rowrrc } + rpc { rpc @Else rowrpc } + + x + } + } + + # symbol for producing @Rowh rows + def @DoRowh + named paint p {} + import @TextureImport named texture t {} + named background bg {} + named font f {} + named break b {} + named width w {} + named height h {} + named indent i {} + named indentvertical iv {} + named strut s {} + named struthorizontal sh {} + named margin m {} + named marginhorizontal mh {} + named marginleft ml {} + named marginright mr {} + named marginvertical mv {} + named marginabove ma {} + named marginbelow mb {} + named rule r {} + named rulehorizontal rh {} + named ruleabove ra {} + named rulebelow rb {} + named rulevertical rv {} + named ruleleft rl {} + named ruleright rr {} + named rulewidth rw {} + named rulehorizontalwidth rhw {} + named ruleabovewidth raw {} + named rulebelowwidth rbw {} + named ruleverticalwidth rvw {} + named ruleleftwidth rlw {} + named rulerightwidth rrw {} + named rulegap rg {} + named rulehorizontalgap rhg {} + named ruleabovegap rag {} + named rulebelowgap rbg {} + named ruleverticalgap rvg {} + named ruleleftgap rlg {} + named rulerightgap rrg {} + named rulecolour rulecolor rc {} + named rulehorizontalcolour rulehorizontalcolor rhc {} + named ruleabovecolour ruleabovecolor rac {} + named rulebelowcolour rulebelowcolor rbc {} + named ruleverticalcolour ruleverticalcolor rvc {} + named ruleleftcolour ruleleftcolor rlc {} + named rulerightcolour rulerightcolor rrc {} + named ruleplainchar rpc {} + named A {} named B {} named C {} named D {} named E {} + named F {} named G {} named H {} named I {} named J {} + named K {} named L {} named M {} named N {} named O {} + named P {} named Q {} named R {} named S {} named T {} + named U {} named V {} named W {} named X {} named Y {} + named Z {} + { + + ################################################################### + # # + # Specific option values at "hoption" level (i.e. Level 3) # + # # + ################################################################### + + def tbxp { hp @Else tblp } + def tbxt { ht @Else tblt } + def tbxbg { hbg @Else tblbg } + def tbxf { hf @Else tblf } + def tbxb { hb @Else tblb } + def tbxw { hw @Else tblw } + def tbxh { hh @Else tblh } + def tbxi { hi @Else tbli } + def tbxiv { hiv @Else tbliv } + def tbxs { hs @Else tbls } + def tbxsh { hsh @Else tblsh } + def tbxml { hml @Else hmh @Else hm @Else tblml } + def tbxmr { hmr @Else hmh @Else hm @Else tblmr } + def tbxma { hma @Else hmv @Else hm @Else tblma } + def tbxmb { hmb @Else hmv @Else hm @Else tblmb } + def tbxra { hra @Else hrh @Else hr @Else tblra } + def tbxrb { hrb @Else hrh @Else hr @Else tblrb } + def tbxrl { hrl @Else hrv @Else hr @Else tblrl } + def tbxrr { hrr @Else hrv @Else hr @Else tblrr } + def tbxraw { hraw @Else hrhw @Else hrw @Else tblraw } + def tbxrbw { hrbw @Else hrhw @Else hrw @Else tblrbw } + def tbxrlw { hrlw @Else hrvw @Else hrw @Else tblrlw } + def tbxrrw { hrrw @Else hrvw @Else hrw @Else tblrrw } + def tbxrag { hrag @Else hrhg @Else hrg @Else tblrag } + def tbxrbg { hrbg @Else hrhg @Else hrg @Else tblrbg } + def tbxrlg { hrlg @Else hrvg @Else hrg @Else tblrlg } + def tbxrrg { hrrg @Else hrvg @Else hrg @Else tblrrg } + def tbxrac { hrac @Else hrhc @Else hrc @Else tblrac } + def tbxrbc { hrbc @Else hrhc @Else hrc @Else tblrbc } + def tbxrlc { hrlc @Else hrvc @Else hrc @Else tblrlc } + def tbxrrc { hrrc @Else hrvc @Else hrc @Else tblrrc } + def tbxrpc { hrpc @Else tblrpc } + + ################################################################### + # # + # Specific option values at @Rowh level (i.e. Level 4) # + # # + ################################################################### + + def rowp { p @Else tbxp } + def rowt { t @Else tblt } + def rowbg { bg @Else tbxbg } + def rowf { f @Else tbxf } + def rowb { b @Else tbxb } + def roww { w @Else tbxw } + def rowh { h @Else tbxh } + def rowi { i @Else tbxi } + def rowiv { iv @Else tbxiv } + def rows { s @Else tbxs } + def rowsh { sh @Else tbxsh } + def rowml { ml @Else mh @Else m @Else tbxml } + def rowmr { mr @Else mh @Else m @Else tbxmr } + def rowma { ma @Else mv @Else m @Else tbxma } + def rowmb { mb @Else mv @Else m @Else tbxmb } + def rowra { ra @Else rh @Else r @Else tbxra } + def rowrb { rb @Else rh @Else r @Else tbxrb } + def rowrl { rl @Else rv @Else r @Else tbxrl } + def rowrr { rr @Else rv @Else r @Else tbxrr } + def rowraw { raw @Else rhw @Else rw @Else tbxraw } + def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw } + def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw } + def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw } + def rowrag { rag @Else rhg @Else rg @Else tbxrag } + def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg } + def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg } + def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg } + def rowrac { rac @Else rhc @Else rc @Else tbxrac } + def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc } + def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc } + def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc } + def rowrpc { rpc @Else tbxrpc } + + hformat + A { A } B { B } C { C } D { D } E { E } F { F } + G { G } H { H } I { I } J { J } K { K } L { L } + M { M } N { N } O { O } P { P } Q { Q } R { R } + S { S } T { T } U { U } V { V } W { W } X { X } + Y { Y } Z { Z } + @Cell { + + @DoCell + + ####################################################### + # # + # Specific option values to @Cell (i.e. Level 5) # + # # + ####################################################### + + p { p @Else rowp } + t { t @Else rowt } + bg { bg @Else rowbg } + f { f @Else rowf } + b { b @Else rowb } + w { w @Else roww } + h { h @Else rowh } + i { i @Else rowi } + iv { iv @Else rowiv } + s { s @Else rows } + sh { sh @Else rowsh } + ml { ml @Else mh @Else m @Else rowml } + mr { mr @Else mh @Else m @Else rowmr } + ma { ma @Else mv @Else m @Else rowma } + mb { mb @Else mv @Else m @Else rowmb } + ra { ra @Else rh @Else r @Else rowra } + rb { rb @Else rh @Else r @Else rowrb } + rl { rl @Else rv @Else r @Else rowrl } + rr { rr @Else rv @Else r @Else rowrr } + raw { raw @Else rhw @Else rw @Else rowraw } + rbw { rbw @Else rhw @Else rw @Else rowrbw } + rlw { rlw @Else rvw @Else rw @Else rowrlw } + rrw { rrw @Else rvw @Else rw @Else rowrrw } + rag { rag @Else rhg @Else rg @Else rowrag } + rbg { rbg @Else rhg @Else rg @Else rowrbg } + rlg { rlg @Else rvg @Else rg @Else rowrlg } + rrg { rrg @Else rvg @Else rg @Else rowrrg } + rac { rac @Else rhc @Else rc @Else rowrac } + rbc { rbc @Else rhc @Else rc @Else rowrbc } + rlc { rlc @Else rvc @Else rc @Else rowrlc } + rrc { rrc @Else rvc @Else rc @Else rowrrc } + rpc { rpc @Else rowrpc } + + x + } + } + + macro @Row { / @DoRow } + macro @Rowa { / @DoRowa } + macro @Rowb { / @DoRowb } + macro @Rowc { / @DoRowc } + macro @Rowd { / @DoRowd } + macro @Rowe { / @DoRowe } + macro @Rowf { / @DoRowf } + macro @Rowg { / @DoRowg } + macro @Rowh { / @DoRowh } + + macro @FirstRow { @DoRow } + macro @FirstRowa { @DoRowa } + macro @FirstRowb { @DoRowb } + macro @FirstRowc { @DoRowc } + macro @FirstRowd { @DoRowd } + macro @FirstRowe { @DoRowe } + macro @FirstRowf { @DoRowf } + macro @FirstRowg { @DoRowg } + macro @FirstRowh { @DoRowh } + + macro @MarkRow { ^/ @DoRow } + macro @MarkRowa { ^/ @DoRowa } + macro @MarkRowb { ^/ @DoRowb } + macro @MarkRowc { ^/ @DoRowc } + macro @MarkRowd { ^/ @DoRowd } + macro @MarkRowe { ^/ @DoRowe } + macro @MarkRowf { ^/ @DoRowf } + macro @MarkRowg { ^/ @DoRowg } + macro @MarkRowh { ^/ @DoRowh } + + macro @NoBreakRow { /0iu @DoRow } + macro @NoBreakRowa { /0iu @DoRowa } + macro @NoBreakRowb { /0iu @DoRowb } + macro @NoBreakRowc { /0iu @DoRowc } + macro @NoBreakRowd { /0iu @DoRowd } + macro @NoBreakRowe { /0iu @DoRowe } + macro @NoBreakRowf { /0iu @DoRowf } + macro @NoBreakRowg { /0iu @DoRowg } + macro @NoBreakRowh { /0iu @DoRowh } + + macro @HeaderRow { / @BeginHeaderComponent @DoRow } + macro @HeaderRowa { / @BeginHeaderComponent @DoRowa } + macro @HeaderRowb { / @BeginHeaderComponent @DoRowb } + macro @HeaderRowc { / @BeginHeaderComponent @DoRowc } + macro @HeaderRowd { / @BeginHeaderComponent @DoRowd } + macro @HeaderRowe { / @BeginHeaderComponent @DoRowe } + macro @HeaderRowf { / @BeginHeaderComponent @DoRowf } + macro @HeaderRowg { / @BeginHeaderComponent @DoRowg } + macro @HeaderRowh { / @BeginHeaderComponent @DoRowh } + + macro @HeaderFirstRow { @BeginHeaderComponent @DoRow } + macro @HeaderFirstRowa { @BeginHeaderComponent @DoRowa } + macro @HeaderFirstRowb { @BeginHeaderComponent @DoRowb } + macro @HeaderFirstRowc { @BeginHeaderComponent @DoRowc } + macro @HeaderFirstRowd { @BeginHeaderComponent @DoRowd } + macro @HeaderFirstRowe { @BeginHeaderComponent @DoRowe } + macro @HeaderFirstRowf { @BeginHeaderComponent @DoRowf } + macro @HeaderFirstRowg { @BeginHeaderComponent @DoRowg } + macro @HeaderFirstRowh { @BeginHeaderComponent @DoRowh } + + macro @EndHeaderRow { / @EndHeaderComponent } + + macro @NP { /"1.1b" } + + @Body + } + +@End @TblSetup diff --git a/include/include/tcl b/include/include/tcl new file mode 100644 index 0000000..d54defe --- /dev/null +++ b/include/include/tcl @@ -0,0 +1,118 @@ +############################################################################### +# # +# Lout setup file for Tcl program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 6 April 2001 # +# # +# This file has been placed in the public domain by its author. # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { tclf } + + +############################################################################### +# # +# @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 { @TclSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # numberedblanks { Yes } # No or Yes + # 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 + # fixedblanklinescale { 1.0 } # blank-line scale + # fixedspace { lout } # spacing mode + # 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 + # varyingblanklinescale { 1.0 } # blank-line scale + # varyingspace { lout } # spacing mode + # 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 + # symbolblanklinescale { 1.0 } # blank-line scale + # symbolspace { lout } # spacing mode + # 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/include/tclf b/include/include/tclf new file mode 100644 index 0000000..fd83271 --- /dev/null +++ b/include/include/tclf @@ -0,0 +1,446 @@ + +############################################################################### +# # +# Lout @TclSetup package for formatting Tcl 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. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +export @Tcl +def @TclSetup + named pipe { } # pipe through this first + named numbered { No } # want lines numbered? + named blanknumbered { Yes } # blank 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 fixedblanklinescale { 1.0 } # blank-line scale + named fixedspace { lout } # spacing mode + 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 varyingblanklinescale { 1.0 } # blank-line scale + named varyingspace { lout } # spacing mode + 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 symbolblanklinescale { 1.0 } # blank-line scale + named symbolspace { lout } # spacing mode + 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 @Tcl + named style { style } # style + named numbered { numbered } # want numbered lines? + named blanknumbered { blanknumbered } # numbered blank lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named blanklinescale { dft } # blank-line scale + named space { dft } # spacing mode + 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 } + } + } + + def wantblanknumbered + { + blanknumbered @Case { + { No no } @Yield "-M" + { NoPrint noprint } @Yield "-N" + { Yes yes } @Yield "" + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lTcl" wantblanknumbered wantnumbered + -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lTcl" wantblanknumbered 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 @InitBLS + { + blanklinescale @Test + iffixed { fixedblanklinescale } + ifvarying { varyingblanklinescale } + ifsymbol { symbolblanklinescale } + } + + + def @InitSpace + { + space @Test + iffixed { fixedspace } + ifvarying { varyingspace } + ifsymbol { symbolspace } + } + + + 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 + named sym {} + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + Programming @Language + { @InitFontFamily Base @InitSize } @Font @InitSpace @Space + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body + + @End @Tcl + +@End @TclSetup diff --git a/include/include/ts b/include/include/ts new file mode 100644 index 0000000..2711633 --- /dev/null +++ b/include/include/ts @@ -0,0 +1,108 @@ + +############################################################################### +# # +# Lout @ToySetup package (Jeff Kingston, July 1993, updated October 1994) # +# # +# This file has been placed in the public domain by its author. # +# # +# In response to a user request I have put together this tiny package for # +# people to play with who want to start learning how to do page layout and # +# galleys with Lout. It produces a very simple sequence of pages. To # +# invoke the package, run "lout myfile > op" where myfile looks like this: # +# # +# @SysInclude { ts } # +# @Use { @ToySetup } # +# @Document # +# // # +# @Text { # +# Any text you like here, using @I, @B, @Heading, @PP, @LP, @DP, # +# @LeftDisplay, @IndentedDisplay, and @CenteredDisplay just as in # +# DocumentSetup. # +# } # +# # +############################################################################### + +@SysInclude { langdefs } + +export @I @B @Heading @PP @LP @DP @NP + @LeftDisplay @IndentedDisplay @CenteredDisplay + @Text @Document + +def @ToySetup + named @PageWidth { 21.0c } + named @PageHeight { 29.7c } +@Begin + + ########################################################################### + # # + # Font changes, headings, and paragraphs. # + # # + ########################################################################### + + def @I right x { Slope @Font x } + def @B right x { Bold @Font x } + def @Heading right x { ragged @Break @B x } + + macro @PP { //1.3vx 1.0f @Wide &0i } + macro @LP { //1.3vx } + macro @DP { //0.5v } + macro @NP { //1.1b } + + + ########################################################################### + # # + # Displays. # + # # + ########################################################################### + + def @DispPlace { @Galley } + + def @Disp into { @DispPlace&&preceding } + right x + { + @OneRow x + } + + macro @LeftDisplay { @DP | @DispPlace | @DP // @Disp } + macro @IndentedDisplay { @DP |2f @DispPlace | @DP // @Disp } + macro @CenteredDisplay { @DP |0.5rt @DispPlace | @DP // @Disp } + + + ########################################################################### + # # + # Page layout. # + # # + ########################################################################### + + def @TextPlace { @Galley } + + def @Text force into { @TextPlace&&preceding } + right x + { + x + } + + def @Page right x + { + @PageWidth @Wide @PageHeight @High + { Times Base 12p } @Font + { adjust nohyphen 14px } @Break + English @Language { 0 0 0 } @SetColour + { //1i ||1i + @HExpand @VExpand x + ||1i //1i + } + } + + def @PageList right num + { + @Page { |0.5rt - num - //0.4i @TextPlace } + // + @PageList @Next num + } + + def @Document { @PageList 1 } + +@End @ToySetup + +@SysDatabase @FontDef { fontdefs } # font definitions diff --git a/include/include/xrgb b/include/include/xrgb new file mode 100644 index 0000000..478f626 --- /dev/null +++ b/include/include/xrgb @@ -0,0 +1,697 @@ +############################################################################### +# # +# @Xrgb symbol # +# # +# Contributed by Mark Summerfield # +# Tested and installed by Jeff Kingston, 18 November 2002 # +# November 2002 # +# # +# Said to be the list of named colours known to the X-windows # +# system. There are 752 colours here, but many are listed twice # +# under different spellings of their names. # +# # +# I've deleted the else clause and moved "black" to the top. # +# This will ensure that if the user mis-types the colour, an # +# error message will be printed and "black" substituted. # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either Version 3, or (at your option) # +# any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # +# # +# As a special exception, when this file is read by Lout when processing # +# a Lout source document, you may use the result without restriction. # +# # +############################################################################### + +def @Xrgb right x { + x @Case { + { black } @Yield { rgb "0.000 0.000 0.000" } + { snow } @Yield { rgb "1.000 0.980 0.980" } + { ghostwhite } @Yield { rgb "0.973 0.973 1.000" } + { whitesmoke } @Yield { rgb "0.961 0.961 0.961" } + { gainsboro } @Yield { rgb "0.863 0.863 0.863" } + { floralwhite } @Yield { rgb "1.000 0.980 0.941" } + { oldlace } @Yield { rgb "0.992 0.961 0.902" } + { linen } @Yield { rgb "0.980 0.941 0.902" } + { antiquewhite } @Yield { rgb "0.980 0.922 0.843" } + { papayawhip } @Yield { rgb "1.000 0.937 0.835" } + { blanchedalmond } @Yield { rgb "1.000 0.922 0.804" } + { bisque } @Yield { rgb "1.000 0.894 0.769" } + { peachpuff } @Yield { rgb "1.000 0.855 0.725" } + { navajowhite } @Yield { rgb "1.000 0.871 0.678" } + { moccasin } @Yield { rgb "1.000 0.894 0.710" } + { cornsilk } @Yield { rgb "1.000 0.973 0.863" } + { ivory } @Yield { rgb "1.000 1.000 0.941" } + { lemonchiffon } @Yield { rgb "1.000 0.980 0.804" } + { seashell } @Yield { rgb "1.000 0.961 0.933" } + { honeydew } @Yield { rgb "0.941 1.000 0.941" } + { mintcream } @Yield { rgb "0.961 1.000 0.980" } + { azure } @Yield { rgb "0.941 1.000 1.000" } + { aliceblue } @Yield { rgb "0.941 0.973 1.000" } + { lavender } @Yield { rgb "0.902 0.902 0.980" } + { lavenderblush } @Yield { rgb "1.000 0.941 0.961" } + { mistyrose } @Yield { rgb "1.000 0.894 0.882" } + { white } @Yield { rgb "1.000 1.000 1.000" } + { darkslategray } @Yield { rgb "0.184 0.310 0.310" } + { darkslategrey } @Yield { rgb "0.184 0.310 0.310" } + { dimgray } @Yield { rgb "0.412 0.412 0.412" } + { dimgrey } @Yield { rgb "0.412 0.412 0.412" } + { slategray } @Yield { rgb "0.439 0.502 0.565" } + { slategrey } @Yield { rgb "0.439 0.502 0.565" } + { lightslategray } @Yield { rgb "0.467 0.533 0.600" } + { lightslategrey } @Yield { rgb "0.467 0.533 0.600" } + { gray } @Yield { rgb "0.745 0.745 0.745" } + { grey } @Yield { rgb "0.745 0.745 0.745" } + { lightgrey } @Yield { rgb "0.827 0.827 0.827" } + { lightgray } @Yield { rgb "0.827 0.827 0.827" } + { midnightblue } @Yield { rgb "0.098 0.098 0.439" } + { navy } @Yield { rgb "0.000 0.000 0.502" } + { navyblue } @Yield { rgb "0.000 0.000 0.502" } + { cornflowerblue } @Yield { rgb "0.392 0.584 0.929" } + { darkslateblue } @Yield { rgb "0.282 0.239 0.545" } + { slateblue } @Yield { rgb "0.416 0.353 0.804" } + { mediumslateblue } @Yield { rgb "0.482 0.408 0.933" } + { lightslateblue } @Yield { rgb "0.518 0.439 1.000" } + { mediumblue } @Yield { rgb "0.000 0.000 0.804" } + { royalblue } @Yield { rgb "0.255 0.412 0.882" } + { blue } @Yield { rgb "0.000 0.000 1.000" } + { dodgerblue } @Yield { rgb "0.118 0.565 1.000" } + { deepskyblue } @Yield { rgb "0.000 0.749 1.000" } + { skyblue } @Yield { rgb "0.529 0.808 0.922" } + { lightskyblue } @Yield { rgb "0.529 0.808 0.980" } + { steelblue } @Yield { rgb "0.275 0.510 0.706" } + { lightsteelblue } @Yield { rgb "0.690 0.769 0.871" } + { lightblue } @Yield { rgb "0.678 0.847 0.902" } + { powderblue } @Yield { rgb "0.690 0.878 0.902" } + { paleturquoise } @Yield { rgb "0.686 0.933 0.933" } + { darkturquoise } @Yield { rgb "0.000 0.808 0.820" } + { mediumturquoise } @Yield { rgb "0.282 0.820 0.800" } + { turquoise } @Yield { rgb "0.251 0.878 0.816" } + { cyan } @Yield { rgb "0.000 1.000 1.000" } + { lightcyan } @Yield { rgb "0.878 1.000 1.000" } + { cadetblue } @Yield { rgb "0.373 0.620 0.627" } + { mediumaquamarine } @Yield { rgb "0.400 0.804 0.667" } + { aquamarine } @Yield { rgb "0.498 1.000 0.831" } + { darkgreen } @Yield { rgb "0.000 0.392 0.000" } + { darkolivegreen } @Yield { rgb "0.333 0.420 0.184" } + { darkseagreen } @Yield { rgb "0.561 0.737 0.561" } + { seagreen } @Yield { rgb "0.180 0.545 0.341" } + { mediumseagreen } @Yield { rgb "0.235 0.702 0.443" } + { lightseagreen } @Yield { rgb "0.125 0.698 0.667" } + { palegreen } @Yield { rgb "0.596 0.984 0.596" } + { springgreen } @Yield { rgb "0.000 1.000 0.498" } + { lawngreen } @Yield { rgb "0.486 0.988 0.000" } + { green } @Yield { rgb "0.000 1.000 0.000" } + { chartreuse } @Yield { rgb "0.498 1.000 0.000" } + { mediumspringgreen } @Yield { rgb "0.000 0.980 0.604" } + { greenyellow } @Yield { rgb "0.678 1.000 0.184" } + { limegreen } @Yield { rgb "0.196 0.804 0.196" } + { yellowgreen } @Yield { rgb "0.604 0.804 0.196" } + { forestgreen } @Yield { rgb "0.133 0.545 0.133" } + { olivedrab } @Yield { rgb "0.420 0.557 0.137" } + { darkkhaki } @Yield { rgb "0.741 0.718 0.420" } + { khaki } @Yield { rgb "0.941 0.902 0.549" } + { palegoldenrod } @Yield { rgb "0.933 0.910 0.667" } + { lightgoldenrodyellow }@Yield{ rgb "0.980 0.980 0.824" } + { lightyellow } @Yield { rgb "1.000 1.000 0.878" } + { yellow } @Yield { rgb "1.000 1.000 0.000" } + { gold } @Yield { rgb "1.000 0.843 0.000" } + { lightgoldenrod } @Yield { rgb "0.933 0.867 0.510" } + { goldenrod } @Yield { rgb "0.855 0.647 0.125" } + { darkgoldenrod } @Yield { rgb "0.722 0.525 0.043" } + { rosybrown } @Yield { rgb "0.737 0.561 0.561" } + { indianred } @Yield { rgb "0.804 0.361 0.361" } + { saddlebrown } @Yield { rgb "0.545 0.271 0.075" } + { sienna } @Yield { rgb "0.627 0.322 0.176" } + { peru } @Yield { rgb "0.804 0.522 0.247" } + { burlywood } @Yield { rgb "0.871 0.722 0.529" } + { beige } @Yield { rgb "0.961 0.961 0.863" } + { wheat } @Yield { rgb "0.961 0.871 0.702" } + { sandybrown } @Yield { rgb "0.957 0.643 0.376" } + { tan } @Yield { rgb "0.824 0.706 0.549" } + { chocolate } @Yield { rgb "0.824 0.412 0.118" } + { firebrick } @Yield { rgb "0.698 0.133 0.133" } + { brown } @Yield { rgb "0.647 0.165 0.165" } + { darksalmon } @Yield { rgb "0.914 0.588 0.478" } + { salmon } @Yield { rgb "0.980 0.502 0.447" } + { lightsalmon } @Yield { rgb "1.000 0.627 0.478" } + { orange } @Yield { rgb "1.000 0.647 0.000" } + { darkorange } @Yield { rgb "1.000 0.549 0.000" } + { coral } @Yield { rgb "1.000 0.498 0.314" } + { lightcoral } @Yield { rgb "0.941 0.502 0.502" } + { tomato } @Yield { rgb "1.000 0.388 0.278" } + { orangered } @Yield { rgb "1.000 0.271 0.000" } + { red } @Yield { rgb "1.000 0.000 0.000" } + { hotpink } @Yield { rgb "1.000 0.412 0.706" } + { deeppink } @Yield { rgb "1.000 0.078 0.576" } + { pink } @Yield { rgb "1.000 0.753 0.796" } + { lightpink } @Yield { rgb "1.000 0.714 0.757" } + { palevioletred } @Yield { rgb "0.859 0.439 0.576" } + { maroon } @Yield { rgb "0.690 0.188 0.376" } + { mediumvioletred } @Yield { rgb "0.780 0.082 0.522" } + { violetred } @Yield { rgb "0.816 0.125 0.565" } + { magenta } @Yield { rgb "1.000 0.000 1.000" } + { violet } @Yield { rgb "0.933 0.510 0.933" } + { plum } @Yield { rgb "0.867 0.627 0.867" } + { orchid } @Yield { rgb "0.855 0.439 0.839" } + { mediumorchid } @Yield { rgb "0.729 0.333 0.827" } + { darkorchid } @Yield { rgb "0.600 0.196 0.800" } + { darkviolet } @Yield { rgb "0.580 0.000 0.827" } + { blueviolet } @Yield { rgb "0.541 0.169 0.886" } + { purple } @Yield { rgb "0.627 0.125 0.941" } + { mediumpurple } @Yield { rgb "0.576 0.439 0.859" } + { thistle } @Yield { rgb "0.847 0.749 0.847" } + { snow1 } @Yield { rgb "1.000 0.980 0.980" } + { snow2 } @Yield { rgb "0.933 0.914 0.914" } + { snow3 } @Yield { rgb "0.804 0.788 0.788" } + { snow4 } @Yield { rgb "0.545 0.537 0.537" } + { seashell1 } @Yield { rgb "1.000 0.961 0.933" } + { seashell2 } @Yield { rgb "0.933 0.898 0.871" } + { seashell3 } @Yield { rgb "0.804 0.773 0.749" } + { seashell4 } @Yield { rgb "0.545 0.525 0.510" } + { antiquewhite1 } @Yield { rgb "1.000 0.937 0.859" } + { antiquewhite2 } @Yield { rgb "0.933 0.875 0.800" } + { antiquewhite3 } @Yield { rgb "0.804 0.753 0.690" } + { antiquewhite4 } @Yield { rgb "0.545 0.514 0.471" } + { bisque1 } @Yield { rgb "1.000 0.894 0.769" } + { bisque2 } @Yield { rgb "0.933 0.835 0.718" } + { bisque3 } @Yield { rgb "0.804 0.718 0.620" } + { bisque4 } @Yield { rgb "0.545 0.490 0.420" } + { peachpuff1 } @Yield { rgb "1.000 0.855 0.725" } + { peachpuff2 } @Yield { rgb "0.933 0.796 0.678" } + { peachpuff3 } @Yield { rgb "0.804 0.686 0.584" } + { peachpuff4 } @Yield { rgb "0.545 0.467 0.396" } + { navajowhite1 } @Yield { rgb "1.000 0.871 0.678" } + { navajowhite2 } @Yield { rgb "0.933 0.812 0.631" } + { navajowhite3 } @Yield { rgb "0.804 0.702 0.545" } + { navajowhite4 } @Yield { rgb "0.545 0.475 0.369" } + { lemonchiffon1 } @Yield { rgb "1.000 0.980 0.804" } + { lemonchiffon2 } @Yield { rgb "0.933 0.914 0.749" } + { lemonchiffon3 } @Yield { rgb "0.804 0.788 0.647" } + { lemonchiffon4 } @Yield { rgb "0.545 0.537 0.439" } + { cornsilk1 } @Yield { rgb "1.000 0.973 0.863" } + { cornsilk2 } @Yield { rgb "0.933 0.910 0.804" } + { cornsilk3 } @Yield { rgb "0.804 0.784 0.694" } + { cornsilk4 } @Yield { rgb "0.545 0.533 0.471" } + { ivory1 } @Yield { rgb "1.000 1.000 0.941" } + { ivory2 } @Yield { rgb "0.933 0.933 0.878" } + { ivory3 } @Yield { rgb "0.804 0.804 0.757" } + { ivory4 } @Yield { rgb "0.545 0.545 0.514" } + { honeydew1 } @Yield { rgb "0.941 1.000 0.941" } + { honeydew2 } @Yield { rgb "0.878 0.933 0.878" } + { honeydew3 } @Yield { rgb "0.757 0.804 0.757" } + { honeydew4 } @Yield { rgb "0.514 0.545 0.514" } + { lavenderblush1 } @Yield { rgb "1.000 0.941 0.961" } + { lavenderblush2 } @Yield { rgb "0.933 0.878 0.898" } + { lavenderblush3 } @Yield { rgb "0.804 0.757 0.773" } + { lavenderblush4 } @Yield { rgb "0.545 0.514 0.525" } + { mistyrose1 } @Yield { rgb "1.000 0.894 0.882" } + { mistyrose2 } @Yield { rgb "0.933 0.835 0.824" } + { mistyrose3 } @Yield { rgb "0.804 0.718 0.710" } + { mistyrose4 } @Yield { rgb "0.545 0.490 0.482" } + { azure1 } @Yield { rgb "0.941 1.000 1.000" } + { azure2 } @Yield { rgb "0.878 0.933 0.933" } + { azure3 } @Yield { rgb "0.757 0.804 0.804" } + { azure4 } @Yield { rgb "0.514 0.545 0.545" } + { slateblue1 } @Yield { rgb "0.514 0.435 1.000" } + { slateblue2 } @Yield { rgb "0.478 0.404 0.933" } + { slateblue3 } @Yield { rgb "0.412 0.349 0.804" } + { slateblue4 } @Yield { rgb "0.278 0.235 0.545" } + { royalblue1 } @Yield { rgb "0.282 0.463 1.000" } + { royalblue2 } @Yield { rgb "0.263 0.431 0.933" } + { royalblue3 } @Yield { rgb "0.227 0.373 0.804" } + { royalblue4 } @Yield { rgb "0.153 0.251 0.545" } + { blue1 } @Yield { rgb "0.000 0.000 1.000" } + { blue2 } @Yield { rgb "0.000 0.000 0.933" } + { blue3 } @Yield { rgb "0.000 0.000 0.804" } + { blue4 } @Yield { rgb "0.000 0.000 0.545" } + { dodgerblue1 } @Yield { rgb "0.118 0.565 1.000" } + { dodgerblue2 } @Yield { rgb "0.110 0.525 0.933" } + { dodgerblue3 } @Yield { rgb "0.094 0.455 0.804" } + { dodgerblue4 } @Yield { rgb "0.063 0.306 0.545" } + { steelblue1 } @Yield { rgb "0.388 0.722 1.000" } + { steelblue2 } @Yield { rgb "0.361 0.675 0.933" } + { steelblue3 } @Yield { rgb "0.310 0.580 0.804" } + { steelblue4 } @Yield { rgb "0.212 0.392 0.545" } + { deepskyblue1 } @Yield { rgb "0.000 0.749 1.000" } + { deepskyblue2 } @Yield { rgb "0.000 0.698 0.933" } + { deepskyblue3 } @Yield { rgb "0.000 0.604 0.804" } + { deepskyblue4 } @Yield { rgb "0.000 0.408 0.545" } + { skyblue1 } @Yield { rgb "0.529 0.808 1.000" } + { skyblue2 } @Yield { rgb "0.494 0.753 0.933" } + { skyblue3 } @Yield { rgb "0.424 0.651 0.804" } + { skyblue4 } @Yield { rgb "0.290 0.439 0.545" } + { lightskyblue1 } @Yield { rgb "0.690 0.886 1.000" } + { lightskyblue2 } @Yield { rgb "0.643 0.827 0.933" } + { lightskyblue3 } @Yield { rgb "0.553 0.714 0.804" } + { lightskyblue4 } @Yield { rgb "0.376 0.482 0.545" } + { slategray1 } @Yield { rgb "0.776 0.886 1.000" } + { slategray2 } @Yield { rgb "0.725 0.827 0.933" } + { slategray3 } @Yield { rgb "0.624 0.714 0.804" } + { slategray4 } @Yield { rgb "0.424 0.482 0.545" } + { lightsteelblue1 } @Yield { rgb "0.792 0.882 1.000" } + { lightsteelblue2 } @Yield { rgb "0.737 0.824 0.933" } + { lightsteelblue3 } @Yield { rgb "0.635 0.710 0.804" } + { lightsteelblue4 } @Yield { rgb "0.431 0.482 0.545" } + { lightblue1 } @Yield { rgb "0.749 0.937 1.000" } + { lightblue2 } @Yield { rgb "0.698 0.875 0.933" } + { lightblue3 } @Yield { rgb "0.604 0.753 0.804" } + { lightblue4 } @Yield { rgb "0.408 0.514 0.545" } + { lightcyan1 } @Yield { rgb "0.878 1.000 1.000" } + { lightcyan2 } @Yield { rgb "0.820 0.933 0.933" } + { lightcyan3 } @Yield { rgb "0.706 0.804 0.804" } + { lightcyan4 } @Yield { rgb "0.478 0.545 0.545" } + { paleturquoise1 } @Yield { rgb "0.733 1.000 1.000" } + { paleturquoise2 } @Yield { rgb "0.682 0.933 0.933" } + { paleturquoise3 } @Yield { rgb "0.588 0.804 0.804" } + { paleturquoise4 } @Yield { rgb "0.400 0.545 0.545" } + { cadetblue1 } @Yield { rgb "0.596 0.961 1.000" } + { cadetblue2 } @Yield { rgb "0.557 0.898 0.933" } + { cadetblue3 } @Yield { rgb "0.478 0.773 0.804" } + { cadetblue4 } @Yield { rgb "0.325 0.525 0.545" } + { turquoise1 } @Yield { rgb "0.000 0.961 1.000" } + { turquoise2 } @Yield { rgb "0.000 0.898 0.933" } + { turquoise3 } @Yield { rgb "0.000 0.773 0.804" } + { turquoise4 } @Yield { rgb "0.000 0.525 0.545" } + { cyan1 } @Yield { rgb "0.000 1.000 1.000" } + { cyan2 } @Yield { rgb "0.000 0.933 0.933" } + { cyan3 } @Yield { rgb "0.000 0.804 0.804" } + { cyan4 } @Yield { rgb "0.000 0.545 0.545" } + { darkslategray1 } @Yield { rgb "0.592 1.000 1.000" } + { darkslategray2 } @Yield { rgb "0.553 0.933 0.933" } + { darkslategray3 } @Yield { rgb "0.475 0.804 0.804" } + { darkslategray4 } @Yield { rgb "0.322 0.545 0.545" } + { aquamarine1 } @Yield { rgb "0.498 1.000 0.831" } + { aquamarine2 } @Yield { rgb "0.463 0.933 0.776" } + { aquamarine3 } @Yield { rgb "0.400 0.804 0.667" } + { aquamarine4 } @Yield { rgb "0.271 0.545 0.455" } + { darkseagreen1 } @Yield { rgb "0.757 1.000 0.757" } + { darkseagreen2 } @Yield { rgb "0.706 0.933 0.706" } + { darkseagreen3 } @Yield { rgb "0.608 0.804 0.608" } + { darkseagreen4 } @Yield { rgb "0.412 0.545 0.412" } + { seagreen1 } @Yield { rgb "0.329 1.000 0.624" } + { seagreen2 } @Yield { rgb "0.306 0.933 0.580" } + { seagreen3 } @Yield { rgb "0.263 0.804 0.502" } + { seagreen4 } @Yield { rgb "0.180 0.545 0.341" } + { palegreen1 } @Yield { rgb "0.604 1.000 0.604" } + { palegreen2 } @Yield { rgb "0.565 0.933 0.565" } + { palegreen3 } @Yield { rgb "0.486 0.804 0.486" } + { palegreen4 } @Yield { rgb "0.329 0.545 0.329" } + { springgreen1 } @Yield { rgb "0.000 1.000 0.498" } + { springgreen2 } @Yield { rgb "0.000 0.933 0.463" } + { springgreen3 } @Yield { rgb "0.000 0.804 0.400" } + { springgreen4 } @Yield { rgb "0.000 0.545 0.271" } + { green1 } @Yield { rgb "0.000 1.000 0.000" } + { green2 } @Yield { rgb "0.000 0.933 0.000" } + { green3 } @Yield { rgb "0.000 0.804 0.000" } + { green4 } @Yield { rgb "0.000 0.545 0.000" } + { chartreuse1 } @Yield { rgb "0.498 1.000 0.000" } + { chartreuse2 } @Yield { rgb "0.463 0.933 0.000" } + { chartreuse3 } @Yield { rgb "0.400 0.804 0.000" } + { chartreuse4 } @Yield { rgb "0.271 0.545 0.000" } + { olivedrab1 } @Yield { rgb "0.753 1.000 0.243" } + { olivedrab2 } @Yield { rgb "0.702 0.933 0.227" } + { olivedrab3 } @Yield { rgb "0.604 0.804 0.196" } + { olivedrab4 } @Yield { rgb "0.412 0.545 0.133" } + { darkolivegreen1 } @Yield { rgb "0.792 1.000 0.439" } + { darkolivegreen2 } @Yield { rgb "0.737 0.933 0.408" } + { darkolivegreen3 } @Yield { rgb "0.635 0.804 0.353" } + { darkolivegreen4 } @Yield { rgb "0.431 0.545 0.239" } + { khaki1 } @Yield { rgb "1.000 0.965 0.561" } + { khaki2 } @Yield { rgb "0.933 0.902 0.522" } + { khaki3 } @Yield { rgb "0.804 0.776 0.451" } + { khaki4 } @Yield { rgb "0.545 0.525 0.306" } + { lightgoldenrod1 } @Yield { rgb "1.000 0.925 0.545" } + { lightgoldenrod2 } @Yield { rgb "0.933 0.863 0.510" } + { lightgoldenrod3 } @Yield { rgb "0.804 0.745 0.439" } + { lightgoldenrod4 } @Yield { rgb "0.545 0.506 0.298" } + { lightyellow1 } @Yield { rgb "1.000 1.000 0.878" } + { lightyellow2 } @Yield { rgb "0.933 0.933 0.820" } + { lightyellow3 } @Yield { rgb "0.804 0.804 0.706" } + { lightyellow4 } @Yield { rgb "0.545 0.545 0.478" } + { yellow1 } @Yield { rgb "1.000 1.000 0.000" } + { yellow2 } @Yield { rgb "0.933 0.933 0.000" } + { yellow3 } @Yield { rgb "0.804 0.804 0.000" } + { yellow4 } @Yield { rgb "0.545 0.545 0.000" } + { gold1 } @Yield { rgb "1.000 0.843 0.000" } + { gold2 } @Yield { rgb "0.933 0.788 0.000" } + { gold3 } @Yield { rgb "0.804 0.678 0.000" } + { gold4 } @Yield { rgb "0.545 0.459 0.000" } + { goldenrod1 } @Yield { rgb "1.000 0.757 0.145" } + { goldenrod2 } @Yield { rgb "0.933 0.706 0.133" } + { goldenrod3 } @Yield { rgb "0.804 0.608 0.114" } + { goldenrod4 } @Yield { rgb "0.545 0.412 0.078" } + { darkgoldenrod1 } @Yield { rgb "1.000 0.725 0.059" } + { darkgoldenrod2 } @Yield { rgb "0.933 0.678 0.055" } + { darkgoldenrod3 } @Yield { rgb "0.804 0.584 0.047" } + { darkgoldenrod4 } @Yield { rgb "0.545 0.396 0.031" } + { rosybrown1 } @Yield { rgb "1.000 0.757 0.757" } + { rosybrown2 } @Yield { rgb "0.933 0.706 0.706" } + { rosybrown3 } @Yield { rgb "0.804 0.608 0.608" } + { rosybrown4 } @Yield { rgb "0.545 0.412 0.412" } + { indianred1 } @Yield { rgb "1.000 0.416 0.416" } + { indianred2 } @Yield { rgb "0.933 0.388 0.388" } + { indianred3 } @Yield { rgb "0.804 0.333 0.333" } + { indianred4 } @Yield { rgb "0.545 0.227 0.227" } + { sienna1 } @Yield { rgb "1.000 0.510 0.278" } + { sienna2 } @Yield { rgb "0.933 0.475 0.259" } + { sienna3 } @Yield { rgb "0.804 0.408 0.224" } + { sienna4 } @Yield { rgb "0.545 0.278 0.149" } + { burlywood1 } @Yield { rgb "1.000 0.827 0.608" } + { burlywood2 } @Yield { rgb "0.933 0.773 0.569" } + { burlywood3 } @Yield { rgb "0.804 0.667 0.490" } + { burlywood4 } @Yield { rgb "0.545 0.451 0.333" } + { wheat1 } @Yield { rgb "1.000 0.906 0.729" } + { wheat2 } @Yield { rgb "0.933 0.847 0.682" } + { wheat3 } @Yield { rgb "0.804 0.729 0.588" } + { wheat4 } @Yield { rgb "0.545 0.494 0.400" } + { tan1 } @Yield { rgb "1.000 0.647 0.310" } + { tan2 } @Yield { rgb "0.933 0.604 0.286" } + { tan3 } @Yield { rgb "0.804 0.522 0.247" } + { tan4 } @Yield { rgb "0.545 0.353 0.169" } + { chocolate1 } @Yield { rgb "1.000 0.498 0.141" } + { chocolate2 } @Yield { rgb "0.933 0.463 0.129" } + { chocolate3 } @Yield { rgb "0.804 0.400 0.114" } + { chocolate4 } @Yield { rgb "0.545 0.271 0.075" } + { firebrick1 } @Yield { rgb "1.000 0.188 0.188" } + { firebrick2 } @Yield { rgb "0.933 0.173 0.173" } + { firebrick3 } @Yield { rgb "0.804 0.149 0.149" } + { firebrick4 } @Yield { rgb "0.545 0.102 0.102" } + { brown1 } @Yield { rgb "1.000 0.251 0.251" } + { brown2 } @Yield { rgb "0.933 0.231 0.231" } + { brown3 } @Yield { rgb "0.804 0.200 0.200" } + { brown4 } @Yield { rgb "0.545 0.137 0.137" } + { salmon1 } @Yield { rgb "1.000 0.549 0.412" } + { salmon2 } @Yield { rgb "0.933 0.510 0.384" } + { salmon3 } @Yield { rgb "0.804 0.439 0.329" } + { salmon4 } @Yield { rgb "0.545 0.298 0.224" } + { lightsalmon1 } @Yield { rgb "1.000 0.627 0.478" } + { lightsalmon2 } @Yield { rgb "0.933 0.584 0.447" } + { lightsalmon3 } @Yield { rgb "0.804 0.506 0.384" } + { lightsalmon4 } @Yield { rgb "0.545 0.341 0.259" } + { orange1 } @Yield { rgb "1.000 0.647 0.000" } + { orange2 } @Yield { rgb "0.933 0.604 0.000" } + { orange3 } @Yield { rgb "0.804 0.522 0.000" } + { orange4 } @Yield { rgb "0.545 0.353 0.000" } + { darkorange1 } @Yield { rgb "1.000 0.498 0.000" } + { darkorange2 } @Yield { rgb "0.933 0.463 0.000" } + { darkorange3 } @Yield { rgb "0.804 0.400 0.000" } + { darkorange4 } @Yield { rgb "0.545 0.271 0.000" } + { coral1 } @Yield { rgb "1.000 0.447 0.337" } + { coral2 } @Yield { rgb "0.933 0.416 0.314" } + { coral3 } @Yield { rgb "0.804 0.357 0.271" } + { coral4 } @Yield { rgb "0.545 0.243 0.184" } + { tomato1 } @Yield { rgb "1.000 0.388 0.278" } + { tomato2 } @Yield { rgb "0.933 0.361 0.259" } + { tomato3 } @Yield { rgb "0.804 0.310 0.224" } + { tomato4 } @Yield { rgb "0.545 0.212 0.149" } + { orangered1 } @Yield { rgb "1.000 0.271 0.000" } + { orangered2 } @Yield { rgb "0.933 0.251 0.000" } + { orangered3 } @Yield { rgb "0.804 0.216 0.000" } + { orangered4 } @Yield { rgb "0.545 0.145 0.000" } + { red1 } @Yield { rgb "1.000 0.000 0.000" } + { red2 } @Yield { rgb "0.933 0.000 0.000" } + { red3 } @Yield { rgb "0.804 0.000 0.000" } + { red4 } @Yield { rgb "0.545 0.000 0.000" } + { deeppink1 } @Yield { rgb "1.000 0.078 0.576" } + { deeppink2 } @Yield { rgb "0.933 0.071 0.537" } + { deeppink3 } @Yield { rgb "0.804 0.063 0.463" } + { deeppink4 } @Yield { rgb "0.545 0.039 0.314" } + { hotpink1 } @Yield { rgb "1.000 0.431 0.706" } + { hotpink2 } @Yield { rgb "0.933 0.416 0.655" } + { hotpink3 } @Yield { rgb "0.804 0.376 0.565" } + { hotpink4 } @Yield { rgb "0.545 0.227 0.384" } + { pink1 } @Yield { rgb "1.000 0.710 0.773" } + { pink2 } @Yield { rgb "0.933 0.663 0.722" } + { pink3 } @Yield { rgb "0.804 0.569 0.620" } + { pink4 } @Yield { rgb "0.545 0.388 0.424" } + { lightpink1 } @Yield { rgb "1.000 0.682 0.725" } + { lightpink2 } @Yield { rgb "0.933 0.635 0.678" } + { lightpink3 } @Yield { rgb "0.804 0.549 0.584" } + { lightpink4 } @Yield { rgb "0.545 0.373 0.396" } + { palevioletred1 } @Yield { rgb "1.000 0.510 0.671" } + { palevioletred2 } @Yield { rgb "0.933 0.475 0.624" } + { palevioletred3 } @Yield { rgb "0.804 0.408 0.537" } + { palevioletred4 } @Yield { rgb "0.545 0.278 0.365" } + { maroon1 } @Yield { rgb "1.000 0.204 0.702" } + { maroon2 } @Yield { rgb "0.933 0.188 0.655" } + { maroon3 } @Yield { rgb "0.804 0.161 0.565" } + { maroon4 } @Yield { rgb "0.545 0.110 0.384" } + { violetred1 } @Yield { rgb "1.000 0.243 0.588" } + { violetred2 } @Yield { rgb "0.933 0.227 0.549" } + { violetred3 } @Yield { rgb "0.804 0.196 0.471" } + { violetred4 } @Yield { rgb "0.545 0.133 0.322" } + { magenta1 } @Yield { rgb "1.000 0.000 1.000" } + { magenta2 } @Yield { rgb "0.933 0.000 0.933" } + { magenta3 } @Yield { rgb "0.804 0.000 0.804" } + { magenta4 } @Yield { rgb "0.545 0.000 0.545" } + { orchid1 } @Yield { rgb "1.000 0.514 0.980" } + { orchid2 } @Yield { rgb "0.933 0.478 0.914" } + { orchid3 } @Yield { rgb "0.804 0.412 0.788" } + { orchid4 } @Yield { rgb "0.545 0.278 0.537" } + { plum1 } @Yield { rgb "1.000 0.733 1.000" } + { plum2 } @Yield { rgb "0.933 0.682 0.933" } + { plum3 } @Yield { rgb "0.804 0.588 0.804" } + { plum4 } @Yield { rgb "0.545 0.400 0.545" } + { mediumorchid1 } @Yield { rgb "0.878 0.400 1.000" } + { mediumorchid2 } @Yield { rgb "0.820 0.373 0.933" } + { mediumorchid3 } @Yield { rgb "0.706 0.322 0.804" } + { mediumorchid4 } @Yield { rgb "0.478 0.216 0.545" } + { darkorchid1 } @Yield { rgb "0.749 0.243 1.000" } + { darkorchid2 } @Yield { rgb "0.698 0.227 0.933" } + { darkorchid3 } @Yield { rgb "0.604 0.196 0.804" } + { darkorchid4 } @Yield { rgb "0.408 0.133 0.545" } + { purple1 } @Yield { rgb "0.608 0.188 1.000" } + { purple2 } @Yield { rgb "0.569 0.173 0.933" } + { purple3 } @Yield { rgb "0.490 0.149 0.804" } + { purple4 } @Yield { rgb "0.333 0.102 0.545" } + { mediumpurple1 } @Yield { rgb "0.671 0.510 1.000" } + { mediumpurple2 } @Yield { rgb "0.624 0.475 0.933" } + { mediumpurple3 } @Yield { rgb "0.537 0.408 0.804" } + { mediumpurple4 } @Yield { rgb "0.365 0.278 0.545" } + { thistle1 } @Yield { rgb "1.000 0.882 1.000" } + { thistle2 } @Yield { rgb "0.933 0.824 0.933" } + { thistle3 } @Yield { rgb "0.804 0.710 0.804" } + { thistle4 } @Yield { rgb "0.545 0.482 0.545" } + { gray0 } @Yield { rgb "0.000 0.000 0.000" } + { grey0 } @Yield { rgb "0.000 0.000 0.000" } + { gray1 } @Yield { rgb "0.012 0.012 0.012" } + { grey1 } @Yield { rgb "0.012 0.012 0.012" } + { gray2 } @Yield { rgb "0.020 0.020 0.020" } + { grey2 } @Yield { rgb "0.020 0.020 0.020" } + { gray3 } @Yield { rgb "0.031 0.031 0.031" } + { grey3 } @Yield { rgb "0.031 0.031 0.031" } + { gray4 } @Yield { rgb "0.039 0.039 0.039" } + { grey4 } @Yield { rgb "0.039 0.039 0.039" } + { gray5 } @Yield { rgb "0.051 0.051 0.051" } + { grey5 } @Yield { rgb "0.051 0.051 0.051" } + { gray6 } @Yield { rgb "0.059 0.059 0.059" } + { grey6 } @Yield { rgb "0.059 0.059 0.059" } + { gray7 } @Yield { rgb "0.071 0.071 0.071" } + { grey7 } @Yield { rgb "0.071 0.071 0.071" } + { gray8 } @Yield { rgb "0.078 0.078 0.078" } + { grey8 } @Yield { rgb "0.078 0.078 0.078" } + { gray9 } @Yield { rgb "0.090 0.090 0.090" } + { grey9 } @Yield { rgb "0.090 0.090 0.090" } + { gray10 } @Yield { rgb "0.102 0.102 0.102" } + { grey10 } @Yield { rgb "0.102 0.102 0.102" } + { gray11 } @Yield { rgb "0.110 0.110 0.110" } + { grey11 } @Yield { rgb "0.110 0.110 0.110" } + { gray12 } @Yield { rgb "0.122 0.122 0.122" } + { grey12 } @Yield { rgb "0.122 0.122 0.122" } + { gray13 } @Yield { rgb "0.129 0.129 0.129" } + { grey13 } @Yield { rgb "0.129 0.129 0.129" } + { gray14 } @Yield { rgb "0.141 0.141 0.141" } + { grey14 } @Yield { rgb "0.141 0.141 0.141" } + { gray15 } @Yield { rgb "0.149 0.149 0.149" } + { grey15 } @Yield { rgb "0.149 0.149 0.149" } + { gray16 } @Yield { rgb "0.161 0.161 0.161" } + { grey16 } @Yield { rgb "0.161 0.161 0.161" } + { gray17 } @Yield { rgb "0.169 0.169 0.169" } + { grey17 } @Yield { rgb "0.169 0.169 0.169" } + { gray18 } @Yield { rgb "0.180 0.180 0.180" } + { grey18 } @Yield { rgb "0.180 0.180 0.180" } + { gray19 } @Yield { rgb "0.188 0.188 0.188" } + { grey19 } @Yield { rgb "0.188 0.188 0.188" } + { gray20 } @Yield { rgb "0.200 0.200 0.200" } + { grey20 } @Yield { rgb "0.200 0.200 0.200" } + { gray21 } @Yield { rgb "0.212 0.212 0.212" } + { grey21 } @Yield { rgb "0.212 0.212 0.212" } + { gray22 } @Yield { rgb "0.220 0.220 0.220" } + { grey22 } @Yield { rgb "0.220 0.220 0.220" } + { gray23 } @Yield { rgb "0.231 0.231 0.231" } + { grey23 } @Yield { rgb "0.231 0.231 0.231" } + { gray24 } @Yield { rgb "0.239 0.239 0.239" } + { grey24 } @Yield { rgb "0.239 0.239 0.239" } + { gray25 } @Yield { rgb "0.251 0.251 0.251" } + { grey25 } @Yield { rgb "0.251 0.251 0.251" } + { gray26 } @Yield { rgb "0.259 0.259 0.259" } + { grey26 } @Yield { rgb "0.259 0.259 0.259" } + { gray27 } @Yield { rgb "0.271 0.271 0.271" } + { grey27 } @Yield { rgb "0.271 0.271 0.271" } + { gray28 } @Yield { rgb "0.278 0.278 0.278" } + { grey28 } @Yield { rgb "0.278 0.278 0.278" } + { gray29 } @Yield { rgb "0.290 0.290 0.290" } + { grey29 } @Yield { rgb "0.290 0.290 0.290" } + { gray30 } @Yield { rgb "0.302 0.302 0.302" } + { grey30 } @Yield { rgb "0.302 0.302 0.302" } + { gray31 } @Yield { rgb "0.310 0.310 0.310" } + { grey31 } @Yield { rgb "0.310 0.310 0.310" } + { gray32 } @Yield { rgb "0.322 0.322 0.322" } + { grey32 } @Yield { rgb "0.322 0.322 0.322" } + { gray33 } @Yield { rgb "0.329 0.329 0.329" } + { grey33 } @Yield { rgb "0.329 0.329 0.329" } + { gray34 } @Yield { rgb "0.341 0.341 0.341" } + { grey34 } @Yield { rgb "0.341 0.341 0.341" } + { gray35 } @Yield { rgb "0.349 0.349 0.349" } + { grey35 } @Yield { rgb "0.349 0.349 0.349" } + { gray36 } @Yield { rgb "0.361 0.361 0.361" } + { grey36 } @Yield { rgb "0.361 0.361 0.361" } + { gray37 } @Yield { rgb "0.369 0.369 0.369" } + { grey37 } @Yield { rgb "0.369 0.369 0.369" } + { gray38 } @Yield { rgb "0.380 0.380 0.380" } + { grey38 } @Yield { rgb "0.380 0.380 0.380" } + { gray39 } @Yield { rgb "0.388 0.388 0.388" } + { grey39 } @Yield { rgb "0.388 0.388 0.388" } + { gray40 } @Yield { rgb "0.400 0.400 0.400" } + { grey40 } @Yield { rgb "0.400 0.400 0.400" } + { gray41 } @Yield { rgb "0.412 0.412 0.412" } + { grey41 } @Yield { rgb "0.412 0.412 0.412" } + { gray42 } @Yield { rgb "0.420 0.420 0.420" } + { grey42 } @Yield { rgb "0.420 0.420 0.420" } + { gray43 } @Yield { rgb "0.431 0.431 0.431" } + { grey43 } @Yield { rgb "0.431 0.431 0.431" } + { gray44 } @Yield { rgb "0.439 0.439 0.439" } + { grey44 } @Yield { rgb "0.439 0.439 0.439" } + { gray45 } @Yield { rgb "0.451 0.451 0.451" } + { grey45 } @Yield { rgb "0.451 0.451 0.451" } + { gray46 } @Yield { rgb "0.459 0.459 0.459" } + { grey46 } @Yield { rgb "0.459 0.459 0.459" } + { gray47 } @Yield { rgb "0.471 0.471 0.471" } + { grey47 } @Yield { rgb "0.471 0.471 0.471" } + { gray48 } @Yield { rgb "0.478 0.478 0.478" } + { grey48 } @Yield { rgb "0.478 0.478 0.478" } + { gray49 } @Yield { rgb "0.490 0.490 0.490" } + { grey49 } @Yield { rgb "0.490 0.490 0.490" } + { gray50 } @Yield { rgb "0.498 0.498 0.498" } + { grey50 } @Yield { rgb "0.498 0.498 0.498" } + { gray51 } @Yield { rgb "0.510 0.510 0.510" } + { grey51 } @Yield { rgb "0.510 0.510 0.510" } + { gray52 } @Yield { rgb "0.522 0.522 0.522" } + { grey52 } @Yield { rgb "0.522 0.522 0.522" } + { gray53 } @Yield { rgb "0.529 0.529 0.529" } + { grey53 } @Yield { rgb "0.529 0.529 0.529" } + { gray54 } @Yield { rgb "0.541 0.541 0.541" } + { grey54 } @Yield { rgb "0.541 0.541 0.541" } + { gray55 } @Yield { rgb "0.549 0.549 0.549" } + { grey55 } @Yield { rgb "0.549 0.549 0.549" } + { gray56 } @Yield { rgb "0.561 0.561 0.561" } + { grey56 } @Yield { rgb "0.561 0.561 0.561" } + { gray57 } @Yield { rgb "0.569 0.569 0.569" } + { grey57 } @Yield { rgb "0.569 0.569 0.569" } + { gray58 } @Yield { rgb "0.580 0.580 0.580" } + { grey58 } @Yield { rgb "0.580 0.580 0.580" } + { gray59 } @Yield { rgb "0.588 0.588 0.588" } + { grey59 } @Yield { rgb "0.588 0.588 0.588" } + { gray60 } @Yield { rgb "0.600 0.600 0.600" } + { grey60 } @Yield { rgb "0.600 0.600 0.600" } + { gray61 } @Yield { rgb "0.612 0.612 0.612" } + { grey61 } @Yield { rgb "0.612 0.612 0.612" } + { gray62 } @Yield { rgb "0.620 0.620 0.620" } + { grey62 } @Yield { rgb "0.620 0.620 0.620" } + { gray63 } @Yield { rgb "0.631 0.631 0.631" } + { grey63 } @Yield { rgb "0.631 0.631 0.631" } + { gray64 } @Yield { rgb "0.639 0.639 0.639" } + { grey64 } @Yield { rgb "0.639 0.639 0.639" } + { gray65 } @Yield { rgb "0.651 0.651 0.651" } + { grey65 } @Yield { rgb "0.651 0.651 0.651" } + { gray66 } @Yield { rgb "0.659 0.659 0.659" } + { grey66 } @Yield { rgb "0.659 0.659 0.659" } + { gray67 } @Yield { rgb "0.671 0.671 0.671" } + { grey67 } @Yield { rgb "0.671 0.671 0.671" } + { gray68 } @Yield { rgb "0.678 0.678 0.678" } + { grey68 } @Yield { rgb "0.678 0.678 0.678" } + { gray69 } @Yield { rgb "0.690 0.690 0.690" } + { grey69 } @Yield { rgb "0.690 0.690 0.690" } + { gray70 } @Yield { rgb "0.702 0.702 0.702" } + { grey70 } @Yield { rgb "0.702 0.702 0.702" } + { gray71 } @Yield { rgb "0.710 0.710 0.710" } + { grey71 } @Yield { rgb "0.710 0.710 0.710" } + { gray72 } @Yield { rgb "0.722 0.722 0.722" } + { grey72 } @Yield { rgb "0.722 0.722 0.722" } + { gray73 } @Yield { rgb "0.729 0.729 0.729" } + { grey73 } @Yield { rgb "0.729 0.729 0.729" } + { gray74 } @Yield { rgb "0.741 0.741 0.741" } + { grey74 } @Yield { rgb "0.741 0.741 0.741" } + { gray75 } @Yield { rgb "0.749 0.749 0.749" } + { grey75 } @Yield { rgb "0.749 0.749 0.749" } + { gray76 } @Yield { rgb "0.761 0.761 0.761" } + { grey76 } @Yield { rgb "0.761 0.761 0.761" } + { gray77 } @Yield { rgb "0.769 0.769 0.769" } + { grey77 } @Yield { rgb "0.769 0.769 0.769" } + { gray78 } @Yield { rgb "0.780 0.780 0.780" } + { grey78 } @Yield { rgb "0.780 0.780 0.780" } + { gray79 } @Yield { rgb "0.788 0.788 0.788" } + { grey79 } @Yield { rgb "0.788 0.788 0.788" } + { gray80 } @Yield { rgb "0.800 0.800 0.800" } + { grey80 } @Yield { rgb "0.800 0.800 0.800" } + { gray81 } @Yield { rgb "0.812 0.812 0.812" } + { grey81 } @Yield { rgb "0.812 0.812 0.812" } + { gray82 } @Yield { rgb "0.820 0.820 0.820" } + { grey82 } @Yield { rgb "0.820 0.820 0.820" } + { gray83 } @Yield { rgb "0.831 0.831 0.831" } + { grey83 } @Yield { rgb "0.831 0.831 0.831" } + { gray84 } @Yield { rgb "0.839 0.839 0.839" } + { grey84 } @Yield { rgb "0.839 0.839 0.839" } + { gray85 } @Yield { rgb "0.851 0.851 0.851" } + { grey85 } @Yield { rgb "0.851 0.851 0.851" } + { gray86 } @Yield { rgb "0.859 0.859 0.859" } + { grey86 } @Yield { rgb "0.859 0.859 0.859" } + { gray87 } @Yield { rgb "0.871 0.871 0.871" } + { grey87 } @Yield { rgb "0.871 0.871 0.871" } + { gray88 } @Yield { rgb "0.878 0.878 0.878" } + { grey88 } @Yield { rgb "0.878 0.878 0.878" } + { gray89 } @Yield { rgb "0.890 0.890 0.890" } + { grey89 } @Yield { rgb "0.890 0.890 0.890" } + { gray90 } @Yield { rgb "0.898 0.898 0.898" } + { grey90 } @Yield { rgb "0.898 0.898 0.898" } + { gray91 } @Yield { rgb "0.910 0.910 0.910" } + { grey91 } @Yield { rgb "0.910 0.910 0.910" } + { gray92 } @Yield { rgb "0.922 0.922 0.922" } + { grey92 } @Yield { rgb "0.922 0.922 0.922" } + { gray93 } @Yield { rgb "0.929 0.929 0.929" } + { grey93 } @Yield { rgb "0.929 0.929 0.929" } + { gray94 } @Yield { rgb "0.941 0.941 0.941" } + { grey94 } @Yield { rgb "0.941 0.941 0.941" } + { gray95 } @Yield { rgb "0.949 0.949 0.949" } + { grey95 } @Yield { rgb "0.949 0.949 0.949" } + { gray96 } @Yield { rgb "0.961 0.961 0.961" } + { grey96 } @Yield { rgb "0.961 0.961 0.961" } + { gray97 } @Yield { rgb "0.969 0.969 0.969" } + { grey97 } @Yield { rgb "0.969 0.969 0.969" } + { gray98 } @Yield { rgb "0.980 0.980 0.980" } + { grey98 } @Yield { rgb "0.980 0.980 0.980" } + { gray99 } @Yield { rgb "0.988 0.988 0.988" } + { grey99 } @Yield { rgb "0.988 0.988 0.988" } + { gray100 } @Yield { rgb "1.000 1.000 1.000" } + { grey100 } @Yield { rgb "1.000 1.000 1.000" } + { darkgrey } @Yield { rgb "0.663 0.663 0.663" } + { darkgray } @Yield { rgb "0.663 0.663 0.663" } + { darkblue } @Yield { rgb "0.000 0.000 0.545" } + { darkcyan } @Yield { rgb "0.000 0.545 0.545" } + { darkmagenta } @Yield { rgb "0.545 0.000 0.545" } + { darkred } @Yield { rgb "0.545 0.000 0.000" } + { lightgreen } @Yield { rgb "0.565 0.933 0.565" } + # else @Yield { rgb "0.000 0.000 0.000" } + } +} |