beta-0.89.2
[luatex.git] / source / texk / web2c / cwebdir / ctang-w2c.ch
blobf1be29aacc5b65e1c6973664612b155b6960e8e4
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.
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}
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}
21 This change can not be applied when `tie' is  used
22 (TOC file can not be typeset).
24 %@x l.48
25 %\let\maybe=\iftrue
26 %@y
27 %\let\maybe=\iffalse % print only sections that change
28 %@z
31 Section 1.
33 @x l.49
34 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
35 is modified.
37 @d banner "This is CTANGLE (Version 3.64)\n"
39 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
40 is modified.
42 @d banner "This is CTANGLE, Version 3.64"
46 Section 2.
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>}.)
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 */
63 Section 3.
65 @x l.92
66 int main (ac, av)
67 int ac;
68 char **av;
70 int main (int ac, char **av)
73 @x l.100 - Add Web2C version to banner.
74   if (show_banner) printf(banner); /* print a ``banner line'' */
76   if (show_banner) {
77     printf("%s%s\n", banner, versionstring); /* print a ``banner line'' */
78   }
81 @x l.112
82 @d max_bytes 90000 /* the number of bytes in identifiers,
84 @d max_bytes 1000000 /* the number of bytes in identifiers,
87 @x l.114
88 @d max_toks 270000 /* number of bytes in compressed \CEE/ code */
89 @d max_names 4000 /* number of identifiers, strings, section names;
91 @d max_toks 1000000 /* number of bytes in compressed \CEE/ code */
92 @d max_names 10239 /* number of identifiers, strings, section names;
95 @x l.117
96 @d max_texts 2500 /* number of replacement texts, must be less than 10240 */
97 @d hash_size 353 /* should be prime; used in |"common.w"| */
99 @d max_texts 10239 /* number of replacement texts, must be less than 10240 */
100 @d hash_size 8501 /* should be prime; used in |"common.w"| */
103 @x l.121
104 @d buf_size 100 /* for \.{CWEAVE} and \.{CTANGLE} */
106 @d buf_size 1000 /* for \.{CWEAVE} and \.{CTANGLE} */
109 Section 5.
111 @x common.h l.30 - boolean comes from kpathsea.
112 typedef short boolean;
116 Section 6.
118 @x common.h l.36
119 #include <stdio.h>
121 #include <kpathsea/kpathsea.h>
122 #include <stdio.h>
125 @x common.h l.65
126 @d xisalpha(c) (isalpha(c)&&((eight_bits)c<0200))
127 @d xisdigit(c) (isdigit(c)&&((eight_bits)c<0200))
128 @d xisspace(c) (isspace(c)&&((eight_bits)c<0200))
129 @d xislower(c) (islower(c)&&((eight_bits)c<0200))
130 @d xisupper(c) (isupper(c)&&((eight_bits)c<0200))
131 @d xisxdigit(c) (isxdigit(c)&&((eight_bits)c<0200))
133 @d xisalpha(c) (isalpha((eight_bits)c)&&((eight_bits)c<0200))
134 @d xisdigit(c) (isdigit((eight_bits)c)&&((eight_bits)c<0200))
135 @d xisspace(c) (isspace((eight_bits)c)&&((eight_bits)c<0200))
136 @d xislower(c) (islower((eight_bits)c)&&((eight_bits)c<0200))
137 @d xisupper(c) (isupper((eight_bits)c)&&((eight_bits)c<0200))
138 @d xisxdigit(c) (isxdigit((eight_bits)c)&&((eight_bits)c<0200))
141 Section 9.
143 @x common.h l.109 - protos now all in cweb.h.
144 extern name_pointer id_lookup(); /* looks up a string in the identifier table */
145 extern name_pointer section_lookup(); /* finds section name */
146 extern void print_section_name(), sprint_section_name();
148 #include "cweb.h"
151 Section 10.
153 @x common.h l.123 - explicit types, protos now all in cweb.h.
154 extern history; /* indicates how bad this run was */
155 extern err_print(); /* print error message and context */
156 extern wrap_up(); /* indicate |history| and exit */
157 extern void fatal(); /* issue error message and die */
158 extern void overflow(); /* succumb because a table has overflowed */
160 extern int history; /* indicates how bad this run was */
163 Section 11.
165 @x common.h l.131 - max_file_name_length is way too small.
166 @d max_file_name_length 60
168 @d max_file_name_length 1024
171 @x common.h l.138 - explicit types.
172 extern include_depth; /* current level of nesting */
174 extern int include_depth; /* current level of nesting */
177 @x common.h l.148 - explicit types.
178 extern line[]; /* number of current line in the stacked files */
179 extern change_line; /* number of current line in change file */
181 extern int line[]; /* number of current line in the stacked files */
182 extern int change_line; /* number of current line in change file */
185 @x common.h l.153 - protos now all in cweb.h.
186 extern reset_input(); /* initialize to read the web file and change file */
187 extern get_line(); /* inputs the next line */
188 extern check_complete(); /* checks that all changes were picked up */
192 Section 15.
194 @x common.h l.192 - protos now all in cweb.h.
195 extern void common_init();
199 Section 21.
201 @x l.184
202 int names_match(p,first,l)
203 name_pointer p; /* points to the proposed match */
204 char *first; /* position of first character of string */
205 int l; /* length of identifier */
207 int names_match (name_pointer p, const char *first, int l, char t)
210 Section 22.
212 @x l.200
213 init_node(node)
214 name_pointer node;
216 init_node (name_pointer node)
219 @x l.207
220 init_p() {}
222 init_p (name_pointer p, char t) {}
225 Section 26.
227 @x l.261
228 void
229 store_two_bytes(x)
230 sixteen_bits x;
232 static void
233 store_two_bytes (sixteen_bits x)
236 Section 30.
238 @x l.337
239 void
240 push_level(p) /* suspends the current level */
241 name_pointer p;
243 static void
244 push_level (name_pointer p) /* suspends the current level */
247 Section 31.
249 @x l.356
250 void
251 pop_level(flag) /* do this when |cur_byte| reaches |cur_end| */
252 int flag; /* |flag==0| means we are in |output_defs| */
254 static void
255 pop_level (int flag) /* do this when |cur_byte| reaches |cur_end| */
258 Section 33.
260 @x l.392
261 void
262 get_output() /* sends next token to |out_char| */
264 static void
265 get_output (void) /* sends next token to |out_char| */
268 Section 37.
270 @x l.482
271 void
272 flush_buffer() /* writes one line to output file */
274 static void
275 flush_buffer (void) /* writes one line to output file */
278 Section 41.
280 @x l.534
281 void phase_two();
283 static void phase_two (void);
286 Section 42.
288 @x l.537
289 void
290 phase_two () {
292 static void
293 phase_two (void) {
296 Section 43.
298 @x l.577 Use binary mode for output files
299     C_file=fopen(output_file_name,"w");
301     C_file=fopen(output_file_name,"wb");
304 Section 46.
306 @x l.603
307 void output_defs();
309 static void output_defs (void);
312 Section 47.
314 @x l.606
315 void
316 output_defs()
318 static void
319 output_defs (void)
322 Section 48.
324 @x l.649
325 static void out_char();
327 static void out_char (eight_bits);
330 Section 49.
332 @x l.653
333 out_char(cur_char)
334 eight_bits cur_char;
336 out_char (eight_bits cur_char)
339 Section 58.
341 @x l.814
342 eight_bits
343 skip_ahead() /* skip to next control code */
345 static eight_bits
346 skip_ahead (void) /* skip to next control code */
349 Section 60.
351 @x l.849
352 int skip_comment(is_long_comment) /* skips over comments */
353 boolean is_long_comment;
355 static int
356 skip_comment (boolean is_long_comment) /* skips over comments */
359 Section 62
361 @x l.889 - add declaration of versionstring.
362 #include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
366 Section 63.
368 @x l.901
369 eight_bits
370 get_next() /* produces the next input token */
372 static eight_bits
373 get_next (void) /* produces the next input token */
376 Section 63.
378 @x l.954
379     else if (*loc=='>') if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
380                         else compress(minus_gt); break;
382     else if (*loc=='>') {if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
383                          else compress(minus_gt);} break;
386 @x l.974
387   while (isalpha(*++loc) || isdigit(*loc) || isxalpha(*loc) || ishigh(*loc));
389   while (isalpha((unsigned char)*++loc) || isdigit((unsigned char)*loc) || isxalpha(*loc) || ishigh(*loc));
392 Section 76.
394 @x l.1200
395 void
396 scan_repl(t) /* creates a replacement text */
397 eight_bits t;
399 static void
400 scan_repl (eight_bits t) /* creates a replacement text */
403 Section 77.
405 @x l.1232 -- rename local var, not to shadow previous local
406 {int a=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a / 0400)+0200);
407   app_repl(a % 0400);}
409 {int a_l=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a_l / 0400)+0200);
410   app_repl(a_l % 0400);}
413 Section 82.
415 @x l.1320
416         c=toupper(*id_first)-'A'+10;
418         c=toupper((unsigned char)*id_first)-'A'+10;
420 @x l.1325
421         c=16*c+toupper(*id_first)-'A'+10;
423         c=16*c+toupper((unsigned char)*id_first)-'A'+10;
426 Section 83.
428 @x l.1358
429 void
430 scan_section()
432 static void
433 scan_section (void)
436 Section 90.
438 @x l.1458
439 void phase_one();
441 static void phase_one (void);
444 Section 91.
446 @x l.1461
447 void
448 phase_one() {
450 static void
451 phase_one (void) {
454 Section 92.
456 @x l.1476
457 void skip_limbo();
459 static void skip_limbo (void);
462 Section 93.
464 @x l.1479
465 void
466 skip_limbo()
468 static void
469 skip_limbo (void)
472 Section 95.
474 @x l.1535
475 print_stats() {
477 print_stats (void) {