-
Notifications
You must be signed in to change notification settings - Fork 11
/
comm-bs.ch
229 lines (192 loc) · 6.16 KB
/
comm-bs.ch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
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, [email protected], 28 Jun 94;
revised 24 Jul 94.)
@x Section 23.
cur_file_name[l]='/'; /* \UNIX/ pathname separator */
@y
cur_file_name[l]='/'; /* A valid {\mc MSDOS} pathname separator */
@z
@x Section 27.
@d max_names 4000 /* number of identifiers, strings, section names;
must be less than 10240 */
@<Definitions that...@>=
typedef struct name_info {
char *byte_start; /* beginning of the name in |byte_mem| */
@<More elements of |name_info| structure@>@;
} 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| */
@y
@d max_names 4000 /* number of identifiers, strings, section names;
must be less than 10240 */
@f huge extern
@<Definitions that...@>=
typedef struct name_info {
char huge* byte_start; /* beginning of the name in |byte_mem| */
@<More elements of |name_info| structure@>@;
} 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;
@z
@x Section 29.
char *byte_ptr; /* first unused position in |byte_mem| */
@y
char huge* byte_ptr; /* first unused position in |byte_mem| */
@z
@x Section 30.
@ @<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 42.
void
print_section_name(p)
name_pointer p;
{
char *ss, *s = first_chunk(p);
@y
void
print_section_name(p)
name_pointer p;
{
char huge* ss, huge* s = first_chunk(p);
@z
@x Section 43.
void
sprint_section_name(dest,p)
char*dest;
name_pointer p;
{
char *ss, *s = first_chunk(p);
@y
void
sprint_section_name(dest,p)
char*dest;
name_pointer p;
{
char huge* ss, huge* s = first_chunk(p);
@z
@x Section 44.
void
print_prefix_name(p)
name_pointer p;
{
char *s = first_chunk(p);
@y
void
print_prefix_name(p)
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? */
{
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? */
{
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? */
{
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? */
{
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 */
{
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 */
{
char *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 */
@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 */
@z
@x Section 69.
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 70.
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