summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/comm-bs.ch
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
committerKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
commitad547a6b5986815fda458221149728d9d9ab1d87 (patch)
tree16296910eb3eca724371474ea9aea3994dc69614 /Build/source/texk/web2c/cwebdir/comm-bs.ch
parent947b43de3dd21d58ccc2ffadefc4441ea1c2a813 (diff)
restore Build,TODO from r57911
git-svn-id: svn://tug.org/texlive/trunk@57915 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.ch223
1 files changed, 223 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/cwebdir/comm-bs.ch b/Build/source/texk/web2c/cwebdir/comm-bs.ch
new file mode 100644
index 00000000000..b01b86799d7
--- /dev/null
+++ b/Build/source/texk/web2c/cwebdir/comm-bs.ch
@@ -0,0 +1,223 @@
+Changes for code common to CTANGLE and CWEAVE, for MSDOS
+and Borland C++ 3.1 using the following options (and perhaps others):
+
+ -mc -w-pro -Ff=5000 -Z- -O-p
+
+The options -Z- and -O-p explicitly turn off optimizations that seem to be
+dangerous for the style of code in the CWEB sources. (See makefile.bs.)
+
+The main purpose of these changes is to support MSDOS with full-size arrays
+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 6.
+ for section names */
+
+@<Common code...@>=
+typedef struct name_info {
+ char *byte_start; /* beginning of the name in |byte_mem| */
+ 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 */
+typedef name_pointer *hash_pointer;
+extern char byte_mem[]; /* characters of names */
+extern char *byte_mem_end; /* end of |byte_mem| */
+@y
+ for section names */
+
+@f huge extern
+
+@<Common code...@>=
+typedef struct name_info {
+ char huge* byte_start; /* beginning of the name in |byte_mem| */
+ 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 */
+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 44.
+char *byte_ptr; /* first unused position in |byte_mem| */
+@y
+char huge* byte_ptr; /* first unused position in |byte_mem| */
+@z
+
+
+@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 */
+name_ptr->byte_start=byte_mem; /* this makes name 0 of length zero */
+@y
+@ @<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 */
+name_ptr->byte_start=byte_mem; /* this makes name 0 of length zero */
+byte_mem_end = byte_mem+max_bytes-1;
+@z
+
+
+@x Section 52.
+void
+print_section_name(
+name_pointer p)
+{
+ char *ss, *s = first_chunk(p);
+@y
+void
+print_section_name(
+name_pointer p)
+{
+ char huge* ss, huge* s = first_chunk(p);
+@z
+
+
+@x Section 53.
+void
+sprint_section_name(
+ char *dest,
+ name_pointer p)
+{
+ char *ss, *s = first_chunk(p);
+@y
+void
+sprint_section_name(
+ char huge* dest,
+ name_pointer p)
+{
+ char huge* ss, huge* s = first_chunk(p);
+@z
+
+
+@x Section 54.
+void
+print_prefix_name(
+name_pointer p)
+{
+ char *s = first_chunk(p);
+@y
+void
+print_prefix_name(
+name_pointer p)
+{
+ char huge* s = first_chunk(p);
+@z
+
+
+@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
+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 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
+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 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
+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 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 75.
+An omitted change file argument means that |"/dev/null"| should be used,
+@y
+An omitted change file argument means that |"NUL"| should be used,
+@z
+
+
+@x Section 76.
+ strcpy(change_file_name,"/dev/null");
+@y
+ strcpy(change_file_name,"NUL");
+@z
+
+
+@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