1 Changes for code common to CTANGLE and CWEAVE, for MSDOS
2 and Borland C++ 3.1 using the following options (and perhaps others):
4 -mc -w-pro -Ff=5000 -Z- -O-p
6 The options -Z- and -O-p explicitly turn off optimizations that seem to be
7 dangerous for the style of code in the CWEB sources. (See makefile.bs.)
9 The main purpose of these changes is to support MSDOS with full-size arrays
10 by using "huge" pointers.
12 (This file contributed by Barry Schwartz, trashman@crud.mn.org, 28 Jun 94;
17 cur_file_name[l]='/'; /* \UNIX/ pathname separator */
19 cur_file_name[l]='/'; /* A valid {\mc MSDOS} pathname separator */
24 @d max_names 4000 /* number of identifiers, strings, section names;
25 must be less than 10240 */
27 @<Definitions that...@>=
28 typedef struct name_info {
29 char *byte_start; /* beginning of the name in |byte_mem| */
30 @<More elements of |name_info| structure@>@;
31 } name_info; /* contains information about an identifier or section name */
32 typedef name_info *name_pointer; /* pointer into array of |name_info|s */
33 char byte_mem[max_bytes]; /* characters of names */
34 char *byte_mem_end = byte_mem+max_bytes-1; /* end of |byte_mem| */
35 name_info name_dir[max_names]; /* information about names */
36 name_pointer name_dir_end = name_dir+max_names-1; /* end of |name_dir| */
38 @d max_names 4000 /* number of identifiers, strings, section names;
39 must be less than 10240 */
43 @<Definitions that...@>=
44 typedef struct name_info {
45 char huge* byte_start; /* beginning of the name in |byte_mem| */
46 @<More elements of |name_info| structure@>@;
47 } name_info; /* contains information about an identifier or section name */
48 typedef name_info *name_pointer; /* pointer into array of |name_info|s */
49 char huge byte_mem[max_bytes]; /* characters of names */
50 char huge* byte_mem_end; /* end of |byte_mem| */
51 name_info name_dir[max_names]; /* information about names */
52 name_pointer name_dir_end = name_dir+max_names-1;
57 char *byte_ptr; /* first unused position in |byte_mem| */
59 char huge* byte_ptr; /* first unused position in |byte_mem| */
65 name_dir->byte_start=byte_ptr=byte_mem; /* position zero in both arrays */
66 name_ptr=name_dir+1; /* |name_dir[0]| will be used only for error recovery */
67 name_ptr->byte_start=byte_mem; /* this makes name 0 of length zero */
70 name_dir->byte_start=byte_ptr=byte_mem; /* position zero in both arrays */
71 name_ptr=name_dir+1; /* |name_dir[0]| will be used only for error recovery */
72 name_ptr->byte_start=byte_mem; /* this makes name 0 of length zero */
73 byte_mem_end = byte_mem+max_bytes-1;
82 char *ss, *s = first_chunk(p);
88 char huge* ss, huge* s = first_chunk(p);
94 sprint_section_name(dest,p)
98 char *ss, *s = first_chunk(p);
101 sprint_section_name(dest,p)
105 char huge* ss, huge* s = first_chunk(p);
114 char *s = first_chunk(p);
120 char huge* s = first_chunk(p);
126 add_section_name(par,c,first,last,ispref) /* install a new node in the tree */
127 name_pointer par; /* parent of new node */
128 int c; /* right or left? */
129 char *first; /* first character of section name */
130 char *last; /* last character of section name, plus one */
131 int ispref; /* are we adding a prefix or a full name? */
133 name_pointer p=name_ptr; /* new node */
134 char *s=first_chunk(p);
137 add_section_name(par,c,first,last,ispref) /* install a new node in the tree */
138 name_pointer par; /* parent of new node */
139 int c; /* right or left? */
140 char *first; /* first character of section name */
141 char *last; /* last character of section name, plus one */
142 int ispref; /* are we adding a prefix or a full name? */
144 name_pointer p=name_ptr; /* new node */
145 char huge* s=first_chunk(p);
151 extend_section_name(p,first,last,ispref)
152 name_pointer p; /* name to be extended */
153 char *first; /* beginning of extension text */
154 char *last; /* one beyond end of extension text */
155 int ispref; /* are we adding a prefix or a full name? */
160 extend_section_name(p,first,last,ispref)
161 name_pointer p; /* name to be extended */
162 char *first; /* beginning of extension text */
163 char *last; /* one beyond end of extension text */
164 int ispref; /* are we adding a prefix or a full name? */
171 int section_name_cmp(pfirst,len,r)
172 char **pfirst; /* pointer to beginning of comparison string */
173 int len; /* length of string */
174 name_pointer r; /* section name being compared */
176 char *first=*pfirst; /* beginning of comparison string */
177 name_pointer q=r+1; /* access to subsequent chunks */
178 char *ss, *s=first_chunk(r);
180 int section_name_cmp(pfirst,len,r)
181 char **pfirst; /* pointer to beginning of comparison string */
182 int len; /* length of string */
183 name_pointer r; /* section name being compared */
185 char *first=*pfirst; /* beginning of comparison string */
186 name_pointer q=r+1; /* access to subsequent chunks */
187 char huge* ss, huge* s=first_chunk(r);
192 source files, respectively; here we just declare a common field
193 |equiv_or_xref| as a pointer to a |char|.
195 @<More elements of |name...@>=
196 char *equiv_or_xref; /* info corresponding to names */
198 source files, respectively. Here we just declare a common field
199 |ptr_union| as a union of pointers to |char|, which happen to have
200 different addressing attributes.
202 @<More elements of |name...@>=
205 char huge* xref_member;
206 } ptr_union; /* info corresponding to names */
211 An omitted change file argument means that |"/dev/null"| should be used,
213 An omitted change file argument means that |"NUL"| should be used,
218 else if (*s=='/') dot_pos=NULL,name_pos=++s;
220 else if (*s == ':' || *s == '\\' || *s == '/')
221 dot_pos=NULL,name_pos=++s;
226 if (found_change<=0) strcpy(change_file_name,"/dev/null");
228 if (found_change<=0) strcpy(change_file_name,"NUL");