Skip to content

Commit

Permalink
CWEB - release 4.3.1, 2021-05-03.
Browse files Browse the repository at this point in the history
This release is almost the same as CWEB 4.3, but

* it fixes the indexing bug in CWEAVE/CTWILL that git retracted
* it adds a few more changes from the CWEB 4.4 development branch
  • Loading branch information
ascherer committed May 3, 2021
1 parent d144765 commit f6c8f2d
Show file tree
Hide file tree
Showing 38 changed files with 1,804 additions and 1,098 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[Git-archive]
.gitattributes export-ignore
README.md export-ignore
my-changes.md export-ignore
testthings.w export-ignore
indentation.w export-ignore
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of CWEB.
# It is distributed WITHOUT ANY WARRANTY, express or implied.
# Version 4.2 --- February 2021
# Version 4.3 --- May 2021

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

Expand Down Expand Up @@ -74,14 +74,14 @@ 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 \
Makefile README 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
comm-os2.ch comm-mac.ch cweb.1 cweb.el c++lib.w iso_types.w

.SUFFIXES: .dvi .tex .w .pdf

Expand Down Expand Up @@ -183,6 +183,8 @@ install: all
- mkdir $(CWEBINPUTS)
$(CP) c++lib.w $(CWEBINPUTS)
chmod 644 $(CWEBINPUTS)/c++lib.w
$(CP) iso_types.w $(CWEBINPUTS)
chmod 644 $(CWEBINPUTS)/iso_types.w

floppy: $(ALL) examples
bar cvhf /dev/rfd0 $(ALL) examples
Expand Down
8 changes: 5 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% 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 February 2021 by Andreas Scherer
% This README file last updated May 2021 by Andreas Scherer

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

