Skip to content

Commit

Permalink
The CWEB System of Structured Documentation by Knuth and Levy
Browse files Browse the repository at this point in the history
This commit brings vanilla files from the original archive with no changes.
  • Loading branch information
wkoszek committed Aug 18, 2015
1 parent ee9ded1 commit d33b6ba
Show file tree
Hide file tree
Showing 59 changed files with 22,316 additions and 0 deletions.
195 changes: 195 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# This file is part of CWEB.
# It is distributed WITHOUT ANY WARRANTY, express or implied.
# Version 3.64 --- February 2002

# Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth

# Permission is granted to make and distribute verbatim copies of this
# document provided that the copyright notice and this permission notice
# are preserved on all copies.

# Permission is granted to copy and distribute modified versions of this
# document under the conditions for verbatim copying, provided that the
# entire resulting derived work is given a different name and distributed
# under the terms of a permission notice identical to this one.

#
# Read the README file, then edit this file to reflect local conditions
#

# directory for TeX inputs (cwebmac.tex goes here)
MACROSDIR= /usr/share/texmf/tex/generic

# directory for CWEB inputs in @i files
CWEBINPUTS= /usr/local/lib/cweb

# extension for manual pages ("l" distinguishes local from system stuff)
MANEXT= l
#MANEXT= 1

# directory for manual pages (cweb.1 goes here)
MANDIR= /usr/share/man/man$(MANEXT)

# destination directory for executables; must end in /
DESTDIR= /usr/local/bin/

# directory for GNU EMACS Lisp code (cweb.el goes here)
EMACSDIR= /usr/share/emacs/site-lisp

# Set DESTPREF to null if you want to call the executables "tangle" and "weave"
# (probably NOT a good idea; we recommend leaving DESTPREF=c)
DESTPREF=c

# Set CCHANGES to comm-foo.ch if you need changes to common.w
CCHANGES=

# Set TCHANGES to ctang-foo.ch if you need changes to ctangle.w
TCHANGES=

# Set WCHANGES to cweav-foo.ch if you need changes to cweave.w
WCHANGES=

# We keep debugging info around, for fun, but most users don't need it
CFLAGS = -g
#CFLAGS = -O
LINKFLAGS = -g
#LINKFLAGS = -s # for smaller (stripped) executables on many UNIX systems

# What C compiler are you using?
CC = cc

# RM and CP are used below in case rm and cp are aliased
RM= /bin/rm
CP= /bin/cp

# uncomment the second line if you use pdftex to bypass .dvi files
PDFTEX = dvipdfm
#PDFTEX = pdftex

########## You shouldn't have to change anything after this point #######

CWEAVE = ./cweave
CTANGLE = ./ctangle
SOURCES = cweave.w common.w ctangle.w
ALL = common.w ctangle.w cweave.w prod.w \
Makefile common.c common.h ctangle.c \
cwebman.tex cwebmac.tex comm-vms.ch ctang-vms.ch \
cweav-vms.ch comm-man.ch ctang-man.ch cweav-man.ch \
comm-pc.ch ctang-pc.ch cweav-pc.ch comm-amiga.ch \
comm-bs.ch ctang-bs.ch cweav-bs.ch makefile.bs \
comm-ql.ch ctang-ql.ch cweav-ql.ch readme.ql \
comm-w32.ch ctang-w32.ch cweav-w32.ch \
comm-os2.ch comm-mac.ch cweb.1 cweb.el c++lib.w README

.SUFFIXES: .dvi .tex .w .pdf

.w.tex:
$(CWEAVE) $*

.tex.dvi:
tex $<

.w.dvi:
make $*.tex
make $*.dvi

.w.c:
$(CTANGLE) $*

.w.o:
make $*.c
make $*.o

.w.pdf:
make $*.tex
case "$(PDFTEX)" in \
dvipdfm ) tex "\let\pdf+ \input $*"; dvipdfm $* ;; \
pdftex ) pdftex $* ;; \
esac

all: ctangle cweave

cautiously: ctangle
$(CP) common.c SAVEcommon.c
./ctangle common $(CCHANGES)
diff common.c SAVEcommon.c
$(RM) SAVEcommon.c
$(CP) ctangle.c SAVEctangle.c
./ctangle ctangle $(TCHANGES)
diff ctangle.c SAVEctangle.c
$(RM) SAVEctangle.c

SAVEctangle.c:
$(CP) ctangle.c SAVEctangle.c

