1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
@Chapter
@Title { Computer Programs }
@Tag { cprint }
@Begin
@LP
This chapter describes how to typeset computer program text using Lout
programs. @Index { programs }
computer.programs. @RawIndex { computer programs @I see programs }
in conjunction with the @Code prg2lout
prg2lout. @Index { @Code prg2lout filter program }
@FootNote {
Prior to Version 3.18 of Lout, this chapter described how to typeset
programs written in the C programming language using the
@Code c2lout filter, and Eiffel programs using the @Code eif2lout
filter. These have now been withdrawn and replaced by {@Code prg2lout},
which handles multiple languages. Ordinary Lout documents require no
modifications as a result of this change.
}
filter program, which is always installed wherever Lout is.
@PP
It is possible to simply print out one or more program files independently
of any document. Alternatively, the program text may be printed as part of
a larger Lout document. Either way, Lout does not lay out the programs in
the sense of choosing line breaks and indenting; it uses whatever line
breaks and indenting you give to the program. What Lout does do is cope
with characters in the program text that it would ordinarily either reject
or interpret in some way (braces and so on), ensuring that you can include
program texts with absolutely no modifications; plus, if you wish, Lout
will print keywords in bold, identifiers in italics, add line numbers, etc.
@PP
At the time of writing, the available programming languages are:
blue. @Index { Blue program printing }
c. @Index { C and C++ program printing }
eiffel. @Index { Eiffel program printing }
haskell. @Index { Haskell program printing }
java. @Index { Java program printing }
nonpareil. @Index { Nonpareil program printing }
perl. @Index { Perl program printing }
pod. @Index { Pod (for Perl) printing }
python. @Index { Python program printing }
rsl. @Index { RSL program printing }
ruby. @Index { Ruby program printing }
@CD @Tbl
mv { 0.5vx }
af { Italic }
aformat { @Cell A | @Cell B | @Cell C | @Cell D | @Cell E }
bformat { @Cell A | @Cell @Code B | @Cell @Code C | @Cell @Code D | @Cell E }
{
@Rowa
rb { yes }
A { Language name }
B { Setup file name }
C { Lout symbol }
D { Default style }
E { ` ' escapes }
@Rowb
A { Blue }
B { blue }
C { "@Blue" }
D { varying }
E { Yes }
@Rowb
A { C, C++ }
B { cprint }
C { "@CP" }
D { fixed }
E { No }
@Rowb
A { Eiffel }
B { eiffel }
C { "@Eiffel" }
D { varying }
E { Yes }
@Rowb
A { Haskell }
B { haskell }
C { "@Haskell" }
D { symbol }
E { Yes }
@Rowb
A { Java }
B { java }
C { "@Java" }
D { fixed }
E { No }
@Rowb
A { Nonpareil }
B { np }
C { "@Nonpareil" }
D { symbol }
E { Yes }
@Rowb
A { Perl }
B { perl }
C { "@Perl" }
D { fixed }
E { No }
@Rowb
A { Pod }
B { pod }
C { "@Pod" }
D { varying }
E { No }
@Rowb
A { Python }
B { python }
C { "@Python" }
D { varying }
E { No }
@Rowb
A { RSL }
B { rsl }
C { "@RSL" }
D { symbol }
E { Yes }
@Rowb
A { Ruby }
B { ruby }
C { "@Ruby" }
D { fixed }
E { No }
rb { yes }
}
C and C++ are handled together since, for formatting purposes, they
differ only in that C++ has some additional keywords plus an extra
way to make comments. Whenever we mention C from now on, we mean
both C and C++. See Section {@NumberOf prg_perl} for more on Perl
and its handmaiden Pod. The second to fifth columns of this table will be
explained at various points later in this chapter.
@PP
The list of languages is likely to expand, because the @Code "prg2lout"
program has been designed to make it relatively easy to add new languages
(you don't have to write executable code, just declare a lot of records
describing your language). Consult the instructions at the top of the
source file of that program ({@I prg2lout.c}) if you want to try it yourself.
@BeginSections
@Include { prg_lone }
@Include { prg_embe }
@Include { prg_opti }
@Include { prg_chan }
@Include { prg_tabs }
@Include { prg_form }
@Include { prg_comm }
@Include { prg_prog }
@Include { prg_pipe }
@Include { prg_erro }
@Include { prg_perl }
@EndSections
@End @Chapter
|