Expand Down Expand Up @@ -66,14 +66,16 @@ makefile.bs
prod.w
readme.ql
c++lib.w
iso_types.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 240-page CWEB manual.
The files c++lib.w and iso_types.w are for C++ users (say `@i c++lib.w'
and/or `@i iso_types.w' at beginning of program).
The files *-man.ch are used if you want to make the full 243-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.
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
# cweb 4.2
# cweb 4.3

people have been accumulating several decades of experience with
[cweb](http://www-cs-faculty.stanford.edu/~uno/cweb.html), and we know that
ctangle and cweave work reasonably well on numerous platforms. in general those
programs are now entirely stable: don knuth won't be changing them any more,
because they've proved their value in extensive use. (henceforth he must
devote full time to the art of computer programming!)
devote full time to
[the art of computer programming](https://www-cs-faculty.stanford.edu/~knuth/taocp.html)!)

however, further significant developments, including versions that don himself
does not maintain, are ongoing. all of the really current news about cweb is,
in fact, now to be found in this cweb development project.
in fact, now to be found in this cweb development project. Check out the
details in the
[releases description](https://github.com/ascherer/cweb/releases).

# software archæology

besides for further development, this ‘project’ is used as an – obviously
incomplete – repository of original release versions of levy/knuth
[cweb](http://www-cs-faculty.stanford.edu/~uno/cweb.html). you can either
compile these sources directly or stick the recent version “cweb-4.2” into my
compile these sources directly or stick the recent version “cweb-4.3” into my
[cwebbin](https://github.com/ascherer/cwebbin), which introduces convenient
extensions and prepares cweb for inclusion in the “tex live” distribution.

Expand Down
2 changes: 1 addition & 1 deletion comm-amiga.ch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ An omitted change file argument means that |"/dev/null"| should be used,
An omitted change file argument means that |"nil:"| should be used,
@z
@x section 76
@x section 75
strcpy(change_file_name,"/dev/null");
@y
strcpy(change_file_name,"nil:");
Expand Down
34 changes: 17 additions & 17 deletions comm-bs.ch
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ by using "huge" pointers.
(Update attempt by Andreas Scherer, 31 Jan 2021. Good luck!)


@x Section 6.
@x Section 9.
for section names */

@<Common code...@>=
Expand Down Expand Up @@ -50,7 +50,7 @@ typedef struct name_info {
union {
void huge* equiv_member;
void huge* xref_member;
} ptr_union; /* info corresponding to names */
} ptr_union; /* info corresponding to names */
} name_info; /* contains information about an identifier or section name */
typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
typedef name_pointer *hash_pointer;
Expand Down Expand Up @@ -136,23 +136,23 @@ name_pointer p)

@x Section 57.
static name_pointer
add_section_name(@t\1\1@> /* install a new node in the tree */
add_section_name( /* install a new node in the tree */
name_pointer par, /* parent of new node */
int c, /* right or left? */
char *first, /* first character of section name */
char *last, /* last character of section name, plus one */
int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
boolean ispref) /* are we adding a prefix or a full name? */
{
name_pointer p=name_ptr; /* new node */
char *s=first_chunk(p);
@y
static name_pointer
add_section_name(@t\1\1@> /* install a new node in the tree */
add_section_name( /* install a new node in the tree */
name_pointer par, /* parent of new node */
int c, /* right or left? */
char huge* first, /* first character of section name */
char huge* last, /* last character of section name, plus one */
int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
boolean ispref) /* are we adding a prefix or a full name? */
{
name_pointer p=name_ptr; /* new node */
char huge* s=first_chunk(p);
Expand All @@ -161,39 +161,39 @@ int ispref@t\2\2@>) /* are we adding a prefix or a full name? */

@x Section 58.
static void
extend_section_name(@t\1\1@>
extend_section_name(
name_pointer p, /* name to be extended */
char *first, /* beginning of extension text */
char *last, /* one beyond end of extension text */
int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
boolean ispref) /* are we adding a prefix or a full name? */
{
char *s;
@y
static void
extend_section_name(@t\1\1@>
extend_section_name(
name_pointer p, /* name to be extended */
char huge* first, /* beginning of extension text */
char huge* last, /* one beyond end of extension text */
int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
boolean ispref) /* are we adding a prefix or a full name? */
{
char huge* s;
@z


@x Section 64.
static int section_name_cmp(@t\1\1@>
@x Section 63.
static int section_name_cmp(
char **pfirst, /* pointer to beginning of comparison string */
int len, /* length of string */
name_pointer r@t\2\2@>) /* section name being compared */
name_pointer r) /* section name being compared */
{
char *first=*pfirst; /* beginning of comparison string */
name_pointer q=r+1; /* access to subsequent chunks */
char *ss, *s=first_chunk(r);
@y
static int section_name_cmp(@t\1\1@>
static int section_name_cmp(
char huge** pfirst, /* pointer to beginning of comparison string */
int len, /* length of string */
name_pointer r@t\2\2@>) /* section name being compared */
name_pointer r) /* section name being compared */
{
char huge* first=*pfirst; /* beginning of comparison string */
name_pointer q=r+1; /* access to subsequent chunks */
Expand All @@ -208,14 +208,14 @@ An omitted change file argument means that |"NUL"| should be used,
@z


@x Section 76.
@x Section 75.
strcpy(change_file_name,"/dev/null");
@y
strcpy(change_file_name,"NUL");
@z


@x Section 76.
@x Section 75.
else if (*s=='/') dot_pos=NULL,name_pos=++s;
@y
else if (*s == ':' || *s == '\\' || *s == '/')
Expand Down
49 changes: 21 additions & 28 deletions comm-mac.ch
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,32 @@ No changes to CTANGLE or CWEAVE are needed.
(Contributed 13 Oct 2000 by [email protected]; slightly edited by Don Knuth)
@x in limbo, change the title page document to specify Mac version
\centerline{(Version 4.2)}
\centerline{(Version 4.3)}
@y
\centerline{(Version 4.2 for MacOS)}
\centerline{(Version 4.3 for MacOS)}
@z
@x sections 23/24: Make input_ln accept \n, \r, \n\r, or \r\n as line endings
@x section 23: Make input_ln accept \n, \r, \n\r, or \r\n as line endings
@ In the unlikely event that your standard I/O library does not
support |feof|, |getc|, and |ungetc| you may have to change things here.
@^system dependencies@>
@<Predecl...@>=
static boolean input_ln(FILE *);@/
@ @c
static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns |false| */
FILE *fp@t\2\2@>) /* what file to read from */
@c
static boolean input_ln( /* copies a line into |buffer| or returns |false| */
FILE *fp) /* what file to read from */
{
register int c=EOF; /* character read; initialized so some compilers won't complain */
register char *k; /* where next character goes */
if (feof(fp)) return false; /* we have hit end-of-file */
limit = k = buffer; /* beginning of buffer */
register int c=EOF; /* character read; initialized so some compilers won't complain */
register char *k; /* where next character goes */
if (feof(fp)) return false; /* we have hit end-of-file */
limit = k = buffer; /* beginning of buffer */
while (k<=buffer_end && (c=getc(fp)) != EOF && c!='\n')
if ((*(k++) = c) != ' ') limit = k;
if (k>buffer_end)
if ((c=getc(fp))!=EOF && c!='\n') {
ungetc(c,fp); loc=buffer; err_print("! Input line too long");
@.Input line too long@>
}
if (c==EOF && limit==buffer) return false; /* there was nothing after
if (c==EOF && limit==buffer) return false; /* there was nothing after
the last newline */
return true;
}
Expand All @@ -45,17 +42,14 @@ line endings, so that \.{CWEB} will works with ASCII files stored in
\UNIX/, {\mc DOS} or {\mc MAC} format.
@^system dependencies@>

@<Predecl...@>=
static boolean input_ln(FILE *);@/

@ @c
static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns |false| */
FILE *fp@t\2\2@>) /* what file to read from */
@c
static boolean input_ln( /* copies a line into |buffer| or returns |false| */
FILE *fp) /* what file to read from */
{
register int c=EOF; /* character read; initialized so some compilers won't complain */
register char *k; /* where next character goes */
if (feof(fp)) return false; /* we have hit end-of-file */
limit = k = buffer; /* beginning of buffer */
register char *k; /* where next character goes */
if (feof(fp)) return false; /* we have hit end-of-file */
limit = k = buffer; /* beginning of buffer */
while (true) {
c = getc(fp);
if (c==EOF) return limit!=buffer; /* |false|, if there was nothing after
Expand All @@ -77,7 +71,7 @@ FILE *fp@t\2\2@>) /* what file to read from */
}
@z

@x section 28, simply return if no change file was specified
@x section 27, simply return if no change file was specified
change_limit=change_buffer; /* this value is used if the change file ends */
@<Skip over comment lines in the change file; |return| if end of file@>@;
@y
Expand Down Expand Up @@ -121,20 +115,19 @@ An omitted change file argument means that |"/dev/null"| should be used,
@y
An omitted change file argument means that no change file should be used,
@z

@x section 76, make change file name empty when it is unspecified
@x section 75, make change file name empty when it is unspecified
strcpy(change_file_name,"/dev/null");
@y
change_file_name[0]='\0'; /* empty string */
@z
@x section 76, use the Metrowerks |ccommand| to access command lines
@x section 75, use the Metrowerks |ccommand| to access command lines
while (--argc > 0) {
@y
argc = ccommand (&argv); /* use Mac interface to command line */
@^system dependencies@>
while (--argc > 0) {
@z
@x section 76, use the path separator constant
@x section 75, use the path separator constant
else if (*s=='/') dot_pos=NULL,name_pos=++s;
@y
else if (*s==PATH_SEP) dot_pos=NULL,name_pos=++s;
Expand Down
4 changes: 2 additions & 2 deletions comm-os2.ch
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ An omitted change file argument means that |"/dev/null"| should be used,
An omitted change file argument means that |"NUL"| should be used,
@z
@x section 76
@x section 75
strcpy(change_file_name,"/dev/null");
@y
strcpy(change_file_name,"NUL");
@z
@x section 76 (this change copied from comm-pc.ch)
@x section 75 (this change copied from comm-pc.ch)
else if (*s=='/') dot_pos=NULL,name_pos=++s;
@y
else if (*s == ':' || *s == '\\' || *s == '/')
Expand Down
4 changes: 2 additions & 2 deletions comm-pc.ch
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ An omitted change file argument means that |"/dev/null"| should be used,
An omitted change file argument means that |"NUL"| should be used,
@z
@x section 76
@x section 75
strcpy(change_file_name,"/dev/null");
@y
strcpy(change_file_name,"NUL");
@z
@x section 76 (this change copied from comm-bs.ch, July 94)
@x section 75 (this change copied from comm-bs.ch, July 94)
else if (*s=='/') dot_pos=NULL,name_pos=++s;
@y
else if (*s == ':' || *s == '\\' || *s == '/')
Expand Down
8 changes: 4 additions & 4 deletions comm-ql.ch
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ ex <dev_>cc;'-v -h -c -=500000 -DCWEBINPUTS=flp2_ common_c'
@x
\def\v{\char'174} % vertical (|) in typewriter font

\def\title{Common code for CTANGLE and CWEAVE (Version 4.2)}
\def\title{Common code for CTANGLE and CWEAVE (Version 4.3)}
\def\topofcontents{\null\vfill
\centerline{\titlefont Common code for {\ttitlefont CTANGLE} and
{\ttitlefont CWEAVE}}
\vskip 15pt
\centerline{(Version 4.2)}
\centerline{(Version 4.3)}
\vfill}
\def\botofcontents{\vfill
\noindent
@y
\def\v{\char'174} % vertical (|) in typewriter font
\def\title{Common code for CTANGLE and CWEAVE (QL Version 4.2)}
\def\title{Common code for CTANGLE and CWEAVE (QL Version 4.3)}
\def\topofcontents{\null\vfill
\centerline{\titlefont Common code for {\ttitlefont CTANGLE} and
{\ttitlefont CWEAVE}}
\vskip 15pt
\centerline{(Version 4.2)}
\centerline{(Version 4.3)}
\vfill}
\def\botofcontents{\vfill
\noindent
Expand Down
Loading

0 comments on commit f6c8f2d

Please sign in to comment.