SAVEcommon.c:
$(CP) common.c SAVEcommon.c

common.c: common.w $(CCHANGES)
$(CTANGLE) common $(CCHANGES)

common.o: common.c
$(CC) $(CFLAGS) -DCWEBINPUTS=\"$(CWEBINPUTS)\" -c common.c

ctangle: ctangle.o common.o
$(CC) $(LINKFLAGS) -o ctangle ctangle.o common.o

ctangle.c: ctangle.w $(TCHANGES)
$(CTANGLE) ctangle $(TCHANGES)

cweave: cweave.o common.o
$(CC) $(LINKFLAGS) -o cweave cweave.o common.o

cweave.c: cweave.w $(WCHANGES)
$(CTANGLE) cweave $(WCHANGES)

doc: $(SOURCES:.w=.dvi)

usermanual: cwebman.tex cwebmac.tex
tex cwebman

fullmanual: usermanual $(SOURCES) comm-man.ch ctang-man.ch cweav-man.ch
make cweave
./cweave common.w comm-man.ch
tex common.tex
./cweave ctangle.w ctang-man.ch
tex ctangle.tex
./cweave cweave.w cweav-man.ch
tex cweave.tex

# be sure to leave ctangle.c and common.c for bootstrapping
clean:
$(RM) -f -r *~ *.o common.tex cweave.tex cweave.c ctangle.tex \
*.log *.dvi *.toc *.idx *.scn *.pdf core cweave ctangle

install: all
- mkdir $(DESTDIR)
$(CP) cweave $(DESTDIR)$(DESTPREF)weave
chmod 755 $(DESTDIR)$(DESTPREF)weave
$(CP) ctangle $(DESTDIR)$(DESTPREF)tangle
chmod 755 $(DESTDIR)$(DESTPREF)tangle
- mkdir $(MANDIR)
$(CP) cweb.1 $(MANDIR)/cweb.$(MANEXT)
chmod 644 $(MANDIR)/cweb.$(MANEXT)
- mkdir $(MACROSDIR)
$(CP) cwebmac.tex $(MACROSDIR)
chmod 644 $(MACROSDIR)/cwebmac.tex
- mkdir $(EMACSDIR)
$(CP) cweb.el $(EMACSDIR)
chmod 644 $(EMACSDIR)/cweb.el
- mkdir $(CWEBINPUTS)
$(CP) c++lib.w $(CWEBINPUTS)
chmod 644 $(CWEBINPUTS)/c++lib.w

floppy: $(ALL) examples
bar cvhf /dev/rfd0 $(ALL) examples
bar tvf /dev/rfd0
eject

tags: $(ALL)
etags -lnone $(ALL)

tarfile: $(ALL) examples
tar cvhf /tmp/cweb.tar $(ALL) examples
gzip -9 /tmp/cweb.tar

98 changes: 98 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
% This file is part of CWEB.
% The CWEB programs by Silvio Levy are based on programs by D. E. Knuth.
% They are distributed WITHOUT ANY WARRANTY, express or implied.
% This README file last updated May 2000 by Don Knuth

% Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth

% Permission is granted to make and distribute verbatim copies of this
% document provided that the copyright notice and this permission notice
% are preserved on all copies.

% Permission is granted to copy and distribute modified versions of this
% document under the conditions for verbatim copying, provided that the
% entire resulting derived work is given a different name and distributed
% under the terms of a permission notice identical to this one.

% Please send comments, suggestions, etc. to levy@math.berkeley.edu.

This directory contains the following files:

Makefile
README
comm-amiga.ch
comm-bs.ch
comm-mac.ch
comm-man.ch
comm-pc.ch
comm-ql.ch
comm-vms.ch
comm-w32.ch
common.c
common.h
common.w
ctang-bs.ch
ctang-man.ch
ctang-pc.ch
ctang-ql.ch
ctang-vms.ch
ctang-w32.ch
ctangle.c
ctangle.w
cweav-bs.ch
cweav-man.ch
cweav-pc.ch
cweav-ql.ch
cweav-vms.ch
cweave-w32.ch
cweave.w
cweb.1
cweb.el
cwebmac.tex
cwebman.tex
examples/
makefile.bs
prod.w
readme.ql
c++lib.w

