aboutsummaryrefslogtreecommitdiffstats
path: root/doc/user/prg_opti
blob: 6ae4e054cdda1a57ee2feba3d75166d49277d2e8 (plain) (blame)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
@Section
   @Title { Changing the appearance of a program }
   @Tag { prg_opti }
@Begin
@PP
The {@Code "@CP"}, {@Code "@Eiffel"} etc. symbols have a number of
options for changing the appearance of the printed program.  These
options are the same for all symbols, although their default values
may vary.  The @Code "style" option changes the printing style; its
programs. @RawIndex { programs }
programs.style @SubIndex { @Code "style" option }
style. @RawIndex { @Code "style" option }
style.in.programs @SubIndex { in programs }
programs. @RawIndex { programs }
programs.fixed @SubIndex { @Code "fixed" style }
fixed.programs @Index { @Code "fixed" style (programs) }
value may be {@Code "fixed"} (fixed-width font), {@Code "varying"}
programs. @RawIndex { programs }
programs.varying @SubIndex { @Code "varying" style }
varying.programs @Index { @Code "varying" style (programs) }
programs. @RawIndex { programs }
programs.symbol @SubIndex { @Code "symbol" style }
symbol.programs @Index { @Code "symbol" style (programs) }
(varying-width font), or {@Code "symbol"} (varying-width font with
mathematical symbols used for some operators).  Its default value
depends on the language, and may be found in the fourth column of
the table at the start of this chapter.  The example in the previous
section was in @Code fixed style; we can switch styles like this:
@ID @OneRow @Code @Verbatim {
@CP
    style { varying }
{
#include <stdio.h>

treeprint(p)        /* print tree p recursively */
struct tnode *p;
{
        if (p != NULL) {
                treeprint(p->left);
                printf(\%4d %s\\n\, p->count, p->word);
                treeprint(p->right);
        }
}
}
}
The result in this case will be
@ID @OneRow @CP style { varying }
{
#include <stdio.h>

treeprint(p)        /* print tree p recursively */
struct tnode *p;
{
        if (p != NULL) {
                treeprint(p->left);
                printf("%4d %s\n", p->count, p->word);
                treeprint(p->right);
        }
}
}
If we use @Code "style { symbol }" we get this:
@ID @OneRow @CP style { symbol }
{
#include <stdio.h>

treeprint(p)        /* print tree p recursively */
struct tnode *p;
{
        if (p != NULL) {
                treeprint(p->left);
                printf("%4d %s\n", p->count, p->word);
                treeprint(p->right);
        }
}
}
with mathematical symbols replacing some of the operators.
@PP
The {@Code "@CP"}, {@Code "@Eiffel"} etc. symbols have additional options
which allow a finer control over the style.  Here they all are, with their
default values:
@ID @OneRow @Code @Verbatim {
@CP         [ or @Eiffel, @Blue, etc. ]
    pipe {}
    numbered { No }
    blanknumbered { Yes }
    style { fixed }
    font { Courier }
    size { -1.0p }
    line { 1.0vx }
    blanklinescale { 1.0 }
    space { lout }
    tabin { 8 }
    tabout { 8s }
    identifiers { Base }
    keywords { Base }
    operators { Base }
    numbers { Base }
    strings { Base }
    comments { Base }
{
    ...
}
}
Apart from {@Code "pipe"}, {@Code "numbered"} and {@Code "blanknumbered"},
the default values shown are for @Code "style { fixed }" only; the other
styles have other defaults (Section {@NumberOf cpsetup}).  For the
{@Code "pipe"} option, see Section {@NumberOf pipes}.
@PP
The value of {@Code "numbered"} may be {@Code "No"} (the default),
{@Code "Yes"}, or a number, and it determines whether or not
programs. @RawIndex { programs }
programs.numbered @SubIndex { @Code "numbered" option }
numbered.programs @Index { @Code "numbered" option (programs) }
line numbers are to be added, and if so the value of the first one.
If @Code "numbered" is {@Code "Yes"}, then the {@Code "blanknumbered"}
option becomes relevant, and it determines whether blank lines are to
programs. @RawIndex { programs }
programs.blanknumbered @SubIndex { @Code "blanknumbered" option }
blanknumbered.programs @Index { @Code "blanknumbered" option (programs) }
receive line numbers or not.  It has three acceptable values:  {@Code "Yes"},
the default value, meaning that blank lines are printed with line numbers,
just like other lines; {@Code No}, meaning that blank lines are not
assigned line numbers; and {@Code NoPrint}, meaning that blank lines
are assigned line numbers but these numbers are not printed, so that
the line numbers printed before and after a single blank line will
differ by 2.
@PP
The {@Code "style"} option is already familiar.  Next comes {@Code "font"},
which determines the font family to use, {@Code "size"},
programs. @RawIndex { programs }
programs.font @SubIndex { @Code "font" option }
font.option. @RawIndex { @Code "font" option }
font.option.in.programs @SubIndex { in program formatting }
programs. @RawIndex { programs }
programs.size @SubIndex { @Code "size" option }
size.programs @Index { @Code "size" option (programs) }
programs. @RawIndex { programs }
programs.line @SubIndex { @Code "line" option }
line.programs @Index { @Code "line" option (programs) }
the font size to use, {@Code "line"}, the inter-line spacing,
{@Code "blanklinescale"}, a scale factor by which the usual
programs. @RawIndex { programs }
programs.blanklinescale @SubIndex { @Code "blanklinescale" option }
blanklinescale.programs @Index { @Code "blanklinescale" option (programs) }
height of blank lines without printed line numbers is reduced (as in the
option to the @Code "@Break" symbol of the same name), and {@Code "space"}, the
spacing mode (as for the @Code "@Space" symbol of Section {@NumberOf white}).
programs. @RawIndex { programs }
programs.space @SubIndex { @Code "space" option }
space.programs @Index { @Code "space" option (programs) }
The default value of @Code "size" asks for one point smaller than in the
surrounding document; this was done to compensate for Courier's relatively
large appearance compared to other fonts of the same nominal size.
@PP
The @Code "tabin" and @Code "tabout" options are the subject of
Section {@NumberOf tabs}.  After them come six options giving the
particular font faces in which to print identifiers, keywords, operators,
programs. @RawIndex { programs }
programs.identifiers @SubIndex { @Code "identifiers" option }
identifiers.programs @Index { @Code "identifiers" option (programs) }
programs. @RawIndex { programs }
programs.keywords @SubIndex { @Code "keywords" option }
keywords.programs @Index { @Code "keywords" option (programs) }
programs. @RawIndex { programs }
programs.operators @SubIndex { @Code "operators" option }
operators.programs @Index { @Code "operators" option (programs) }
programs. @RawIndex { programs }
programs.numbers @SubIndex { @Code "numbers" option }
numbers.programs @Index { @Code "numbers" option (programs) }
programs. @RawIndex { programs }
programs.strings @SubIndex { @Code "strings" option }
strings.programs @Index { @Code "strings" option (programs) }
programs. @RawIndex { programs }
programs.comments @SubIndex { @Code "comments" option }
comments.programs @Index { @Code "comments" option (programs) }
numbers, strings, and comments.  {@Code "Base"} means the basic face; other
commonly available choices are {@Code "Slope"} and {@Code "Bold"}.  These
options may all be set to different faces if desired.
@End @Section