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.
7 \def\title{CWEAVE (Version 3.64)}
8 \def\topofcontents{\null\vfill
9 \centerline{\titlefont The {\ttitlefont CWEAVE} processor}
11 \centerline{(Version 3.64)}
14 \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}}
15 \def\SQUARE{\vrule width 2pt depth -1pt height 3pt}
16 \def\sqitem{\item{\SQUARE}}
18 \def\title{CWEAVE (Version 3.64k)}
19 \def\topofcontents{\null\vfill
20 \centerline{\titlefont The {\ttitlefont CWEAVE} processor}
22 \centerline{(Version 3.64k)}
26 This change can not be applied when `tie' is used
27 (TOC file can not be typeset).
32 %\let\maybe=\iffalse % print only changed modules
39 The ``banner line'' defined here should be changed whenever \.{CWEAVE}
42 @d banner "This is CWEAVE (Version 3.64)\n"
44 The ``banner line'' defined here should be changed whenever \.{CWEAVE}
47 @d banner "This is CWEAVE, Version 3.64"
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>}.)
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 */
72 int ac; /* argument count */
73 char **av; /* argument values */
75 int main P2C(int,ac, char**,av)
78 @x l.107 - Add Web2C version to banner.
79 if (show_banner) printf(banner); /* print a ``banner line'' */
82 printf("%s%s\n", banner, versionstring); /* print a ``banner line'' */
89 @x common.h l.30 - boolean comes from kpathsea.
90 typedef short boolean;
100 /* #include "cpascal.h" ??? */
101 extern char *versionstring;
102 #include <kpathsea/kpathsea.h>
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();
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);
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 */
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 */
138 @x common.h l.131 - max_file_name_length is way too small.
139 @d max_file_name_length 60
141 @d max_file_name_length 1024
144 @x common.h l.138 - explicit types.
145 extern include_depth; /* current level of nesting */
147 extern int include_depth; /* current level of nesting */
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 */
154 extern int line[]; /* number of current line in the stacked files */
155 extern int change_line; /* number of current line in change file */
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 */
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 */
171 extern void common_init();
173 extern void common_init P1H(void);
182 new_xref P1C(name_pointer,p)
191 new_section_xref P1C(name_pointer,p)
200 set_file_flag P1C(name_pointer,p)
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 */
212 int names_match P4C(name_pointer,p, char*,first, int,l, char,t)
220 init_p P2C(name_pointer,p, char,t)
227 init_node P1C(name_pointer,p)
235 void skip_limbo P1H(void);
243 skip_limbo P1H(void) {
249 skip_TeX() /* skip past pure \TEX/ code */
251 skip_TeX P1H(void) /* skip past pure \TEX/ code */
256 @x l.682 - Add declaration for versionstring.
257 #include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
264 eight_bits get_next();
266 eight_bits get_next P1H(void);
272 get_next() /* produces the next input token */
274 get_next P1H(void) /* produces the next input token */
280 void skip_restricted();
282 void skip_restricted P1H(void);
290 skip_restricted P1H(void)
298 void phase_one P1H(void);
306 phase_one P1H(void) {
314 void C_xref P1H(eight_bits);
320 C_xref( spec_ctrl ) /* makes cross-references for \CEE/ identifiers */
321 eight_bits spec_ctrl;
323 C_xref P1C(eight_bits,spec_ctrl) /* makes cross-references for \CEE/ identifiers */
331 void outer_xref P1H(void);
337 outer_xref() /* extension of |C_xref| */
339 outer_xref P1H(void) /* extension of |C_xref| */
345 void section_check();
347 void section_check P1H(name_pointer);
354 name_pointer p; /* print anomalies in subtree |p| */
356 section_check P1C(name_pointer,p) /* print anomalies in subtree |p| */
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;
366 flush_buffer P3C(char*,b, boolean,per_cent, boolean,carryover)
372 finish_line() /* do this at the end of a line */
374 finish_line P1H(void) /* do this at the end of a line */
380 out_str(s) /* output characters from |s| to end of string */
383 out_str P1C(char*,s) /* output characters from |s| to end of string */
391 void break_out P1H(void);
397 break_out() /* finds a way to break the output line */
399 break_out P1H(void) /* finds a way to break the output line */
408 out_section P1C(sixteen_bits,n)
414 out_name(p,quote_xalpha)
416 boolean quote_xalpha;
418 out_name P2C(name_pointer,p, boolean,quote_xalpha)
442 int copy_comment P2H(boolean,int);
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 */
452 int copy_comment P2C(boolean,is_long_comment, int,bal)
458 print_cat(c) /* symbolic printout of a category */
461 print_cat P1C(eight_bits,c)
467 print_text(p) /* prints a token list for debugging; not used in |main| */
470 print_text P1C(text_pointer,p)
493 big_app1 P1C(scrap_pointer,a)
502 find_first_ident P1C(text_pointer,p)
508 make_reserved(p) /* make the first identifier in |p->trans| like |int| */
511 make_reserved P1C(scrap_pointer,p)
518 /* underline the entry for the first identifier in |p->trans| */
521 make_underlined P1C(scrap_pointer,p)
527 void underline_xref();
529 void underline_xref P1H(name_pointer);
538 underline_xref P1C(name_pointer,p)
549 reduce P5C(scrap_pointer,j, short,k, eight_bits,c, short,d, short,n)
560 squash P5C(scrap_pointer,j, short,k, eight_bits,c, short,d, short,n)
566 translate() /* converts a sequence of scraps */
568 translate P1H(void) /* converts a sequence of scraps */
574 C_parse(spec_ctrl) /* creates scraps from \CEE/ tokens */
575 eight_bits spec_ctrl;
577 C_parse P1C(eight_bits,spec_ctrl) /* creates scraps from \CEE/ tokens */
585 void app_cur_id P1H(boolean);
591 app_cur_id(scrapping)
592 boolean scrapping; /* are we making this into a scrap? */
594 app_cur_id P1C(boolean,scrapping)
602 C_translate P1H(void)
608 outer_parse() /* makes scraps from \CEE/ tokens and comments */
610 outer_parse P1H(void) /* makes scraps from \CEE/ tokens and comments */
616 push_level(p) /* suspends the current level */
619 push_level P1C(text_pointer,p) /* suspends the current level */
633 get_output() /* returns the next token of output */
635 get_output P1H(void) /* returns the next token of output */
641 output_C() /* outputs the current token list */
643 output_C P1H(void) /* outputs the current token list */
651 void make_output P1H(void);
657 make_output() /* outputs the equivalents of tokens */
659 make_output P1H(void) /* outputs the equivalents of tokens */
667 void phase_two P1H(void);
675 phase_two P1H(void) {
683 void finish_C P1H(boolean);
689 finish_C(visible) /* finishes a definition or a \CEE/ part */
690 boolean visible; /* nonzero if we should produce \TEX/ output */
692 finish_C P1C(boolean,visible) /* finishes a definition or a \CEE/ part */
700 void footnote P1H(sixteen_bits);
706 footnote(flag) /* outputs section cross-references */
709 footnote P1C(sixteen_bits,flag) /* outputs section cross-references */
717 void phase_three P1H(void);
725 phase_three P1H(void) {
733 void unbucket P1H(eight_bits);
739 unbucket(d) /* empties buckets having depth |d| */
742 unbucket P1C(eight_bits,d) /* empties buckets having depth |d| */
748 void section_print();
750 void section_print P1H(name_pointer);
756 section_print(p) /* print all section names in subtree |p| */
759 section_print P1C(name_pointer,p) /* print all section names in subtree |p| */
767 print_stats P1H(void) {