1CWEB(1) General Commands Manual CWEB(1)
2
3
4
6 ctangle, cweave - translate CWEB to C and/or TeX
7
9 ctangle [ -bhp ] [ +s ] webfile[.w] [changefile[.ch]] [outputfile[.c]]
10 cweave [ -befhpx ] [ +s ] webfile[.w] [changefile[.ch]] [output‐
11 file[.tex]]
12
14 The ctangle program converts a CWEB source document into a C program
15 that may be compiled in the usual way. The output file includes #line
16 specifications so that debugging can be done in terms of the CWEB
17 source file.
18
19 The cweave program converts the same CWEB file into a TeX file that may
20 be formatted and printed in the usual way. It takes appropriate care
21 of typographic details like page layout and the use of indentation,
22 italics, boldface, etc., and it supplies extensive cross-index informa‐
23 tion that it gathers automatically.
24
25 CWEB allows you to prepare a single document containing all the infor‐
26 mation that is needed both to produce a compilable C program and to
27 produce a well-formatted document describing the program in as much
28 detail as the writer may desire. The user of CWEB ought to be familiar
29 with TeX as well as C.
30
31 The command line should have one, two, or three names on it. The first
32 is taken as the CWEB file (and .w is added if there is no extension).
33 If that file cannot be opened, the extension .web is tried instead.
34 (But .w is recommended, since .web usually implies Pascal.) If there
35 is a second name, it is a change file (and .ch is added if there is no
36 extension). The change file overrides parts of the WEB file, as
37 described in the documentation. If there is a third name, it overrides
38 the default name of the output file, which is ordinarily the same as
39 the name of the input file (but on the current directory) with the
40 extension .c or .tex.
41
42 Options in the command line may be either turned off with - (if they
43 are on by default) or turned on with + (if they are off by default).
44 In fact, the options are processed from left to right, so a sequence
45 like -f +f corresponds to +f (which is the default).
46
47 The -b option suppresses the banner line that normally appears on your
48 terminal when ctangle or cweave begins. The -h option suppresses the
49 happy message that normally appears if the processing was successful.
50 The -p option suppresses progress reports (starred module numbers) as
51 the processing takes place. If you say -bhp, you get nothing but error
52 messages.
53
54 The +s option prints statistics about memory usage at the end of a run
55 (assuming that the programs have been compiled with the -DSTAT switch).
56
57 There are three other options applicable to cweave only: -f means do
58 not force a newline after every statement in the formatted output. -e
59 inhibits the enclosure of C material formatted by cweave in brackets
60 \PB{...}. Such brackets are normally inserted so that special hooks
61 can be used by cweb-latex and similar programs. -x means omit the
62 index and table of contents.
63
65 The location of the files mentioned below varies from system to system.
66 Use the kpsewhich utility to find their locations.
67
68 cwebmac.tex
69 TeX macros used by cweave output.
70
71 cwebman.tex
72 The user manual.
73
75 Literate Programming
76 by D. E. Knuth
77
78 Weaving a Program
79 by Wayne Sewell
80
81 The CWEB System of Structured Documentation
82 by Donald E. Knuth and Silvio Levy (hardcopy version of cweb‐
83 man.tex and the source code listings)
84
85 tex(1), cc(1)
86
88 Don Knuth wrote WEB for TeX and Pascal. Silvio Levy designed and
89 developed CWEB by adapting the WEB conventions to C and by recoding
90 everything in CWEB. Knuth began using CWEB and made further refine‐
91 ments. Many other helpers are acknowledged in the CWEB manual.
92
93
94
95
96Web2C 7.5.6 19 December 2004 CWEB(1)