blob: dad8b023c56db41b2e72ec8e78a1c1fddbf63152 (
plain)
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
|
#!/bin/sh
# Copyright 1991-1997 by Norman Ramsey. All rights reserved.
# See file COPYRIGHT for more information.
# $Id: noweave.nw,v 1.7 2008/10/06 01:03:24 nr Exp $
LIB=|LIBDIR|
markup=$LIB/markup backend=$LIB/totex
wrapper= delay= args= markopts= noweboptions= autodefs= verbose= shortxref=
noquote="-noquote" docanchor= noindex="-noindex"
filtera= filterb= filterc= filterd= filtere= filterf= filterg=
# following supported by change in totex back end
noquote=
using_index= using_xref=
pass2setcmd="set ignore"
for i do
pass2setcmd="$pass2setcmd '$i'"
done
arg=
while [ $# -gt 0 ]; do
case $1 in
-latex) if [ "$wrapper" != "none" ]; then wrapper=latex; fi ;;
-tex) wrapper=tex ;;
-html) if [ "$wrapper" != "none" ]; then wrapper=html; fi;
backend="$LIB/tohtml -localindex"
noquote=""; docanchor="-docanchor 10" ;;
-latex+html) if [ "$wrapper" != "none" ]; then wrapper=latex; fi;
backend="$LIB/tohtml -localindex -raw"
noquote=""; docanchor="-docanchor 10" ;;
-ascii) wrapper=none
backend="$LIB/toascii" ;;
-troff) wrapper=mm
backend="$LIB/toroff" ;;
-n) wrapper=none ;;
-backend) backend="$2" ; shift ;;
-markup) markup="$2" ; shift ;;
-filter) shift ;;
-x) using_xref=1 ;;
-index) noindex= ; using_index=1 ;;
-indexfrom) shift; noindex= ; using_index=1 ;;
-autodefs) newfilter="$LIB/autodefs.$2"
if [ -r $newfilter ]; then if [ -z "$filtera" ]; then
filtera="$newfilter"
elif [ -z "$filterb" ]; then
filterb="$newfilter"
elif [ -z "$filterc" ]; then
filterc="$newfilter"
elif [ -z "$filterd" ]; then
filterd="$newfilter"
elif [ -z "$filtere" ]; then
filtere="$newfilter"
elif [ -z "$filterf" ]; then
filterf="$newfilter"
elif [ -z "$filterg" ]; then
filterg="$newfilter"
else
echo "$0: ran out of filters" 1>&2
exit 1
fi
else echo "$0: don't know how to find definitions for '$2'" 1>&2; exit 1
fi
shift
;;
-showautodefs) foundautodefs=
for i in $LIB/autodefs.*; do
if [ -r $i ]; then
echo "This `basename $0` supports -autodefs $i" |
sed "s@$LIB/autodefs\.@@" 1>&2
foundautodefs=$i
fi
done
if [ -z "$foundautodefs" ]; then
echo "This `basename $0` does not support -autodefs"
fi; exit 1 ;;
-option) newopt="$2"; shift
if [ "X$newopt" = "Xshortxref" ]; then shortxref="-shortxref"; fi
if [ "X$newopt" = "Xlongxref" ]; then shortxref="-longxref"; fi
if [ -z "$noweboptions" ] ; then noweboptions="$newopt"
else noweboptions="$noweboptions,$newopt"
fi ;;
# -nodelay) delay= ;;
-delay) delay="-delay" ; wrapper=none ;;
-t*) markopts="$markopts $1" ;;
-v) echo 'RCS version name $Name: $' 1>&2
echo 'RCS id $Id: noweave.nw,v 1.7 2008/10/06 01:03:24 nr Exp $' 1>&2
verbose=1 ;;
-) arg="$arg $1" ;;
-*) echo "$0: Unrecognized option '$1'" 1>&2 ; echo "Usage: $0 [options] [files]" 1>&2
echo "Options recognized are:" 1>&2
echo "-latex Emit LaTeX with headers and trailers (default)." 1>&2
echo "-tex Emit plain TeX with headers and trailers." 1>&2
echo "-html Emit HTML with headers and trailers." 1>&2
echo "-latex+html Assume LaTeX in documentation, but use HTML in code." 1>&2
# echo "-ascii Emit ASCII." 1>&2
echo "-troff Emit troff (actually GNU groff)." 1>&2
echo " -n Don't use any header or trailer." 1>&2
echo "-markup frontend Parse input with frontend (e.g., numarkup)." 1>&2
echo "-x Use the default cross-referencer (needs LaTeX or HTML)." 1>&2
echo "-index Create index using identifiers defined in input files." 1>&2
echo "-indexfrom defs Create index of identifers listed in file defs." 1>&2
echo "-filter cmd Filter through 'cmd' before weaving; cmd could prettyprint" 1>&2
echo " or perform other functions." 1>&2
echo "-autodefs lang Source is in language 'lang'; find definitions automatically." 1>&2
echo "-showautodefs List languages that can be used with -autodefs" 1>&2
echo '-option opt Add \noweboptions{opt} to header (latex only)' 1>&2
echo "-delay Delay markup until after first documentation chunk." 1>&2
echo "-tk Expand tab stops every k columns" 1>&2
echo "-t Copy tabs to the output" 1>&2
echo "-v Print pipeline and RCS info on standard error" 1>&2; exit 1 ;;
*) arg="$arg $1" ;;
esac
shift
done
if [ -n "$using_xref" -a -n "$using_index" ]; then
echo "$0: you may not use -x with -index or -indexfrom (drop the -x)" 1>&2
exit 1
fi
if [ -z "$wrapper" ]; then wrapper=latex; fi
eval $pass2setcmd
shift
while [ $# -gt 0 ]; do
case $1 in
-filter)
newfilter="$2" ; shift ; if [ -z "$filtera" ]; then
filtera="$newfilter"
elif [ -z "$filterb" ]; then
filterb="$newfilter"
elif [ -z "$filterc" ]; then
filterc="$newfilter"
elif [ -z "$filterd" ]; then
filterd="$newfilter"
elif [ -z "$filtere" ]; then
filtere="$newfilter"
elif [ -z "$filterf" ]; then
filterf="$newfilter"
elif [ -z "$filterg" ]; then
filterg="$newfilter"
else
echo "$0: ran out of filters" 1>&2
exit 1
fi ;;
-x) newfilter="$LIB/noidx $docanchor $delay"; if [ -z "$filtera" ]; then
filtera="$newfilter"
elif [ -z "$filterb" ]; then
filterb="$newfilter"
elif [ -z "$filterc" ]; then
filterc="$newfilter"
elif [ -z "$filterd" ]; then
filterd="$newfilter"
elif [ -z "$filtere" ]; then
filtere="$newfilter"
elif [ -z "$filterf" ]; then
filterf="$newfilter"
elif [ -z "$filterg" ]; then
filterg="$newfilter"
else
echo "$0: ran out of filters" 1>&2
exit 1
fi ;;
-index)
newfilter="$LIB/finduses $noquote" ; if [ -z "$filtera" ]; then
filtera="$newfilter"
elif [ -z "$filterb" ]; then
filterb="$newfilter"
elif [ -z "$filterc" ]; then
filterc="$newfilter"
elif [ -z "$filterd" ]; then
filterd="$newfilter"
elif [ -z "$filtere" ]; then
filtere="$newfilter"
elif [ -z "$filterf" ]; then
filterf="$newfilter"
elif [ -z "$filterg" ]; then
filterg="$newfilter"
else
echo "$0: ran out of filters" 1>&2
exit 1
fi
newfilter="$LIB/noidx $docanchor $delay"; if [ -z "$filtera" ]; then
filtera="$newfilter"
elif [ -z "$filterb" ]; then
filterb="$newfilter"
elif [ -z "$filterc" ]; then
filterc="$newfilter"
elif [ -z "$filterd" ]; then
filterd="$newfilter"
elif [ -z "$filtere" ]; then
filtere="$newfilter"
elif [ -z "$filterf" ]; then
filterf="$newfilter"
elif [ -z "$filterg" ]; then
filterg="$newfilter"
else
echo "$0: ran out of filters" 1>&2
exit 1
fi ;;
-indexfrom)
newfilter="$LIB/finduses $noquote $2"; if [ -z "$filtera" ]; then
filtera="$newfilter"
elif [ -z "$filterb" ]; then
filterb="$newfilter"
elif [ -z "$filterc" ]; then
filterc="$newfilter"
elif [ -z "$filterd" ]; then
filterd="$newfilter"
elif [ -z "$filtere" ]; then
filtere="$newfilter"
elif [ -z "$filterf" ]; then
filterf="$newfilter"
elif [ -z "$filterg" ]; then
filterg="$newfilter"
else
echo "$0: ran out of filters" 1>&2
exit 1
fi
newfilter="$LIB/noidx $docanchor $delay"; if [ -z "$filtera" ]; then
filtera="$newfilter"
elif [ -z "$filterb" ]; then
filterb="$newfilter"
elif [ -z "$filterc" ]; then
filterc="$newfilter"
elif [ -z "$filterd" ]; then
filterd="$newfilter"
elif [ -z "$filtere" ]; then
filtere="$newfilter"
elif [ -z "$filterf" ]; then
filterf="$newfilter"
elif [ -z "$filterg" ]; then
filterg="$newfilter"
else
echo "$0: ran out of filters" 1>&2
exit 1
fi
shift ;;
esac
shift
done
(
header=
case $wrapper in
none) ;;
latex) header="@header $wrapper $noweboptions"
trailer="@trailer $wrapper" ;;
*) header="@header $wrapper$arg"
trailer="@trailer $wrapper" ;;
esac
if [ -n "$header" ]; then echo "$header"; fi
PATH="$PATH:$LIB"
export PATH
if [ -n "$verbose" ]; then
if [ -n "$header" -o -n "$trailer" ]; then
parenpfx="("
if [ -n "$header" ]; then echo "(echo $header" 1>&2; parenpfx=" "; fi
echo "$parenpfx$markup" $markopts $arg 1>&2
if [ -n "$trailer" ]; then echo " echo $trailer" 1>&2; fi
echo ") |" 1>&2
else
echo $markup $markopts $arg '|' 1>&2
fi
if [ -n "$filtera" ]; then echo $filtera '|' 1>&2; fi
if [ -n "$filterb" ]; then echo $filterb '|' 1>&2; fi
if [ -n "$filterc" ]; then echo $filterc '|' 1>&2; fi
if [ -n "$filterd" ]; then echo $filterd '|' 1>&2; fi
if [ -n "$filtere" ]; then echo $filtere '|' 1>&2; fi
if [ -n "$filterf" ]; then echo $filterf '|' 1>&2; fi
if [ -n "$filterg" ]; then echo $filterg '|' 1>&2; fi
fi
if [ -n "$verbose" ]; then echo $backend $noindex $delay $shortxref 1>&2; fi
if [ -z "$filtera" ]; then
$markup $markopts $arg
elif [ -z "$filterb" ]; then
$markup $markopts $arg | eval $filtera
elif [ -z "$filterc" ]; then
$markup $markopts $arg | eval $filtera | eval $filterb
elif [ -z "$filterd" ]; then
$markup $markopts $arg | eval $filtera | eval $filterb | eval $filterc
elif [ -z "$filtere" ]; then
$markup $markopts $arg | eval $filtera | eval $filterb | eval $filterc |
eval $filterd
elif [ -z "$filterf" ]; then
$markup $markopts $arg | eval $filtera | eval $filterb | eval $filterc |
eval $filterd | eval $filtere
elif [ -z "$filterg" ]; then
$markup $markopts $arg | eval $filtera | eval $filterb | eval $filterc |
eval $filterd | eval $filtere | eval $filterf
else
$markup $markopts $arg | eval $filtera | eval $filterb | eval $filterc |
eval $filterd | eval $filtere | eval $filterf |
eval $filterg
fi
if [ -n "$trailer" ]; then echo $trailer; fi
) |
$backend $noindex $delay $shortxref
exit $?
|