File: README

package info (click to toggle)
cwebx 3.52-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,280 kB
  • sloc: ansic: 1,622; pascal: 228; makefile: 123; sh: 1
file content (125 lines) | stat: -rw-r--r-- 6,855 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
This file is part of CWEBx (version 3.51 at the time of writing; the actual
version number is defined near the end of intro.inc, and can be found by
running ctanglex or cweavex with the --version flag). It explains briefly what
CWEB is, and how to set it up, and what the various files are for.

The CWEBx system consists of two executable programs that are designated here
as CTANGLE and CWEAVE. These programs were traditionally named 'ctangle' and
'cweave', but to avoid confusion with the Levy/Knuth version of CWEB that may
also be installed, the executables are called 'ctanglex' and 'cweavex' in the
CWEBx system, so that is what CTANGLE and CWEAVE stand for, respectively.
Newvertheless their source files have names without an x.

Here is a listing of the files constituting the release with a brief
indication of their purpose.

README	        % the file you are currently reading
Makefile	% control file for POSIX 'make' facility to build CWEB
configure	% a script that explains that there is nothing to configure

common.w	% CWEBx source for routines common to CTANGLE and CWEAVE
ctangle.w	% CWEBx source for CTANGLE
cweave.w	% CWEBx source for bulk of CWEAVE
parser.w	% CWEBx source for parser of CWEAVE
rules.w		% CWEBx source for grammar rules of CWEAVE
common.inc	% CWEBx source included by common.w, ctangle.w, and cweave.w
intro.inc	% CWEBx source included by ctangle.w and cweave.w

common.c	% C file produced (by CTANGLE) from common.w; for bootstrap
common.h	% C file produced (by CTANGLE) from common.w; for bootstrap
ctangle.c	% C file produced (by CTANGLE) from ctangle.w; for bootstrap

cwebxmac.tex	% TeX macro file needed to process files produced by CWEAVE
cwebcmac.tex	% TeX macro file needed in addition for compatibility mode

cwebhmac.tex	% optional TeX macro file creating hyperlinks for xhdvi (e.g.)

manual.tex	% master file for the CWEB manual
compare.tex	% file \input by manual.tex (present to facilitate bootstrap)

man1		% directory with UNIX manpage
man1/cweb.1		% UNIX manpage for CTANGLE and CWEAVE

examples	% directory with sample CWEB programs
examples/compare.w	% Compare files; source for compare.tex above
examples/treeprint.w	% Convert sorted file listings to a tree diagram
examples/wc.w		% Count characters, words and lines in text files
examples/wmerge.w	% Perform preprocessing of change files as filter
examples/Makefile

cweb.el		% EMACS file that might facilitate editing CWEB files



The CWEB system allows you to write C programs and their documentation at the
same time, in a way that optimises human readability. This version fully
supports ANSI/ISO C, and indeed requires such a compiler for its own
compilation; it also provides reasonalble support for C++. Like other WEB
systems, CWEB allows you to decompose your programs into small, logically
related portions, to add any desired amount of documentation to each of them,
and to present them in any order that help understanding. As TeX is used to
obtain the printed source document, a high typographic quality can be obtained
while allowing for formatting of complicated formulae and tables; formatting
of C/C++ program fragments is simple however, since it is done almost fully
automatically. When used properly, CWEB can be used to produce documents that
combine the qualities of a scientific publication about algorithms and of a
well documented source listing for an implementation of those algorithms.

The CWEB system consists of two programs, CTANGLE and CWEAVE, that are to be
used in combination with a C compiler and TeX; both transform text files,
while they share the same input language. CWEB source files, that typically
have suffix `.w', can be converted by CTANGLE to C files (suffix `.c') that
can be compiled, and alternatively can be converted by CWEAVE to TeX files
(suffix `.tex') from which the typeset source listing can be produced by
TeX. More details can be found in the manual, which you obtain by running
TeX on the file manual.tex. Here the main interest is that since CWEB is
written using CWEB you need a bootstrap procedure to get things going. For
this purpose the derived files common.c, common.h and ctangle.c are supplied.
If you have the UNIX make facility, all you have to do is check that these
files are newer than the sources common.w and ctangle.w (they should be when
the archive is unpacked, but you can use "touch" to make them newer in case
this should be necessary), and that the Makefile macro CC refers to an ANSI
compiler (it is set to "cc"; you may need to select "gcc" instead or to
supply additional flags in CFLAGS) and then invoke "make all". Otherwise,
without using 'make', here is the required sequence of commands.

$ cc -c ctangle.c			# compile main part of CTANGLE
$ cc -c common.c			# compile common code
$ cc -o ctangle ctangle.o common.o 	# link CTANGLE together
$ ./ctangle cweave 			# create cweave.c from cweave.w
$ cc -DDEBUG -DSTAT -g -c cweave.c	# compile main part of CWEAVE
$ cc -DDEBUG -DSTAT -g -o cweave cweave.o common.o # link CWEAVE together
$ tex manual.tex			# typeset the manual

$ # the rest is only needed to obtain source listings for the CWEB system
$ ./cweave common			# produce common.tex
$ tex common				# typeset listing of common code
$ ./cweave ctangle			# produce ctangle.tex
$ tex ctangle				# typeset listing of CTANGLE
$ ./cweave cweave			# produce cweave.tex
$ tex cweave				# typeset listing of CWEAVE

By the time you have done all this successfully, you have already tested
CTANGLE and CWEAVE on a substantial amount of input, and you may be
confident that the system is working properly.

Should you on the other hand encounter problems during bootstrapping, then
things are of course less pleasant, especially because you cannot print the
source listings yet. Few problems are expected though, since there are no
known system dependencies, and identical source code compiles on several
dissimilar systems, one of which is quite non-UNIX. The cwebx system expects
though that the compiler can handle large arrays (certainly larger than 64 Kb,
which should not be a concern at all nowadays) and programs that use command
line arguments; in the unlikely case that your compiler does not support this,
you will either have to replace it by a better one or do some tailoring of the
programs. If you encounter any other difficulties, please report them to me at
<maavl@math.univ-poitiers.fr>. If you do need to make changes to common.c,
common.h, or ctangle.c, don't forget to write them down, since they will have
to be applied at the proper places in common.w, ctangle.w, or common.inc in
order to persist after bootstrapping. Such patches are best incorporated into
a change file (e.g., ctangle.ch) as explained in the manual.

Marc van Leeuwen
Universit\'e de Poitiers
maavl@math.univ-poitiers.fr
http://www-math.univ-poitiers.fr/~maavl/