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