blob: dc088139b29b79fe2612bc28a5459e8360f0d6d9 (
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
|
def "->" { {Symbol Base} @Font "\256" } #174 decimal
def "=>" { {Symbol Base} @Font "\336" } #222 decimal
macro @JP { /0.5v }
def @Code right x
{ { Helvetica Base -1p } @Font lines @Break x }
macro @JL { //1vx }
###################################################
# #
# Lout keywords. #
# #
###################################################
def @@BackEnd { @Code "@BackEnd" }
def @@Background { @Code "@Background" }
def @@Begin { @Code "@Begin" }
def @@BeginHeaderComponent { @Code "@BeginHeaderComponent" }
def @@Break { @Code "@Break" }
def @@Case { @Code "@Case" }
def @@Char { @Code "@Char" }
def @@ClearHeaderComponent { @Code "@ClearHeaderComponent" }
def @@Common { @Code "@Common" }
def @@CurrLang { @Code "@CurrLang" }
def @@CurrFamily { @Code "@CurrFamily" }
def @@CurrFace { @Code "@CurrFace" }
def @@CurrYUnit { @Code "@CurrYUnit" }
def @@CurrZUnit { @Code "@CurrZUnit" }
def @@Database { @Code "@Database" }
def @@End { @Code "@End" }
def @@EndHeaderComponent { @Code "@EndHeaderComponent" }
def @@Enclose { @Code "@Enclose" }
def @@Font { @Code "@Font" }
def @@ForceGalley { @Code "@ForceGalley" }
def @@Galley { @Code "@Galley" }
def @@Graphic { @Code "@Graphic" }
def @@HAdjust { @Code "@HAdjust" }
def @@HCover { @Code "@HCover" }
def @@HContract { @Code "@HContract" }
def @@HExpand { @Code "@HExpand" }
def @@HLimited { @Code "@HLimited" }
def @@High { @Code "@High" }
def @@HScale { @Code "@HScale" }
def @@HShift { @Code "@HShift" }
def @@HSpan { @Code "@HSpan" }
def @@Include { @Code "@Include" }
def @@IncludeGraphic { @Code "@IncludeGraphic" }
def @@IncludeGraphicRepeated { @Code "@IncludeGraphicRepeated" }
def @@KernShrink { @Code "@KernShrink" }
def @@Key { @Code "@Key" }
def @@Language { @Code "@Language" }
def @@LClos { @Code "@LClos" }
def @@LEnv { @Code "@LEnv" }
def @@LInput { @Code "@LInput" }
def @@LUse { @Code "@LUse" }
def @@LVis { @Code "@LVis" }
def @@LinkSource { @Code "@LinkSource" }
def @@LinkDest { @Code "@LinkDest" }
def @@Meld { @Code "@Meld" }
def @@Merge { @Code "@Merge" }
def @@Moment { @Code "@Moment" }
def @@Next { @Code "@Next" }
def @@NotRevealed { @Code "@NotRevealed" }
def @@Null { @Code "@Null" }
def @@OneCol { @Code "@OneCol" }
def @@OneOf { @Code "@OneOf" }
def @@OneRow { @Code "@OneRow" }
def @@Open { @Code "@Open" }
def @@Outline { @Code "@Outline" }
def @@PAdjust { @Code "@PAdjust" }
def @@PageLabel { @Code "@PageLabel" }
def @@PlainGraphic { @Code "@PlainGraphic" }
def @@PrependGraphic { @Code "@PrependGraphic" }
def @@RawVerbatim { @Code "@RawVerbatim" }
def @@Rotate { @Code "@Rotate" }
def @@Rump { @Code "@Rump" }
def @@Insert { @Code "@Insert" }
def @@Scale { @Code "@Scale" }
def @@SetColor { @Code "@SetColor" }
def @@SetColour { @Code "@SetColour" }
def @@SetHeaderComponent { @Code "@SetHeaderComponent" }
def @@Space { @Code "@Space" }
def @@StartHSpan { @Code "@StartHSpan" }
def @@StartVSpan { @Code "@StartVSpan" }
def @@StartHVSpan { @Code "@StartHVSpan" }
def @@SysDatabase { @Code "@SysDatabase" }
def @@SysInclude { @Code "@SysInclude" }
def @@SysIncludeGraphic { @Code "@SysIncludeGraphic" }
def @@SysIncludeGraphicRepeated { @Code "@SysIncludeGraphicRepeated" }
def @@SysPrependGraphic { @Code "@SysPrependGraphic" }
def @@Tag { @Code "@Tag" }
def @@Tagged { @Code "@Tagged" }
def @@SetTexture { @Code "@SetTexture" }
def @@Underline { @Code "@Underline" }
def @@URLLink { @Code "@URLLink" }
def @@Use { @Code "@Use" }
def @@VAdjust { @Code "@VAdjust" }
def @@VContract { @Code "@VContract" }
def @@VCover { @Code "@VCover" }
def @@VExpand { @Code "@VExpand" }
def @@Verbatim { @Code "@Verbatim" }
def @@VLimited { @Code "@VLimited" }
def @@VScale { @Code "@VScale" }
def @@VShift { @Code "@VShift" }
def @@VSpan { @Code "@VSpan" }
def @@Wide { @Code "@Wide" }
def @@Yield { @Code "@Yield" }
def @@YUnit { @Code "@YUnit" }
def @@ZUnit { @Code "@ZUnit" }
###################################################
# #
# Miscellaneous, mostly graphical definitions. #
# #
###################################################
def @TeX
{ @OneCol { T &0.4fo {-0.2f @VShift E} &0.45fo X }
}
export sp sb
def @Equation
body x
@Begin
def sp left x right y { @OneRow { | "-2p" @Font y ^/0.5fk x } }
def sb left x right y { @OneRow { x ^/0.5fk | "-2p" @Font y } }
Slope @Font x
@End @Equation
def @Super
left x
right y
{ @OneRow { | -2p @Font y ^/0.5fk x }
}
def @NineSquare
right x
{
def @Three { x |0.2i x |0.2i x }
@Three /0.2i @Three /0.2i @Three
}
def @Leaders
{ .. @Leaders
}
def @HLine
{
@BackEnd @Case {
PostScript @Yield { {0 0 moveto xsize 0 lineto stroke} @Graphic {} }
PDF @Yield { {0 0 m __xsize 0 l s} @Graphic {} }
}
# { 0 0 moveto xsize 0 lineto stroke } @Graphic {}
}
def @VDashLine
right length
{
length @High {
@BackEnd @Case {
PostScript @Yield { { 0 0 moveto 0 ysize lineto [ 3 pt ] 0 setdash stroke } @Graphic {} }
# VT: double quotes required:
PDF @Yield { { "__pt 3 0 d 0 0 m 0 __ysize l s" } @Graphic {} }
}
# { 0 0 moveto 0 ysize lineto [ 3 pt ] 0 setdash stroke } @Graphic {}
}
}
def @LBox
right offset
{ @HContract @VContract
{
{ //0.2c
0.6c @High 1.2c @Wide
@BackEnd @Case {
PostScript @Yield {
{ 0 0 moveto xsize 0 lineto
xsize ysize lineto 0 ysize lineto closepath
gsave 0.9 setgray fill grestore stroke } @Graphic {}
}
PDF @Yield {
{ 0 0 m __xsize 0 l
__xsize __ysize l 0 __ysize l h
q 0.9 g f Q s } @Graphic {}
}
}
# { 0 0 moveto xsize 0 lineto
# xsize ysize lineto 0 ysize lineto closepath
# gsave 0.9 setgray fill grestore stroke }
# @Graphic {}
}
||offset @VDashLine 1c
}
}
def @Arrow
right length
{ @OneCol @OneRow
{
30d @Rotate {0.12c @Wide @HLine}
//
length @Wide @HLine
//
"-30d" @Rotate {0.12c @Wide @HLine}
}
}
def @DoubleArrow
right length
{ @OneCol @OneRow
{
& 180d @Rotate @Arrow length
|0io @Arrow length
}
}
def @Put
left coord
right x
{ @OneCol @OneRow
{ coord / | @OneCol @OneRow x
}
}
macro @At { //0io }
###################################################
# #
# Interpolated example documents. #
# #
###################################################
def @LittleEndRunPlace { @Galley }
def @LittleEndRun
force into { @LittleEndRunPlace&&preceding }
{}
def @LittleTextPlace { @Galley }
def @LittleText into { @LittleTextPlace&&preceding }
right x
{ x
}
def @LittleFootPlace { @Galley }
def @LittleFootNote into { @LittleFootPlace&&following }
right x
{ x
}
def @LittlePageColumn
right x
{
9px @Break 8p @Font
2.8c @Wide x
}
def @LittlePage
right x
{
@HContract @VContract {
@BackEnd @Case {
PostScript @Yield {
{ 0 0 moveto xsize 0 lineto xsize ysize lineto
0 ysize lineto closepath stroke } @Graphic
{ //0.3c ||0.3c
9px @Break 8p @Font
2.8c @Wide 3.8c @High x
||0.3c //0.3c
}
}
PDF @Yield {
{ 0 0 m __xsize 0 l __xsize __ysize l
0 __ysize l h s } @Graphic
{ //0.3c ||0.3c
9px @Break 8p @Font
2.8c @Wide 3.8c @High x
||0.3c //0.3c
}
}
}
# { 0 0 moveto xsize 0 lineto xsize ysize lineto
# 0 ysize lineto closepath stroke } @Graphic
# { //0.3c ||0.3c
# 9px @Break 8p @Font
# 2.8c @Wide 3.8c @High x
# ||0.3c //0.3c
# }
}
}
def @LittleFootSect
{ 1c @Wide @HLine
//0.3v @LittleFootPlace ||0.5c
}
def @LittlePageList
right @PageNum
{
@LittlePage { # |0.5rt @PageNum //0.8v
//0.3v @LittleTextPlace
//1rt @LittleFootSect
}
//
@LittlePageList @Next @PageNum
}
def @LittleDocument
{ @LittlePage
{ @LittleTextPlace
//1rt @LittleFootSect
}
// @LittlePageList 2
// @LittleEndRunPlace
}
def @ShowMarks
named linewidth {
@BackEnd @Case {
PostScript @Yield { 0.015 cm }
PDF @Yield { __mul(0.015, __cm) }
}
}
named linestyle { dashed }
named dashlength {
@BackEnd @Case {
PostScript @Yield { 0.15 cm }
PDF @Yield { __mul(0.15, __cm) }
}
}
named paint { lightgrey}
right x
{
@HContract @VContract @Fig
{ @Box margin { 0c } linewidth { linewidth } paint { paint }
{ @Figure
shape {
@BackEnd @Case {
PostScript @Yield {
-0.3 cm ymark
{xsize ymark} ++ {0.3 cm 0} []
xmark -0.3 cm
{xmark ysize} ++ {0 0.3 cm}
}
PDF @Yield { "" # VT: PDF currently has no output
}
}
}
linewidth { linewidth }
linestyle { linestyle }
dashlength { dashlength }
x
}
}
}
def @ShowVMark
named linewidth { 0.015 cm }
named linestyle { dashed }
named dashlength { 0.15 cm }
named paint { light }
right x
{
@Fig
{
@Figure
shape {
@BackEnd @Case {
PostScript @Yield {
xmark -0.3 cm
{xmark ysize} ++ {0 0.3 cm}
}
PDF @Yield { "" # VT: PDF currently has no output
}
}
}
linewidth { linewidth }
linestyle { linestyle }
dashlength { dashlength }
x
}
}
def @ShowHMark
named linewidth { 0.015 cm }
named linestyle { dashed }
named dashlength { 0.15 cm }
named paint { light }
right x
{
@Fig
{
@Figure
shape {
@BackEnd @Case {
PostScript @Yield {
-0.3 cm ymark
{xsize ymark} ++ {0.3 cm 0}
}
PDF @Yield { "" # VT: PDF currently has no output
}
}
}
linewidth { linewidth }
linestyle { linestyle }
dashlength { dashlength }
x
}
}
def @Strange
named @Format right @Val { [@Val] }
right x
{ @Format x
}
def @TightBox right x
{
@BackEnd @Case {
PostScript @Yield {
"0 0 moveto xsize 0 lineto xsize ysize lineto 0 ysize lineto closepath stroke"
@Graphic x
}
PDF @Yield {
"0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h s"
@Graphic x
}
}
}
def @GreyBox right x
{
@BackEnd @Case {
PostScript @Yield {
"0 0 moveto xsize 0 lineto xsize ysize lineto 0 ysize lineto closepath 0.8 setgray fill"
@Graphic x
}
PDF @Yield {
"0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h 0.8 g f"
@Graphic x
}
}
}
|