tentative fix for issue 3 (ex 53)
[mplib] / src / texk / web2c / cwebdir / cweav-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
6 @x l.32
7 \def\title{CWEAVE (Version 3.64)}
8 \def\topofcontents{\null\vfill
9   \centerline{\titlefont The {\ttitlefont CWEAVE} processor}
10   \vskip 15pt
11   \centerline{(Version 3.64)}
12   \vfill}
13 @y
14 \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}}
15 \def\SQUARE{\vrule width 2pt depth -1pt height 3pt}
16 \def\sqitem{\item{\SQUARE}}
17
18 \def\title{CWEAVE (Version 3.64k)}
19 \def\topofcontents{\null\vfill
20   \centerline{\titlefont The {\ttitlefont CWEAVE} processor}
21   \vskip 15pt
22   \centerline{(Version 3.64k)}
23   \vfill}
24 @z
25
26 This change can not be applied when `tie' is  used
27 (TOC file can not be typeset).
28
29 %@x l.51
30 %\let\maybe=\iftrue
31 %@y
32 %\let\maybe=\iffalse % print only changed modules
33 %@z
34
35
36 Section 1.
37
38 @x l.65
39 The ``banner line'' defined here should be changed whenever \.{CWEAVE}
40 is modified.
41
42 @d banner "This is CWEAVE (Version 3.64)\n"
43 @y 
44 The ``banner line'' defined here should be changed whenever \.{CWEAVE}
45 is modified.
46
47 @d banner "This is CWEAVE, Version 3.64"
48 @z
49
50
51 Section 2.
52
53 @x l.77
54 @ We predeclare several standard system functions here instead of including
55 their system header files, because the names of the header files are not as
56 standard as the names of the functions. (For example, some \CEE/ environments
57 have \.{<string.h>} where others have \.{<strings.h>}.)
58
59 @<Predecl...@>=
60 extern int strlen(); /* length of string */
61 extern int strcmp(); /* compare strings lexicographically */
62 extern char* strcpy(); /* copy one string to another */
63 extern int strncmp(); /* compare up to $n$ string characters */
64 extern char* strncpy(); /* copy up to $n$ string characters */
65 @y
66 @z
67
68 Section 3.
69
70 @x l.98
71 int main (ac, av)
72 int ac; /* argument count */
73 char **av; /* argument values */
74 @y
75 int main P2C(int,ac, char**,av)
76 @z
77
78 @x l.107 - Add Web2C version to banner.
79   if (show_banner) printf(banner); /* print a ``banner line'' */
80 @y
81   if (show_banner) {
82      printf("%s%s\n", banner, versionstring); /* print a ``banner line'' */
83   }
84 @z
85
86
87 Section 5.
88
89 @x common.h l.30 - boolean comes from kpathsea.
90 typedef short boolean;
91 @y
92 @z
93
94 Section 6.
95
96 @x l.36
97 #include <stdio.h>
98 @y
99 #include <stdio.h>
100 /* #include "cpascal.h" ??? */
101 extern char *versionstring;
102 #include <kpathsea/kpathsea.h>
103 @z
104
105 Section 9.
106
107 @x common.h l.109
108 extern name_pointer id_lookup(); /* looks up a string in the identifier table */
109 extern name_pointer section_lookup(); /* finds section name */
110 extern void print_section_name(), sprint_section_name();
111 @y
112 /* looks up a string in the identifier table */
113 extern name_pointer id_lookup P3H(char*,char*,char);
114 /* finds section name */
115 extern name_pointer section_lookup P3H(char*,char*,char);
116 extern void print_section_name P1H(name_pointer);
117 extern void sprint_section_name P2H(char*,name_pointer);
118 @z
119
120 Section 10.
121
122 @x common.h l.123 - explicit types.
123 extern history; /* indicates how bad this run was */
124 extern err_print(); /* print error message and context */
125 extern wrap_up(); /* indicate |history| and exit */
126 extern void fatal(); /* issue error message and die */
127 extern void overflow(); /* succumb because a table has overflowed */
128 @y
129 extern int history; /* indicates how bad this run was */
130 extern void err_print P1H(char*); /* print error message and context */
131 extern int wrap_up P1H(void); /* indicate |history| and exit */
132 extern void fatal P2H(char*,char*); /* issue error message and die */
133 extern void overflow P1H(char*); /* succumb because a table has overflowed */
134 @z
135
136 Section 11.
137
138 @x common.h l.131 - max_file_name_length is way too small.
139 @d max_file_name_length 60
140 @y
141 @d max_file_name_length 1024
142 @z
143
144 @x common.h l.138 - explicit types.
145 extern include_depth; /* current level of nesting */
146 @y
147 extern int include_depth; /* current level of nesting */
148 @z
149
150 @x common.h l.148 - explicit types.
151 extern line[]; /* number of current line in the stacked files */
152 extern change_line; /* number of current line in change file */
153 @y
154 extern int line[]; /* number of current line in the stacked files */
155 extern int change_line; /* number of current line in change file */
156 @z
157
158 @x common.h l.153 - explicit types.
159 extern reset_input(); /* initialize to read the web file and change file */
160 extern get_line(); /* inputs the next line */
161 extern check_complete(); /* checks that all changes were picked up */
162 @y
163 extern void reset_input P1H(void); /* initialize to read the web file and change file */
164 extern int get_line P1H(void); /* inputs the next line */
165 extern void check_complete P1H(void); /* checks that all changes were picked up */
166 @z
167
168 Section 15.
169
170 @x common.h l.192
171 extern void common_init();
172 @y
173 extern void common_init P1H(void);
174 @z
175
176 Section 21.
177
178 @x l.276
179 new_xref(p)
180 name_pointer p;
181 @y
182 new_xref P1C(name_pointer,p)
183 @z
184
185 Section 22.
186
187 @x l.307
188 new_section_xref(p)
189 name_pointer p;
190 @y
191 new_section_xref P1C(name_pointer,p)
192 @z
193
194 Section 23.
195
196 @x l.327
197 set_file_flag(p)
198 name_pointer p;
199 @y
200 set_file_flag P1C(name_pointer,p)
201 @z
202
203 Section 27.
204
205 @x l.371
206 int names_match(p,first,l,t)
207 name_pointer p; /* points to the proposed match */
208 char *first; /* position of first character of string */
209 int l; /* length of identifier */
210 eight_bits t; /* desired ilk */
211 @y
212 int names_match P4C(name_pointer,p, char*,first, int,l, char,t)
213 @z
214
215 @x l.383
216 init_p(p,t)
217 name_pointer p;
218 eight_bits t;
219 @y
220 init_p P2C(name_pointer,p, char,t)
221 @z
222
223 @x l.391
224 init_node(p)
225 name_pointer p;
226 @y
227 init_node P1C(name_pointer,p)
228 @z
229
230 Section 34.
231
232 @x l.600
233 void   skip_limbo();
234 @y
235 void   skip_limbo P1H(void);
236 @z
237
238 Section 35.
239
240 @x l.604
241 skip_limbo() {
242 @y
243 skip_limbo P1H(void) {
244 @z
245
246 Section 36.
247
248 @x l.626
249 skip_TeX() /* skip past pure \TEX/ code */
250 @y
251 skip_TeX P1H(void) /* skip past pure \TEX/ code */
252 @z
253
254 Section 38.
255
256 @x l.682 - Add declaration for versionstring.
257 #include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
258 @y
259 @z
260
261 Section 39.
262
263 @x l.696
264 eight_bits get_next();
265 @y
266 eight_bits get_next P1H(void);
267 @z
268
269 Section 40.
270
271 @x l.700
272 get_next() /* produces the next input token */
273 @y
274 get_next P1H(void) /* produces the next input token */
275 @z
276
277 Section 55.
278
279 @x l.971
280 void skip_restricted();
281 @y
282 void skip_restricted P1H(void);
283 @z
284
285 Section 56.
286
287 @x l.975
288 skip_restricted()
289 @y
290 skip_restricted P1H(void)
291 @z
292
293 Section 59.
294
295 @x l.1024
296 void phase_one();
297 @y
298 void phase_one P1H(void);
299 @z
300
301 Section 60.
302
303 @x l.1028
304 phase_one() {
305 @y
306 phase_one P1H(void) {
307 @z
308
309 Section 62.
310
311 @x l.1076
312 void C_xref();
313 @y
314 void C_xref P1H(eight_bits);
315 @z
316
317 Section 63.
318
319 @x l.1080
320 C_xref( spec_ctrl ) /* makes cross-references for \CEE/ identifiers */
321   eight_bits spec_ctrl;
322 @y
323 C_xref P1C(eight_bits,spec_ctrl) /* makes cross-references for \CEE/ identifiers */
324 @z
325
326 Section 64.
327
328 @x l.1104
329 void outer_xref();
330 @y
331 void outer_xref P1H(void);
332 @z
333
334 Section 65.
335
336 @x l.1108
337 outer_xref() /* extension of |C_xref| */
338 @y
339 outer_xref P1H(void) /* extension of |C_xref| */
340 @z
341
342 Section 74.
343
344 @x l.1266
345 void section_check();
346 @y
347 void section_check P1H(name_pointer);
348 @z
349
350 Section 75.
351
352 @x l.1270
353 section_check(p)
354 name_pointer p; /* print anomalies in subtree |p| */
355 @y
356 section_check P1C(name_pointer,p) /* print anomalies in subtree |p| */
357 @z
358
359 Section 78.
360
361 @x l.1323
362 flush_buffer(b,per_cent,carryover)
363 char *b;  /* outputs from |out_buf+1| to |b|,where |b<=out_ptr| */
364 boolean per_cent,carryover;
365 @y
366 flush_buffer P3C(char*,b, boolean,per_cent, boolean,carryover)
367 @z
368
369 Section 79.
370
371 @x l.1352
372 finish_line() /* do this at the end of a line */
373 @y
374 finish_line P1H(void) /* do this at the end of a line */
375 @z
376
377 Section 81.
378
379 @x l.1384
380 out_str(s) /* output characters from |s| to end of string */
381 char *s;
382 @y
383 out_str P1C(char*,s) /* output characters from |s| to end of string */
384 @z
385
386 Section 83.
387
388 @x l.1402
389 void break_out();
390 @y
391 void break_out P1H(void);
392 @z
393
394 Section 84.
395
396 @x l.1406
397 break_out() /* finds a way to break the output line */
398 @y
399 break_out P1H(void) /* finds a way to break the output line */
400 @z
401
402 Section 86.
403
404 @x l.1441
405 out_section(n)
406 sixteen_bits n;
407 @y
408 out_section P1C(sixteen_bits,n)
409 @z
410
411 Section 87.
412
413 @x l.1455
414 out_name(p,quote_xalpha)
415 name_pointer p;
416 boolean quote_xalpha;
417 @y
418 out_name P2C(name_pointer,p, boolean,quote_xalpha)
419 @z
420
421 Section 88.
422
423 @x l.1485
424 copy_limbo()
425 @y
426 copy_limbo P1H(void)
427 @z
428
429 Section 90.
430
431 @x l.1520
432 copy_TeX()
433 @y
434 copy_TeX P1H(void)
435 @z
436
437 Section 91.
438
439 @x l.1449
440 int copy_comment();
441 @y
442 int copy_comment P2H(boolean,int);
443 @z
444
445 Section 92.
446
447 @x l.1551
448 int copy_comment(is_long_comment,bal) /* copies \TEX/ code in comments */
449 boolean is_long_comment; /* is this a traditional \CEE/ comment? */
450 int bal; /* brace balance */
451 @y
452 int copy_comment P2C(boolean,is_long_comment, int,bal)
453 @z
454
455 Section 99.
456
457 @x l.1784
458 print_cat(c) /* symbolic printout of a category */
459 eight_bits c;
460 @y
461 print_cat P1C(eight_bits,c)
462 @z
463
464 Section 106.
465
466 @x l.2139
467 print_text(p) /* prints a token list for debugging; not used in |main| */
468 text_pointer p;
469 @y
470 print_text P1C(text_pointer,p)
471 @z
472
473 Section 109.
474
475 @x l.2264
476 app_str(s)
477 char *s;
478 @y
479 app_str P1C(char*,s)
480 @z
481
482 @x l.2271
483 big_app(a)
484 token a;
485 @y
486 big_app P1C(token,a)
487 @z
488
489 @x l.2288
490 big_app1(a)
491 scrap_pointer a;
492 @y
493 big_app1 P1C(scrap_pointer,a)
494 @z
495
496 Section 111.
497
498 @x l.2415
499 find_first_ident(p)
500 text_pointer p;
501 @y
502 find_first_ident P1C(text_pointer,p)
503 @z
504
505 Section 112.
506
507 @x l.2447
508 make_reserved(p) /* make the first identifier in |p->trans| like |int| */
509 scrap_pointer p;
510 @y
511 make_reserved P1C(scrap_pointer,p)
512 @z
513
514 Section 113.
515
516 @x l.2478
517 make_underlined(p)
518 /* underline the entry for the first identifier in |p->trans| */
519 scrap_pointer p;
520 @y
521 make_underlined P1C(scrap_pointer,p)
522 @z
523
524 Section 114.
525
526 @x l.2495
527 void  underline_xref();
528 @y
529 void  underline_xref P1H(name_pointer);
530 @z
531
532 Section 115.
533
534 @x l.2499
535 underline_xref(p)
536 name_pointer p;
537 @y
538 underline_xref P1C(name_pointer,p)
539 @z
540
541 Section 164.
542
543 @x l.3004
544 reduce(j,k,c,d,n)
545 scrap_pointer j;
546 eight_bits c;
547 short k, d, n;
548 @y
549 reduce P5C(scrap_pointer,j, short,k, eight_bits,c, short,d, short,n)
550 @z
551
552 Section 165.
553
554 @x l.3030
555 squash(j,k,c,d,n)
556 scrap_pointer j;
557 eight_bits c;
558 short k, d, n;
559 @y
560 squash P5C(scrap_pointer,j, short,k, eight_bits,c, short,d, short,n)
561 @z
562
563 Section 170.
564
565 @x l.3126
566 translate() /* converts a sequence of scraps */
567 @y
568 translate P1H(void) /* converts a sequence of scraps */
569 @z
570
571 Section 174.
572
573 @x l.3191
574 C_parse(spec_ctrl) /* creates scraps from \CEE/ tokens */
575   eight_bits spec_ctrl;
576 @y
577 C_parse P1C(eight_bits,spec_ctrl) /* creates scraps from \CEE/ tokens */
578 @z
579
580 Section 181.
581
582 @x l.3421
583 void app_cur_id();
584 @y
585 void app_cur_id P1H(boolean);
586 @z
587
588 Section 182.
589
590 @x l.3425
591 app_cur_id(scrapping)
592 boolean scrapping; /* are we making this into a scrap? */
593 @y
594 app_cur_id P1C(boolean,scrapping)
595 @z
596
597 Section 183.
598
599 @x l.3451
600 C_translate()
601 @y
602 C_translate P1H(void)
603 @z
604
605 Section 184.
606
607 @x l.3480
608 outer_parse() /* makes scraps from \CEE/ tokens and comments */
609 @y
610 outer_parse P1H(void) /* makes scraps from \CEE/ tokens and comments */
611 @z
612
613 Section 189.
614
615 @x l.3586
616 push_level(p) /* suspends the current level */
617 text_pointer p;
618 @y
619 push_level P1C(text_pointer,p) /* suspends the current level */
620 @z
621
622 Section 190.
623
624 @x l.3606
625 pop_level()
626 @y
627 pop_level P1H(void)
628 @z
629
630 Section 192.
631
632 @x l.3628
633 get_output() /* returns the next token of output */
634 @y
635 get_output P1H(void) /* returns the next token of output */
636 @z
637
638 Section 193.
639
640 @x l.3665
641 output_C() /* outputs the current token list */
642 @y
643 output_C P1H(void) /* outputs the current token list */
644 @z
645
646 Section 194.
647
648 @x l.3687
649 void make_output();
650 @y
651 void make_output P1H(void);
652 @z
653
654 Section 195.
655
656 @x l.3691
657 make_output() /* outputs the equivalents of tokens */
658 @y
659 make_output P1H(void) /* outputs the equivalents of tokens */
660 @z
661
662 Section 205.
663
664 @x l.3951
665 void phase_two();
666 @y
667 void phase_two P1H(void);
668 @z
669
670 Section 206.
671
672 @x l.3955
673 phase_two() {
674 @y
675 phase_two P1H(void) {
676 @z
677
678 Section 212.
679
680 @x l.4074
681 void finish_C();
682 @y
683 void finish_C P1H(boolean);
684 @z
685
686 Section 213.
687
688 @x l.4078
689 finish_C(visible) /* finishes a definition or a \CEE/ part */
690   boolean visible; /* nonzero if we should produce \TEX/ output */
691 @y
692 finish_C P1C(boolean,visible) /* finishes a definition or a \CEE/ part */
693 @z
694
695 Section 221.
696
697 @x l.4245
698 void footnote();
699 @y
700 void footnote P1H(sixteen_bits);
701 @z
702
703 Section 222.
704
705 @x l.4249
706 footnote(flag) /* outputs section cross-references */
707 sixteen_bits flag;
708 @y
709 footnote P1C(sixteen_bits,flag) /* outputs section cross-references */
710 @z
711
712 Section 225.
713
714 @x l.4294
715 void phase_three();
716 @y
717 void phase_three P1H(void);
718 @z
719
720 Section 226.
721
722 @x l.4298
723 phase_three() {
724 @y
725 phase_three P1H(void) {
726 @z
727
728 Section 237.
729
730 @x l.4474
731 void  unbucket();
732 @y
733 void  unbucket P1H(eight_bits);
734 @z
735
736 Section 238.
737
738 @x l.4478
739 unbucket(d) /* empties buckets having depth |d| */
740 eight_bits d;
741 @y
742 unbucket P1C(eight_bits,d) /* empties buckets having depth |d| */
743 @z
744
745 Section 246.
746
747 @x l.4594
748 void section_print();
749 @y
750 void section_print P1H(name_pointer);
751 @z
752
753 Section 247.
754
755 @x l.4598
756 section_print(p) /* print all section names in subtree |p| */
757 name_pointer p;
758 @y
759 section_print P1C(name_pointer,p) /* print all section names in subtree |p| */
760 @z
761
762 Section 249.
763
764 @x l.4620
765 print_stats() {
766 @y
767 print_stats P1H(void) {
768 @z