Debian Codegraph @

texk/web2c/cwebdir/cweav-w2c.ch

raw
1 @q Changes for CWEB in TeX Live from numerous contributors. @>
2 @q This file is in the Public Domain. @>
3
4 @q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
5 @q were merged with the set of change files of the CWEBbin project; @>
6 @q see https://github.com/ascherer/cwebbin for the original parts. @>
7
8 @q This stripped change file {comm,ctang,cweav,ctwill,cwebman}-w2c.ch @>
9 @q has been created from the elaborate set of change files @>
10 @q {comm,ctang,cweav,cwebman}-patch.ch, @>
11 @q {comm,cweav,cwebman}-extensions.ch, {comm,ctang,cweav}-output.ch, @>
12 @q {comm,ctang,cweav}-i18n.ch, and cweav-twill.ch for CTWILL, and @>
13 @q {comm,ctang,cweav,ctwill,cwebman}-texlive.ch with the 'tie' processor @>
14 @q and is used as a monolithic changefile for {common,ctangle,cweave}.w @>
15 @q and cwebman.tex in TeX Live. @>
16
17 @q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
18
19 @x [0.0] l.34
20 \def\title{CWEAVE (Version 4.12.2)}
21 @y
22 \def\title{CWEAVE (Version 4.12.2 [\TeX~Live])}
23 @z
24
25 @x [0.0] l.38
26 \centerline{(Version 4.12.2)}
27 @y
28 \centerline{(Version 4.12.2 [\TeX~Live])}
29 @z
30
31 @x [0.0] l.40
32 \def\botofcontents{\vfill
33 @y
34 \def\covernote{\vbox{%
35 @z
36
37 @x [0.0] l.53
38 }
39 @y
40 }}\datecontentspage
41 @z
42
43 @x [1.1] l.69
44 @d banner "This is CWEAVE (Version 4.12.2)"
45 @y
46 @d banner "This is CWEAVE, Version 4.12.2"
47 /* will be extended by the \TeX~Live |versionstring| */
48 @z
49
50 @x [1.2] l.97
51 if (show_banner) puts(banner); /* print a ``banner line'' */
52 @y
53 if (show_banner) cb_show_banner(); /* print a ``banner line'' */
54 @z
55
56 @x [1.3] l.111
57 @i common.h
58 @y
59 @i comm-w2c.h
60 @z
61
62 @x [2.23] l.216
63 @ @d max_refs 30000 /* number of cross-references; must be less than 65536 */
64 @y
65 @ @d max_refs 65535 /* number of cross-references; must be less than 65536 */
66 @z
67
68 @x [2.25] l.245
69 @d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference");
70 @y
71 @d append_xref(c) if (xref_ptr==xmem_end) overflow(_("cross-reference"));
72 @z
73
74 @x [2.30] l.336
75 @d max_toks 30000 /* number of symbols in \CEE/ texts being parsed;
76 must be less than 65536 */
77 @d max_texts 8000 /* number of phrases in \CEE/ texts being parsed;
78 must be less than 10240 */
79 @y
80 @d max_toks 65535 /* number of symbols in \CEE/ texts being parsed;
81 must be less than 65536 */
82 @d max_texts 10239 /* number of phrases in \CEE/ texts being parsed;
83 must be less than 10240 */
84 @z
85
86 @x [4.57] l.887
87 err_print("! String didn't end"); loc=limit; break;
88 @y
89 err_print(_("! String didn't end")); loc=limit; break;
90 @z
91
92 @x [4.57] l.891
93 err_print("! Input ended in middle of string"); loc=buffer; break;
94 @y
95 err_print(_("! Input ended in middle of string")); loc=buffer; break;
96 @z
97
98 @x [4.57] l.910
99 printf("%s","\n! String too long: ");
100 @y
101 printf("%s",_("\n! String too long: "));
102 @z
103
104 @x [4.59] l.929
105 case translit_code: err_print("! Use @@l in limbo only"); continue;
106 @y
107 case translit_code: err_print(_("! Use @@l in limbo only")); continue;
108 @z
109
110 @x [4.62] l.967
111 err_print("! Input ended in section name");
112 @y
113 err_print(_("! Input ended in section name"));
114 @z
115
116 @x [4.62] l.980
117 printf("%s","\n! Section name too long: ");
118 @y
119 printf("%s",_("\n! Section name too long: "));
120 @z
121
122 @x [4.63] l.994
123 err_print("! Section name didn't end"); break;
124 @y
125 err_print(_("! Section name didn't end")); break;
126 @z
127
128 @x [4.63] l.998
129 err_print("! Control codes are forbidden in section name"); break;
130 @y
131 err_print(_("! Control codes are forbidden in section name")); break;
132 @z
133
134 @x [4.64] l.1015
135 err_print("! Control text didn't end"); loc=limit;
136 @y
137 err_print(_("! Control text didn't end")); loc=limit;
138 @z
139
140 @x [4.64] l.1020
141 err_print("! Control codes are forbidden in control text");
142 @y
143 err_print(_("! Control codes are forbidden in control text"));
144 @z
145
146 @x [4.66] l.1035
147 if (loc>=limit) err_print("! Verbatim string didn't end");
148 @y
149 if (loc>=limit) err_print(_("! Verbatim string didn't end"));
150 @z
151
152 @x [5.70] l.1072
153 if (++section_count==max_sections) overflow("section number");
154 @y
155 if (++section_count==max_sections) overflow(_("section number"));
156 @z
157
158 @x [5.74] l.1161
159 case translit_code: err_print("! Use @@l in limbo only"); continue;
160 @y
161 case translit_code: err_print(_("! Use @@l in limbo only")); continue;
162 @z
163
164 @x [5.79] l.1248
165 err_print("! Missing left identifier of @@s");
166 @y
167 err_print(_("! Missing left identifier of @@s"));
168 @z
169
170 @x [5.79] l.1253
171 err_print("! Missing right identifier of @@s");
172 @y
173 err_print(_("! Missing right identifier of @@s"));
174 @z
175
176 @x [5.82] l.1301
177 printf("%s","\n! Never defined: <");
178 print_section_name(p); putchar('>'); mark_harmless();
179 @y
180 printf("%s",_("\n! Never defined: <"));
181 print_section_name(p); putchar('>'); mark_harmless();
182 @z
183
184 @x [5.82] l.1307
185 printf("%s","\n! Never used: <");
186 print_section_name(p); putchar('>'); mark_harmless();
187 @y
188 printf("%s",_("\n! Never used: <"));
189 print_section_name(p); putchar('>'); mark_harmless();
190 @z
191
192 @x [6.89] l.1396
193 @ In particular, the |finish_line| procedure is called near the very
194 beginning of phase two. We initialize the output variables in a slightly
195 tricky way so that the first line of the output file will be
196 `\.{\\input cwebmac}'.
197
198 @<Start \9{t}\TEX/...@>=
199 out_ptr=out_buf+1; out_line=1; active_file=tex_file;
200 tex_printf("\\input cwebma"); *out_ptr='c';
201 @y
202 @ In particular, the |finish_line| procedure is called near the very
203 beginning of phase two. We initialize the output variables in a slightly
204 tricky way so that the first line of the output file will be dependent of
205 the user language set by the `\.{+l}' option and its argument. If you call
206 \.{CWEAVE} with `\.{+lX}' (or `\.{-lX}' as well), where `\.X' is the
207 (possibly empty) string of characters to the right of~`\.l', `\.X'~will be
208 prepended to `\.{cwebmac.tex}', e.g., if you call \.{CWEAVE} with
209 `\.{+ldeutsch}', you will receive the line `\.{\\input deutschcwebmac}'.
210 Without this option the first line of the output file will be
211 `\.{\\input cwebmac}'.
212
213 @<Start \9{t}\TEX/...@>=
214 out_ptr=out_buf+1; out_line=1; active_file=tex_file;
215 tex_puts("\\input ");
216 tex_printf(use_language);
217 tex_puts("cwebma");
218 *out_ptr='c';
219 @z
220
221 @x [6.94] l.1461
222 printf("\n! Line had to be broken (output l. %d):\n",out_line);
223 @y
224 printf(_("\n! Line had to be broken (output l. %d):\n"),out_line);
225 @z
226
227 @x [7.99] l.1542
228 default: err_print("! Double @@ should be used in limbo");
229 @y
230 default: err_print(_("! Double @@ should be used in limbo"));
231 @z
232
233 @x [7.101] l.1584
234 @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow("token"); *(tok_ptr++)=c;}
235 @y
236 @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow(_("token")); *(tok_ptr++)=c;}
237 @z
238
239 @x [7.101] l.1596
240 err_print("! Input ended in mid-comment");
241 @y
242 err_print(_("! Input ended in mid-comment"));
243 @z
244
245 @x [7.101] l.1601
246 if (bal>1) err_print("! Missing } in comment");
247 @y
248 if (bal>1) err_print(_("! Missing } in comment"));
249 @z
250
251 @x [7.101] l.1617
252 else {err_print("! Extra } in comment");
253 @y
254 else {err_print(_("! Extra } in comment"));
255 @z
256
257 @x [7.102] l.1629
258 if (bal>1) err_print("! Missing } in comment");
259 @y
260 if (bal>1) err_print(_("! Missing } in comment"));
261 @z
262
263 @x [7.103] l.1637
264 err_print("! Illegal use of @@ in comment");
265 @y
266 err_print(_("! Illegal use of @@ in comment"));
267 @z
268
269 @x [8.110] l.2128
270 @i prod.w
271 @y
272 @i prod-cweave.w
273 @z
274
275 @x [9.128] l.2650
276 @<Cases for |exp|@>=
277 if (cat1==lbrace || cat1==int_like || cat1==decl) {
278 make_underlined(pp); big_app(dindent); big_app1(pp);
279 reduce(pp,1,fn_decl,0,1);
280 }
281 @y
282 @<Cases for |exp|@>=
283 if(cat1==lbrace || cat1==int_like || cat1==decl) {
284 make_underlined(pp); if (indent_param_decl) big_app(dindent); big_app1(pp);
285 reduce(pp,1,fn_decl,0,1);
286 }
287 @z
288
289 @x [9.138] l.2754
290 @ @<Cases for |decl_head|@>=
291 if (cat1==comma) {
292 big_app2(pp); app(opt); app('9'); reduce(pp,2,decl_head,-1,33);
293 }
294 else if (cat1==ubinop) {
295 big_app1_insert(pp,'{'); big_app('}'); reduce(pp,2,decl_head,-1,34);
296 }
297 else if (cat1==exp && cat2!=lpar && cat2!=lbrack && cat2!=exp && cat2!=cast) {
298 make_underlined(pp+1); squash(pp,2,decl_head,-1,35);
299 }
300 else if ((cat1==binop||cat1==colon) && cat2==exp && (cat3==comma ||
301 cat3==semi || cat3==rpar))
302 squash(pp,3,decl_head,-1,36);
303 else if (cat1==cast) squash(pp,2,decl_head,-1,37);
304 else if (cat1==int_like || cat1==lbrace || cat1==decl) {
305 big_app(dindent); squash(pp,1,fn_decl,0,38);
306 }
307 else if (cat1==semi) squash(pp,2,decl,-1,39);
308 @y
309 @ @<Cases for |decl_head|@>=
310 if (cat1==comma) {
311 big_app2(pp); app(opt); app('9'); reduce(pp,2,decl_head,-1,33);
312 }
313 else if (cat1==ubinop) {
314 big_app1_insert(pp,'{'); big_app('}');
315 reduce(pp,2,decl_head,-1,34);
316 }
317 else if (cat1==exp && cat2!=lpar && cat2!=lbrack && cat2!=exp && cat2!=cast) {
318 make_underlined(pp+1); squash(pp,2,decl_head,-1,35);
319 }
320 else if ((cat1==binop||cat1==colon) && cat2==exp && (cat3==comma ||
321 cat3==semi || cat3==rpar))
322 squash(pp,3,decl_head,-1,36);
323 else if (cat1==cast) squash(pp,2,decl_head,-1,37);
324 else if (cat1==int_like || cat1==lbrace || cat1==decl) {
325 if (indent_param_decl) big_app(dindent);
326 squash(pp,1,fn_decl,0,38);
327 }
328 else if (cat1==semi) squash(pp,2,decl,-1,39);
329 @z
330
331 @x [9.139] l.2776
332 @ @<Cases for |decl|@>=
333 if (cat1==decl) {
334 big_app1_insert(pp,force); reduce(pp,2,decl,-1,40);
335 }
336 else if (cat1==stmt || cat1==function) {
337 big_app1_insert(pp,big_force); reduce(pp,2,cat1,-1,41);
338 }
339 @y
340 @ @<Cases for |decl|@>=
341 if (cat1==decl) {
342 big_app1_insert(pp,force); reduce(pp,2,decl,-1,40);
343 }
344 else if (cat1==stmt || cat1==function) {
345 big_app1_insert(pp,order_decl_stmt ? big_force : force);
346 reduce(pp,2,cat1,-1,41);
347 }
348 @z
349
350 @x [9.143] l.2833
351 @ @<Cases for |fn_decl|@>=
352 if (cat1==decl) {
353 big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51);
354 }
355 else if (cat1==stmt) {
356 big_app1(pp); app(outdent); app(outdent); big_app(force);
357 big_app1(pp+1); reduce(pp,2,function,-1,52);
358 }
359 @y
360 @ @<Cases for |fn_decl|@>=
361 if (cat1==decl) {
362 big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51);
363 }
364 else if (cat1==stmt) {
365 big_app1(pp);
366 if (indent_param_decl) {
367 app(outdent); app(outdent);
368 }
369 big_app(force); big_app1(pp+1); reduce(pp,2,function,-1,52);
370 }
371 @z
372
373 @x [9.153] l.2937
374 big_app1_insert(pp,dindent); reduce(pp,2,fn_decl,0,73);
375 @y
376 big_app1(pp); if (indent_param_decl) big_app(dindent);
377 big_app1(pp+1); reduce(pp,2,fn_decl,0,73);
378 @z
379
380 @x [9.156] l.2963
381 big_app1_insert(pp, (cat1==decl || cat1==function) ? big_force :
382 force_lines ? force : break_space); reduce(pp,2,cat1,-1,76);
383 @y
384 big_app1_insert(pp, (cat1==decl || cat1==function) ? @|
385 ( order_decl_stmt ? big_force : force ) : @|
386 ( force_lines ? force : break_space ) ); reduce(pp,2,cat1,-1,76);
387 @z
388
389 @x [9.186] l.3292
390 overflow("token");
391 @y
392 overflow(_("token"));
393 @z
394
395 @x [9.186] l.3296
396 overflow("text");
397 @y
398 overflow(_("text"));
399 @z
400
401 @x [9.190] l.3351
402 if (tok_ptr+6>tok_mem_end) overflow("token");
403 @y
404 if (tok_ptr+6>tok_mem_end) overflow(_("token"));
405 @z
406
407 @x [9.191] l.3357
408 printf("\nIrreducible scrap sequence in section %d:",(int)section_count);
409 @y
410 printf(_("\nIrreducible scrap sequence in section %d:"),(int)section_count);
411 @z
412
413 @x [9.192] l.3367
414 printf("\nTracing after l. %d:\n",cur_line); mark_harmless();
415 @y
416 printf(_("\nTracing after l. %d:\n"),cur_line); mark_harmless();
417 @z
418
419 @x [10.197] l.3499
420 overflow("scrap/token/text");
421 @y
422 overflow(_("scrap/token/text"));
423 @z
424
425 @x [10.199] l.3584
426 else err_print("! Double @@ should be used in strings");
427 @y
428 else err_print(_("! Double @@ should be used in strings"));
429 @z
430
431 @x [10.203] l.3667
432 if (next_control!='|') err_print("! Missing '|' after C text");
433 @y
434 if (next_control!='|') err_print(_("! Missing '|' after C text"));
435 @z
436
437 @x [11.211] l.3808
438 if (stack_ptr==stack_end) overflow("stack");
439 @y
440 if (stack_ptr==stack_end) overflow(_("stack"));
441 @z
442
443 @x [11.224] l.4131
444 printf("%s","\n! Illegal control code in section name: <");
445 @y
446 printf("%s",_("\n! Illegal control code in section name: <"));
447 @z
448
449 @x [11.225] l.4146
450 printf("%s","\n! C text in section name didn't end: <");
451 @y
452 printf("%s",_("\n! C text in section name didn't end: <"));
453 @z
454
455 @x [11.225] l.4158
456 if (j>buffer+long_buf_size-3) overflow("buffer");
457 @y
458 if (j>buffer+long_buf_size-3) overflow(_("buffer"));
459 @z
460
461 @x [11.226] l.4166
462 if (j>buffer+long_buf_size-4) overflow("buffer");
463 @y
464 if (j>buffer+long_buf_size-4) overflow(_("buffer"));
465 @z
466
467 @x [12.227] l.4181
468 if (show_progress) printf("%s","\nWriting the output file...");
469 @y
470 if (show_progress) printf("%s",_("\nWriting the output file..."));
471 @z
472
473 @x [12.232] l.4268
474 err_print("! TeX string should be in C text only");
475 @y
476 err_print(_("! TeX string should be in C text only"));
477 @z
478
479 @x [12.232] l.4271
480 err_print("! Verbatim string should be in C text only"); break;
481 @y
482 err_print(_("! Verbatim string should be in C text only")); break;
483 @z
484
485 @x [12.232] l.4277
486 err_print("! You can't do that in TeX text"); break;
487 @y
488 err_print(_("! You can't do that in TeX text")); break;
489 @z
490
491 @x [12.236] l.4349
492 err_print("! Improper macro definition");
493 @y
494 err_print(_("! Improper macro definition"));
495 @z
496
497 @x [12.236] l.4362
498 } @=/* otherwise fall through */@>@;
499 default: err_print("! Improper macro definition"); break;
500 @y
501 } @=/* otherwise fall through */@>@;
502 default: err_print(_("! Improper macro definition")); break;
503 @z
504
505 @x [12.237] l.4389
506 if (scrap_ptr!=scrap_info+2) err_print("! Improper format definition");
507 @y
508 if (scrap_ptr!=scrap_info+2) err_print(_("! Improper format definition"));
509 @z
510
511 @x [12.240] l.4424
512 err_print("! You need an = sign after the section name");
513 @y
514 err_print(_("! You need an = sign after the section name"));
515 @z
516
517 @x [12.241] l.4446
518 err_print("! You can't do that in C text");
519 @y
520 err_print(_("! You can't do that in C text"));
521 @z
522
523 @x [13.247] l.4537
524 if (show_progress) printf("%s","\nWriting the index...");
525 @y
526 if (show_progress) printf("%s",_("\nWriting the index..."));
527 @z
528
529 @x [13.247] l.4548
530 fatal("! Cannot open index file ",idx_file_name);
531 @y
532 fatal(_("! Cannot open index file "),idx_file_name);
533 @z
534
535 @x [13.247] l.4560
536 fatal("! Cannot open section file ",scn_file_name);
537 @y
538 fatal(_("! Cannot open section file "),scn_file_name);
539 @z
540
541 @x [13.247] l.4572
542 fclose(active_file);
543 @y
544 fclose(active_file); active_file=tex_file=NULL;
545 if (check_for_change) @<Update the result when it has changed@>@;
546 @z
547
548 @x [13.247] l.4575
549 printf("%s","Done.");
550 @y
551 printf("%s",_("Done."));
552 @z
553
554 @x [13.257] l.4727
555 if (sort_ptr>=scrap_info_end) overflow("sorting");
556 @y
557 if (sort_ptr>=scrap_info_end) overflow(_("sorting"));
558 @z
559
560 @x [13.269] l.4864
561 puts("\nMemory usage statistics:");
562 @.Memory usage statistics:@>
563 printf("%td names (out of %ld)\n",@^system dependencies@>
564 (ptrdiff_t)(name_ptr-name_dir),(long)max_names);
565 printf("%td cross-references (out of %ld)\n",
566 (ptrdiff_t)(xref_ptr-xmem),(long)max_refs);
567 printf("%td bytes (out of %ld)\n",
568 (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
569 puts("Parsing:");
570 printf("%td scraps (out of %ld)\n",
571 (ptrdiff_t)(max_scr_ptr-scrap_info),(long)max_scraps);
572 printf("%td texts (out of %ld)\n",
573 (ptrdiff_t)(max_text_ptr-tok_start),(long)max_texts);
574 printf("%td tokens (out of %ld)\n",
575 (ptrdiff_t)(max_tok_ptr-tok_mem),(long)max_toks);
576 printf("%td levels (out of %ld)\n",
577 (ptrdiff_t)(max_stack_ptr-stack),(long)stack_size);
578 puts("Sorting:");
579 printf("%td levels (out of %ld)\n",
580 (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps);
581 @y
582 puts(_("\nMemory usage statistics:"));
583 @.Memory usage statistics:@>
584 printf(_("%td names (out of %ld)\n"),@^system dependencies@>
585 (ptrdiff_t)(name_ptr-name_dir),(long)max_names);
586 printf(_("%td cross-references (out of %ld)\n"),
587 (ptrdiff_t)(xref_ptr-xmem),(long)max_refs);
588 printf(_("%td bytes (out of %ld)\n"),
589 (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
590 puts(_("Parsing:"));
591 printf(_("%td scraps (out of %ld)\n"),
592 (ptrdiff_t)(max_scr_ptr-scrap_info),(long)max_scraps);
593 printf(_("%td texts (out of %ld)\n"),
594 (ptrdiff_t)(max_text_ptr-tok_start),(long)max_texts);
595 printf(_("%td tokens (out of %ld)\n"),
596 (ptrdiff_t)(max_tok_ptr-tok_mem),(long)max_toks);
597 printf(_("%td levels (out of %ld)\n"),
598 (ptrdiff_t)(max_stack_ptr-stack),(long)stack_size);
599 puts(_("Sorting:"));
600 printf(_("%td levels (out of %ld)\n"),
601 (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps);
602 @z
603
604 @x [14.270] l.4886
605 @** Index.
606 @y
607 @** Extensions to {\tentex CWEB}. The following sections introduce new or
608 improved features that have been created by numerous contributors over the
609 course of a quarter century.
610
611 Care has been taken to keep the original section numbering intact, so this new
612 material should nicely integrate with the original ``\&{270.~Index}.''
613
614 @* Formatting alternatives.
615 \.{CWEAVE} indents declarations after old-style function definitions and
616 long parameter lists of modern function definitions.
617 With the \.{-i} option they will come out flush left.
618
619 @d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */
620
621 @<Set init...@>=
622 indent_param_decl=true;
623
624 @ The original manual described the \.{-o} option for \.{CWEAVE}, but this was
625 not yet present. Here is a simple implementation. The purpose is to suppress
626 the extra space between local variable declarations and the first statement in
627 a function block.
628
629 @d order_decl_stmt flags['o'] /* should declarations and statements be separated? */
630
631 @<Set init...@>=
632 order_decl_stmt=true;
633
634 @* Output file update. Most \CEE/ projects are controlled by a \.{Makefile}
635 that automatically takes care of the temporal dependencies between the different
636 source modules. It may be convenient that \.{CWEB} doesn't create new output
637 for all existing files, when there are only changes to some of them. Thus the
638 \.{make} process will only recompile those modules where necessary. You can
639 activate this feature with the `\.{+c}' command-line option. The idea and basic
640 implementation of this mechanism can be found in the program \.{NUWEB} by
641 Preston Briggs, to whom credit is due.
642
643 @<Update the result...@>= {
644 if((tex_file=fopen(tex_file_name,"r"))!=NULL) {
645 bool comparison=false;
646
647 if((check_file=fopen(check_file_name,"r"))==NULL)
648 fatal(_("! Cannot open output file "),check_file_name);
649 @.Cannot open output file@>
650
651 @<Compare the temporary output...@>@;
652
653 fclose(tex_file); tex_file=NULL;
654 fclose(check_file); check_file=NULL;
655
656 @<Take appropriate action depending on the comparison@>@;
657 } else
658 rename(check_file_name,tex_file_name); /* This was the first run */
659
660 strcpy(check_file_name,""); /* We want to get rid of the temporary file */
661 }
662
663 @ We hope that this runs fast on most systems.
664
665 @<Compare the temporary output to the previous output@>=
666 do {
667 char x[BUFSIZ],y[BUFSIZ];
668 int x_size = fread(x,sizeof(char),BUFSIZ,tex_file);
669 int y_size = fread(y,sizeof(char),BUFSIZ,check_file);
670 comparison = (x_size == y_size) && !memcmp(x,y,x_size);
671 } while(comparison && !feof(tex_file) && !feof(check_file));
672
673 @ Note the superfluous call to |remove| before |rename|. We're using it to
674 get around a bug in some implementations of |rename|.@^system dependencies@>
675
676 @<Take appropriate action...@>=
677 if(comparison)
678 remove(check_file_name); /* The output remains untouched */
679 else {
680 remove(tex_file_name);
681 rename(check_file_name,tex_file_name);
682 }
683
684 @* Print ``version'' information.
685 Don't do this at home, kids! Push our local macro to the variable in \.{COMMON}
686 for printing the |banner| and the |versionstring| from there.
687
688 @d max_banner 50
689
690 @<Common code...@>=
691 extern char cb_banner[];
692
693 @ @<Set init...@>=
694 strncpy(cb_banner,banner,max_banner-1);
695
696 @** Index.
697 @z
698