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
|
#!/usr/bin/sciteco -m
! ./generate-docs.tes <output> <input> <sources> !
!
Preprocess a manpage template, inserting a SciTECO command reference.
The .COMMANDS request is replaced with Troff markup generated from code
comments in <sources>.
The comments support a small but powerful markup for documenting
TECO commands:
* comments start with /*$
* all lines until first empty line are command syntax descriptions
* text followed by "--" is a short description
* variable values and characters of syntactic significance should be
detected automatically
* alternatives are denoted by "|"
* every line is an alternative
* return values may be specified after "->"
* the remaining text is the verbose command description
* <name> denotes a variable from the syntax description
* empty lines introduce paragraphs
* lines beginning with "-" are unordered lists
* lines beginning with numbers and dot ("1.", "2.", etc.) are
ordered lists
* the above transformations are only preprocessing, so that
Troff requests, escapes and tman macros may also be used.
!
@{format_header}{
fd--S .U.f :L"S.|Z'U.t Q.f,Q.tXa Q.f,Q.tD I
ebQ#tm I\# GENERATED FROM Q.#sc (\.#sc):
.SS Qa -a-10"N I
' eq.{header}
j<fr
.br
;>
j<sMA;.u.t 1ua<."=1;'-a"A|1;'-a"V-1ua1;'r> qa"Sq.tj|.,q.txa.,q.td i
.B Qa
'>
j<s[MC];.u.t-s[.,q.t-1xa .-1,q.td i
.RI [ Qa ]
>
j<fr->\(->;>
j<sMCM[|MC];.u.t <-a"C|-a-|"N1;''r> .,q.txa .,q.td eqa<fr| | ;> eq.{header}i
.IR Qa
>
j<frS
;>j<fr
S
;>j<fs
;>
j 0a-10"=d'
zj-a-10"=-d'
ebQ#tm g.{header}i
.
}
@{format_body}{
i.LP
<fr
.
.LP
;>
j<fs
-S
.IP \(bu 4
;>j<s
MD.S; 0L I.IP FSS 4
>
! set margin for list paragraphs !
j 0U.n<
Z-.-3"<1;'
.,.+3:S.LP"S Q.n">0L I.RE
0U.n' | .,.+3:S.IP"S Q.n"=0L I.RS
%.n' ' '
:L;
> Q.n"> ZJ I
.RE '
j<s<MC>;-di
-s<-di
.I >
j<frS
;>j<fr
S
;>
ebQ#tm g.ci
.
.
}
! process command-line options !
LR 0X#ou 2LR 0X#tm EBQ#tm EB L
[.f
<:L;R 0X.f EBQ.f EB L>
].f
-EF
I\#
\# AUTOGENERATED FROM Q#tm
\# DO NOT EDIT MANUALLY!!!
\#
! find insertion point !
FS
.COMMANDS
<
<
! extract comment !
2EB EQ* HX.#sc 2EB
s/*$; .-3u.#sc s*/ q.#sc+3,.-2x.ceq.c
! q.#sc= !
<fs
;>
j<fs
[S,]*[M[ , ],]
;>
j<0a-13"=df>'0a-10"=df>'0a- "=df>'0a- "=df>';>
zj<-a-13"=-df>'-a-10"=-df>'-a- "=-df>'-a- "=-df>';>
! extract header !
h:fd
"Fzj'0,.x.{header}0,.d
eq.{header}
:M{format_header}
eq.c
:M{format_body}
>
EF
Q*-1"=1;'
>
EWQ#ou
EX
|