The file cwebman.tex is the user manual.
The examples directory contains additional examples of the use of CWEB.
The files common.c and ctangle.c are used for bootstrapping.
The file cweb.1 is a manual page.
The file cweb.el is suggested for GNU-Emacs users.
The file c++lib.w is for C++ users (say `@i c++lib.w' at beginning of program).
The files *-man.ch are used if you want to make the full 239-page CWEB manual.
The files *-bs.ch are used instead of *-pc.ch if you are doing BIG programs.
You can use makefile.bs to make CWEB with *-bs.ch.
The files *-ql.ch are for QDOS/SMSQ systems; see readme.ql for further info.
The files *-w32.ch use __fastcall conventions on win32 systems.
The file comm-mac.ch is for Macintosh conventions.
The other files named *.ch are sample change files for local customization.

IMPORTANT: Please touch *.c before proceeding.
Then edit the opening lines of Makefile so that it has the proper
directory information for your local system.

To make ctangle and cweave say `make all'; this should produce roughly
the following actions (possibly with harmless warning messages from cc):

cc -g -w -c ctangle.c
cc -g -w -DCWEBINPUTS=\"/usr/local/lib/cweb\" -c common.c
cc -g -o ctangle ctangle.o common.o
./ctangle cweave
cc -g -w -c cweave.c
cc -g -w -o cweave cweave.o common.o

To get some reassurance that things are OK, you can say `make cautiously',
which ensures that CTANGLE will reproduce itself. (Otherwise the source
files common.w and ctangle.w won't actually have been used.)

To install cweave and ctangle say `make install'. You probably need to
be superuser to do this; but it's wise to `make all' first, BEFORE
becoming superuser and saying `make install'.

Note that change files for VMS, AMIGA, MAC, and PCs are provided. When you
are first bootstrapping to a new system, you may need to edit common.c and
ctangle.c by hand, but the vast majority of the change-file changes are
minor refinements that are not necessary for a rudimentary ctangle.
85 changes: 85 additions & 0 deletions c++lib.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@q This file defines standard C++ namespaces and classes @>
@q Please send corrections to saroj-tamasa@@worldnet.att.net @>
@s std int
@s rel_ops int
@s bitset int
@s char_traits int
@s deque int
@s list int
@s map int
@s multimap int
@s multiset int
@s pair int
@s set int
@s stack int
@s exception int
@s logic_error int
@s runtime_error int
@s domain_error int
@s invalid_argument int
@s length_error int
@s out_of_range int
@s range_error int
@s overflow_error int
@s underflow_error int
@s back_insert_iterator int
@s front_insert_iterator int
@s insert_iterator int
@s reverse_iterator int
@s istream_iterator int
@s ostream_iterator int
@s istreambuf_iterator int
@s ostreambuf_iterator int
@s iterator_traits int
@s queue int
@s vector int
@s basic_string int
@s string int
@s auto_ptr int
@s valarray int
@s ios_base int
@s basic_ios int
@s basic_streambuf int
@s basic_istream int
@s basic_ostream int
@s basic_iostream int
@s basic_stringbuf int
@s basic_istringstream int
@s basic_ostringstream int
@s basic_stringstream int
@s basic_filebuf int
@s basic_ifstream int
@s basic_ofstream int
@s basic_fstream int
@s ctype int
@s collate int
@s collate_byname int
@s streambuf int
@s istream int
@s ostream int
@s iostream int
@s stringbuf int
@s istringstream int
@s ostringstream int
@s stringstream int
@s filebuf int
@s ifstream int
@s ofstream int
@s fstream int
@s wstreambuf int
@s wistream int
@s wostream int
@s wiostram int
@s wstringbuf int
@s wistringstream int
@s wostringstream int
@s wstringstream int
@s wfilebuf int
@s wifstream int
@s wofstream int
@s wfstream int
@s streamoff int
@s streamsize int
@s fpos int
@s streampos int
@s wstreampos int
17 changes: 17 additions & 0 deletions comm-amiga.ch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This is the change file for CWEB's COMMON on the Amiga
(Contributed by Tomas Rokicki, June 1993)
With Lattice C 5.1, use compilation switches -b0 -r0, and ignore the
compiler warnings. With SAS 6.0, use compilation switches Code=far Data=far.
@x section 69
An omitted change file argument means that |"/dev/null"| should be used,
@y
An omitted change file argument means that |"nil:"| should be used,
@z
@x section 70
if (found_change<=0) strcpy(change_file_name,"/dev/null");
@y
if (found_change<=0) strcpy(change_file_name,"nil:");
@z
Loading

0 comments on commit d33b6ba

Please sign in to comment.