tentative fix for issue 3 (ex 53)
[mplib] / src / texk / web2c / cwebdir / ctang-w2c.ch
1 % Kpathsea changes for CWEB by Wlodek Bzyl and Olaf Weber
2 % Copyright 2002 Wlodek Bzyl and Olaf Weber
3 % This file is in the Public Domain.
4
5 @x l.27
6 \def\title{CTANGLE (Version 3.64)}
7 \def\topofcontents{\null\vfill
8   \centerline{\titlefont The {\ttitlefont CTANGLE} processor}
9   \vskip 15pt
10   \centerline{(Version 3.64)}
11   \vfill}
12 @y
13 \def\title{CTANGLE (Version 3.64k)}
14 \def\topofcontents{\null\vfill
15   \centerline{\titlefont The {\ttitlefont CTANGLE} processor}
16   \vskip 15pt
17   \centerline{(Version 3.64k)}
18   \vfill}
19 @z
20
21 This change can not be applied when `tie' is  used
22 (TOC file can not be typeset).
23
24 %@x l.48
25 %\let\maybe=\iftrue
26 %@y
27 %\let\maybe=\iffalse % print only sections that change
28 %@z
29
30
31 Section 1.
32
33 @x l.49
34 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
35 is modified.
36
37 @d banner "This is CTANGLE (Version 3.64)\n"
38 @y
39 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
40 is modified.
41
42 @d banner "This is CTANGLE, Version 3.64"
43 @z
44
45
46 Section 2.
47
48 @x l.72
49 @ We predeclare several standard system functions here instead of including
50 their system header files, because the names of the header files are not as
51 standard as the names of the functions. (For example, some \CEE/ environments
52 have \.{<string.h>} where others have \.{<strings.h>}.)
53
54 @<Predecl...@>=
55 extern int strlen(); /* length of string */
56 extern int strcmp(); /* compare strings lexicographically */
57 extern char* strcpy(); /* copy one string to another */
58 extern int strncmp(); /* compare up to $n$ string characters */
59 extern char* strncpy(); /* copy up to $n$ string characters */
60 @y
61 @z
62
63 Section 3.
64
65 @x l.92
66 int main (ac, av)
67 int ac;
68 char **av;
69 @y
70 int main P2C(int,ac, char**,av)
71 @z
72
73 @x l.100 - Add Web2C version to banner.
74   if (show_banner) printf(banner); /* print a ``banner line'' */
75 @y
76   if (show_banner) {
77     printf("%s%s\n", banner, versionstring); /* print a ``banner line'' */
78   }
79 @z
80
81 Section 5.
82
83 @x common.h l.30 - boolean comes from kpathsea.
84 typedef short boolean;
85 @y
86 @z
87
88 Section 6.
89
90 @x l.36
91 #include <stdio.h>
92 @y
93 #include <stdio.h>
94 /* #include "cpascal.h" ??? */
95 extern char *versionstring;
96 #include <kpathsea/kpathsea.h>
97 @z
98
99 Section 9.
100
101 @x common.h l.109
102 extern name_pointer id_lookup(); /* looks up a string in the identifier table */
103 extern name_pointer section_lookup(); /* finds section name */
104 extern void print_section_name(), sprint_section_name();
105 @y
106 /* looks up a string in the identifier table */
107 extern name_pointer id_lookup P3H(char*,char*,char);
108 /* finds section name */
109 extern name_pointer section_lookup P3H(char*,char*,char);
110 extern void print_section_name P1H(name_pointer);
111 extern void sprint_section_name P2H(char*,name_pointer);
112 @z
113
114 Section 10.
115
116 @x common.h l.123 - explicit types.
117 extern history; /* indicates how bad this run was */
118 extern err_print(); /* print error message and context */
119 extern wrap_up(); /* indicate |history| and exit */
120 extern void fatal(); /* issue error message and die */
121 extern void overflow(); /* succumb because a table has overflowed */
122 @y
123 extern int history; /* indicates how bad this run was */
124 extern void err_print P1H(char*); /* print error message and context */
125 extern int wrap_up P1H(void); /* indicate |history| and exit */
126 extern void fatal P2H(char*,char*); /* issue error message and die */
127 extern void overflow P1H(char*); /* succumb because a table has overflowed */
128 @z
129
130 Section 11.
131
132 @x common.h l.131 - max_file_name_length is way too small.
133 @d max_file_name_length 60
134 @y
135 @d max_file_name_length 1024
136 @z
137
138 @x common.h l.138 - explicit types.
139 extern include_depth; /* current level of nesting */
140 @y
141 extern int include_depth; /* current level of nesting */
142 @z
143
144 @x common.h l.148 - explicit types.
145 extern line[]; /* number of current line in the stacked files */
146 extern change_line; /* number of current line in change file */
147 @y
148 extern int line[]; /* number of current line in the stacked files */
149 extern int change_line; /* number of current line in change file */
150 @z
151
152 @x common.h l.153 - explicit types.
153 extern reset_input(); /* initialize to read the web file and change file */
154 extern get_line(); /* inputs the next line */
155 extern check_complete(); /* checks that all changes were picked up */
156 @y
157 extern void reset_input P1H(void); /* initialize to read the web file and change file */
158 extern int get_line P1H(void); /* inputs the next line */
159 extern void check_complete P1H(void); /* checks that all changes were picked up */
160 @z
161
162 Section 15.
163
164 @x common.h l.192
165 extern void common_init();
166 @y
167 extern void common_init P1H(void);
168 @z
169
170 Section 21.
171
172 @x l.184
173 int names_match(p,first,l)
174 name_pointer p; /* points to the proposed match */
175 char *first; /* position of first character of string */
176 int l; /* length of identifier */
177 @y
178 int names_match P4C(name_pointer,p, char*,first, int,l, char,t)
179 @z
180
181 Section 22.
182
183 @x l.200
184 init_node(node)
185 name_pointer node;
186 @y
187 init_node P1C(name_pointer,node)
188 @z
189
190 @x l.207
191 init_p() {}
192 @y
193 init_p P2C(name_pointer,p, char,t) {}
194 @z
195
196 Section 26.
197
198 @x l.262
199 store_two_bytes(x)
200 sixteen_bits x;
201 @y
202 store_two_bytes P1C(sixteen_bits,x)
203 @z
204
205 Section 30.
206
207 @x l.338
208 push_level(p) /* suspends the current level */
209 name_pointer p;
210 @y
211 push_level P1C(name_pointer,p) /* suspends the current level */
212 @z
213
214 Section 31.
215
216 @x l.357
217 pop_level(flag) /* do this when |cur_byte| reaches |cur_end| */
218 int flag; /* |flag==0| means we are in |output_defs| */
219 @y
220 pop_level P1C(int,flag) /* do this when |cur_byte| reaches |cur_end| */
221 @z
222
223 Section 33.
224
225 @x l.393
226 get_output() /* sends next token to |out_char| */
227 @y
228 get_output P1H(void) /* sends next token to |out_char| */
229 @z
230
231 Section 37.
232
233 @x l.483
234 flush_buffer() /* writes one line to output file */
235 @y
236 flush_buffer P1H(void) /* writes one line to output file */
237 @z
238
239 Section 41.
240
241 @x l.534
242 void phase_two();
243 @y
244 void phase_two P1H(void);
245 @z
246
247 Section 42.
248
249 @x l.538
250 phase_two () {
251 @y
252 phase_two P1H(void) {
253 @z
254
255 Section 46.
256
257 @x l.603
258 void output_defs();
259 @y
260 void output_defs P1H(void);
261 @z
262
263 Section 47.
264
265 @x l.607
266 output_defs()
267 @y
268 output_defs P1H(void)
269 @z
270
271 Section 48.
272
273 @x l.649
274 static void out_char();
275 @y
276 static void out_char P1H(eight_bits);
277 @z
278
279 Section 49.
280
281 @x l.653
282 out_char(cur_char)
283 eight_bits cur_char;
284 @y
285 out_char P1C(eight_bits,cur_char)
286 @z
287
288 Section 58.
289
290 @x l.815
291 skip_ahead() /* skip to next control code */
292 @y
293 skip_ahead P1H(void) /* skip to next control code */
294 @z
295
296 Section 60.
297
298 @x l.849
299 int skip_comment(is_long_comment) /* skips over comments */
300 boolean is_long_comment;
301 @y
302 int skip_comment P1C(boolean,is_long_comment) /* skips over comments */
303 @z
304
305 Section 62
306
307 @x l.889 - add declaration of versionstring.
308 #include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
309 @y
310 @z
311
312 Section 63.
313
314 @x l.902
315 get_next() /* produces the next input token */
316 @y
317 get_next P1H(void) /* produces the next input token */
318 @z
319
320 Section 76.
321
322 @x l.1201
323 scan_repl(t) /* creates a replacement text */
324 eight_bits t;
325 @y
326 scan_repl P1C(eight_bits,t) /* creates a replacement text */
327 @z
328
329 Section 83.
330
331 @x l.1359
332 scan_section()
333 @y
334 scan_section P1H(void)
335 @z
336
337 Section 90.
338
339 @x l.1458
340 void phase_one();
341 @y
342 void phase_one P1H(void);
343 @z
344
345 Section 91.
346
347 @x l.1462
348 phase_one() {
349 @y
350 phase_one P1H(void) {
351 @z
352
353 Section 92.
354
355 @x l.1476
356 void skip_limbo();
357 @y
358 void skip_limbo P1H(void);
359 @z
360
361 Section 93.
362
363 @x l.1480
364 skip_limbo()
365 @y
366 skip_limbo P1H(void)
367 @z
368
369 Section 95.
370
371 @x l.1535
372 print_stats() {
373 @y
374 print_stats P1H(void) {
375 @z