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

NAME

6       ctangle, cweave – translate CWEB to 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 -i, -o,  and
49         +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.
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       · +s: print usage statistics
84
85       · --help: display help message and exit
86
87       · --version: output version information and exit
88
89       There are six other options applicable to cweave only:
90
91       · -e: do not enclose C/C++ material in \PB{...}
92
93       · -f: do not force a newline after every C/C++ statement in output
94
95       · -i: suppress indentation of parameter declarations
96
97       · -o: suppress separation of declarations and statements
98
99       · -x: omit indices, section names, table of contents
100
101       · +lX/-lX: use macros for language X as of Xcwebmac.tex
102

ENVIRONMENT

104       The environment variable CWEBINPUTS is used to  search  for  the  input
105       files,  or the system default if CWEBINPUTS is not set.  See tex(1) for
106       the details of the searching.
107
108       If prepared for NLS support, ctangle and  cweave  use  the  environment
109       variable  TEXMFLOCALEDIR  to  configure  the parent directory where the
110       “GNU gettext utilities” search for translation catalogs.
111
112       These variables are preconfigured in TeX Live’s texmf.cnf.
113

FILES

115       The location of the files mentioned below varies from system to system.
116       Use the kpsewhich utility to find their locations.
117
118       · cwebmac.tex:  The  default TeX macros \input in the first line of the
119         cweave output file.
120
121       · cwebman.tex: The  CWEB  user  manual,  available  in  PDF  from  CTAN
122         (https://ctan.org/pkg/cweb).
123

SEE ALSO

125       · The  CWEB  System of Structured Documentation: by Donald E. Knuth and
126         Silvio Levy (hardcopy version of  cwebman.tex  and  the  source  code
127         listings of common.w, ctangle.w, and cweave.w).
128
129       · Literate Programming: by D. E. Knuth.
130
131       · Weaving a Program: by Wayne Sewell.
132
133       cweb(1), tex(1), cc(1)
134

AUTHORS

136       Don Knuth wrote WEB for TeX and Pascal.
137       Silvio Levy designed and developed CWEB by adapting the WEB conventions
138       to C and by recoding everything in CWEB.  Knuth began  using  CWEB  and
139       made  further  refinements.  Many other helpers are acknowledged in the
140       CWEB manual.
141       As of 2019, the CWEB system in TeX Live is based on the CWEBbin  exten‐
142       sion  that  collects ideas and improvements from numerous contributors;
143       see the project page (https://github.com/ascherer/cwebbin).
144
145
146
147Web2c 2019                     January 27, 2019                        CWEB(1)
Impressum