Debian Codegraph @

texk/web2c/cwebdir/cweav-bs.ch

raw
1 Changes for CWEAVE for MSDOS and Borland C++ 3.1 using the following
2 options (and perhaps others):
3
4 -mc -w-pro -Ff=5000 -Z- -O-p
5
6 The options -Z- and -O-p explicitly turn off optimizations that break
7 the code. (See makefile.bs.)
8
9 The main purpose of these changes is to support MSDOS with full-size arrays
10 by using "huge" pointers.
11
12 This file contributed by Barry Schwartz, [email protected], 28 Jun 94.
13 (Includes workaround for compiler bug [pointers wrapping around at
14 segment boundaries], November 1993, contributed by Jorge Fernandez Arnaiz
15 -- [email protected])
16 (Last revised 5 Dec 94 with help of [email protected].)
17
18
19 @x Section 1.
20 The ``banner line'' defined here should be changed whenever \.{CWEAVE}
21 is modified.
22
23 @d banner "This is CWEAVE (Version 4.12.2)"
24 @y
25 The ``banner line'' defined here should be changed whenever \.{CWEAVE}
26 is modified.
27
28 @d banner "This is CWEAVE (Version 4.12.2pc/big)"
29 @z
30
31
32 @x Section 11.
33 @d ilk dummy.Ilk /* used by \.{CWEAVE} only */
34
35 @<Common code...@>=
36 typedef struct name_info {
37 char *byte_start; /* beginning of the name in |byte_mem| */
38 struct name_info *link;
39 union {
40 struct name_info *Rlink; /* right link in binary search tree for section
41 names */
42 eight_bits Ilk; /* used by identifiers in \.{CWEAVE} only */
43 } dummy;
44 void *equiv_or_xref; /* info corresponding to names */
45 } name_info; /* contains information about an identifier or section name */
46 typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
47 typedef name_pointer *hash_pointer;
48 extern char byte_mem[]; /* characters of names */
49 extern char *byte_mem_end; /* end of |byte_mem| */
50 extern char *byte_ptr; /* first unused position in |byte_mem| */
51 extern name_info name_dir[]; /* information about names */
52 extern name_pointer name_dir_end; /* end of |name_dir| */
53 extern name_pointer name_ptr; /* first unused position in |name_dir| */
54 @y
55 @d ilk dummy.Ilk /* used by \.{CWEAVE} only */
56
57 @f huge extern
58
59 @<Common code...@>=
60 typedef struct name_info {
61 char huge* byte_start; /* beginning of the name in |byte_mem| */
62 struct name_info *link;
63 union {
64 struct name_info *Rlink; /* right link in binary search tree for section
65 names */
66 eight_bits Ilk; /* used by identifiers in \.{CWEAVE} only */
67 } dummy;
68 union {
69 char *equiv_member;
70 char huge* xref_member;
71 } ptr_union; /* info corresponding to names */
72 } name_info; /* contains information about an identifier or section name */
73 typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
74 typedef name_pointer *hash_pointer;
75 extern char huge byte_mem[]; /* characters of names */
76 extern char huge* byte_mem_end; /* end of |byte_mem| */
77 extern name_info name_dir[]; /* information about names */
78 extern name_pointer name_dir_end; /* end of |name_dir| */
79 extern name_pointer name_ptr; /* first unused position in |name_dir| */
80 extern char huge* byte_ptr; /* first unused position in |byte_mem| */
81 @z
82
83
84 @x Section 22.
85 typedef struct xref_info {
86 sixteen_bits num; /* section number plus zero or |def_flag| */
87 struct xref_info *xlink; /* pointer to the previous cross-reference */
88 } xref_info;
89 typedef xref_info *xref_pointer;
90 @y
91 typedef struct xref_info {
92 sixteen_bits num; /* section number plus zero or |def_flag| */
93 struct xref_info huge* xlink; /* pointer to the previous cross-reference */
94 } xref_info;
95 typedef xref_info huge* xref_pointer;
96 @z
97
98
99 @x Section 23.
100 static xref_info xmem[max_refs]; /* contains cross-reference information */
101 static xref_pointer xmem_end = xmem+max_refs-1;
102 @y
103 static xref_info huge xmem[max_refs]; /* contains cross-reference information */
104 static xref_pointer xmem_end;
105 @z
106
107
108 @x Section 24.
109 @d xref equiv_or_xref
110 @y
111 @d xref ptr_union.xref_member
112 @z
113
114
115 @x Section 24.
116 xref_ptr=xmem; init_node(name_dir); xref_switch=section_xref_switch=0;
117 xmem->num=0; /* sentinel value */
118 @y
119 xmem_end = xmem + max_refs - 1;
120 xref_ptr=xmem; init_node(name_dir); xref_switch=section_xref_switch=0;
121 xmem->num=0; /* sentinel value */
122 @z
123
124
125 @x Section 30. (to please Borland's C++, version 4.02)
126 static token tok_mem[max_toks]; /* tokens */
127 static token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */
128 static token_pointer tok_ptr; /* first unused position in |tok_mem| */
129 static token_pointer max_tok_ptr; /* largest value of |tok_ptr| */
130 static token_pointer tok_start[max_texts]; /* directory into |tok_mem| */
131 static text_pointer tok_start_end = tok_start+max_texts-1; /* end of |tok_start| */
132 static text_pointer text_ptr; /* first unused position in |tok_start| */
133 @y
134 static token tok_mem[max_toks]; /* tokens */
135 static token_pointer tok_mem_end; /* end of |tok_mem| */
136 static token_pointer tok_ptr; /* first unused position in |tok_mem| */
137 static token_pointer max_tok_ptr; /* largest value of |tok_ptr| */
138 static token_pointer tok_start[max_texts]; /* directory into |tok_mem| */
139 static text_pointer tok_start_end; /* end of |tok_start| */
140 static text_pointer text_ptr; /* first unused position in |tok_start| */
141 @z
142
143
144 @x Section 31. (goes with the previous change)
145 tok_ptr=max_tok_ptr=tok_mem+1;@/
146 tok_start[0]=tok_start[1]=tok_mem+1;@/
147 text_ptr=max_text_ptr=tok_start+1;
148 @y
149 tok_start[1]=tok_mem+1;
150 tok_mem_end=tok_mem+max_toks-1;
151 tok_start_end=tok_start+max_texts-1;
152 max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1;
153 @z
154
155
156 @x Section 32.
157 p->xref=(void *)xmem;
158 @y
159 p->xref=(void huge*)xmem;
160 @z
161
162
163 @x Section 78.
164 if (unindexed(lhs)) { /* retain only underlined entries */
165 xref_pointer q,r=NULL;
166 for (q=(xref_pointer)lhs->xref;q>xmem;q=q->xlink)
167 if (q->num<def_flag)
168 if (r) r->xlink=q->xlink;
169 else lhs->xref=(void *)q->xlink;
170 else r=q;
171 }
172 @y
173 if (unindexed(lhs)) { /* retain only underlined entries */
174 xref_pointer q,r=NULL;
175 for (q=(xref_pointer)lhs->xref;q>xmem;q=q->xlink)
176 if (q->num<def_flag)
177 if (r) r->xlink=q->xlink;
178 else lhs->xref=(void huge*)q->xlink;
179 else r=q;
180 }
181 @z
182
183
184 @x Section 97.
185 char *k; /* pointer into |byte_mem| */
186 @y
187 char huge* *k; /* pointer into |byte_mem| */
188 @z
189
190
191 @x Section 217.
192 char *p; /* index into |byte_mem| */
193 @y
194 char huge *p; /* index into |byte_mem| */
195 @z
196
197
198 @x Section 252.
199 if (cur_name->xref!=(void *)xmem) {
200 @y
201 if (cur_name->xref!=(void huge*)xmem) {
202 @z
203
204
205 @x Section 254.
206 static char *cur_byte; /* index into |byte_mem| */
207 @y
208 static char huge* cur_byte; /* index into |byte_mem| */
209 @z
210
211
212 @x Section 263.
213 switch (cur_name->ilk) {@+char *p; /* index into |byte_mem| */@+@t}\6{\4@>
214 @y
215 switch (cur_name->ilk) {@+char huge* p; /* index into |byte_mem| */@+@t}\6{\4@>
216 @z