diff options
author | Jeffrey H. Kingston <jeff@it.usyd.edu.au> | 2010-09-14 20:36:08 +0000 |
---|---|---|
committer | Jeffrey H. Kingston <jeff@it.usyd.edu.au> | 2010-09-14 20:36:08 +0000 |
commit | e3fe9fa1d10264370c63e20756e5cbd2c1050f43 (patch) | |
tree | 57165bf2889337044bc3633854e5aa38f7d89e6b /include | |
parent | 73d840b9f14b65166b92e6b43f930fd0ef7b8267 (diff) | |
download | lout-3.20.tar.gz |
Lout 3.20 tag.3.20
git-svn-id: http://svn.savannah.nongnu.org/svn/lout/tags/3.20@10 9365b830-b601-4143-9ba8-b4a8e2c3339c
Diffstat (limited to 'include')
-rw-r--r-- | include/README | 16 | ||||
-rw-r--r-- | include/blue | 117 | ||||
-rw-r--r-- | include/bluef | 318 | ||||
-rw-r--r-- | include/cprint | 119 | ||||
-rw-r--r-- | include/cprintf | 327 | ||||
-rw-r--r-- | include/eiffel | 117 | ||||
-rw-r--r-- | include/eiffelf | 318 | ||||
-rw-r--r-- | include/perl | 102 | ||||
-rw-r--r-- | include/perlf | 354 | ||||
-rw-r--r-- | include/pod | 164 | ||||
-rw-r--r-- | include/podf | 513 | ||||
-rw-r--r-- | include/progf | 281 |
12 files changed, 1967 insertions, 779 deletions
diff --git a/include/README b/include/README index 008aac8..1a2389a 100644 --- a/include/README +++ b/include/README @@ -32,6 +32,8 @@ Setup files (containing mainly lists of options settable by the user) cprint C and C++ eiffel Eiffel blue Blue + perl Perl + Pod + pod Pod Source files (containing Lout and PostScript source code for the packages) -------------------------------------------------------------------------- @@ -58,24 +60,26 @@ Source files (containing Lout and PostScript source code for the packages) graphf The Graph graph drawing package graphf.etc A file included by graphf graphf.lpg A PostScript prepend file needed by graphf - progf Programming language formatting (for use by prg2lout) - cprintf C and C++ - eiffelf Eiffel - bluef Blue pasf Pascal modulaf Modula-2 latin2.fd Latin2 font definitions file (placeholder file) russian.fd Russian font definitions file (placeholder file) + cprintf C and C++ + eiffelf Eiffel + bluef Blue + perlf Perl + podf Pod + Miscellaneous ------------- fontdefs Standard font definitions file langdefs Standard language definitions file - mydefs Empty file for if the user doesn't have one + 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 -9 March 2000 +8 April 2000 diff --git a/include/blue b/include/blue index 78c5d33..94ae775 100644 --- a/include/blue +++ b/include/blue @@ -2,18 +2,19 @@ # # # Lout setup file for Blue program printing # # # +# Version 3.0 # # Jeffrey H. Kingston # -# 23 February 2000 # +# 5 April 2000 # # # ############################################################################### ############################################################################### # # -# The @SysInclude { bluef } line # +# @SysInclude line # # # -# This line causes Lout to read the definitions for Blue, and should # -# not be touched. # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # # # ############################################################################### @@ -22,7 +23,7 @@ ############################################################################### # # -# The @BlueSetup @Use clause # +# @Use clause # # # # To change the default value of any option, delete the # at the start of # # its line and change the value between braces. # @@ -30,42 +31,72 @@ ############################################################################### @Use { @BlueSetup - # style { varying @OrIfPlain fixed } # fixed, varying, or symbol - # pipe { } # pipe source through this - - # fixedfont { Courier } # font family if fixed - # fixedstrings { Base } # string face if fixed - # fixedidentifiers { Base } # identifier face if fixed - # fixedcomments { Base } # comment face if fixed - # fixedkeywords { Base } # keyword face if fixed - # fixednumbers { Base } # number face if fixed - # fixedoperators { Base } # operator face if fixed - # fixedsize { -1.0p } # font size if fixed - # fixedline { 1.0vx } # line-space if fixed - # fixedtabin { 8 } # tab interval if fixed - # fixedtabout { 8s } # tab width if fixed - - # varyingfont { } # font family if varying - # varyingstrings { Slope } # string face if varying - # varyingidentifiers { Slope } # identifier face if varying - # varyingcomments { Base } # comment face if varying - # varyingkeywords { Bold } # keyword face if varying - # varyingnumbers { Base } # number face if varying - # varyingoperators { Base } # operator face if varying - # varyingsize { 1.0f } # font size if varying - # varyingline { 1.0vx } # line-space if varying - # varyingtabin { 8 } # tab interval if varying - # varyingtabout { 3f } # tab width if varying - - # symbolfont { } # font family if symbol - # symbolstrings { Slope } # string face if symbol - # symbolidentifiers { Slope } # identifier face if symbol - # symbolcomments { Base } # comment face if symbol - # symbolkeywords { Bold } # keyword face if symbol - # symbolnumbers { Base } # number face if symbol - # symboloperators { Base } # operator face if symbol - # symbolsize { 1.0f } # font size if symbol - # symbolline { 1.0vx } # line-space if symbol - # symboltabin { 8 } # tab interval if symbol - # symboltabout { 3f } # tab width if symbol + # pipe { } # pipe source through this + # 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 + # 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 + + # fixedidentifiersformat { @Body } # identifiers format + # fixedkeywordsformat { @Body } # keywords format + # fixedoperatorsformat { @Body } # operators format + # fixednumbersformat { @Body } # numbers format + # fixedstringsformat { @Body } # strings format + # fixedcommentsformat { @Body } # comments format + + # the following options apply when style is "varying" + + # varyingfont { } # font family + # varyingsize { 1.0f } # font size + # varyingline { 1.0vx } # line-space + # varyingtabin { 8 } # tab interval + # varyingtabout { 3f } # tab width + + # varyingidentifiers { Slope } # identifier face + # varyingkeywords { Bold } # keyword face + # varyingoperators { Base } # operator face + # varyingnumbers { Base } # number face + # varyingstrings { Slope } # string face + # varyingcomments { Base } # comment face + + # varyingidentifiersformat { @Body } # identifiers format + # varyingkeywordsformat { @Body } # keywords format + # varyingoperatorsformat { @Body } # operators format + # varyingnumbersformat { @Body } # numbers format + # varyingstringsformat { @Body } # strings format + # varyingcommentsformat { @Body } # comments format + + # the following options apply when style is "symbol" + + # symbolfont { } # font family + # symbolsize { 1.0f } # font size + # symbolline { 1.0vx } # line-space + # symboltabin { 8 } # tab interval + # symboltabout { 3f } # tab width + + # symbolidentifiers { Slope } # identifier face + # symbolkeywords { Bold } # keyword face + # symboloperators { Base } # operator face + # symbolnumbers { Base } # number face + # symbolstrings { Slope } # string face + # symbolcomments { Base } # comment face + + # symbolidentifiersformat { @Body } # identifiers format + # symbolkeywordsformat { @Body } # keywords format + # symboloperatorsformat { @Body } # operators format + # symbolnumbersformat { @Body } # numbers format + # symbolstringsformat { @Body } # strings format + # symbolcommentsformat { @Body } # comments format } diff --git a/include/bluef b/include/bluef index 2966814..3574516 100644 --- a/include/bluef +++ b/include/bluef @@ -3,9 +3,11 @@ # # # Lout @BlueSetup package for formatting Blue programs # # # -# Version 2.0 by Jeffrey H. Kingston, February 2000. # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # # # -# This package uses a filtered body parameter to convert Blue source # +# 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. # @@ -14,68 +16,96 @@ export @Blue def @BlueSetup + 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 - named pipe { } # pipe through this first - - named fixedfont { Courier } # font family if fixed - named fixedstrings { Base } # string face if fixed - named fixedidentifiers { Base } # identifier face if fixed - named fixedcomments { Base } # comment face if fixed - named fixedkeywords { Base } # keyword face if fixed - named fixednumbers { Base } # number face if fixed - named fixedoperators { Base } # operator face if fixed - named fixedsize { -1.0p } # font size if fixed - named fixedline { 1.0vx } # line-space if fixed - named fixedtabin { 8 } # tab interval if fixed - named fixedtabout { 8s } # tab width if fixed - - named varyingfont { } # font family if varying - named varyingstrings { Slope } # string face if varying - named varyingidentifiers { Slope } # identifier face if varying - named varyingcomments { Base } # comment face if varying - named varyingkeywords { Bold } # keyword face if varying - named varyingnumbers { Base } # number face if varying - named varyingoperators { Base } # operator face if varying - named varyingsize { 1.0f } # font size if varying - named varyingline { 1.0vx } # line-space if varying - named varyingtabin { 8 } # tab interval if varying - named varyingtabout { 3f } # tab width if varying - - named symbolfont { } # font family if symbol - named symbolstrings { Slope } # string face if symbol - named symbolidentifiers { Slope } # identifier face if symbol - named symbolcomments { Base } # comment face if symbol - named symbolkeywords { Bold } # keyword face if symbol - named symbolnumbers { Base } # number face if symbol - named symboloperators { Base } # operator face if symbol - named symbolsize { 1.0f } # font size if symbol - named symbolline { 1.0vx } # line-space if symbol - named symboltabin { 8 } # tab interval if symbol - named symboltabout { 3f } # tab width if symbol + { 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 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 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 + + # the following options apply when style is "varying" + named varyingfont { } # font family + named varyingsize { 1.0f } # font size + named varyingline { 1.0vx } # line-space + named varyingtabin { 8 } # tab interval + named varyingtabout { 3f } # tab width + + named varyingidentifiers { Slope } # identifier face + named varyingkeywords { Bold } # keyword face + named varyingoperators { Base } # operator face + named varyingnumbers { Base } # number face + named varyingstrings { Slope } # string face + named varyingcomments { Base } # comment face + + named 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 + + # the following options apply when style is "symbol" + named symbolfont { } # font family + named symbolsize { 1.0f } # font size + named symbolline { 1.0vx } # line-space + named symboltabin { 8 } # tab interval + named symboltabout { 3f } # tab width + + named symbolidentifiers { Slope } # identifier face + named symbolkeywords { Bold } # keyword face + named symboloperators { Base } # operator face + named symbolnumbers { Base } # number face + named symbolstrings { Slope } # string face + named symbolcomments { Base } # comment face + + named 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 @Begin export - "$>" @S @D @C @K @N @O @A @ST @ED @M + @PI @PK @PO @PN @PS @PC @PA @PM @PD + @A "$>" def @Blue named style { style } # style named pipe { pipe } # pipe through this first named font { dft } # font family - named strings { dft } # string font - named identifiers { dft } # ident. font - named comments { dft } # comment font - named keywords { dft } # keyword font - named numbers { dft } # number font - named operators { dft } # operator font named size { dft } # font size named line { dft } # line-space named tabin { dft } # tab interval named tabout { dft } # tab width + named identifiers { dft } # ident. font + named keywords { dft } # keyword font + named operators { dft } # operator font + named numbers { dft } # number font + named strings { dft } # string font + named comments { dft } # comment font body @Body # filtered, see below @Begin @@ -97,6 +127,18 @@ def @BlueSetup } } + + 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 @@ -105,6 +147,7 @@ def @BlueSetup ifsymbol { symboltabin } } + def @InitTabWidth { tabout @Test @@ -113,6 +156,7 @@ def @BlueSetup ifsymbol { symboltabout } } + def @Filter { pipe @Case { @@ -128,6 +172,7 @@ def @BlueSetup } } + def @InitFontFamily { font @Test @@ -136,6 +181,7 @@ def @BlueSetup ifsymbol { symbolfont } } + def @InitSize { size @Test @@ -144,6 +190,7 @@ def @BlueSetup ifsymbol { symbolsize } } + def @InitLine { line @Test @@ -152,120 +199,153 @@ def @BlueSetup ifsymbol { symbolline } } - def @S # for formatting strings + + def @PI # for formatting identifiers right x { - # "\"" & - strings @Test - iffixed { fixedstrings } - ifvarying { varyingstrings } - ifsymbol { symbolstrings } - @Font 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 "`" -# { -# style @Case { -# symbol @Yield { "`" } -# else @Yield { "'" } -# } -# } - def @D # for formatting identifiers + def @PK # for formatting keywords right x { - identifiers @Test - iffixed { fixedidentifiers } - ifvarying { varyingidentifiers } - ifsymbol { symbolidentifiers } - @Font 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 @C # for formatting comments + + def @PO # for formatting operators right x { - comments @Test - iffixed { fixedcomments } - ifvarying { varyingcomments } - ifsymbol { symbolcomments } - @Font 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 @K # for formatting keywords + + def @PN # for formatting numbers right x { - keywords @Test - iffixed { fixedkeywords } - ifvarying { varyingkeywords } - ifsymbol { symbolkeywords } - @Font 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 @N # for formatting numbers + + def @PS # for formatting strings right x { - numbers @Test - iffixed { fixednumbers } - ifvarying { varyingnumbers } - ifsymbol { symbolnumbers } - @Font 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 @O # for formatting operators + + def @PC # for formatting comments right x { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font 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 @A # get characters from the Adobe Symbol font - left sym - right x + + def @PA # for formatting asterisks { - style @Case { - symbol @Yield { { Symbol Base } @Font @Char sym } - else @Yield { x } + @PO @BackEnd @Case { + PlainText @Yield "*" + else @Yield { "0.5w" @VShift "*" } } } - def @ST # for formatting asterisks - right x + + def @PM # for formatting minus signs { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font "0.5w" @VShift x + @PO @BackEnd @Case { + PlainText @Yield "-" + else @Yield style @Case { + fixed @Yield "-" + else @Yield { { Symbol Base } @Font @Char "minus" } + } + } } - def @ED # for formatting larger dots - right x + + def @PD # for formatting dots, if wanted larger { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font @BackEnd @Case { - PlainText @Yield x - else @Yield { "1.2f" @Font "+0.05f" @VShift @O x &"0.05f" } + @PO @BackEnd @Case { + PlainText @Yield "." + else @Yield { "1.4f" @Font "+0.04f" @VShift "." &"0.05f" } } } - macro "$>" { {} & } - def @M right x + def @A # get characters from the Adobe Symbol font + left sym + right x { style @Case { - fixed @Yield "-" - varying @Yield { { Symbol Base } @Font @Char minus } - symbol @Yield { { Symbol Base } @Font @Char minus } + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } } } + + macro "$>" { {} & } + + { @InitFontFamily Base @InitSize } @Font { @InitLine lines } @Break @Body diff --git a/include/cprint b/include/cprint index e720b22..b3d69c5 100644 --- a/include/cprint +++ b/include/cprint @@ -1,19 +1,20 @@ ############################################################################### # # -# Lout setup file for C program printing # +# Lout setup file for C and C++ program printing # # # +# Version 3.0 # # Jeffrey H. Kingston # -# 23 February 2000 # +# 5 April 2000 # # # ############################################################################### ############################################################################### # # -# The @SysInclude { cprintf } line # +# @SysInclude line # # # -# This line causes Lout to read the definitions for C, and should # -# not be touched. # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # # # ############################################################################### @@ -22,7 +23,7 @@ ############################################################################### # # -# The @CPSetup @Use clause # +# @Use clause # # # # To change the default value of any option, delete the # at the start of # # its line and change the value between braces. # @@ -30,42 +31,72 @@ ############################################################################### @Use { @CPSetup - # style { fixed } # fixed, varying, or symbol - # pipe { } # pipe source through this - - # fixedfont { Courier } # font family if fixed - # fixedstrings { Base } # string face if fixed - # fixedidentifiers { Base } # identifier face if fixed - # fixedcomments { Base } # comment face if fixed - # fixedkeywords { Base } # keyword face if fixed - # fixednumbers { Base } # number face if fixed - # fixedoperators { Base } # operator face if fixed - # fixedsize { -1.0p } # font size if fixed - # fixedline { 1.0vx } # line-space if fixed - # fixedtabin { 8 } # tab interval if fixed - # fixedtabout { 8s } # tab width if fixed - - # varyingfont { } # font family if varying - # varyingstrings { Slope } # string face if varying - # varyingidentifiers { Slope } # identifier face if varying - # varyingcomments { Base } # comment face if varying - # varyingkeywords { Bold } # keyword face if varying - # varyingnumbers { Base } # number face if varying - # varyingoperators { Base } # operator face if varying - # varyingsize { 1.0f } # font size if varying - # varyingline { 1.0vx } # line-space if varying - # varyingtabin { 8 } # tab interval if varying - # varyingtabout { 3f } # tab width if varying - - # symbolfont { } # font family if symbol - # symbolstrings { Slope } # string face if symbol - # symbolidentifiers { Slope } # identifier face if symbol - # symbolcomments { Base } # comment face if symbol - # symbolkeywords { Bold } # keyword face if symbol - # symbolnumbers { Base } # number face if symbol - # symboloperators { Base } # operator face if symbol - # symbolsize { 1.0f } # font size if symbol - # symbolline { 1.0vx } # line-space if symbol - # symboltabin { 8 } # tab interval if symbol - # symboltabout { 3f } # tab width if symbol + # pipe { } # pipe source through this + # style { fixed } # fixed, varying, or symbol + + # the following options apply when style is "fixed" + + # fixedfont { Courier } # font family + # fixedsize { -1.0p } # font size + # fixedline { 1.0vx } # line-space + # fixedtabin { 8 } # tab interval + # fixedtabout { 8s } # tab width + + # fixedidentifiers { Base } # identifier face + # fixedkeywords { Base } # keyword face + # fixedoperators { Base } # operator face + # fixednumbers { Base } # number face + # fixedstrings { Base } # string face + # fixedcomments { Base } # comment face + + # fixedidentifiersformat { @Body } # identifiers format + # fixedkeywordsformat { @Body } # keywords format + # fixedoperatorsformat { @Body } # operators format + # fixednumbersformat { @Body } # numbers format + # fixedstringsformat { @Body } # strings format + # fixedcommentsformat { @Body } # comments format + + # the following options apply when style is "varying" + + # varyingfont { } # font family + # varyingsize { 1.0f } # font size + # varyingline { 1.0vx } # line-space + # varyingtabin { 8 } # tab interval + # varyingtabout { 3f } # tab width + + # varyingidentifiers { Slope } # identifier face + # varyingkeywords { Bold } # keyword face + # varyingoperators { Base } # operator face + # varyingnumbers { Base } # number face + # varyingstrings { Slope } # string face + # varyingcomments { Base } # comment face + + # varyingidentifiersformat { @Body } # identifiers format + # varyingkeywordsformat { @Body } # keywords format + # varyingoperatorsformat { @Body } # operators format + # varyingnumbersformat { @Body } # numbers format + # varyingstringsformat { @Body } # strings format + # varyingcommentsformat { @Body } # comments format + + # the following options apply when style is "symbol" + + # symbolfont { } # font family + # symbolsize { 1.0f } # font size + # symbolline { 1.0vx } # line-space + # symboltabin { 8 } # tab interval + # symboltabout { 3f } # tab width + + # symbolidentifiers { Slope } # identifier face + # symbolkeywords { Bold } # keyword face + # symboloperators { Base } # operator face + # symbolnumbers { Base } # number face + # symbolstrings { Slope } # string face + # symbolcomments { Base } # comment face + + # symbolidentifiersformat { @Body } # identifiers format + # symbolkeywordsformat { @Body } # keywords format + # symboloperatorsformat { @Body } # operators format + # symbolnumbersformat { @Body } # numbers format + # symbolstringsformat { @Body } # strings format + # symbolcommentsformat { @Body } # comments format } diff --git a/include/cprintf b/include/cprintf index 313b110..5a2ce50 100644 --- a/include/cprintf +++ b/include/cprintf @@ -1,11 +1,13 @@ ############################################################################### # # -# Lout @CPSetup package for formatting C programs # +# Lout @CPSetup package for formatting C and C++ programs # # # -# Version 2.0 by Jeffrey H. Kingston, February 2000. # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # # # -# This package uses a filtered body parameter to convert C source # +# 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. # @@ -14,69 +16,96 @@ export @CP def @CPSetup + named pipe { } # pipe through this first named style - named @OrIfPlain left x right y - { @BackEnd @Case { PlainText @Yield y else @Yield x } } - { fixed } # print style - - named pipe { } # pipe through this first - - named fixedfont { Courier } # font family if fixed - named fixedstrings { Base } # string face if fixed - named fixedidentifiers { Base } # identifier face if fixed - named fixedcomments { Base } # comment face if fixed - named fixedkeywords { Base } # keyword face if fixed - named fixednumbers { Base } # number face if fixed - named fixedoperators { Base } # operator face if fixed - named fixedsize { -1.0p } # font size if fixed - named fixedline { 1.0vx } # line-space if fixed - named fixedtabin { 8 } # tab interval if fixed - named fixedtabout { 8s } # tab width if fixed - - named varyingfont { } # font family if varying - named varyingstrings { Slope } # string face if varying - named varyingidentifiers { Slope } # identifier face if varying - named varyingcomments { Base } # comment face if varying - named varyingkeywords { Bold } # keyword face if varying - named varyingnumbers { Base } # number face if varying - named varyingoperators { Base } # operator face if varying - named varyingsize { 1.0f } # font size if varying - named varyingline { 1.0vx } # line-space if varying - named varyingtabin { 8 } # tab interval if varying - named varyingtabout { 3f } # tab width if varying - - named symbolfont { } # font family if symbol - named symbolstrings { Slope } # string face if symbol - named symbolidentifiers { Slope } # identifier face if symbol - named symbolcomments { Base } # comment face if symbol - named symbolkeywords { Bold } # keyword face if symbol - named symbolnumbers { Base } # number face if symbol - named symboloperators { Base } # operator face if symbol - named symbolsize { 1.0f } # font size if symbol - named symbolline { 1.0vx } # line-space if symbol - named symboltabin { 8 } # tab interval if symbol - named symboltabout { 3f } # tab width if symbol + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { fixed } # print style + + # the following options apply when style is "fixed" + named fixedfont { Courier }# font family + named fixedsize { -1.0p } # font size + named fixedline { 1.0vx } # line-space + named fixedtabin { 8 } # tab interval + named fixedtabout { 8s } # tab width + + named fixedidentifiers { Base } # identifier face + named fixedkeywords { Base } # keyword face + named fixedoperators { Base } # operator face + named fixednumbers { Base } # number face + named fixedstrings { Base } # string face + named fixedcomments { Base } # comment face + + named 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 + + # the following options apply when style is "varying" + named varyingfont { } # font family + named varyingsize { 1.0f } # font size + named varyingline { 1.0vx } # line-space + named varyingtabin { 8 } # tab interval + named varyingtabout { 3f } # tab width + + named varyingidentifiers { Slope } # identifier face + named varyingkeywords { Bold } # keyword face + named varyingoperators { Base } # operator face + named varyingnumbers { Base } # number face + named varyingstrings { Slope } # string face + named varyingcomments { Base } # comment face + + named 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 + + # the following options apply when style is "symbol" + named symbolfont { } # font family + named symbolsize { 1.0f } # font size + named symbolline { 1.0vx } # line-space + named symboltabin { 8 } # tab interval + named symboltabout { 3f } # tab width + + named symbolidentifiers { Slope } # identifier face + named symbolkeywords { Bold } # keyword face + named symboloperators { Base } # operator face + named symbolnumbers { Base } # number face + named symbolstrings { Slope } # string face + named symbolcomments { Base } # comment face + + named 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 @Begin export - "$>" @S @D @C @K @N @O @A @ST @ED @M + @PI @PK @PO @PN @PS @PC @PA @PM @PD + @A "$>" def @CP named style { style } # style named pipe { pipe } # pipe through this first named font { dft } # font family - named strings { dft } # string font - named identifiers { dft } # ident. font - named comments { dft } # comment font - named keywords { dft } # keyword font - named numbers { dft } # number font - named operators { dft } # operator font named size { dft } # font size named line { dft } # line-space named tabin { dft } # tab interval named tabout { dft } # tab width + named identifiers { dft } # ident. font + named keywords { dft } # keyword font + named operators { dft } # operator font + named numbers { dft } # number font + named strings { dft } # string font + named comments { dft } # comment font body @Body # filtered, see below @Begin @@ -98,6 +127,18 @@ def @CPSetup } } + + 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 @@ -106,6 +147,7 @@ def @CPSetup ifsymbol { symboltabin } } + def @InitTabWidth { tabout @Test @@ -114,6 +156,7 @@ def @CPSetup ifsymbol { symboltabout } } + def @Filter { pipe @Case { @@ -129,6 +172,7 @@ def @CPSetup } } + def @InitFontFamily { font @Test @@ -137,6 +181,7 @@ def @CPSetup ifsymbol { symbolfont } } + def @InitSize { size @Test @@ -145,6 +190,7 @@ def @CPSetup ifsymbol { symbolsize } } + def @InitLine { line @Test @@ -153,120 +199,153 @@ def @CPSetup ifsymbol { symbolline } } - def @S # for formatting strings + + def @PI # for formatting identifiers right x { - # "\"" & - strings @Test - iffixed { fixedstrings } - ifvarying { varyingstrings } - ifsymbol { symbolstrings } - @Font 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 "`" -# { -# style @Case { -# symbol @Yield { "`" } -# else @Yield { "'" } -# } -# } - def @D # for formatting identifiers + def @PK # for formatting keywords right x { - identifiers @Test - iffixed { fixedidentifiers } - ifvarying { varyingidentifiers } - ifsymbol { symbolidentifiers } - @Font 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 @C # for formatting comments + + def @PO # for formatting operators right x { - comments @Test - iffixed { fixedcomments } - ifvarying { varyingcomments } - ifsymbol { symbolcomments } - @Font 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 @K # for formatting keywords + + def @PN # for formatting numbers right x { - keywords @Test - iffixed { fixedkeywords } - ifvarying { varyingkeywords } - ifsymbol { symbolkeywords } - @Font 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 @N # for formatting numbers + + def @PS # for formatting strings right x { - numbers @Test - iffixed { fixednumbers } - ifvarying { varyingnumbers } - ifsymbol { symbolnumbers } - @Font 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 @O # for formatting operators + + def @PC # for formatting comments right x { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font 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 @A # get characters from the Adobe Symbol font - left sym - right x + + def @PA # for formatting asterisks { - style @Case { - symbol @Yield { { Symbol Base } @Font @Char sym } - else @Yield { x } + @PO @BackEnd @Case { + PlainText @Yield "*" + else @Yield { "0.5w" @VShift "*" } } } - def @ST # for formatting asterisks - right x + + def @PM # for formatting minus signs { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font "0.5w" @VShift x + @PO @BackEnd @Case { + PlainText @Yield "-" + else @Yield style @Case { + fixed @Yield "-" + else @Yield { { Symbol Base } @Font @Char "minus" } + } + } } - - def @ED # for formatting larger dots (not used in C) - right x + + + def @PD # for formatting dots, if wanted larger { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font @BackEnd @Case { - PlainText @Yield x - else @Yield { "1.2f" @Font "+0.05f" @VShift @O x &"0.05f" } + @PO @BackEnd @Case { + PlainText @Yield "." + else @Yield { "1.4f" @Font "+0.04f" @VShift "." &"0.05f" } } } - macro "$>" { {} & } - def @M right x + def @A # get characters from the Adobe Symbol font + left sym + right x { style @Case { - fixed @Yield "-" - varying @Yield { { Symbol Base } @Font @Char minus } - symbol @Yield { { Symbol Base } @Font @Char minus } + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } } } + + macro "$>" { {} & } + + { @InitFontFamily Base @InitSize } @Font { @InitLine lines } @Break @Body diff --git a/include/eiffel b/include/eiffel index a55d5f7..e31a170 100644 --- a/include/eiffel +++ b/include/eiffel @@ -2,18 +2,19 @@ # # # Lout setup file for Eiffel program printing # # # +# Version 3.0 # # Jeffrey H. Kingston # -# 23 February 2000 # +# 5 April 2000 # # # ############################################################################### ############################################################################### # # -# The @SysInclude { eiffelf } line # +# @SysInclude line # # # -# This line causes Lout to read the definitions for Eiffel, and should # -# not be touched. # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # # # ############################################################################### @@ -22,7 +23,7 @@ ############################################################################### # # -# The @EiffelSetup @Use clause # +# @Use clause # # # # To change the default value of any option, delete the # at the start of # # its line and change the value between braces. # @@ -30,42 +31,72 @@ ############################################################################### @Use { @EiffelSetup - # style { varying @OrIfPlain fixed } # fixed, varying, or symbol - # pipe { } # pipe source through this - - # fixedfont { Courier } # font family if fixed - # fixedstrings { Base } # string face if fixed - # fixedidentifiers { Base } # identifier face if fixed - # fixedcomments { Base } # comment face if fixed - # fixedkeywords { Base } # keyword face if fixed - # fixednumbers { Base } # number face if fixed - # fixedoperators { Base } # operator face if fixed - # fixedsize { -1.0p } # font size if fixed - # fixedline { 1.0vx } # line-space if fixed - # fixedtabin { 8 } # tab interval if fixed - # fixedtabout { 8s } # tab width if fixed - - # varyingfont { } # font family if varying - # varyingstrings { Slope } # string face if varying - # varyingidentifiers { Slope } # identifier face if varying - # varyingcomments { Base } # comment face if varying - # varyingkeywords { Bold } # keyword face if varying - # varyingnumbers { Base } # number face if varying - # varyingoperators { Base } # operator face if varying - # varyingsize { 1.0f } # font size if varying - # varyingline { 1.0vx } # line-space if varying - # varyingtabin { 8 } # tab interval if varying - # varyingtabout { 3f } # tab width if varying - - # symbolfont { } # font family if symbol - # symbolstrings { Slope } # string face if symbol - # symbolidentifiers { Slope } # identifier face if symbol - # symbolcomments { Base } # comment face if symbol - # symbolkeywords { Bold } # keyword face if symbol - # symbolnumbers { Base } # number face if symbol - # symboloperators { Base } # operator face if symbol - # symbolsize { 1.0f } # font size if symbol - # symbolline { 1.0vx } # line-space if symbol - # symboltabin { 8 } # tab interval if symbol - # symboltabout { 3f } # tab width if symbol + # pipe { } # pipe source through this + # 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 + # 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 + + # fixedidentifiersformat { @Body } # identifiers format + # fixedkeywordsformat { @Body } # keywords format + # fixedoperatorsformat { @Body } # operators format + # fixednumbersformat { @Body } # numbers format + # fixedstringsformat { @Body } # strings format + # fixedcommentsformat { @Body } # comments format + + # the following options apply when style is "varying" + + # varyingfont { } # font family + # varyingsize { 1.0f } # font size + # varyingline { 1.0vx } # line-space + # varyingtabin { 8 } # tab interval + # varyingtabout { 3f } # tab width + + # varyingidentifiers { Slope } # identifier face + # varyingkeywords { Bold } # keyword face + # varyingoperators { Base } # operator face + # varyingnumbers { Base } # number face + # varyingstrings { Slope } # string face + # varyingcomments { Base } # comment face + + # varyingidentifiersformat { @Body } # identifiers format + # varyingkeywordsformat { @Body } # keywords format + # varyingoperatorsformat { @Body } # operators format + # varyingnumbersformat { @Body } # numbers format + # varyingstringsformat { @Body } # strings format + # varyingcommentsformat { @Body } # comments format + + # the following options apply when style is "symbol" + + # symbolfont { } # font family + # symbolsize { 1.0f } # font size + # symbolline { 1.0vx } # line-space + # symboltabin { 8 } # tab interval + # symboltabout { 3f } # tab width + + # symbolidentifiers { Slope } # identifier face + # symbolkeywords { Bold } # keyword face + # symboloperators { Base } # operator face + # symbolnumbers { Base } # number face + # symbolstrings { Slope } # string face + # symbolcomments { Base } # comment face + + # symbolidentifiersformat { @Body } # identifiers format + # symbolkeywordsformat { @Body } # keywords format + # symboloperatorsformat { @Body } # operators format + # symbolnumbersformat { @Body } # numbers format + # symbolstringsformat { @Body } # strings format + # symbolcommentsformat { @Body } # comments format } diff --git a/include/eiffelf b/include/eiffelf index 5ba94e1..2beaa6e 100644 --- a/include/eiffelf +++ b/include/eiffelf @@ -3,9 +3,11 @@ # # # Lout @EiffelSetup package for formatting Eiffel programs # # # -# Version 2.0 by Jeffrey H. Kingston, February 2000. # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # # # -# This package uses a filtered body parameter to convert Eiffel source # +# 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. # @@ -14,68 +16,96 @@ export @Eiffel def @EiffelSetup + 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 - named pipe { } # pipe through this first - - named fixedfont { Courier } # font family if fixed - named fixedstrings { Base } # string face if fixed - named fixedidentifiers { Base } # identifier face if fixed - named fixedcomments { Base } # comment face if fixed - named fixedkeywords { Base } # keyword face if fixed - named fixednumbers { Base } # number face if fixed - named fixedoperators { Base } # operator face if fixed - named fixedsize { -1.0p } # font size if fixed - named fixedline { 1.0vx } # line-space if fixed - named fixedtabin { 8 } # tab interval if fixed - named fixedtabout { 8s } # tab width if fixed - - named varyingfont { } # font family if varying - named varyingstrings { Slope } # string face if varying - named varyingidentifiers { Slope } # identifier face if varying - named varyingcomments { Base } # comment face if varying - named varyingkeywords { Bold } # keyword face if varying - named varyingnumbers { Base } # number face if varying - named varyingoperators { Base } # operator face if varying - named varyingsize { 1.0f } # font size if varying - named varyingline { 1.0vx } # line-space if varying - named varyingtabin { 8 } # tab interval if varying - named varyingtabout { 3f } # tab width if varying - - named symbolfont { } # font family if symbol - named symbolstrings { Slope } # string face if symbol - named symbolidentifiers { Slope } # identifier face if symbol - named symbolcomments { Base } # comment face if symbol - named symbolkeywords { Bold } # keyword face if symbol - named symbolnumbers { Base } # number face if symbol - named symboloperators { Base } # operator face if symbol - named symbolsize { 1.0f } # font size if symbol - named symbolline { 1.0vx } # line-space if symbol - named symboltabin { 8 } # tab interval if symbol - named symboltabout { 3f } # tab width if symbol + { 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 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 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 + + # the following options apply when style is "varying" + named varyingfont { } # font family + named varyingsize { 1.0f } # font size + named varyingline { 1.0vx } # line-space + named varyingtabin { 8 } # tab interval + named varyingtabout { 3f } # tab width + + named varyingidentifiers { Slope } # identifier face + named varyingkeywords { Bold } # keyword face + named varyingoperators { Base } # operator face + named varyingnumbers { Base } # number face + named varyingstrings { Slope } # string face + named varyingcomments { Base } # comment face + + named 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 + + # the following options apply when style is "symbol" + named symbolfont { } # font family + named symbolsize { 1.0f } # font size + named symbolline { 1.0vx } # line-space + named symboltabin { 8 } # tab interval + named symboltabout { 3f } # tab width + + named symbolidentifiers { Slope } # identifier face + named symbolkeywords { Bold } # keyword face + named symboloperators { Base } # operator face + named symbolnumbers { Base } # number face + named symbolstrings { Slope } # string face + named symbolcomments { Base } # comment face + + named 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 @Begin export - "$>" @S @D @C @K @N @O @A @ST @ED @M + @PI @PK @PO @PN @PS @PC @PA @PM @PD + @A "$>" def @Eiffel named style { style } # style named pipe { pipe } # pipe through this first named font { dft } # font family - named strings { dft } # string font - named identifiers { dft } # ident. font - named comments { dft } # comment font - named keywords { dft } # keyword font - named numbers { dft } # number font - named operators { dft } # operator font named size { dft } # font size named line { dft } # line-space named tabin { dft } # tab interval named tabout { dft } # tab width + named identifiers { dft } # ident. font + named keywords { dft } # keyword font + named operators { dft } # operator font + named numbers { dft } # number font + named strings { dft } # string font + named comments { dft } # comment font body @Body # filtered, see below @Begin @@ -97,6 +127,18 @@ def @EiffelSetup } } + + 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 @@ -105,6 +147,7 @@ def @EiffelSetup ifsymbol { symboltabin } } + def @InitTabWidth { tabout @Test @@ -113,6 +156,7 @@ def @EiffelSetup ifsymbol { symboltabout } } + def @Filter { pipe @Case { @@ -128,6 +172,7 @@ def @EiffelSetup } } + def @InitFontFamily { font @Test @@ -136,6 +181,7 @@ def @EiffelSetup ifsymbol { symbolfont } } + def @InitSize { size @Test @@ -144,6 +190,7 @@ def @EiffelSetup ifsymbol { symbolsize } } + def @InitLine { line @Test @@ -152,120 +199,153 @@ def @EiffelSetup ifsymbol { symbolline } } - def @S # for formatting strings + + def @PI # for formatting identifiers right x { - # "\"" & - strings @Test - iffixed { fixedstrings } - ifvarying { varyingstrings } - ifsymbol { symbolstrings } - @Font 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 "`" -# { -# style @Case { -# symbol @Yield { "`" } -# else @Yield { "'" } -# } -# } - def @D # for formatting identifiers + def @PK # for formatting keywords right x { - identifiers @Test - iffixed { fixedidentifiers } - ifvarying { varyingidentifiers } - ifsymbol { symbolidentifiers } - @Font 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 @C # for formatting comments + + def @PO # for formatting operators right x { - comments @Test - iffixed { fixedcomments } - ifvarying { varyingcomments } - ifsymbol { symbolcomments } - @Font 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 @K # for formatting keywords + + def @PN # for formatting numbers right x { - keywords @Test - iffixed { fixedkeywords } - ifvarying { varyingkeywords } - ifsymbol { symbolkeywords } - @Font 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 @N # for formatting numbers + + def @PS # for formatting strings right x { - numbers @Test - iffixed { fixednumbers } - ifvarying { varyingnumbers } - ifsymbol { symbolnumbers } - @Font 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 @O # for formatting operators + + def @PC # for formatting comments right x { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font 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 @A # get characters from the Adobe Symbol font - left sym - right x + + def @PA # for formatting asterisks { - style @Case { - symbol @Yield { { Symbol Base } @Font @Char sym } - else @Yield { x } + @PO @BackEnd @Case { + PlainText @Yield "*" + else @Yield { "0.5w" @VShift "*" } } } - def @ST # for formatting asterisks - right x + + def @PM # for formatting minus signs { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font "0.5w" @VShift x + @PO @BackEnd @Case { + PlainText @Yield "-" + else @Yield style @Case { + fixed @Yield "-" + else @Yield { { Symbol Base } @Font @Char "minus" } + } + } } - def @ED # for formatting larger dots - right x + + def @PD # for formatting dots, if wanted larger { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font @BackEnd @Case { - PlainText @Yield x - else @Yield { "1.2f" @Font "+0.05f" @VShift @O x &"0.05f" } + @PO @BackEnd @Case { + PlainText @Yield "." + else @Yield { "1.4f" @Font "+0.04f" @VShift "." &"0.05f" } } } - macro "$>" { {} & } - def @M right x + def @A # get characters from the Adobe Symbol font + left sym + right x { style @Case { - fixed @Yield "-" - varying @Yield { { Symbol Base } @Font @Char minus } - symbol @Yield { { Symbol Base } @Font @Char minus } + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } } } + + macro "$>" { {} & } + + { @InitFontFamily Base @InitSize } @Font { @InitLine lines } @Break @Body diff --git a/include/perl b/include/perl new file mode 100644 index 0000000..86561a9 --- /dev/null +++ b/include/perl @@ -0,0 +1,102 @@ +############################################################################### +# # +# Lout setup file for Perl program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +############################################################################### + + +############################################################################### +# # +# @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 + # style { fixed } # fixed, varying, or symbol + + # the following options apply when style is "fixed" + + # fixedfont { Courier } # font family + # fixedsize { -1.0p } # font size + # fixedline { 1.0vx } # line-space + # fixedtabin { 8 } # tab interval + # fixedtabout { 8s } # tab width + + # fixedidentifiers { Base } # identifier face + # fixedkeywords { Base } # keyword face + # fixedoperators { Base } # operator face + # fixednumbers { Base } # number face + # fixedstrings { Base } # string face + # fixedcomments { Base } # comment face + + # fixedidentifiersformat { @Body } # identifiers format + # fixedkeywordsformat { @Body } # keywords format + # fixedoperatorsformat { @Body } # operators format + # fixednumbersformat { @Body } # numbers format + # fixedstringsformat { @Body } # strings format + # fixedcommentsformat { @Body } # comments format + + # the following options apply when style is "varying" + + # varyingfont { } # font family + # varyingsize { 1.0f } # font size + # varyingline { 1.0vx } # line-space + # varyingtabin { 8 } # tab interval + # varyingtabout { 3f } # tab width + + # varyingidentifiers { Slope } # identifier face + # varyingkeywords { Bold } # keyword face + # varyingoperators { Base } # operator face + # varyingnumbers { Base } # number face + # varyingstrings { Slope } # string face + # varyingcomments { Base } # comment face + + # varyingidentifiersformat { @Body } # identifiers format + # varyingkeywordsformat { @Body } # keywords format + # varyingoperatorsformat { @Body } # operators format + # varyingnumbersformat { @Body } # numbers format + # varyingstringsformat { @Body } # strings format + # varyingcommentsformat { @Body } # comments format + + # the following options apply when style is "symbol" + + # symbolfont { } # font family + # symbolsize { 1.0f } # font size + # symbolline { 1.0vx } # line-space + # symboltabin { 8 } # tab interval + # symboltabout { 3f } # tab width + + # symbolidentifiers { Slope } # identifier face + # symbolkeywords { Bold } # keyword face + # symboloperators { Base } # operator face + # symbolnumbers { Base } # number face + # symbolstrings { Slope } # string face + # symbolcomments { Base } # comment face + + # symbolidentifiersformat { @Body } # identifiers format + # symbolkeywordsformat { @Body } # keywords format + # symboloperatorsformat { @Body } # operators format + # symbolnumbersformat { @Body } # numbers format + # symbolstringsformat { @Body } # strings format + # symbolcommentsformat { @Body } # comments format +} diff --git a/include/perlf b/include/perlf new file mode 100644 index 0000000..20604d3 --- /dev/null +++ b/include/perlf @@ -0,0 +1,354 @@ + +############################################################################### +# # +# Lout @PerlSetup package for formatting Perl 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. # +# # +############################################################################### + +export @Perl +def @PerlSetup + named pipe { } # pipe through this first + named style + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { fixed } # print style + + # the following options apply when style is "fixed" + named fixedfont { Courier }# font family + named fixedsize { -1.0p } # font size + named fixedline { 1.0vx } # line-space + named fixedtabin { 8 } # tab interval + named fixedtabout { 8s } # tab width + + named fixedidentifiers { Base } # identifier face + named fixedkeywords { Base } # keyword face + named fixedoperators { Base } # operator face + named fixednumbers { Base } # number face + named fixedstrings { Base } # string face + named fixedcomments { Base } # comment face + + named 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 + + # the following options apply when style is "varying" + named varyingfont { } # font family + named varyingsize { 1.0f } # font size + named varyingline { 1.0vx } # line-space + named varyingtabin { 8 } # tab interval + named varyingtabout { 3f } # tab width + + named varyingidentifiers { Slope } # identifier face + named varyingkeywords { Bold } # keyword face + named varyingoperators { Base } # operator face + named varyingnumbers { Base } # number face + named varyingstrings { Slope } # string face + named varyingcomments { Base } # comment face + + named 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 + + # the following options apply when style is "symbol" + named symbolfont { } # font family + named symbolsize { 1.0f } # font size + named symbolline { 1.0vx } # line-space + named symboltabin { 8 } # tab interval + named symboltabout { 3f } # tab width + + named symbolidentifiers { Slope } # identifier face + named symbolkeywords { Bold } # keyword face + named symboloperators { Base } # operator face + named symbolnumbers { Base } # number face + named symbolstrings { Slope } # string face + named symbolcomments { Base } # comment face + + named 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 + +@Begin + + export + + @PI @PK @PO @PN @PS @PC @PA @PM @PD + @A "$>" + + def @Perl + named style { style } # style + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named tabin { dft } # tab interval + named tabout { dft } # tab width + named identifiers { dft } # ident. font + named keywords { dft } # keyword font + named operators { dft } # operator font + named numbers { dft } # number font + named strings { dft } # string font + named comments { dft } # comment font + 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 -lPerl" -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lPerl" -o{@FilterOut} + -e{@FilterErr} -t{@InitTab} -T{@InitTabWidth} + } + } + } + + + def @InitFontFamily + { + font @Test + iffixed { fixedfont } + ifvarying { varyingfont } + ifsymbol { symbolfont } + } + + + def @InitSize + { + size @Test + iffixed { fixedsize } + ifvarying { varyingsize } + ifsymbol { symbolsize } + } + + + def @InitLine + { + line @Test + iffixed { fixedline } + ifvarying { varyingline } + ifsymbol { symbolline } + } + + + def @PI # for formatting identifiers + right x + { + style @Case { + fixed @Yield fixedidentifiersformat { + { identifiers @Else fixedidentifiers } @Font x + } + varying @Yield varyingidentifiersformat { + { identifiers @Else varyingidentifiers } @Font x + } + symbol @Yield symbolidentifiersformat { + { identifiers @Else symbolidentifiers } @Font x + } + } + } + + + def @PK # for formatting keywords + right x + { + style @Case { + fixed @Yield fixedkeywordsformat { + { keywords @Else fixedkeywords } @Font x + } + varying @Yield varyingkeywordsformat { + { keywords @Else varyingkeywords } @Font x + } + symbol @Yield symbolkeywordsformat { + { keywords @Else symbolkeywords } @Font x + } + } + } + + + def @PO # for formatting operators + right x + { + style @Case { + fixed @Yield fixedoperatorsformat { + { operators @Else fixedoperators } @Font x + } + varying @Yield varyingoperatorsformat { + { operators @Else varyingoperators } @Font x + } + symbol @Yield symboloperatorsformat { + { operators @Else symboloperators } @Font x + } + } + } + + + def @PN # for formatting numbers + right x + { + style @Case { + fixed @Yield fixednumbersformat { + { numbers @Else fixednumbers } @Font x + } + varying @Yield varyingnumbersformat { + { numbers @Else varyingnumbers } @Font x + } + symbol @Yield symbolnumbersformat { + { numbers @Else symbolnumbers } @Font x + } + } + } + + + def @PS # for formatting strings + right x + { + style @Case { + fixed @Yield fixedstringsformat { + { strings @Else fixedstrings } @Font x + } + varying @Yield varyingstringsformat { + { strings @Else varyingstrings } @Font x + } + symbol @Yield symbolstringsformat { + { strings @Else symbolstrings } @Font x + } + } + } + + + def @PC # for formatting comments + right x + { + style @Case { + fixed @Yield fixedcommentsformat { + { comments @Else fixedcomments } @Font x + } + varying @Yield varyingcommentsformat { + { comments @Else varyingcomments } @Font x + } + symbol @Yield symbolcommentsformat { + { comments @Else symbolcomments } @Font x + } + } + } + + + def @PA # for formatting asterisks + { + @PO @BackEnd @Case { + PlainText @Yield "*" + else @Yield { "0.5w" @VShift "*" } + } + } + + + def @PM # for formatting minus signs + { + @PO @BackEnd @Case { + PlainText @Yield "-" + else @Yield style @Case { + fixed @Yield "-" + else @Yield { { Symbol Base } @Font @Char "minus" } + } + } + } + + + def @PD # for formatting dots, if wanted larger + { + @PO @BackEnd @Case { + PlainText @Yield "." + else @Yield { "1.4f" @Font "+0.04f" @VShift "." &"0.05f" } + } + } + + + def @A # get characters from the Adobe Symbol font + left sym + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + { @InitFontFamily Base @InitSize } @Font + { @InitLine lines } @Break @Body + + @End @Perl + +@End @PerlSetup diff --git a/include/pod b/include/pod new file mode 100644 index 0000000..e827a24 --- /dev/null +++ b/include/pod @@ -0,0 +1,164 @@ +############################################################################### +# # +# Lout setup file for Pod documentation printing # +# # +# 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. # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +############################################################################### + + +############################################################################### +# # +# @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. # +# # +############################################################################### + +@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 + + # 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 { } # text font + # varyingtextbreak { adjust 1.0vx hyphen } # text para breaking + # varyingverbatimfont { Courier Base -1p } # verbatim font + # varyingtabin { 8 } # tab interval + # varyingtabout { 8s } # tab width + + # 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 { } # text font + # symboltextbreak { adjust 1.0vx hyphen } # text para breaking + # symbolverbatimfont { Courier Base -1p } # verbatim font + # symboltabin { 8 } # tab interval + # symboltabout { 8s } # tab width + + # 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/podf b/include/podf new file mode 100644 index 0000000..108f455 --- /dev/null +++ b/include/podf @@ -0,0 +1,513 @@ + +############################################################################### +# # +# 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. # +# # +############################################################################### + +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 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 { @DP @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 { } # 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 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{ @DP @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 { } # 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 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 { @DP @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 "$>" + + 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 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 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 + left sym + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + @InitFont @Font @InitBreak @Break @Body + + @End @Pod + +@End @PodSetup diff --git a/include/progf b/include/progf deleted file mode 100644 index ec864df..0000000 --- a/include/progf +++ /dev/null @@ -1,281 +0,0 @@ - -############################################################################### -# # -# Lout @ProgSetup package for formatting computer programs (Version 1.4) # -# # -# Version 1.0 by Jeffrey H. Kingston, February 2000. # -# Adapted from the original @CPrint package. # -# # -# 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 package is intended for use by prg2lout's stand-alone mode. # -# If you are adding a new language, a better place to start would be # -# files eiffelf and eiffel rather than progf. # -# # -############################################################################### - -export @Prog -def @ProgSetup - named language { "missing_language" } # programming language - named style - named @OrIfPlain left x right y - { @BackEnd @Case { PlainText @Yield y else @Yield x } } - { varying @OrIfPlain fixed } # print style - named pipe { } # pipe through this first - - named fixedfont { Courier } # font family if fixed - named fixedstrings { Base } # string face if fixed - named fixedidentifiers { Base } # identifier face if fixed - named fixedcomments { Base } # comment face if fixed - named fixedkeywords { Base } # keyword face if fixed - named fixednumbers { Base } # number face if fixed - named fixedoperators { Base } # operator face if fixed - named fixedsize { -1.0p } # font size if fixed - named fixedline { 1.0vx } # line-space if fixed - named fixedtabin { 8 } # tab interval if fixed - named fixedtabout { 8s } # tab width if fixed - - named varyingfont { } # font family if varying - named varyingstrings { Slope } # string face if varying - named varyingidentifiers { Slope } # identifier face if varying - named varyingcomments { Base } # comment face if varying - named varyingkeywords { Bold } # keyword face if varying - named varyingnumbers { Base } # number face if varying - named varyingoperators { Base } # operator face if varying - named varyingsize { 1.0f } # font size if varying - named varyingline { 1.0vx } # line-space if varying - named varyingtabin { 8 } # tab interval if varying - named varyingtabout { 3f } # tab width if varying - - named symbolfont { } # font family if symbol - named symbolstrings { Slope } # string face if symbol - named symbolidentifiers { Slope } # identifier face if symbol - named symbolcomments { Base } # comment face if symbol - named symbolkeywords { Bold } # keyword face if symbol - named symbolnumbers { Base } # number face if symbol - named symboloperators { Base } # operator face if symbol - named symbolsize { 1.0f } # font size if symbol - named symbolline { 1.0vx } # line-space if symbol - named symboltabin { 8 } # tab interval if symbol - named symboltabout { 3f } # tab width if symbol - -@Begin - - export - - "$>" @S @D @C @K @N @O @A @ST @ED @M - - def @Prog - named language { language } # language - named style { style } # style - named pipe { pipe } # pipe through this first - named font { dft } # font family - named strings { dft } # string font - named identifiers { dft } # ident. font - named comments { dft } # comment font - named keywords { dft } # keyword font - named numbers { dft } # number font - named operators { dft } # operator font - named size { dft } # font size - named line { dft } # line-space - named tabin { dft } # tab interval - named tabout { dft } # tab width - 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 @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 -l" language -i{@FilterIn} -o{@FilterOut} -e{@FilterErr} - -t{@InitTab} -T{@InitTabWidth} - } - else @Yield { - "cat" @FilterIn "|" pipe "|" - "prg2lout -r -l" language -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 @S # for formatting strings - right x - { - # "\"" & - strings @Test - iffixed { fixedstrings } - ifvarying { varyingstrings } - ifsymbol { symbolstrings } - @Font x - # & "\"" - } - -# def "`" -# { -# style @Case { -# symbol @Yield { "`" } -# else @Yield { "'" } -# } -# } - - def @D # for formatting identifiers - right x - { - identifiers @Test - iffixed { fixedidentifiers } - ifvarying { varyingidentifiers } - ifsymbol { symbolidentifiers } - @Font x - } - - def @C # for formatting comments - right x - { - comments @Test - iffixed { fixedcomments } - ifvarying { varyingcomments } - ifsymbol { symbolcomments } - @Font x - } - - def @K # for formatting keywords - right x - { - keywords @Test - iffixed { fixedkeywords } - ifvarying { varyingkeywords } - ifsymbol { symbolkeywords } - @Font x - } - - def @N # for formatting numbers - right x - { - numbers @Test - iffixed { fixednumbers } - ifvarying { varyingnumbers } - ifsymbol { symbolnumbers } - @Font x - } - - def @O # for formatting operators - right x - { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font x - } - - def @A # get characters from the Adobe Symbol font - left sym - right x - { - style @Case { - symbol @Yield { { Symbol Base } @Font @Char sym } - else @Yield { x } - } - } - - def @ST # for formatting asterisks - right x - { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font "0.5w" @VShift x - } - - def @ED # for formatting larger dots - right x - { - operators @Test - iffixed { fixedoperators } - ifvarying { varyingoperators } - ifsymbol { symboloperators } - @Font @BackEnd @Case { - PlainText @Yield x - else @Yield { "1.2f" @Font "+0.05f" @VShift @O x &"0.05f" } - } - } - - macro "$>" { {} & } - - def @M right x - { - style @Case { - fixed @Yield "-" - varying @Yield { { Symbol Base } @Font @Char minus } - symbol @Yield { { Symbol Base } @Font @Char minus } - } - } - - { @InitFontFamily Base @InitSize } @Font - { @InitLine lines } @Break @Body - - @End @Prog - -@End @ProgSetup |