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.
6 \def\title{CTANGLE (Version 3.64)}
7 \def\topofcontents{\null\vfill
8 \centerline{\titlefont The {\ttitlefont CTANGLE} processor}
10 \centerline{(Version 3.64)}
13 \def\title{CTANGLE (Version 3.64k)}
14 \def\topofcontents{\null\vfill
15 \centerline{\titlefont The {\ttitlefont CTANGLE} processor}
17 \centerline{(Version 3.64k)}
21 This change can not be applied when `tie' is used
22 (TOC file can not be typeset).
27 %\let\maybe=\iffalse % print only sections that change
34 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
37 @d banner "This is CTANGLE (Version 3.64)\n"
39 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
42 @d banner "This is CTANGLE, Version 3.64"
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>}.)
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 */
70 int main P2C(int,ac, char**,av)
73 @x l.100 - Add Web2C version to banner.
74 if (show_banner) printf(banner); /* print a ``banner line'' */
77 printf("%s%s\n", banner, versionstring); /* print a ``banner line'' */
83 @x common.h l.30 - boolean comes from kpathsea.
84 typedef short boolean;
94 /* #include "cpascal.h" ??? */
95 extern char *versionstring;
96 #include <kpathsea/kpathsea.h>
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();
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);
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 */
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 */
132 @x common.h l.131 - max_file_name_length is way too small.
133 @d max_file_name_length 60
135 @d max_file_name_length 1024
138 @x common.h l.138 - explicit types.
139 extern include_depth; /* current level of nesting */
141 extern int include_depth; /* current level of nesting */
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 */
148 extern int line[]; /* number of current line in the stacked files */
149 extern int change_line; /* number of current line in change file */
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 */
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 */
165 extern void common_init();
167 extern void common_init P1H(void);
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 */
178 int names_match P4C(name_pointer,p, char*,first, int,l, char,t)
187 init_node P1C(name_pointer,node)
193 init_p P2C(name_pointer,p, char,t) {}
202 store_two_bytes P1C(sixteen_bits,x)
208 push_level(p) /* suspends the current level */
211 push_level P1C(name_pointer,p) /* suspends the current level */
217 pop_level(flag) /* do this when |cur_byte| reaches |cur_end| */
218 int flag; /* |flag==0| means we are in |output_defs| */
220 pop_level P1C(int,flag) /* do this when |cur_byte| reaches |cur_end| */
226 get_output() /* sends next token to |out_char| */
228 get_output P1H(void) /* sends next token to |out_char| */
234 flush_buffer() /* writes one line to output file */
236 flush_buffer P1H(void) /* writes one line to output file */
244 void phase_two P1H(void);
252 phase_two P1H(void) {
260 void output_defs P1H(void);
268 output_defs P1H(void)
274 static void out_char();
276 static void out_char P1H(eight_bits);
285 out_char P1C(eight_bits,cur_char)
291 skip_ahead() /* skip to next control code */
293 skip_ahead P1H(void) /* skip to next control code */
299 int skip_comment(is_long_comment) /* skips over comments */
300 boolean is_long_comment;
302 int skip_comment P1C(boolean,is_long_comment) /* skips over comments */
307 @x l.889 - add declaration of versionstring.
308 #include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
315 get_next() /* produces the next input token */
317 get_next P1H(void) /* produces the next input token */
323 scan_repl(t) /* creates a replacement text */
326 scan_repl P1C(eight_bits,t) /* creates a replacement text */
334 scan_section P1H(void)
342 void phase_one P1H(void);
350 phase_one P1H(void) {
358 void skip_limbo P1H(void);
374 print_stats P1H(void) {