1CWEB(1)                     General Commands Manual                    CWEB(1)
2
3
4

NAME

6       ctangle, cweave - translate CWEB to C/C++ and/or TeX
7

SYNOPSIS

9       ctangle [options] webfile[.w] [{changefile[.ch]|-} [outfile[.c]]]
10       cweave [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]
11

DESCRIPTION

13       The  ctangle  program converts a CWEB source document into a C/C++ pro‐
14       gram that may be compiled in the usual way.  The output  file  includes
15       #line 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/C++ program and to
26       produce a well-formatted document describing the program in as much de‐
27       tail  as  the writer may desire.  The user of CWEB ought to be familiar
28       with TeX as well as C/C++.
29

USAGE

31       The command line should have one, two, or three names on it.  The first
32       is  taken as the CWEB input file (and .w is added if there is no exten‐
33       sion).  If there is a second name, it is a  change  file  (and  .ch  is
34       added  if  there  is no extension).  The change file overrides parts of
35       the CWEB file, as described in the documentation.  If there is a  third
36       name,  it overrides the default name of the output file, which is ordi‐
37       narily the same as the name of the input file (but on the  current  di‐
38       rectory)  with the extension .tex.  If you just want to change the out‐
39       put file name, but don’t have a change file to apply, you can  use  `-'
40       as the second argument.
41

DIFFERENCES TO ORIGINAL CWEB

43       CWEBbin  tries hard to be a drop-in replacement for CWEB, so in general
44       you should not notice any differences in invoking the programs  nor  in
45       the resulting output.  There are, however, a few differences worth not‐
46       ing:
47
48       • Options --help, --quiet, --verbose, --version, and flags +c, -i,  -o,
49         +u, and +lX are new in CWEBbin and TeX Live.
50
51       • Option  +lX  is  accompanied by several wrapper files for cwebmac.tex
52         with translated captions for German (+ld), French (+lf), and  Italian
53         (+li).
54
55       • CWEB  in  TeX Live operates silently by default (as of 2019); use the
56         --verbose option to get the original behavior.
57
58       • File lookup with the environment variable CWEBINPUTS is  extended  to
59         permit several, colon-separated, paths; see ENVIRONMENT below.
60
61       • If  properly configured, the main programs ctangle and cweave are lo‐
62         calized with the “GNU gettext utilities”.
63

OPTIONS

65       Options on the command line may be either turned off with `-' (if  they
66       are  on by default) or turned on with `+' (if they are off by default).
67       In fact, the options are processed from left to right,  so  a  sequence
68       like  --verbose -h will only show the banner line (+b) and the progress
69       report (+p), but leave out the happy message (-h).
70
71       The first batch of options are common to both ctangle and cweave:
72
73+b: print banner line on terminal
74
75+h: print success message on completion
76
77+p: print progress report messages
78
79+q/-q: shortcut for -bhp; also --quiet (default)
80
81+v/-v: shortcut for +bhp; also --verbose
82
83+c: check temporary output for changes
84
85+s: print usage statistics
86
87--help: display help message and exit
88
89--version: output version information and exit
90
91       There is one other option applicable to ctangle only:
92
93+k: keep separators in numeric literals in the output
94
95+u: transliterate UTF-8 charcters in C code
96
97       There are seven other options applicable to cweave only:
98
99-e: do not enclose C/C++ material in \PB{...}
100
101-f: do not force a newline after every C/C++ statement in output
102
103-i: suppress indentation of parameter declarations
104
105-o: suppress separation of declarations and statements
106
107-x: omit indices, section names, table of contents
108
109+lX/-lX: use macros for language X as of Xcwebmac.tex
110
111+t: treat typename in a template like typedef
112

ENVIRONMENT

114       The environment variable CWEBINPUTS is used to  search  for  the  input
115       files,  or the system default if CWEBINPUTS is not set.  See tex(1) for
116       the details of the searching.  To avoid conflicts with  other  programs
117       that  also use the CWEBINPUTS environment, you can be more specific and
118       use CWEBINPUTS_cweb for special requirements in CWEB.
119
120       If prepared for NLS support, ctangle and  cweave  use  the  environment
121       variable  TEXMFLOCALEDIR  to  configure  the parent directory where the
122       “GNU gettext utilities” search for translation catalogs.
123
124       These variables are preconfigured in TeX Live’s texmf.cnf.
125

FILES

127       The location of the files mentioned below varies from system to system.
128       Use the kpsewhich utility to find their locations.
129
130cwebmac.tex:  The  default TeX macros \input in the first line of the
131         cweave output file.
132
133cwebman.tex: The  CWEB  user  manual,  available  in  PDF  from  CTAN
134         (https://ctan.org/pkg/cweb).
135

SEE ALSO

137       • The  CWEB  System of Structured Documentation: by Donald E. Knuth and
138         Silvio Levy (hardcopy version of  cwebman.tex  and  the  source  code
139         listings of common.w, ctangle.w, and cweave.w).
140
141       • Literate Programming: by D. E. Knuth.
142
143       • Weaving a Program: by Wayne Sewell.
144
145       cweb(1), tex(1), cc(1)
146

AUTHORS

148       Don Knuth wrote WEB for TeX and Pascal.
149       Silvio Levy designed and developed CWEB by adapting the WEB conventions
150       to C and by recoding everything in CWEB.  Knuth began  using  CWEB  and
151       made further refinements.
152       Many other helpers are acknowledged in the CWEB manual.
153       Contemporary development on https://github.com/ascherer/cweb.
154
155
156
157Web2c 2023                      August 20, 2022                        CWEB(1)
Impressum