summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/comm-bs.ch
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2021-02-07 11:02:17 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2021-02-07 11:02:17 +0000
commit3063cfbe5a32a13420a310bad225be72bcde4982 (patch)
tree01cdd5b69339785bc339eeaa5ec8e5e0dc7e29d0 /Build/source/texk/web2c/cwebdir/comm-bs.ch
parent1842aa2477fe04aa641c9332262e21b78c4e50ed (diff)
CWEB – release 4.0, 2021-02-07.
In the course of the "2021 TeX tuneup", Don Knuth kindly transferred the responsibility for CWEB to me; see the original CWEB home page (https://www-cs-faculty.stanford.edu/~knuth/cweb.html), section "CWEB 4.0" and the updated CWEB development project (https://github.com/ascherer/cweb). This first new release draws heavily on the multi-decade work collected in my "CWEBbin" project (https://github.com/ascherer/cwebbin). I moved (almost) all stuff from the "*-patch.*" changefiles into the new CWEB sources and applied all of the "*-ansi.*" changes as well. Moreover, I made "common.h" the full interface of "common.w" in order to avoid code redundancy. And I tried to fix as many of the bugs reported by email to DEK and/or tex-k@tug.org. In total, "make; make cautiously; make fullmanual" runs flawlessly with GCC on Linux and with LLVM on MacOS. After the release of "CWEB 4.0", also "CWEBbin 2021" has also been fully revised. Thousands of lines of changefiles could be purged. What's left are the clearcut extensions for CWEB and the additional stuff for integration in "TeX Live 2021". git-svn-id: svn://tug.org/texlive/trunk@57658 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/comm-bs.ch')
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-bs.ch210
1 files changed, 102 insertions, 108 deletions
diff --git a/Build/source/texk/web2c/cwebdir/comm-bs.ch b/Build/source/texk/web2c/cwebdir/comm-bs.ch
index 26f79b160d1..1e65f4334c6 100644
--- a/Build/source/texk/web2c/cwebdir/comm-bs.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-bs.ch
@@ -12,55 +12,68 @@ by using "huge" pointers.
(This file contributed by Barry Schwartz, trashman@crud.mn.org, 28 Jun 94;
revised 24 Jul 94.)
+(Update attempt by Andreas Scherer, 31 Jan 2021. Good luck!)
-@x Section 23.
- cur_file_name[l]='/'; /* \UNIX/ pathname separator */
-@y
- cur_file_name[l]='/'; /* A valid {\mc MSDOS} pathname separator */
-@z
+@x Section 6.
+@d chunk_marker 0
-@x Section 27.
-@d max_names 4000 /* number of identifiers, strings, section names;
- must be less than 10240 */
-
-@<Definitions that...@>=
+@<Common code...@>=
typedef struct name_info {
char *byte_start; /* beginning of the name in |byte_mem| */
- @<More elements of |name_info| structure@>@;
+ struct name_info *link;
+ union {
+ struct name_info *Rlink; /* right link in binary search tree for section
+ names */
+ char Ilk; /* used by identifiers in \.{CWEAVE} only */
+ } dummy;
+ void *equiv_or_xref; /* 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 */
-char byte_mem[max_bytes]; /* characters of names */
-char *byte_mem_end = byte_mem+max_bytes-1; /* end of |byte_mem| */
-name_info name_dir[max_names]; /* information about names */
-name_pointer name_dir_end = name_dir+max_names-1; /* end of |name_dir| */
+typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
+typedef name_pointer *hash_pointer;
+extern char byte_mem[]; /* characters of names */
+extern char *byte_mem_end; /* end of |byte_mem| */
@y
-@d max_names 4000 /* number of identifiers, strings, section names;
- must be less than 10240 */
+@d chunk_marker 0
@f huge extern
-@<Definitions that...@>=
+@<Common code...@>=
typedef struct name_info {
char huge* byte_start; /* beginning of the name in |byte_mem| */
- @<More elements of |name_info| structure@>@;
+ struct name_info *link;
+ union {
+ struct name_info *Rlink; /* right link in binary search tree for section
+ names */
+ char Ilk; /* used by identifiers in \.{CWEAVE} only */
+ } dummy;
+ union {
+ void huge* equiv_member;
+ void huge* xref_member;
+ } 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 */
-char huge byte_mem[max_bytes]; /* characters of names */
-char huge* byte_mem_end; /* end of |byte_mem| */
-name_info name_dir[max_names]; /* information about names */
-name_pointer name_dir_end = name_dir+max_names-1;
+typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
+typedef name_pointer *hash_pointer;
+extern char huge byte_mem[]; /* characters of names */
+extern char huge* byte_mem_end; /* end of |byte_mem| */
+@z
+
+
+@x Section 39.
+ cur_file_name[l]='/'; /* \UNIX/ pathname separator */
+@y
+ cur_file_name[l]='/'; /* A valid {\mc MSDOS} pathname separator */
@z
-@x Section 29.
+@x Section 44.
char *byte_ptr; /* first unused position in |byte_mem| */
@y
char huge* byte_ptr; /* first unused position in |byte_mem| */
@z
-@x Section 30.
+@x Section 45.
@ @<Init...@>=
name_dir->byte_start=byte_ptr=byte_mem; /* position zero in both arrays */
name_ptr=name_dir+1; /* |name_dir[0]| will be used only for error recovery */
@@ -74,156 +87,137 @@ byte_mem_end = byte_mem+max_bytes-1;
@z
-@x Section 42.
+@x Section 52.
void
-print_section_name(p)
-name_pointer p;
+print_section_name(
+name_pointer p)
{
char *ss, *s = first_chunk(p);
@y
void
-print_section_name(p)
-name_pointer p;
+print_section_name(
+name_pointer p)
{
char huge* ss, huge* s = first_chunk(p);
@z
-@x Section 43.
+@x Section 53.
void
-sprint_section_name(dest,p)
- char*dest;
- name_pointer p;
+sprint_section_name(
+ char *dest,
+ name_pointer p)
{
char *ss, *s = first_chunk(p);
@y
void
-sprint_section_name(dest,p)
- char*dest;
- name_pointer p;
+sprint_section_name(
+ char huge* dest,
+ name_pointer p)
{
char huge* ss, huge* s = first_chunk(p);
@z
-@x Section 44.
+@x Section 54.
void
-print_prefix_name(p)
-name_pointer p;
+print_prefix_name(
+name_pointer p)
{
char *s = first_chunk(p);
@y
void
-print_prefix_name(p)
-name_pointer p;
+print_prefix_name(
+name_pointer p)
{
char huge* s = first_chunk(p);
@z
-@x Section 47.
-name_pointer
-add_section_name(par,c,first,last,ispref) /* 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; /* are we adding a prefix or a full name? */
+@x Section 57.
+static name_pointer
+add_section_name(@t\1\1@> /* 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? */
{
name_pointer p=name_ptr; /* new node */
char *s=first_chunk(p);
@y
-name_pointer
-add_section_name(par,c,first,last,ispref) /* 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; /* are we adding a prefix or a full name? */
+static name_pointer
+add_section_name(@t\1\1@> /* 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? */
{
name_pointer p=name_ptr; /* new node */
char huge* s=first_chunk(p);
@z
-@x Section 48.
-void
-extend_section_name(p,first,last,ispref)
-name_pointer p; /* name to be extended */
-char *first; /* beginning of extension text */
-char *last; /* one beyond end of extension text */
-int ispref; /* are we adding a prefix or a full name? */
+@x Section 58.
+static void
+extend_section_name(@t\1\1@>
+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? */
{
char *s;
@y
-void
-extend_section_name(p,first,last,ispref)
-name_pointer p; /* name to be extended */
-char *first; /* beginning of extension text */
-char *last; /* one beyond end of extension text */
-int ispref; /* are we adding a prefix or a full name? */
+static void
+extend_section_name(@t\1\1@>
+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? */
{
char huge* s;
@z
-@x Section 54.
-int section_name_cmp(pfirst,len,r)
-char **pfirst; /* pointer to beginning of comparison string */
-int len; /* length of string */
-name_pointer r; /* section name being compared */
+@x Section 64.
+static int section_name_cmp(@t\1\1@>
+char **pfirst, /* pointer to beginning of comparison string */
+int len, /* length of string */
+name_pointer r@t\2\2@>) /* 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
-int section_name_cmp(pfirst,len,r)
-char **pfirst; /* pointer to beginning of comparison string */
-int len; /* length of string */
-name_pointer r; /* section name being compared */
+static int section_name_cmp(@t\1\1@>
+char huge** pfirst, /* pointer to beginning of comparison string */
+int len, /* length of string */
+name_pointer r@t\2\2@>) /* section name being compared */
{
- char *first=*pfirst; /* beginning of comparison string */
+ char huge* first=*pfirst; /* beginning of comparison string */
name_pointer q=r+1; /* access to subsequent chunks */
char huge* ss, huge* s=first_chunk(r);
@z
-@x Section 55.
-source files, respectively; here we just declare a common field
-|equiv_or_xref| as a pointer to a |char|.
-
-@<More elements of |name...@>=
-char *equiv_or_xref; /* info corresponding to names */
+@x Section 75.
+An omitted change file argument means that |"/dev/null"| should be used,
@y
-source files, respectively. Here we just declare a common field
-|ptr_union| as a union of pointers to |char|, which happen to have
-different addressing attributes.
-
-@<More elements of |name...@>=
-union {
- char *equiv_member;
- char huge* xref_member;
-} ptr_union; /* info corresponding to names */
+An omitted change file argument means that |"NUL"| should be used,
@z
-@x Section 69.
-An omitted change file argument means that |"/dev/null"| should be used,
+@x Section 76.
+ strcpy(change_file_name,"/dev/null");
@y
-An omitted change file argument means that |"NUL"| should be used,
+ strcpy(change_file_name,"NUL");
@z
-@x Section 70.
+@x Section 76.
else if (*s=='/') dot_pos=NULL,name_pos=++s;
@y
else if (*s == ':' || *s == '\\' || *s == '/')
dot_pos=NULL,name_pos=++s;
@z
-
-
-@x Section 70.
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
-@y
- if (found_change<=0) strcpy(change_file_name,"NUL");
-@z