| 1 |
.TH CWEB 1 2024-Mar-09 |
| 2 |
. |
| 3 |
.SH NAME |
| 4 |
ctangle, cweave \- translate CWEB to C and/or TeX |
| 5 |
. |
| 6 |
.SH SYNOPSIS |
| 7 |
.na |
| 8 |
.B ctangle |
| 9 |
[ |
| 10 |
.B \-bhp |
| 11 |
] [ |
| 12 |
.B +ks |
| 13 |
] webfile[.w] [{changefile[.ch]|-} [outputfile[.c]]] |
| 14 |
.br |
| 15 |
.B cweave |
| 16 |
[ |
| 17 |
.B \-befFhpx |
| 18 |
] [ |
| 19 |
.B +st |
| 20 |
] webfile[.w] [{changefile[.ch]|-} [outputfile[.tex]]] |
| 21 |
.ad |
| 22 |
. |
| 23 |
.SH DESCRIPTION |
| 24 |
The |
| 25 |
.I ctangle |
| 26 |
program converts a CWEB |
| 27 |
source document into a C\ program that may be compiled in the usual way. |
| 28 |
The output file includes #line specifications so that debugging can be |
| 29 |
done in terms of the CWEB source file. |
| 30 |
.PP |
| 31 |
The |
| 32 |
.I cweave |
| 33 |
program converts the same CWEB file into a TeX file that may be |
| 34 |
formatted and printed in the usual way. |
| 35 |
It takes appropriate care of typographic details like page |
| 36 |
layout and the use of indentation, italics, boldface, etc., and it supplies |
| 37 |
extensive cross-index information that it gathers automatically. |
| 38 |
.PP |
| 39 |
CWEB allows you to prepare a single |
| 40 |
document containing all the information that is needed both to produce |
| 41 |
a compilable C\ program and to produce a well-formatted document |
| 42 |
describing the program in as much detail as the writer may desire. |
| 43 |
The user of CWEB ought to be familiar with TeX as well as\ C. |
| 44 |
.PP |
| 45 |
The command line should have one, two, or three names on it. |
| 46 |
The first is taken as the CWEB file (and .w is added if there is no |
| 47 |
extension). |
| 48 |
If that file cannot be opened, the extension .web is tried instead. |
| 49 |
(But .w is recommended, since .web usually implies Pascal.) |
| 50 |
If there is a second name, it is a change file (and .ch is added if there is |
| 51 |
no extension). |
| 52 |
The change file overrides parts of the WEB file, |
| 53 |
as described in the documentation. |
| 54 |
If there is a third name, it overrides |
| 55 |
the default name of the output file, which is ordinarily the same as |
| 56 |
the name of the input file (but on the current directory) with the |
| 57 |
extension .c or .tex. |
| 58 |
.PP |
| 59 |
Options in the command line may be either turned off with\ \- |
| 60 |
(if they are on by default) or turned on with\ + (if they are off by |
| 61 |
default). |
| 62 |
In fact, the options are processed from left to right, |
| 63 |
so a sequence like -f\ +f corresponds to +f (which is the default). |
| 64 |
.PP |
| 65 |
The |
| 66 |
.B \-b |
| 67 |
option suppresses the banner line that normally appears on your terminal |
| 68 |
when ctangle or cweave begins. |
| 69 |
The |
| 70 |
.B \-h |
| 71 |
option suppresses the happy message that normally appears if the processing |
| 72 |
was successful. |
| 73 |
The |
| 74 |
.B \-p |
| 75 |
option suppresses progress reports (starred module numbers) as the processing |
| 76 |
takes place. |
| 77 |
If you say -bhp, you get nothing but error messages. |
| 78 |
.PP |
| 79 |
The |
| 80 |
.B +s |
| 81 |
option prints statistics about memory usage at the end of a run. |
| 82 |
.PP |
| 83 |
There is one other option applicable to |
| 84 |
.I ctangle |
| 85 |
only: |
| 86 |
.B +k |
| 87 |
means keep '-separators in numeric literals in the C/C++\ output. |
| 88 |
.PP |
| 89 |
There are five other options applicable to |
| 90 |
.I cweave |
| 91 |
only: |
| 92 |
.B \-f |
| 93 |
means do not force a newline after every statement in the formatted output. |
| 94 |
.B \-F |
| 95 |
means do not force a compound statement to start on a new line in the |
| 96 |
formatted output. |
| 97 |
.B \-e |
| 98 |
inhibits the enclosure of C\ material formatted by |
| 99 |
.I cweave |
| 100 |
in brackets |
| 101 |
\ePB{...}; |
| 102 |
such brackets are normally inserted so that special hooks |
| 103 |
can be used by |
| 104 |
.I cweb-latex |
| 105 |
and similar programs. |
| 106 |
.B \-x |
| 107 |
means omit the index, the names of the sections, and the table of contents. |
| 108 |
.B +t |
| 109 |
means treat 'typename' in templates like 'typedef'. |
| 110 |
. |
| 111 |
.SH FILES |
| 112 |
The location of the files mentioned below varies from system to system. |
| 113 |
.TP |
| 114 |
cwebmac.tex, cwebacromac.tex |
| 115 |
TeX macros used by cweave output. |
| 116 |
.TP |
| 117 |
cwebman.tex |
| 118 |
The user manual. |
| 119 |
.TP |
| 120 |
/usr/lib/cweb |
| 121 |
Directory for cweb "include" files. |
| 122 |
. |
| 123 |
.SH "SEE ALSO" |
| 124 |
.TP |
| 125 |
.I Literate Programming |
| 126 |
by D. E. Knuth |
| 127 |
.TP |
| 128 |
.I Weaving a Program |
| 129 |
by Wayne Sewell |
| 130 |
.TP |
| 131 |
.I The CWEB System of Structured Documentation |
| 132 |
by Donald E. Knuth and Silvio Levy (hardcopy version of cwebman.tex |
| 133 |
and the source code listings) |
| 134 |
.TP |
| 135 |
tex(1), cc(1) |
| 136 |
. |
| 137 |
.SH AUTHORS |
| 138 |
Don Knuth wrote WEB for TeX and Pascal. |
| 139 |
Silvio Levy designed and developed CWEB |
| 140 |
by adapting the WEB conventions to\ C and by recoding everything in CWEB. |
| 141 |
Knuth began using CWEB and made further refinements. |
| 142 |
Many other helpers are acknowledged in the CWEB manual. |
| 143 |
Contemporary development on https://github.com/ascherer/cweb. |
| 144 |
|