CWEBX(1)
π CWEBX(1) π
ok so this is the manual page for CWEBX, from the General Commands Manual section (that's section 1, bestie, the "just type it in your shell" section π«Ά). Grab a snack, we're translating CWEB(x) into C and TeX and it's gonna be a whole vibe β¨
πΈ NAME πΈ
ctanglex, cweavex β translate CWEB(x) to C (or C++) and/or TeX π
β¨ SYNOPSIS β¨
ctanglex [ -bhpl ] [ +cs+ ] cwebfile[.w] [(changefile[.ch]|+|-)
[outputfile[.c]]]
cweavex [ -bhpx ] [ +cs+dtefauwm ] [ +isearchpath ] cwebfile[.w]
[(changefile[.ch]|+|-) [outputfile[.tex]]]
π DESCRIPTION π
So here's the tea β: ctanglex takes your CWEB(x) source document and turns it into a C program that you can compile the normal way, no cap. And the output file? It's stuffed with #line specifications, which means error reporting and debugging happen in terms of your CWEB(x) source file. iconic behaviour honestly π
cweavex is the other half of the duo β it takes that same CWEB(x) file and turns it into a TeX file you can format and print the usual way. It handles all the typographic cuteness for you: page layout, indentation, italics, boldface, etc., etc., and it serves up extensive cross-reference information that it gathers automatically. it's giving β¨automaticβ¨ π¦
CWEBx lets you write ONE single document containing everything you need β both to produce a compilable C program and to produce a well-formatted document describing that program in as much detail as the writer could possibly want. Obsessed. But heads up: if you're the user of CWEBx, you ought to have some familiarity with TeX, plus actual knowledge of C. both. no skipping π
π§ The command line, explained π§
Your command line should have one, two, or three names on it. Let's break it down:
- The first name is taken as the CWEB(x) file β and
.wgets added if there's no extension. If that file can't be opened, the extension.webis tried instead. π - If there's a second name, it's a change file (and
.chgets added if there's no extension). Otherwise, the name of the CWEB(x) file with its extension replaced by.chis tried as the change file name; and if there's no such file, no change file is used. - Instead of a change file you can specify
-or+:-means do not use a change file.+means use a change file only if a file of the default name exists (exactly as if only one name was given).
- The change file overrides parts of the CWEB(x) file, as described in the documentation. π
- A third name, if present, specifies the output file name explicitly. The default output file name is the CWEB(x) file's name with extension
.c(forctanglex) or.tex(forcweavex). And yes, that default extension also gets applied if a third name is given without an extension. periodt π
β Options, and how the toggling works β
Options on the command line may be either turned on with + or off with -. Several characters can follow in the same argument, and they indicate several options turned on (or off) simultaneously. And here's the key part, bestie: the options are processed left to right, so a sequence like -b +b is equivalent to +b (which is the default). π
+bβ shows a banner line on your terminal.+hβ shows a happy message if the processing was successful. π (we love a happy message)+pβ shows progress reports (starred module numbers) as the processing takes place.- If you say
-bhp, you get no terminal output but error messages. +cβ emulates Levy/Knuth CWEB.+sβ prints statistics about memory usage at the end of a run (assuming the programs have been compiled with the-DSTATswitch, as they are by default on Debian systems).++β by setting this option you can select the C++ language instead of C. π-lβ applicable toctanglexonly. When selected, the C output is made more readable for humans by omitting#linedirectives and preserving layout and comments. π
π The cweavex-only options π
There are several other options applicable to cweavex only:
-xβ omit the index and table of contents.+dβ causescweavexto report problems encountered in parsing the program fragments.+tβ the index and module names will be written to separate files.+eβ the table of contents is forced to start on a new sheet when using a two-sided printer.+fβ changes the style in which programs are formatted: force a newline after every simple statement in the formatted output.+aβ also force a newline before every simple statement, even if it follows a label or a condition.+uβ changes the style so that a line break goes after{instead of before, thus preventing them from aligning with their matching}(this is the style of Levy/Knuth CWEB).+wβ puts a line break both before and after{, producing a more symmetric layout at the expense of some extra paper. π+mβ avoids forcing line breaks between successive declarations in a local block.+isearchpathβ lets you specify a place to look for header files, for when they're not found in the current directory. The string following the+iwill be stored and prepended to a header file name if it can't be found otherwise (so the string should probably end with a pathname separator/). More than one such search path can be specified; they'll be tried in order from left to right. π¦
ok so+f,+a,+u,+w, and+mare all about style β how programs get formatted. Pick your aesthetic, bestie π
π FILES π
/usr/share/texmf/macros/litprog/cwebxmac.texβ TeX macros used bycweavexoutput./usr/share/texmf/macros/litprog/cwebcmac.texβ TeX macros used in compatibility mode./usr/share/texmf/macros/litprog/cwebhmac.texβ TeX macros which can be input aftercwebxmacto produce hyperlinks in the output./usr/share/doc/cwebx/manual.texβ The user manual source./usr/share/doc/cwebx/manual.texβ The user manual in DVI format.
π SEE ALSO π
π AUTHORS π
Don Knuth wrote WEB for TeX and Pascal. Silvio Levy designed and developed CWEB by adapting the WEB conventions to C and by recoding everything in CWEB. Frank Jensen adapted the programs to ANSI/ISO C, and Marc van Leeuwen made numerous changes for version x3.0, and wrote a new manual. absolute legends, all of them π«Ά
π BUGS π
The syntactic support for C++ does not cover that language completely, so formatting of complex C++ code may be bad. π
and that's the whole page!! this one came from the CWEBX(1) page, dated 7/12/90 β ye olde but still serving looks π mwah, go write some literate programs bestie πΈ
π¦ where this page comes from
- debian bookworm: cwebx 3.52-3 Β· cwebx
- debian trixie: cwebx 3.52-4 Β· cwebx
- ubuntu jammy: cwebx 3.52-3 Β· cwebx
- ubuntu noble: cwebx 3.52-3 Β· cwebx
- ubuntu questing: cwebx 3.52-4
- ubuntu resolute: cwebx 3.52-4build1 Β· cwebx
- ubuntu stonking: cwebx 3.52-4build1 Β· cwebx
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms