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

ENVIRONMENT

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

FILES

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

SEE ALSO

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

AUTHORS

140       Don Knuth wrote WEB for TeX and Pascal.
141       Silvio Levy designed and developed CWEB by adapting the WEB conventions
142       to C and by recoding everything in CWEB.  Knuth began  using  CWEB  and
143       made  further  refinements.  Many other helpers are acknowledged in the
144       CWEB manual.
145       CWEB in TeX Live is based on the CWEBbin  extension;  see  the  project
146       page (https://github.com/ascherer/cwebbin).
147
148
149
150Web2c 2021                    September 23, 2020                       CWEB(1)
Impressum