History

CWEB — release 3.64ae, 2016-01-20.

I removed backup files and executables.

Andreas Scherer committed 10 years ago

Commit 32934261 parent 6be350c16 files · +297 −281Browse files

Unified · Split

16 files
  1. README +9 −3
  2. common.c +115 −115
  3. common.h +1 −1
  4. common.w +1 −1
  5. ctang-bs.ch +2 −2
  6. ctangle.c +6 −6
  7. cweav-bs.ch +2 −2
  8. cweb.el +3 −0
  9. cwebmac.tex +9 −6
  10. cwebman.tex +1 −1
  11. examples/extex.c +25 −24
  12. examples/extex.w +1 −0
  13. examples/wmerge.c +69 −69
  14. examples/wmerge.w +1 −1
  15. examples/wordtest.c +51 −50
  16. examples/wordtest.w +1 −0
README+9−3
@@ -1,9 +1,9 @@
1% This file is part of CWEB.1% This file is part of CWEB.
2% The CWEB programs by Silvio Levy are based on programs by D. E. Knuth.2% The CWEB programs by Silvio Levy are based on programs by D. E. Knuth.
3% They are distributed WITHOUT ANY WARRANTY, express or implied.3% They are distributed WITHOUT ANY WARRANTY, express or implied.
4% This README file last updated May 2000 by Don Knuth4% This README file last updated January 2016 by Don Knuth
5 5
6% Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth6% Copyright (C) 1987,1990,1993,2000,2016 Silvio Levy and Donald E. Knuth
7 7
8% Permission is granted to make and distribute verbatim copies of this8% Permission is granted to make and distribute verbatim copies of this
9% document provided that the copyright notice and this permission notice9% document provided that the copyright notice and this permission notice
@@ -14,7 +14,13 @@ · 4 unmodified lines
14% entire resulting derived work is given a different name and distributed14% entire resulting derived work is given a different name and distributed
15% under the terms of a permission notice identical to this one.15% under the terms of a permission notice identical to this one.
16 16
17% Please send comments, suggestions, etc. to levy@math.berkeley.edu.17% Please send comments, suggestions, etc. to tex-k@tug.org, and people
18% there will verify and forward bug reports.
19%
20% DEK takes no responsibility for the changefiles; they should be
21% maintained independently. His job is to correct errors in
22% ctangle.w, cweave.w, common.w, cwebmac.tex, cwebman.tex,
23% and in the files of examples/*.w, nothing more.
18 24
19This directory contains the following files:25This directory contains the following files:
20 26
common.c+115−115
@@ -1,23 +1,23 @@
1/*1:*/1/*1:*/
2#line 58 "common.w"2#line 58 "./common.w"
3 3
4/*5:*/4/*5:*/
5#line 102 "common.w"5#line 102 "./common.w"
6 6
7#include <ctype.h> 7#include <ctype.h>
8 8
9/*:5*//*8:*/9/*:5*//*8:*/
10#line 165 "common.w"10#line 165 "./common.w"
11 11
12#include <stdio.h> 12#include <stdio.h>
13 13
14/*:8*//*22:*/14/*:8*//*22:*/
15#line 471 "common.w"15#line 471 "./common.w"
16 16
17#include <stdlib.h> 17#include <stdlib.h>
18 18
19/*:22*/19/*:22*/
20#line 59 "common.w"20#line 59 "./common.w"
21 21
22#define ctangle 022#define ctangle 0
23#define cweave 1 \23#define cweave 1 \
@@ -121,16 +121,16 @@ err_print("! Include file name too long") ;goto restart;} \ · 97 unmodified lines
121#define C_putc(c) putc(c,C_file) \121#define C_putc(c) putc(c,C_file) \
122 122
123 123
124#line 60 "common.w"124#line 60 "./common.w"
125 125
126/*2:*/126/*2:*/
127#line 73 "common.w"127#line 73 "./common.w"
128 128
129typedef short boolean;129typedef short boolean;
130boolean program;130boolean program;
131 131
132/*:2*//*7:*/132/*:2*//*7:*/
133#line 159 "common.w"133#line 159 "./common.w"
134 134
135char buffer[long_buf_size];135char buffer[long_buf_size];
136char*buffer_end= buffer+buf_size-2;136char*buffer_end= buffer+buf_size-2;
@@ -138,7 +138,7 @@ char*limit= buffer; · 1 unmodified line
138char*loc= buffer;138char*loc= buffer;
139 139
140/*:7*//*10:*/140/*:7*//*10:*/
141#line 214 "common.w"141#line 214 "./common.w"
142 142
143int include_depth;143int include_depth;
144FILE*file[max_include_depth];144FILE*file[max_include_depth];
@@ -155,7 +155,7 @@ boolean changing; · 10 unmodified lines
155boolean web_file_open= 0;155boolean web_file_open= 0;
156 156
157/*:10*//*20:*/157/*:10*//*20:*/
158#line 418 "common.w"158#line 418 "./common.w"
159 159
160typedef unsigned short sixteen_bits;160typedef unsigned short sixteen_bits;
161sixteen_bits section_count;161sixteen_bits section_count;
@@ -165,17 +165,17 @@ boolean change_pending; · 3 unmodified lines
165boolean print_where= 0;165boolean print_where= 0;
166 166
167/*:20*//*27:*/167/*:20*//*27:*/
168#line 594 "common.w"168#line 594 "./common.w"
169 169
170typedef struct name_info{170typedef struct name_info{
171char*byte_start;171char*byte_start;
172/*31:*/172/*31:*/
173#line 631 "common.w"173#line 631 "./common.w"
174 174
175struct name_info*link;175struct name_info*link;
176 176
177/*:31*//*40:*/177/*:31*//*40:*/
178#line 730 "common.w"178#line 730 "./common.w"
179 179
180union{180union{
181struct name_info*Rlink;181struct name_info*Rlink;
@@ -184,12 +184,12 @@ char Ilk; · 2 unmodified lines
184}dummy;184}dummy;
185 185
186/*:40*//*55:*/186/*:40*//*55:*/
187#line 1062 "common.w"187#line 1062 "./common.w"
188 188
189char*equiv_or_xref;189char*equiv_or_xref;
190 190
191/*:55*/191/*:55*/
192#line 597 "common.w"192#line 597 "./common.w"
193 193
194}name_info;194}name_info;
195typedef name_info*name_pointer;195typedef name_info*name_pointer;
@@ -199,13 +199,13 @@ name_info name_dir[max_names]; · 3 unmodified lines
199name_pointer name_dir_end= name_dir+max_names-1;199name_pointer name_dir_end= name_dir+max_names-1;
200 200
201/*:27*//*29:*/201/*:27*//*29:*/
202#line 617 "common.w"202#line 617 "./common.w"
203 203
204name_pointer name_ptr;204name_pointer name_ptr;
205char*byte_ptr;205char*byte_ptr;
206 206
207/*:29*//*32:*/207/*:29*//*32:*/
208#line 644 "common.w"208#line 644 "./common.w"
209 209
210typedef name_pointer*hash_pointer;210typedef name_pointer*hash_pointer;
211name_pointer hash[hash_size];211name_pointer hash[hash_size];
@@ -213,12 +213,12 @@ hash_pointer hash_end= hash+hash_size-1; · 1 unmodified line
213hash_pointer h;213hash_pointer h;
214 214
215/*:32*//*56:*/215/*:32*//*56:*/
216#line 1082 "common.w"216#line 1082 "./common.w"
217 217
218int history= spotless;218int history= spotless;
219 219
220/*:56*//*67:*/220/*:56*//*67:*/
221#line 1220 "common.w"221#line 1220 "./common.w"
222 222
223int argc;223int argc;
224char**argv;224char**argv;
@@ -229,7 +229,7 @@ char scn_file_name[max_file_name_length]; · 4 unmodified lines
229boolean flags[128];229boolean flags[128];
230 230
231/*:67*//*77:*/231/*:67*//*77:*/
232#line 1370 "common.w"232#line 1370 "./common.w"
233 233
234FILE*C_file;234FILE*C_file;
235FILE*tex_file;235FILE*tex_file;
@@ -238,64 +238,64 @@ FILE*scn_file; · 2 unmodified lines
238FILE*active_file;238FILE*active_file;
239 239
240/*:77*/240/*:77*/
241#line 61 "common.w"241#line 61 "./common.w"
242 242
243/*3:*/243/*3:*/
244#line 83 "common.w"244#line 83 "./common.w"
245int phase;245int phase;
246 246
247/*:3*//*11:*/247/*:3*//*11:*/
248#line 240 "common.w"248#line 240 "./common.w"
249 249
250char change_buffer[buf_size];250char change_buffer[buf_size];
251char*change_limit;251char*change_limit;
252 252
253/*:11*/253/*:11*/
254#line 62 "common.w"254#line 62 "./common.w"
255 255
256/*33:*/256/*33:*/
257#line 650 "common.w"257#line 650 "./common.w"
258 258
259extern int names_match();259extern int names_match();
260 260
261/*:33*//*38:*/261/*:33*//*38:*/
262#line 703 "common.w"262#line 703 "./common.w"
263 263
264void init_p();264void init_p();
265 265
266/*:38*//*46:*/266/*:38*//*46:*/
267#line 852 "common.w"267#line 852 "./common.w"
268 268
269extern void init_node();269extern void init_node();
270 270
271/*:46*//*53:*/271/*:46*//*53:*/
272#line 1017 "common.w"272#line 1017 "./common.w"
273 273
274int section_name_cmp();274int section_name_cmp();
275 275
276/*:53*//*57:*/276/*:53*//*57:*/
277#line 1092 "common.w"277#line 1092 "./common.w"
278 278
279void err_print();279void err_print();
280 280
281/*:57*//*60:*/281/*:57*//*60:*/
282#line 1140 "common.w"282#line 1140 "./common.w"
283 283
284int wrap_up();284int wrap_up();
285extern void print_stats();285extern void print_stats();
286 286
287/*:60*//*63:*/287/*:60*//*63:*/
288#line 1173 "common.w"288#line 1173 "./common.w"
289 289
290void fatal(),overflow();290void fatal(),overflow();
291 291
292/*:63*//*69:*/292/*:63*//*69:*/
293#line 1251 "common.w"293#line 1251 "./common.w"
294 294
295void scan_args();295void scan_args();
296 296
297/*:69*//*81:*/297/*:69*//*81:*/
298#line 1411 "common.w"298#line 1411 "./common.w"
299 299
300extern int strlen();300extern int strlen();
301extern int strcmp();301extern int strcmp();
@@ -304,45 +304,45 @@ extern int strncmp(); · 2 unmodified lines
304extern char*strncpy();304extern char*strncpy();
305 305
306/*:81*/306/*:81*/
307#line 63 "common.w"307#line 63 "./common.w"
308 308
309 309
310/*:1*//*4:*/310/*:1*//*4:*/
311#line 89 "common.w"311#line 89 "./common.w"
312 312
313void313void
314common_init()314common_init()
315{315{
316/*30:*/316/*30:*/
317#line 621 "common.w"317#line 621 "./common.w"
318 318
319name_dir->byte_start= byte_ptr= byte_mem;319name_dir->byte_start= byte_ptr= byte_mem;
320name_ptr= name_dir+1;320name_ptr= name_dir+1;
321name_ptr->byte_start= byte_mem;321name_ptr->byte_start= byte_mem;
322 322
323/*:30*//*34:*/323/*:30*//*34:*/
324#line 655 "common.w"324#line 655 "./common.w"
325 325
326for(h= hash;h<=hash_end;*h++= NULL);326for(h= hash;h<=hash_end;*h++= NULL);
327 327
328/*:34*//*41:*/328/*:34*//*41:*/
329#line 737 "common.w"329#line 737 "./common.w"
330 330
331root= NULL;331root= NULL;
332 332
333/*:41*/333/*:41*/
334#line 93 "common.w"334#line 93 "./common.w"
335;335;
336/*68:*/336/*68:*/
337#line 1233 "common.w"337#line 1233 "./common.w"
338 338
339show_banner= show_happiness= show_progress= 1;339show_banner= show_happiness= show_progress= 1;
340 340
341/*:68*/341/*:68*/
342#line 94 "common.w"342#line 94 "./common.w"
343;343;
344/*78:*/344/*78:*/
345#line 1377 "common.w"345#line 1377 "./common.w"
346 346
347scan_args();347scan_args();
348if(program==ctangle){348if(program==ctangle){
@@ -356,12 +356,12 @@ fatal("! Cannot open output file ",tex_file_name); · 7 unmodified lines
356}356}
357 357
358/*:78*/358/*:78*/
359#line 95 "common.w"359#line 95 "./common.w"
360;360;
361}361}
362 362
363/*:4*//*9:*/363/*:4*//*9:*/
364#line 172 "common.w"364#line 172 "./common.w"
365 365
366int input_ln(fp)366int input_ln(fp)
367FILE*fp;367FILE*fp;
@@ -383,14 +383,14 @@ return(1); · 15 unmodified lines
383}383}
384 384
385/*:9*//*12:*/385/*:9*//*12:*/
386#line 251 "common.w"386#line 251 "./common.w"
387 387
388void388void
389prime_the_change_buffer()389prime_the_change_buffer()
390{390{
391change_limit= change_buffer;391change_limit= change_buffer;
392/*13:*/392/*13:*/
393#line 265 "common.w"393#line 265 "./common.w"
394 394
395while(1){395while(1){
396change_line++;396change_line++;
@@ -407,10 +407,10 @@ err_print("! Missing @x in change file"); · 10 unmodified lines
407}407}
408 408
409/*:13*/409/*:13*/
410#line 256 "common.w"410#line 256 "./common.w"
411;411;
412/*14:*/412/*14:*/
413#line 282 "common.w"413#line 282 "./common.w"
414 414
415do{415do{
416change_line++;416change_line++;
@@ -422,10 +422,10 @@ return; · 5 unmodified lines
422}while(limit==buffer);422}while(limit==buffer);
423 423
424/*:14*/424/*:14*/
425#line 257 "common.w"425#line 257 "./common.w"
426;426;
427/*15:*/427/*15:*/
428#line 292 "common.w"428#line 292 "./common.w"
429 429
430{430{
431change_limit= change_buffer+(limit-buffer);431change_limit= change_buffer+(limit-buffer);
@@ -433,12 +433,12 @@ strncpy(change_buffer,buffer,limit-buffer+1); · 1 unmodified line
433}433}
434 434
435/*:15*/435/*:15*/
436#line 258 "common.w"436#line 258 "./common.w"
437;437;
438}438}
439 439
440/*:12*//*16:*/440/*:12*//*16:*/
441#line 320 "common.w"441#line 320 "./common.w"
442 442
443void443void
444check_change()444check_change()
@@ -461,7 +461,7 @@ return; · 16 unmodified lines
461if(limit> buffer+1&&buffer[0]=='@'){461if(limit> buffer+1&&buffer[0]=='@'){
462char xyz_code= xisupper(buffer[1])?tolower(buffer[1]):buffer[1];462char xyz_code= xisupper(buffer[1])?tolower(buffer[1]):buffer[1];
463/*17:*/463/*17:*/
464#line 358 "common.w"464#line 358 "./common.w"
465 465
466if(xyz_code=='x'||xyz_code=='z'){466if(xyz_code=='x'||xyz_code=='z'){
467loc= buffer+2;err_print("! Where is the matching @y?");467loc= buffer+2;err_print("! Where is the matching @y?");
@@ -479,11 +479,11 @@ return; · 11 unmodified lines
479}479}
480 480
481/*:17*/481/*:17*/
482#line 342 "common.w"482#line 342 "./common.w"
483;483;
484}484}
485/*15:*/485/*15:*/
486#line 292 "common.w"486#line 292 "./common.w"
487 487
488{488{
489change_limit= change_buffer+(limit-buffer);489change_limit= change_buffer+(limit-buffer);
@@ -491,7 +491,7 @@ strncpy(change_buffer,buffer,limit-buffer+1); · 1 unmodified line
491}491}
492 492
493/*:15*/493/*:15*/
494#line 344 "common.w"494#line 344 "./common.w"
495;495;
496changing= 0;cur_line++;496changing= 0;cur_line++;
497while(!input_ln(cur_file)){497while(!input_ln(cur_file)){
@@ -507,14 +507,14 @@ if(lines_dont_match)n++; · 9 unmodified lines
507}507}
508 508
509/*:16*//*18:*/509/*:16*//*18:*/
510#line 378 "common.w"510#line 378 "./common.w"
511 511
512void512void
513reset_input()513reset_input()
514{514{
515limit= buffer;loc= buffer+1;buffer[0]= ' ';515limit= buffer;loc= buffer+1;buffer[0]= ' ';
516/*19:*/516/*19:*/
517#line 393 "common.w"517#line 393 "./common.w"
518 518
519if((web_file= fopen(web_file_name,"r"))==NULL){519if((web_file= fopen(web_file_name,"r"))==NULL){
520strcpy(web_file_name,alt_web_file_name);520strcpy(web_file_name,alt_web_file_name);
@@ -528,7 +528,7 @@ if((change_file= fopen(change_file_name,"r"))==NULL) · 7 unmodified lines
528fatal("! Cannot open change file ",change_file_name);528fatal("! Cannot open change file ",change_file_name);
529 529
530/*:19*/530/*:19*/
531#line 383 "common.w"531#line 383 "./common.w"
532;532;
533include_depth= 0;cur_line= 0;change_line= 0;533include_depth= 0;cur_line= 0;change_line= 0;
534change_depth= include_depth;534change_depth= include_depth;
@@ -537,14 +537,14 @@ limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= 0; · 2 unmodified lines
537}537}
538 538
539/*:18*//*21:*/539/*:18*//*21:*/
540#line 426 "common.w"540#line 426 "./common.w"
541 541
542int get_line()542int get_line()
543{543{
544restart:544restart:
545if(changing&&include_depth==change_depth)545if(changing&&include_depth==change_depth)
546/*25:*/546/*25:*/
547#line 537 "common.w"547#line 537 "./common.w"
548{548{
549change_line++;549change_line++;
550if(!input_ln(change_file)){550if(!input_ln(change_file)){
@@ -575,11 +575,11 @@ prime_the_change_buffer();changing= !changing;print_where= 1; · 24 unmodified lines
575}575}
576 576
577/*:25*/577/*:25*/
578#line 431 "common.w"578#line 431 "./common.w"
579;579;
580if(!changing||include_depth> change_depth){580if(!changing||include_depth> change_depth){
581/*24:*/581/*24:*/
582#line 520 "common.w"582#line 520 "./common.w"
583{583{
584cur_line++;584cur_line++;
585while(!input_ln(cur_file)){585while(!input_ln(cur_file)){
@@ -598,7 +598,7 @@ if(change_limit> change_buffer)check_change(); · 12 unmodified lines
598}598}
599 599
600/*:24*/600/*:24*/
601#line 433 "common.w"601#line 433 "./common.w"
602;602;
603if(changing&&include_depth==change_depth)goto restart;603if(changing&&include_depth==change_depth)goto restart;
604}604}
@@ -619,7 +619,7 @@ goto restart; · 14 unmodified lines
619}619}
620include_depth++;620include_depth++;
621/*23:*/621/*23:*/
622#line 474 "common.w"622#line 474 "./common.w"
623{623{
624char temp_file_name[max_file_name_length];624char temp_file_name[max_file_name_length];
625char*cur_file_name_end= cur_file_name+max_file_name_length-1;625char*cur_file_name_end= cur_file_name+max_file_name_length-1;
@@ -667,14 +667,14 @@ include_depth--;err_print("! Cannot open include file");goto restart; · 41 unmodified lines
667}667}
668 668
669/*:23*/669/*:23*/
670#line 452 "common.w"670#line 452 "./common.w"
671;671;
672}672}
673return 1;673return 1;
674}674}
675 675
676/*:21*//*26:*/676/*:21*//*26:*/
677#line 569 "common.w"677#line 569 "./common.w"
678 678
679void679void
680check_complete(){680check_complete(){
@@ -688,7 +688,7 @@ err_print("! Change file entry did not match"); · 7 unmodified lines
688}688}
689 689
690/*:26*//*35:*/690/*:26*//*35:*/
691#line 660 "common.w"691#line 660 "./common.w"
692 692
693name_pointer693name_pointer
694id_lookup(first,last,t)694id_lookup(first,last,t)
@@ -703,17 +703,17 @@ name_pointer p; · 8 unmodified lines
703if(last==NULL)for(last= first;*last!='\0';last++);703if(last==NULL)for(last= first;*last!='\0';last++);
704l= last-first;704l= last-first;
705/*36:*/705/*36:*/
706#line 683 "common.w"706#line 683 "./common.w"
707 707
708h= (unsigned char)*i;708h= (unsigned char)*i;
709while(++i<last)h= (h+h+(int)((unsigned char)*i))%hash_size;709while(++i<last)h= (h+h+(int)((unsigned char)*i))%hash_size;
710 710
711 711
712/*:36*/712/*:36*/
713#line 673 "common.w"713#line 673 "./common.w"
714;714;
715/*37:*/715/*37:*/
716#line 691 "common.w"716#line 691 "./common.w"
717 717
718p= hash[h];718p= hash[h];
719while(p&&!names_match(p,first,l,t))p= p->link;719while(p&&!names_match(p,first,l,t))p= p->link;
@@ -723,10 +723,10 @@ p->link= hash[h];hash[h]= p; · 3 unmodified lines
723}723}
724 724
725/*:37*/725/*:37*/
726#line 674 "common.w"726#line 674 "./common.w"
727;727;
728if(p==name_ptr)/*39:*/728if(p==name_ptr)/*39:*/
729#line 706 "common.w"729#line 706 "./common.w"
730{730{
731if(byte_ptr+l> byte_mem_end)overflow("byte memory");731if(byte_ptr+l> byte_mem_end)overflow("byte memory");
732if(name_ptr>=name_dir_end)overflow("name");732if(name_ptr>=name_dir_end)overflow("name");
@@ -736,13 +736,13 @@ if(program==cweave)init_p(p,t); · 3 unmodified lines
736}736}
737 737
738/*:39*/738/*:39*/
739#line 675 "common.w"739#line 675 "./common.w"
740;740;
741return(p);741return(p);
742}742}
743 743
744/*:35*//*42:*/744/*:35*//*42:*/
745#line 764 "common.w"745#line 764 "./common.w"
746 746
747void747void
748print_section_name(p)748print_section_name(p)
@@ -763,7 +763,7 @@ if(q)term_write("...",3); · 14 unmodified lines
763}763}
764 764
765/*:42*//*43:*/765/*:42*//*43:*/
766#line 783 "common.w"766#line 783 "./common.w"
767 767
768void768void
769sprint_section_name(dest,p)769sprint_section_name(dest,p)
@@ -786,7 +786,7 @@ s= p->byte_start; · 16 unmodified lines
786}786}
787 787
788/*:43*//*44:*/788/*:43*//*44:*/
789#line 804 "common.w"789#line 804 "./common.w"
790 790
791void791void
792print_prefix_name(p)792print_prefix_name(p)
@@ -799,7 +799,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); · 6 unmodified lines
799}799}
800 800
801/*:44*//*45:*/801/*:44*//*45:*/
802#line 825 "common.w"802#line 825 "./common.w"
803 803
804int web_strcmp(j,j_len,k,k_len)804int web_strcmp(j,j_len,k,k_len)
805char*j,*k;805char*j,*k;
@@ -815,7 +815,7 @@ else return greater; · 9 unmodified lines
815}815}
816 816
817/*:45*//*47:*/817/*:45*//*47:*/
818#line 855 "common.w"818#line 855 "./common.w"
819 819
820name_pointer820name_pointer
821add_section_name(par,c,first,last,ispref)821add_section_name(par,c,first,last,ispref)
@@ -846,7 +846,7 @@ return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); · 24 unmodified lines
846}846}
847 847
848/*:47*//*48:*/848/*:47*//*48:*/
849#line 884 "common.w"849#line 884 "./common.w"
850 850
851void851void
852extend_section_name(p,first,last,ispref)852extend_section_name(p,first,last,ispref)
@@ -870,7 +870,7 @@ if(ispref)*(byte_ptr-1)= ' '; · 17 unmodified lines
870}870}
871 871
872/*:48*//*49:*/872/*:48*//*49:*/
873#line 912 "common.w"873#line 912 "./common.w"
874 874
875name_pointer875name_pointer
876section_lookup(first,last,ispref)876section_lookup(first,last,ispref)
@@ -885,7 +885,7 @@ name_pointer par= NULL; · 8 unmodified lines
885 885
886int name_len= last-first+1;886int name_len= last-first+1;
887/*50:*/887/*50:*/
888#line 936 "common.w"888#line 936 "./common.w"
889 889
890while(p){890while(p){
891c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p));891c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p));
@@ -912,19 +912,19 @@ p= q,q= NULL; · 20 unmodified lines
912}912}
913 913
914/*:50*/914/*:50*/
915#line 926 "common.w"915#line 926 "./common.w"
916;916;
917/*51:*/917/*51:*/
918#line 961 "common.w"918#line 961 "./common.w"
919 919
920if(r==NULL)920if(r==NULL)
921return add_section_name(par,c,first,last+1,ispref);921return add_section_name(par,c,first,last+1,ispref);
922 922
923/*:51*/923/*:51*/
924#line 927 "common.w"924#line 927 "./common.w"
925;925;
926/*52:*/926/*52:*/
927#line 969 "common.w"927#line 969 "./common.w"
928 928
929switch(section_name_cmp(&first,name_len,r)){929switch(section_name_cmp(&first,name_len,r)){
930 930
@@ -958,12 +958,12 @@ return r; · 27 unmodified lines
958}958}
959 959
960/*:52*/960/*:52*/
961#line 928 "common.w"961#line 928 "./common.w"
962;962;
963}963}
964 964
965/*:49*//*54:*/965/*:49*//*54:*/
966#line 1020 "common.w"966#line 1020 "./common.w"
967 967
968int section_name_cmp(pfirst,len,r)968int section_name_cmp(pfirst,len,r)
969char**pfirst;969char**pfirst;
@@ -997,7 +997,7 @@ default:return c; · 27 unmodified lines
997}997}
998 998
999/*:54*//*58:*/999/*:54*//*58:*/
1000#line 1095 "common.w"1000#line 1095 "./common.w"
1001 1001
1002void1002void
1003err_print(s)1003err_print(s)
@@ -1006,7 +1006,7 @@ char*s; · 2 unmodified lines
1006char*k,*l;1006char*k,*l;
1007printf(*s=='!'?"\n%s":"%s",s);1007printf(*s=='!'?"\n%s":"%s",s);
1008if(web_file_open)/*59:*/1008if(web_file_open)/*59:*/
1009#line 1115 "common.w"1009#line 1115 "./common.w"
1010 1010
1011{if(changing&&include_depth==change_depth)1011{if(changing&&include_depth==change_depth)
1012printf(". (l. %d of change file)\n",change_line);1012printf(". (l. %d of change file)\n",change_line);
@@ -1026,20 +1026,20 @@ putchar(' '); · 13 unmodified lines
1026}1026}
1027 1027
1028/*:59*/1028/*:59*/
1029#line 1102 "common.w"1029#line 1102 "./common.w"
1030;1030;
1031update_terminal;mark_error;1031update_terminal;mark_error;
1032}1032}
1033 1033
1034/*:58*//*61:*/1034/*:58*//*61:*/
1035#line 1150 "common.w"1035#line 1150 "./common.w"
1036 1036
1037int wrap_up(){1037int wrap_up(){
1038putchar('\n');1038putchar('\n');
1039if(show_stats)1039if(show_stats)
1040print_stats();1040print_stats();
1041/*62:*/1041/*62:*/
1042#line 1160 "common.w"1042#line 1160 "./common.w"
1043 1043
1044switch(history){1044switch(history){
1045case spotless:if(show_happiness)printf("(No errors were found.)\n");break;1045case spotless:if(show_happiness)printf("(No errors were found.)\n");break;
@@ -1051,14 +1051,14 @@ case fatal_message:printf("(That was a fatal error, my friend.)\n"); · 5 unmodified lines
1051}1051}
1052 1052
1053/*:62*/1053/*:62*/
1054#line 1155 "common.w"1054#line 1155 "./common.w"
1055;1055;
1056if(history> harmless_message)return(1);1056if(history> harmless_message)return(1);
1057else return(0);1057else return(0);
1058}1058}
1059 1059
1060/*:61*//*64:*/1060/*:61*//*64:*/
1061#line 1179 "common.w"1061#line 1179 "./common.w"
1062void1062void
1063fatal(s,t)1063fatal(s,t)
1064char*s,*t;1064char*s,*t;
@@ -1069,7 +1069,7 @@ history= fatal_message;exit(wrap_up()); · 4 unmodified lines
1069}1069}
1070 1070
1071/*:64*//*65:*/1071/*:64*//*65:*/
1072#line 1190 "common.w"1072#line 1190 "./common.w"
1073void1073void
1074overflow(t)1074overflow(t)
1075char*t;1075char*t;
@@ -1079,7 +1079,7 @@ printf("\n! Sorry, %s capacity exceeded",t);fatal("",""); · 3 unmodified lines
1079 1079
1080 1080
1081/*:65*//*70:*/1081/*:65*//*70:*/
1082#line 1254 "common.w"1082#line 1254 "./common.w"
1083 1083
1084void1084void
1085scan_args()1085scan_args()
@@ -1093,7 +1093,7 @@ boolean flag_change; · 7 unmodified lines
1093 1093
1094while(--argc> 0){1094while(--argc> 0){
1095if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*74:*/1095if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*74:*/
1096#line 1344 "common.w"1096#line 1344 "./common.w"
1097 1097
1098{1098{
1099if(**argv=='-')flag_change= 0;1099if(**argv=='-')flag_change= 0;
@@ -1103,7 +1103,7 @@ flags[*dot_pos]= flag_change; · 3 unmodified lines
1103}1103}
1104 1104
1105/*:74*/1105/*:74*/
1106#line 1266 "common.w"1106#line 1266 "./common.w"
1107 1107
1108else{1108else{
1109s= name_pos= *argv;dot_pos= NULL;1109s= name_pos= *argv;dot_pos= NULL;
@@ -1113,17 +1113,17 @@ else if(*s=='/')dot_pos= NULL,name_pos= ++s; · 3 unmodified lines
1113else s++;1113else s++;
1114}1114}
1115if(!found_web)/*71:*/1115if(!found_web)/*71:*/
1116#line 1292 "common.w"1116#line 1292 "./common.w"
1117 1117
1118{1118{
1119if(s-*argv> max_file_name_length-5)1119if(s-*argv> max_file_name_length-5)
1120/*76:*/1120/*76:*/
1121#line 1364 "common.w"1121#line 1364 "./common.w"
1122fatal("! Filename too long\n",*argv);1122fatal("! Filename too long\n",*argv);
1123 1123
1124 1124
1125/*:76*/1125/*:76*/
1126#line 1295 "common.w"1126#line 1295 "./common.w"
1127;1127;
1128if(dot_pos==NULL)1128if(dot_pos==NULL)
1129sprintf(web_file_name,"%s.w",*argv);1129sprintf(web_file_name,"%s.w",*argv);
@@ -1140,22 +1140,22 @@ found_web= 1; · 10 unmodified lines
1140}1140}
1141 1141
1142/*:71*/1142/*:71*/
1143#line 1275 "common.w"1143#line 1275 "./common.w"
1144 1144
1145else if(!found_change)/*72:*/1145else if(!found_change)/*72:*/
1146#line 1310 "common.w"1146#line 1310 "./common.w"
1147 1147
1148{1148{
1149if(strcmp(*argv,"-")==0)found_change= -1;1149if(strcmp(*argv,"-")==0)found_change= -1;
1150else{1150else{
1151if(s-*argv> max_file_name_length-4)1151if(s-*argv> max_file_name_length-4)
1152/*76:*/1152/*76:*/
1153#line 1364 "common.w"1153#line 1364 "./common.w"
1154fatal("! Filename too long\n",*argv);1154fatal("! Filename too long\n",*argv);
1155 1155
1156 1156
1157/*:76*/1157/*:76*/
1158#line 1315 "common.w"1158#line 1315 "./common.w"
1159;1159;
1160if(dot_pos==NULL)1160if(dot_pos==NULL)
1161sprintf(change_file_name,"%s.ch",*argv);1161sprintf(change_file_name,"%s.ch",*argv);
@@ -1165,20 +1165,20 @@ found_change= 1; · 3 unmodified lines
1165}1165}
1166 1166
1167/*:72*/1167/*:72*/
1168#line 1276 "common.w"1168#line 1276 "./common.w"
1169 1169
1170else if(!found_out)/*73:*/1170else if(!found_out)/*73:*/
1171#line 1323 "common.w"1171#line 1323 "./common.w"
1172 1172
1173{1173{
1174if(s-*argv> max_file_name_length-5)1174if(s-*argv> max_file_name_length-5)
1175/*76:*/1175/*76:*/
1176#line 1364 "common.w"1176#line 1364 "./common.w"
1177fatal("! Filename too long\n",*argv);1177fatal("! Filename too long\n",*argv);
1178 1178
1179 1179
1180/*:76*/1180/*:76*/
1181#line 1326 "common.w"1181#line 1326 "./common.w"
1182;1182;
1183if(dot_pos==NULL){1183if(dot_pos==NULL){
1184sprintf(tex_file_name,"%s.tex",*argv);1184sprintf(tex_file_name,"%s.tex",*argv);
@@ -1198,10 +1198,10 @@ found_out= 1; · 13 unmodified lines
1198}1198}
1199 1199
1200/*:73*/1200/*:73*/
1201#line 1277 "common.w"1201#line 1277 "./common.w"
1202 1202
1203else/*75:*/1203else/*75:*/
1204#line 1352 "common.w"1204#line 1352 "./common.w"
1205 1205
1206{1206{
1207if(program==ctangle)1207if(program==ctangle)
@@ -1215,12 +1215,12 @@ else fatal( · 7 unmodified lines
1215}1215}
1216 1216
1217/*:75*/1217/*:75*/
1218#line 1278 "common.w"1218#line 1278 "./common.w"
1219;1219;
1220}1220}
1221}1221}
1222if(!found_web)/*75:*/1222if(!found_web)/*75:*/
1223#line 1352 "common.w"1223#line 1352 "./common.w"
1224 1224
1225{1225{
1226if(program==ctangle)1226if(program==ctangle)
@@ -1234,7 +1234,7 @@ else fatal( · 7 unmodified lines
1234}1234}
1235 1235
1236/*:75*/1236/*:75*/
1237#line 1281 "common.w"1237#line 1281 "./common.w"
1238;1238;
1239if(found_change<=0)strcpy(change_file_name,"/dev/null");1239if(found_change<=0)strcpy(change_file_name,"/dev/null");
1240}1240}
common.h+1−1
@@ -101,7 +101,7 @@ extern char byte_mem[]; /* characters of names */ · 100 unmodified lines
101extern char *byte_mem_end; /* end of |byte_mem| */101extern char *byte_mem_end; /* end of |byte_mem| */
102extern name_info name_dir[]; /* information about names */102extern name_info name_dir[]; /* information about names */
103extern name_pointer name_dir_end; /* end of |name_dir| */103extern name_pointer name_dir_end; /* end of |name_dir| */
104extern name_pointer name_ptr; /* first unused position in |byte_start| */104extern name_pointer name_ptr; /* first unused position in |name_dir| */
105extern char *byte_ptr; /* first unused position in |byte_mem| */105extern char *byte_ptr; /* first unused position in |byte_mem| */
106extern name_pointer hash[]; /* heads of hash lists */106extern name_pointer hash[]; /* heads of hash lists */
107extern hash_pointer hash_end; /* end of |hash| */107extern hash_pointer hash_end; /* end of |hash| */
common.w+1−1
@@ -615,7 +615,7 @@ usually have |name_ptr->byte_start==byte_ptr|, and certainly · 614 unmodified lines
615we want to keep |name_ptr<=name_dir_end| and |byte_ptr<=byte_mem_end|.615we want to keep |name_ptr<=name_dir_end| and |byte_ptr<=byte_mem_end|.
616 616
617@<Defini...@>=617@<Defini...@>=
618name_pointer name_ptr; /* first unused position in |byte_start| */618name_pointer name_ptr; /* first unused position in |name_dir| */
619char *byte_ptr; /* first unused position in |byte_mem| */619char *byte_ptr; /* first unused position in |byte_mem| */
620 620
621@ @<Init...@>=621@ @<Init...@>=
ctang-bs.ch+2−2
@@ -93,7 +93,7 @@ extern char byte_mem[]; /* characters of names */ · 92 unmodified lines
93extern char *byte_mem_end; /* end of |byte_mem| */93extern char *byte_mem_end; /* end of |byte_mem| */
94extern name_info name_dir[]; /* information about names */94extern name_info name_dir[]; /* information about names */
95extern name_pointer name_dir_end; /* end of |name_dir| */95extern name_pointer name_dir_end; /* end of |name_dir| */
96extern name_pointer name_ptr; /* first unused position in |byte_start| */96extern name_pointer name_ptr; /* first unused position in |name_dir| */
97extern char *byte_ptr; /* first unused position in |byte_mem| */97extern char *byte_ptr; /* first unused position in |byte_mem| */
98extern name_pointer hash[]; /* heads of hash lists */98extern name_pointer hash[]; /* heads of hash lists */
99extern hash_pointer hash_end; /* end of |hash| */99extern hash_pointer hash_end; /* end of |hash| */
@@ -126,7 +126,7 @@ extern char huge byte_mem[]; /* characters of names */ · 26 unmodified lines
126extern char huge* byte_mem_end; /* end of |byte_mem| */126extern char huge* byte_mem_end; /* end of |byte_mem| */
127extern name_info name_dir[]; /* information about names */127extern name_info name_dir[]; /* information about names */
128extern name_pointer name_dir_end; /* end of |name_dir| */128extern name_pointer name_dir_end; /* end of |name_dir| */
129extern name_pointer name_ptr; /* first unused position in |byte_start| */129extern name_pointer name_ptr; /* first unused position in |name_dir| */
130extern char huge* byte_ptr; /* first unused position in |byte_mem| */130extern char huge* byte_ptr; /* first unused position in |byte_mem| */
131extern name_pointer hash[]; /* heads of hash lists */131extern name_pointer hash[]; /* heads of hash lists */
132extern hash_pointer hash_end; /* end of |hash| */132extern hash_pointer hash_end; /* end of |hash| */
ctangle.c+6−6
@@ -11,7 +11,7 @@ · 10 unmodified lines
11 11
12#include <ctype.h> 12#include <ctype.h>
13#include <stdlib.h> 13#include <stdlib.h>
14 14#include <string.h>
15/*:62*/15/*:62*/
16#line 65 "ctangle.w"16#line 65 "ctangle.w"
17 17
@@ -366,11 +366,11 @@ extern sixteen_bits section_count; · 348 unmodified lines
366/*2:*/366/*2:*/
367#line 77 "ctangle.w"367#line 77 "ctangle.w"
368 368
369extern int strlen();369
370extern int strcmp();370
371extern char*strcpy();371
372extern int strncmp();372
373extern char*strncpy();373
374 374
375/*:2*//*41:*/375/*:2*//*41:*/
376#line 533 "ctangle.w"376#line 533 "ctangle.w"
cweav-bs.ch+2−2
@@ -49,7 +49,7 @@ extern char byte_mem[]; /* characters of names */ · 48 unmodified lines
49extern char *byte_mem_end; /* end of |byte_mem| */49extern char *byte_mem_end; /* end of |byte_mem| */
50extern name_info name_dir[]; /* information about names */50extern name_info name_dir[]; /* information about names */
51extern name_pointer name_dir_end; /* end of |name_dir| */51extern name_pointer name_dir_end; /* end of |name_dir| */
52extern name_pointer name_ptr; /* first unused position in |byte_start| */52extern name_pointer name_ptr; /* first unused position in |name_dir| */
53extern char *byte_ptr; /* first unused position in |byte_mem| */53extern char *byte_ptr; /* first unused position in |byte_mem| */
54extern name_pointer hash[]; /* heads of hash lists */54extern name_pointer hash[]; /* heads of hash lists */
55extern hash_pointer hash_end; /* end of |hash| */55extern hash_pointer hash_end; /* end of |hash| */
@@ -82,7 +82,7 @@ extern char huge byte_mem[]; /* characters of names */ · 26 unmodified lines
82extern char huge* byte_mem_end; /* end of |byte_mem| */82extern char huge* byte_mem_end; /* end of |byte_mem| */
83extern name_info name_dir[]; /* information about names */83extern name_info name_dir[]; /* information about names */
84extern name_pointer name_dir_end; /* end of |name_dir| */84extern name_pointer name_dir_end; /* end of |name_dir| */
85extern name_pointer name_ptr; /* first unused position in |byte_start| */85extern name_pointer name_ptr; /* first unused position in |name_dir| */
86extern char huge* byte_ptr; /* first unused position in |byte_mem| */86extern char huge* byte_ptr; /* first unused position in |byte_mem| */
87extern name_pointer hash[]; /* heads of hash lists */87extern name_pointer hash[]; /* heads of hash lists */
88extern hash_pointer hash_end; /* end of |hash| */88extern hash_pointer hash_end; /* end of |hash| */
cweb.el+3−0
@@ -110,6 +110,8 @@ otherwise do an ordinary Meta-y." · 109 unmodified lines
110 (insert ch)110 (insert ch)
111 (setq arg (1- arg)))))111 (setq arg (1- arg)))))
112(global-set-key "\M-\"" 'ditto)112(global-set-key "\M-\"" 'ditto)
113; If "ditto" suddenly fails to work, you have probably set goal-column
114; inadvertently. To unset it, say C-u C-x C-n.
113 115
114;; OK, here's part (2): Changes to TeX mode.116;; OK, here's part (2): Changes to TeX mode.
115; The WEB modes below are very much like TeX mode, but some improvements were117; The WEB modes below are very much like TeX mode, but some improvements were
@@ -210,6 +212,7 @@ for relative module movement. The automatic \" feature is disabled." · 94 unmodified lines
210 (modify-syntax-entry ?% "@")212 (modify-syntax-entry ?% "@")
211 (setq mode-name "CWEB")213 (setq mode-name "CWEB")
212 (setq major-mode 'cweb-mode)214 (setq major-mode 'cweb-mode)
215 (setq tex-fontify-script nil) ;; needed in GNU Emacs version 22?
213 (run-hooks 'cweb-mode-hook))216 (run-hooks 'cweb-mode-hook))
214(setq auto-mode-alist (cons '("\\.w$" . cweb-mode) auto-mode-alist))217(setq auto-mode-alist (cons '("\\.w$" . cweb-mode) auto-mode-alist))
215(setq auto-mode-alist (cons '("\\.ch$" . cweb-mode) auto-mode-alist))218(setq auto-mode-alist (cons '("\\.ch$" . cweb-mode) auto-mode-alist))
cwebmac.tex+9−6
@@ -1,8 +1,8 @@
1% standard macros for CWEB listings (in addition to plain.tex)1% standard macros for CWEB listings (in addition to plain.tex)
2% Version 3.67 --- July 20062% Version 3.68 --- January 2016
3\ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros3\ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
4\xdef\fmtversion{\fmtversion+CWEB3.67}4\xdef\fmtversion{\fmtversion+CWEB3.68}
5\chardef\cwebversion=3 \chardef\cwebrevision=675\chardef\cwebversion=3 \chardef\cwebrevision=68
6\newif\ifpdf6\newif\ifpdf
7\ifx\pdf+\pdftrue\fi7\ifx\pdf+\pdftrue\fi
8% Uncomment the following line if you want PDF goodies to be the default8% Uncomment the following line if you want PDF goodies to be the default
@@ -278,7 +278,8 @@ · 269 unmodified lines
278 \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50278 \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50
279 \noindent{\let\*=\lapstar\bf\secstar.\quad}%279 \noindent{\let\*=\lapstar\bf\secstar.\quad}%
280 \ifpdftex\smash{\raise\baselineskip\hbox to0pt{%280 \ifpdftex\smash{\raise\baselineskip\hbox to0pt{%
281 \let\*=\empty\pdfdest num \secstar fith}}281% \let\*=\empty\pdfdest num \secstar fith}} % bad space in versions < 3.68
282 \let\*=\empty\pdfdest num \secstar fith}}% changed in version 3.68
282 \else\ifpdf\smash{\raise\baselineskip\hbox to0pt{%283 \else\ifpdf\smash{\raise\baselineskip\hbox to0pt{%
283 \let\*=\empty\special{%284 \let\*=\empty\special{%
284 pdf: dest (\romannumeral\secstar) [ @thispage /FitH @ypos ]}}}\fi\fi}285 pdf: dest (\romannumeral\secstar) [ @thispage /FitH @ypos ]}}}\fi\fi}
@@ -340,7 +341,7 @@ · 55 unmodified lines
340\def\T#1{\leavevmode % octal, hex or decimal constant341\def\T#1{\leavevmode % octal, hex or decimal constant
341 \hbox{$\def\?{\kern.2em}%342 \hbox{$\def\?{\kern.2em}%
342% \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant % versions < 3.67343% \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant % versions < 3.67
343 \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant344 \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant % in version 3.67
344 \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)345 \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
345 \let\~=\oct \let\^=\hex {#1}$}}346 \let\~=\oct \let\^=\hex {#1}$}}
346\def\U{\note{This code is used in section}} % xref for use of a section347\def\U{\note{This code is used in section}} % xref for use of a section
@@ -457,6 +458,7 @@ · 110 unmodified lines
457\def\fin{\par\vfill\eject % this is done when we are ending the index458\def\fin{\par\vfill\eject % this is done when we are ending the index
458 \ifpagesaved\null\vfill\eject\fi % output a null index column459 \ifpagesaved\null\vfill\eject\fi % output a null index column
459 \if L\lr\else\null\vfill\eject\fi % finish the current page460 \if L\lr\else\null\vfill\eject\fi % finish the current page
461 \ifpdftex \makebookmarks \fi % added in Version 3.68
460 \parfillskip 0pt plus 1fil462 \parfillskip 0pt plus 1fil
461 \def\grouptitle{NAMES OF THE SECTIONS}463 \def\grouptitle{NAMES OF THE SECTIONS}
462 \let\topsecno=\nullsec464 \let\topsecno=\nullsec
@@ -470,7 +472,8 @@ · 7 unmodified lines
470 \def\Us{\note{Used in sections}} % crossref for uses of a section472 \def\Us{\note{Used in sections}} % crossref for uses of a section
471 \def\I{\par\hangindent 2em}\let\*=*473 \def\I{\par\hangindent 2em}\let\*=*
472 \ifacro \def\outsecname{Names of the sections} \let\Xpdf\X474 \ifacro \def\outsecname{Names of the sections} \let\Xpdf\X
473 \ifpdftex \makebookmarks \pdfdest name {NOS} fitb475% \ifpdftex \makebookmarks \pdfdest name {NOS} fitb % in versions < 3.68
476 \ifpdftex \pdfdest name {NOS} fitb % changed in version 3.68
474 \pdfoutline goto name {NOS} count -\secno {\outsecname}477 \pdfoutline goto name {NOS} count -\secno {\outsecname}
475 \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%478 \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
476 {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%479 {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
cwebman.tex+1−1
@@ -1514,7 +1514,7 @@ is to explain some of the possibilities. · 1513 unmodified lines
1514 1514
1515\point 1. Four fonts have been declared in addition to the standard fonts of1515\point 1. Four fonts have been declared in addition to the standard fonts of
1516\.{PLAIN} format: You can say `\.{\{\\mc UNIX\}}' to get {\mc UNIX} in1516\.{PLAIN} format: You can say `\.{\{\\mc UNIX\}}' to get {\mc UNIX} in
1517xmedium-size caps; you can say `\.{\{\\sc STUFF\}}' to get {\sc STUFF}1517medium-size caps; you can say `\.{\{\\sc STUFF\}}' to get {\sc STUFF}
1518in small caps; and you can select the largish fonts \.{\\titlefont}1518in small caps; and you can select the largish fonts \.{\\titlefont}
1519and \.{\\ttitlefont} in the title of your document, where \.{\\ttitlefont}1519and \.{\\ttitlefont} in the title of your document, where \.{\\ttitlefont}
1520is a typewriter style of type. There are macros \.{\\UNIX/} and \.{\\CEE/}1520is a typewriter style of type. There are macros \.{\\UNIX/} and \.{\\CEE/}
examples/extex.c+25−24
@@ -14,19 +14,20 @@ if(cc=='\\'&&c==cc) c= '\0';} \ · 13 unmodified lines
14#define ignore_line 7 \14#define ignore_line 7 \
15 15
16/*2:*/16/*2:*/
17#line 47 "extex.w"17#line 47 "./extex.w"
18 18
19#include <stdio.h> 19#include <stdio.h>
20#include <ctype.h> 20#include <ctype.h>
21#include <string.h>
21extern void exit();22extern void exit();
22 23
23/*3:*/24/*3:*/
24#line 75 "extex.w"25#line 76 "./extex.w"
25 26
26int c;27int c;
27 28
28/*:3*//*14:*/29/*:3*//*14:*/
29#line 233 "extex.w"30#line 234 "./extex.w"
30 31
31char ptab[]= {0,1,1,1,1,0,32char ptab[]= {0,1,1,1,1,0,
321,1,1,1,1,0,0,1,331,1,1,1,1,0,0,1,
@@ -39,7 +40,7 @@ char ptab[]= {0,1,1,1,1,0, · 6 unmodified lines
390,0,0,1,1,1,0};400,0,0,1,1,1,0};
40 41
41/*:14*//*17:*/42/*:14*//*17:*/
42#line 290 "extex.w"43#line 291 "./extex.w"
43 44
44char wtab[]= {start_section,nop,nop,nop,nop,nop,nop,nop,45char wtab[]= {start_section,nop,nop,nop,nop,nop,nop,nop,
45start_name,nop,start_section,nop,nop,nop,start_index,nop,46start_name,nop,start_section,nop,nop,nop,start_index,nop,
@@ -55,10 +56,10 @@ nop,ignore_line,nop,nop,ignore_line,nop,nop,nop, · 9 unmodified lines
55start_C,start_insert,nop,start_C,start_insert};56start_C,start_insert,nop,start_C,start_insert};
56 57
57/*:17*/58/*:17*/
58#line 52 "extex.w"59#line 53 "./extex.w"
59 60
60/*6:*/61/*6:*/
61#line 109 "extex.w"62#line 110 "./extex.w"
62 63
63int get()64int get()
64{register int x;65{register int x;
@@ -68,7 +69,7 @@ return x; · 3 unmodified lines
68}69}
69 70
70/*:6*//*12:*/71/*:6*//*12:*/
71#line 188 "extex.w"72#line 189 "./extex.w"
72 73
73int controlseq()74int controlseq()
74{75{
@@ -83,7 +84,7 @@ if(l==1)b= c; · 8 unmodified lines
83}84}
84if(l==0)c= getchar();85if(l==0)c= getchar();
85/*13:*/86/*13:*/
86#line 208 "extex.w"87#line 209 "./extex.w"
87 88
88if((a>='"'&&a<='~'&&ptab[a-'"']==l)||89if((a>='"'&&a<='~'&&ptab[a-'"']==l)||
89(l==2&&(pair('a','e')||pair('A','E')90(l==2&&(pair('a','e')||pair('A','E')
@@ -107,13 +108,13 @@ return 1; · 17 unmodified lines
107}108}
108 109
109/*:13*/110/*:13*/
110#line 202 "extex.w"111#line 203 "./extex.w"
111;112;
112return 0;113return 0;
113}114}
114 115
115/*:12*/116/*:12*/
116#line 53 "extex.w"117#line 54 "./extex.w"
117 118
118 119
119int main(argc,argv)120int main(argc,argv)
@@ -121,7 +122,7 @@ int argc; · 1 unmodified line
121char*argv[];122char*argv[];
122{123{
123/*4:*/124/*4:*/
124#line 78 "extex.w"125#line 79 "./extex.w"
125 126
126int web;127int web;
127int comment;128int comment;
@@ -130,17 +131,17 @@ int save_skipping; · 2 unmodified lines
130register int cc;131register int cc;
131 132
132/*:4*/133/*:4*/
133#line 59 "extex.w"134#line 60 "./extex.w"
134;135;
135if(strlen(*argv)>=6&&strcmp(*argv+strlen(*argv)-6,"excweb")==0){136if(strlen(*argv)>=6&&strcmp(*argv+strlen(*argv)-6,"excweb")==0){
136web= 1;137web= 1;
137/*15:*/138/*15:*/
138#line 248 "extex.w"139#line 249 "./extex.w"
139 140
140ptab[12]= 1;141ptab[12]= 1;
141 142
142/*:15*/143/*:15*/
143#line 62 "extex.w"144#line 63 "./extex.w"
144;145;
145}else web= 0;146}else web= 0;
146comment= skipping= c= 0;147comment= skipping= c= 0;
@@ -148,7 +149,7 @@ main_cycle:if(c)goto big_switch; · 1 unmodified line
148restart:c= get();149restart:c= get();
149big_switch:switch(c){150big_switch:switch(c){
150/*5:*/151/*5:*/
151#line 94 "extex.w"152#line 95 "./extex.w"
152 153
153case'%':discard_to('\n');goto restart;154case'%':discard_to('\n');goto restart;
154case'$':c= getchar();155case'$':c= getchar();
@@ -160,7 +161,7 @@ while(getchar()!='$'); · 5 unmodified lines
160goto restart;161goto restart;
161 162
162/*:5*//*7:*/163/*:5*//*7:*/
163#line 121 "extex.w"164#line 122 "./extex.w"
164 165
165case'a':case'A':166case'a':case'A':
166case'b':case'B':167case'b':case'B':
@@ -191,13 +192,13 @@ case'z':case'Z': · 24 unmodified lines
191goto out_word;192goto out_word;
192 193
193/*:7*//*11:*/194/*:7*//*11:*/
194#line 184 "extex.w"195#line 185 "./extex.w"
195 196
196case'\\':if(controlseq())goto control_seq_in_word;197case'\\':if(controlseq())goto control_seq_in_word;
197goto main_cycle;198goto main_cycle;
198 199
199/*:11*//*16:*/200/*:11*//*16:*/
200#line 262 "extex.w"201#line 263 "./extex.w"
201 202
202case'@':if(web)goto do_web;203case'@':if(web)goto do_web;
203goto restart;204goto restart;
@@ -215,13 +216,13 @@ goto skip_C; · 11 unmodified lines
215goto big_switch;216goto big_switch;
216 217
217/*:16*/218/*:16*/
218#line 68 "extex.w"219#line 69 "./extex.w"
219 220
220case EOF:exit(0);221case EOF:exit(0);
221default:goto restart;222default:goto restart;
222}223}
223/*8:*/224/*8:*/
224#line 154 "extex.w"225#line 155 "./extex.w"
225 226
226out_word:putchar(c);227out_word:putchar(c);
227continue_word:c= getchar();228continue_word:c= getchar();
@@ -239,13 +240,13 @@ end_word:putchar('\n'); · 11 unmodified lines
239goto main_cycle;240goto main_cycle;
240 241
241/*:8*//*10:*/242/*:8*//*10:*/
242#line 180 "extex.w"243#line 181 "./extex.w"
243 244
244control_seq_in_word:if(!c)goto continue_word;245control_seq_in_word:if(!c)goto continue_word;
245goto checkout_word;246goto checkout_word;
246 247
247/*:10*//*18:*/248/*:10*//*18:*/
248#line 306 "extex.w"249#line 307 "./extex.w"
249 250
250do_web:c= getchar();251do_web:c= getchar();
251if(c<' '||c> 't')goto restart;252if(c<' '||c> 't')goto restart;
@@ -264,7 +265,7 @@ goto restart; · 12 unmodified lines
264}265}
265 266
266/*:18*//*19:*/267/*:18*//*19:*/
267#line 328 "extex.w"268#line 329 "./extex.w"
268 269
269skip_C:save_skipping= 2;270skip_C:save_skipping= 2;
270skip_C_prime:skipping= 1;271skip_C_prime:skipping= 1;
@@ -303,7 +304,7 @@ default:continue; · 32 unmodified lines
303}304}
304 305
305/*:19*/306/*:19*/
306#line 72 "extex.w"307#line 73 "./extex.w"
307;308;
308}309}
309 310
examples/extex.w+1−0
@@ -47,6 +47,7 @@ any other programs that simulate finite-state automata.) · 46 unmodified lines
47@c47@c
48#include <stdio.h>48#include <stdio.h>
49#include <ctype.h>49#include <ctype.h>
50#include <string.h>
50extern void exit(); /* system routine that terminates execution */51extern void exit(); /* system routine that terminates execution */
51@#52@#
52@<Global variables@>@;53@<Global variables@>@;
examples/wmerge.c+69−69
@@ -33,20 +33,20 @@ history= fatal_message;exit(wrap_up() ) ; \ · 32 unmodified lines
33#define update_terminal fflush(stderr) \33#define update_terminal fflush(stderr) \
34 34
35/*1:*/35/*1:*/
36#line 15 "wmerge.w"36#line 15 "./wmerge.w"
37 37
38#include <stdio.h> 38#include <stdio.h>
39#include <stdlib.h> 39#include <stdlib.h>
40#include <ctype.h> 40#include <ctype.h>
41/*2:*/41/*2:*/
42#line 37 "wmerge.w"42#line 37 "./wmerge.w"
43 43
44typedef short boolean;44typedef short boolean;
45typedef unsigned char eight_bits;45typedef unsigned char eight_bits;
46typedef char ASCII;46typedef char ASCII;
47 47
48/*:2*//*5:*/48/*:2*//*5:*/
49#line 70 "wmerge.w"49#line 70 "./wmerge.w"
50 50
51ASCII buffer[buf_size];51ASCII buffer[buf_size];
52ASCII*buffer_end= buffer+buf_size-2;52ASCII*buffer_end= buffer+buf_size-2;
@@ -54,7 +54,7 @@ ASCII*limit; · 1 unmodified line
54ASCII*loc;54ASCII*loc;
55 55
56/*:5*//*7:*/56/*:5*//*7:*/
57#line 136 "wmerge.w"57#line 136 "./wmerge.w"
58 58
59int include_depth;59int include_depth;
60FILE*file[max_include_depth];60FILE*file[max_include_depth];
@@ -71,18 +71,18 @@ boolean changing; · 10 unmodified lines
71boolean web_file_open= 0;71boolean web_file_open= 0;
72 72
73/*:7*//*8:*/73/*:7*//*8:*/
74#line 162 "wmerge.w"74#line 162 "./wmerge.w"
75 75
76char change_buffer[buf_size];76char change_buffer[buf_size];
77char*change_limit;77char*change_limit;
78 78
79/*:8*//*23:*/79/*:8*//*23:*/
80#line 486 "wmerge.w"80#line 486 "./wmerge.w"
81 81
82int history= spotless;82int history= spotless;
83 83
84/*:23*//*30:*/84/*:23*//*30:*/
85#line 584 "wmerge.w"85#line 584 "./wmerge.w"
86 86
87int argc;87int argc;
88char**argv;88char**argv;
@@ -90,40 +90,40 @@ char out_file_name[max_file_name_length]; · 1 unmodified line
90boolean flags[128];90boolean flags[128];
91 91
92/*:30*//*40:*/92/*:30*//*40:*/
93#line 700 "wmerge.w"93#line 700 "./wmerge.w"
94 94
95FILE*out_file;95FILE*out_file;
96 96
97/*:40*/97/*:40*/
98#line 19 "wmerge.w"98#line 19 "./wmerge.w"
99 99
100/*3:*/100/*3:*/
101#line 47 "wmerge.w"101#line 47 "./wmerge.w"
102 102
103extern int strlen();103extern size_t strlen();
104extern char*strcpy();104extern char*strcpy();
105extern int strncmp();105extern int strncmp();
106extern char*strncpy();106extern char*strncpy();
107 107
108/*:3*//*4:*/108/*:3*//*4:*/
109#line 53 "wmerge.w"109#line 53 "./wmerge.w"
110 110
111 111
112/*:4*//*24:*/112/*:4*//*24:*/
113#line 498 "wmerge.w"113#line 498 "./wmerge.w"
114 114
115void err_print();115void err_print();
116 116
117/*:24*//*32:*/117/*:24*//*32:*/
118#line 608 "wmerge.w"118#line 608 "./wmerge.w"
119 119
120void scan_args();120void scan_args();
121 121
122/*:32*/122/*:32*/
123#line 20 "wmerge.w"123#line 20 "./wmerge.w"
124 124
125/*6:*/125/*6:*/
126#line 95 "wmerge.w"126#line 95 "./wmerge.w"
127 127
128input_ln(fp)128input_ln(fp)
129FILE*fp;129FILE*fp;
@@ -145,14 +145,14 @@ return(1); · 15 unmodified lines
145}145}
146 146
147/*:6*//*9:*/147/*:6*//*9:*/
148#line 173 "wmerge.w"148#line 173 "./wmerge.w"
149 149
150void150void
151prime_the_change_buffer()151prime_the_change_buffer()
152{152{
153change_limit= change_buffer;153change_limit= change_buffer;
154/*10:*/154/*10:*/
155#line 187 "wmerge.w"155#line 187 "./wmerge.w"
156 156
157while(1){157while(1){
158change_line++;158change_line++;
@@ -169,10 +169,10 @@ err_print("! Missing @x in change file"); · 10 unmodified lines
169}169}
170 170
171/*:10*/171/*:10*/
172#line 178 "wmerge.w"172#line 178 "./wmerge.w"
173;173;
174/*11:*/174/*11:*/
175#line 204 "wmerge.w"175#line 204 "./wmerge.w"
176 176
177do{177do{
178change_line++;178change_line++;
@@ -184,10 +184,10 @@ return; · 5 unmodified lines
184}while(limit==buffer);184}while(limit==buffer);
185 185
186/*:11*/186/*:11*/
187#line 179 "wmerge.w"187#line 179 "./wmerge.w"
188;188;
189/*12:*/189/*12:*/
190#line 214 "wmerge.w"190#line 214 "./wmerge.w"
191 191
192{192{
193change_limit= change_buffer+(limit-buffer);193change_limit= change_buffer+(limit-buffer);
@@ -195,12 +195,12 @@ strncpy(change_buffer,buffer,limit-buffer+1); · 1 unmodified line
195}195}
196 196
197/*:12*/197/*:12*/
198#line 180 "wmerge.w"198#line 180 "./wmerge.w"
199;199;
200}200}
201 201
202/*:9*//*13:*/202/*:9*//*13:*/
203#line 232 "wmerge.w"203#line 232 "./wmerge.w"
204 204
205void205void
206check_change()206check_change()
@@ -218,7 +218,7 @@ return; · 11 unmodified lines
218if(limit> buffer+1&&buffer[0]=='@'){218if(limit> buffer+1&&buffer[0]=='@'){
219char xyz_code= isupper(buffer[1])?tolower(buffer[1]):buffer[1];219char xyz_code= isupper(buffer[1])?tolower(buffer[1]):buffer[1];
220/*14:*/220/*14:*/
221#line 265 "wmerge.w"221#line 265 "./wmerge.w"
222 222
223if(xyz_code=='x'||xyz_code=='z'){223if(xyz_code=='x'||xyz_code=='z'){
224loc= buffer+2;err_print("! Where is the matching @y?");224loc= buffer+2;err_print("! Where is the matching @y?");
@@ -236,11 +236,11 @@ return; · 11 unmodified lines
236}236}
237 237
238/*:14*/238/*:14*/
239#line 249 "wmerge.w"239#line 249 "./wmerge.w"
240;240;
241}241}
242/*12:*/242/*12:*/
243#line 214 "wmerge.w"243#line 214 "./wmerge.w"
244 244
245{245{
246change_limit= change_buffer+(limit-buffer);246change_limit= change_buffer+(limit-buffer);
@@ -248,7 +248,7 @@ strncpy(change_buffer,buffer,limit-buffer+1); · 1 unmodified line
248}248}
249 249
250/*:12*/250/*:12*/
251#line 251 "wmerge.w"251#line 251 "./wmerge.w"
252;252;
253changing= 0;cur_line++;253changing= 0;cur_line++;
254while(!input_ln(cur_file)){254while(!input_ln(cur_file)){
@@ -264,14 +264,14 @@ if(lines_dont_match)n++; · 9 unmodified lines
264}264}
265 265
266/*:13*//*15:*/266/*:13*//*15:*/
267#line 284 "wmerge.w"267#line 284 "./wmerge.w"
268 268
269void269void
270reset_input()270reset_input()
271{271{
272limit= buffer;loc= buffer+1;buffer[0]= ' ';272limit= buffer;loc= buffer+1;buffer[0]= ' ';
273/*16:*/273/*16:*/
274#line 299 "wmerge.w"274#line 299 "./wmerge.w"
275 275
276if((web_file= fopen(web_file_name,"r"))==NULL){276if((web_file= fopen(web_file_name,"r"))==NULL){
277strcpy(web_file_name,alt_web_file_name);277strcpy(web_file_name,alt_web_file_name);
@@ -285,7 +285,7 @@ if((change_file= fopen(change_file_name,"r"))==NULL) · 7 unmodified lines
285fatal("! Cannot open change file ",change_file_name);285fatal("! Cannot open change file ",change_file_name);
286 286
287/*:16*/287/*:16*/
288#line 289 "wmerge.w"288#line 289 "./wmerge.w"
289;289;
290include_depth= 0;cur_line= 0;change_line= 0;290include_depth= 0;cur_line= 0;change_line= 0;
291change_depth= include_depth;291change_depth= include_depth;
@@ -294,14 +294,14 @@ limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= 0; · 2 unmodified lines
294}294}
295 295
296/*:15*//*17:*/296/*:15*//*17:*/
297#line 317 "wmerge.w"297#line 317 "./wmerge.w"
298 298
299int get_line()299int get_line()
300{300{
301restart:301restart:
302if(changing&&include_depth==change_depth)302if(changing&&include_depth==change_depth)
303/*21:*/303/*21:*/
304#line 431 "wmerge.w"304#line 431 "./wmerge.w"
305{305{
306change_line++;306change_line++;
307if(!input_ln(change_file)){307if(!input_ln(change_file)){
@@ -326,11 +326,11 @@ prime_the_change_buffer();changing= !changing; · 18 unmodified lines
326}326}
327 327
328/*:21*/328/*:21*/
329#line 322 "wmerge.w"329#line 322 "./wmerge.w"
330;330;
331if(!changing||include_depth> change_depth){331if(!changing||include_depth> change_depth){
332/*20:*/332/*20:*/
333#line 415 "wmerge.w"333#line 415 "./wmerge.w"
334{334{
335cur_line++;335cur_line++;
336while(!input_ln(cur_file)){336while(!input_ln(cur_file)){
@@ -348,7 +348,7 @@ if(change_limit> change_buffer)check_change(); · 11 unmodified lines
348}348}
349 349
350/*:20*/350/*:20*/
351#line 324 "wmerge.w"351#line 324 "./wmerge.w"
352;352;
353if(changing&&include_depth==change_depth)goto restart;353if(changing&&include_depth==change_depth)goto restart;
354}354}
@@ -369,7 +369,7 @@ goto restart; · 14 unmodified lines
369}369}
370include_depth++;370include_depth++;
371/*19:*/371/*19:*/
372#line 369 "wmerge.w"372#line 369 "./wmerge.w"
373{373{
374char temp_file_name[max_file_name_length];374char temp_file_name[max_file_name_length];
375char*cur_file_name_end= cur_file_name+max_file_name_length-1;375char*cur_file_name_end= cur_file_name+max_file_name_length-1;
@@ -417,7 +417,7 @@ include_depth--;err_print("! Cannot open include file");goto restart; · 41 unmodified lines
417}417}
418 418
419/*:19*/419/*:19*/
420#line 343 "wmerge.w"420#line 343 "./wmerge.w"
421;421;
422}422}
423return 1;423return 1;
@@ -431,7 +431,7 @@ putc('\n',out_file); · 7 unmodified lines
431}431}
432 432
433/*:17*//*22:*/433/*:17*//*22:*/
434#line 457 "wmerge.w"434#line 457 "./wmerge.w"
435 435
436void436void
437check_complete(){437check_complete(){
@@ -445,7 +445,7 @@ err_print("! Change file entry did not match"); · 7 unmodified lines
445}445}
446 446
447/*:22*//*25:*/447/*:22*//*25:*/
448#line 502 "wmerge.w"448#line 502 "./wmerge.w"
449 449
450void450void
451err_print(s)451err_print(s)
@@ -454,7 +454,7 @@ char*s; · 2 unmodified lines
454char*k,*l;454char*k,*l;
455fprintf(stderr,*s=='!'?"\n%s":"%s",s);455fprintf(stderr,*s=='!'?"\n%s":"%s",s);
456if(web_file_open)/*26:*/456if(web_file_open)/*26:*/
457#line 523 "wmerge.w"457#line 523 "./wmerge.w"
458 458
459{if(changing&&include_depth==change_depth)459{if(changing&&include_depth==change_depth)
460fprintf(stderr,". (l. %d of change file)\n",change_line);460fprintf(stderr,". (l. %d of change file)\n",change_line);
@@ -473,18 +473,18 @@ putc('\n',stderr); · 12 unmodified lines
473}473}
474 474
475/*:26*/475/*:26*/
476#line 509 "wmerge.w"476#line 509 "./wmerge.w"
477 477
478else putc('\n',stderr);478else putc('\n',stderr);
479update_terminal;mark_error;479update_terminal;mark_error;
480}480}
481 481
482/*:25*//*28:*/482/*:25*//*28:*/
483#line 555 "wmerge.w"483#line 555 "./wmerge.w"
484 484
485wrap_up(){485wrap_up(){
486/*29:*/486/*29:*/
487#line 562 "wmerge.w"487#line 562 "./wmerge.w"
488 488
489switch(history){489switch(history){
490case spotless:if(show_happiness)fprintf(stderr,"(No errors were found.)\n");break;490case spotless:if(show_happiness)fprintf(stderr,"(No errors were found.)\n");break;
@@ -496,14 +496,14 @@ case fatal_message:fprintf(stderr,"(That was a fatal error, my friend.)\n"); · 5 unmodified lines
496}496}
497 497
498/*:29*/498/*:29*/
499#line 557 "wmerge.w"499#line 557 "./wmerge.w"
500;500;
501if(history> harmless_message)return(1);501if(history> harmless_message)return(1);
502else return(0);502else return(0);
503}503}
504 504
505/*:28*//*33:*/505/*:28*//*33:*/
506#line 612 "wmerge.w"506#line 612 "./wmerge.w"
507 507
508void508void
509scan_args()509scan_args()
@@ -516,7 +516,7 @@ boolean flag_change; · 6 unmodified lines
516 516
517while(--argc> 0){517while(--argc> 0){
518if(**(++argv)=='-'||**argv=='+')/*37:*/518if(**(++argv)=='-'||**argv=='+')/*37:*/
519#line 682 "wmerge.w"519#line 682 "./wmerge.w"
520 520
521{521{
522if(**argv=='-')flag_change= 0;522if(**argv=='-')flag_change= 0;
@@ -526,7 +526,7 @@ flags[*dot_pos]= flag_change; · 3 unmodified lines
526}526}
527 527
528/*:37*/528/*:37*/
529#line 623 "wmerge.w"529#line 623 "./wmerge.w"
530 530
531else{531else{
532s= *argv;dot_pos= NULL;532s= *argv;dot_pos= NULL;
@@ -536,16 +536,16 @@ else if(*s=='/')dot_pos= NULL,++s; · 3 unmodified lines
536else s++;536else s++;
537}537}
538if(!found_web)/*34:*/538if(!found_web)/*34:*/
539#line 648 "wmerge.w"539#line 648 "./wmerge.w"
540 540
541{541{
542if(s-*argv> max_file_name_length-5)542if(s-*argv> max_file_name_length-5)
543/*39:*/543/*39:*/
544#line 695 "wmerge.w"544#line 695 "./wmerge.w"
545fatal("! Filename too long\n",*argv);545fatal("! Filename too long\n",*argv);
546 546
547/*:39*/547/*:39*/
548#line 651 "wmerge.w"548#line 651 "./wmerge.w"
549;549;
550if(dot_pos==NULL)550if(dot_pos==NULL)
551sprintf(web_file_name,"%s.w",*argv);551sprintf(web_file_name,"%s.w",*argv);
@@ -559,19 +559,19 @@ found_web= 1; · 7 unmodified lines
559}559}
560 560
561/*:34*/561/*:34*/
562#line 631 "wmerge.w"562#line 631 "./wmerge.w"
563 563
564else if(!found_change)/*35:*/564else if(!found_change)/*35:*/
565#line 663 "wmerge.w"565#line 663 "./wmerge.w"
566 566
567{567{
568if(s-*argv> max_file_name_length-4)568if(s-*argv> max_file_name_length-4)
569/*39:*/569/*39:*/
570#line 695 "wmerge.w"570#line 695 "./wmerge.w"
571fatal("! Filename too long\n",*argv);571fatal("! Filename too long\n",*argv);
572 572
573/*:39*/573/*:39*/
574#line 666 "wmerge.w"574#line 666 "./wmerge.w"
575;575;
576if(dot_pos==NULL)576if(dot_pos==NULL)
577sprintf(change_file_name,"%s.ch",*argv);577sprintf(change_file_name,"%s.ch",*argv);
@@ -580,19 +580,19 @@ found_change= 1; · 2 unmodified lines
580}580}
581 581
582/*:35*/582/*:35*/
583#line 632 "wmerge.w"583#line 632 "./wmerge.w"
584 584
585else if(!found_out)/*36:*/585else if(!found_out)/*36:*/
586#line 673 "wmerge.w"586#line 673 "./wmerge.w"
587 587
588{588{
589if(s-*argv> max_file_name_length-5)589if(s-*argv> max_file_name_length-5)
590/*39:*/590/*39:*/
591#line 695 "wmerge.w"591#line 695 "./wmerge.w"
592fatal("! Filename too long\n",*argv);592fatal("! Filename too long\n",*argv);
593 593
594/*:39*/594/*:39*/
595#line 676 "wmerge.w"595#line 676 "./wmerge.w"
596;596;
597if(dot_pos==NULL)sprintf(out_file_name,"%s.out",*argv);597if(dot_pos==NULL)sprintf(out_file_name,"%s.out",*argv);
598else strcpy(out_file_name,*argv);598else strcpy(out_file_name,*argv);
@@ -600,50 +600,50 @@ found_out= 1; · 1 unmodified line
600}600}
601 601
602/*:36*/602/*:36*/
603#line 633 "wmerge.w"603#line 633 "./wmerge.w"
604 604
605else/*38:*/605else/*38:*/
606#line 690 "wmerge.w"606#line 690 "./wmerge.w"
607 607
608{608{
609fatal("! Usage: wmerge webfile[.w] [changefile[.ch] [outfile[.out]]]\n","")609fatal("! Usage: wmerge webfile[.w] [changefile[.ch] [outfile[.out]]]\n","")
610}610}
611 611
612/*:38*/612/*:38*/
613#line 634 "wmerge.w"613#line 634 "./wmerge.w"
614;614;
615}615}
616}616}
617if(!found_web)/*38:*/617if(!found_web)/*38:*/
618#line 690 "wmerge.w"618#line 690 "./wmerge.w"
619 619
620{620{
621fatal("! Usage: wmerge webfile[.w] [changefile[.ch] [outfile[.out]]]\n","")621fatal("! Usage: wmerge webfile[.w] [changefile[.ch] [outfile[.out]]]\n","")
622}622}
623 623
624/*:38*/624/*:38*/
625#line 637 "wmerge.w"625#line 637 "./wmerge.w"
626;626;
627if(!found_change)strcpy(change_file_name,"/dev/null");627if(!found_change)strcpy(change_file_name,"/dev/null");
628}628}
629 629
630/*:33*/630/*:33*/
631#line 21 "wmerge.w"631#line 21 "./wmerge.w"
632 632
633main(ac,av)633main(ac,av)
634int ac;char**av;634int ac;char**av;
635{635{
636argc= ac;argv= av;636argc= ac;argv= av;
637/*31:*/637/*31:*/
638#line 592 "wmerge.w"638#line 592 "./wmerge.w"
639 639
640show_banner= show_happiness= 1;640show_banner= show_happiness= 1;
641 641
642/*:31*/642/*:31*/
643#line 26 "wmerge.w"643#line 26 "./wmerge.w"
644;644;
645/*41:*/645/*41:*/
646#line 703 "wmerge.w"646#line 703 "./wmerge.w"
647 647
648scan_args();648scan_args();
649if(out_file_name[0]=='\0')out_file= stdout;649if(out_file_name[0]=='\0')out_file= stdout;
@@ -652,7 +652,7 @@ fatal("! Cannot open output file ",out_file_name); · 2 unmodified lines
652 652
653 653
654/*:41*/654/*:41*/
655#line 27 "wmerge.w"655#line 27 "./wmerge.w"
656;656;
657reset_input();657reset_input();
658while(get_line())658while(get_line())
examples/wmerge.w+1−1
@@ -45,7 +45,7 @@ are not as standard as the names of the functions. (There's confusion · 44 unmodified lines
45between \.{<string.h>} and \.{<strings.h>}.)45between \.{<string.h>} and \.{<strings.h>}.)
46 46
47@<Predecl...@>=47@<Predecl...@>=
48extern int strlen(); /* length of string */48extern size_t strlen(); /* length of string */
49extern char* strcpy(); /* copy one string to another */49extern char* strcpy(); /* copy one string to another */
50extern int strncmp(); /* compare up to $n$ string characters */50extern int strncmp(); /* compare up to $n$ string characters */
51extern char* strncpy(); /* copy up to $n$ string characters */51extern char* strncpy(); /* copy up to $n$ string characters */
examples/wordtest.c+51−50
@@ -9,17 +9,18 @@ · 8 unmodified lines
9return x;} \9return x;} \
10 10
11/*3:*/11/*3:*/
12#line 92 "wordtest.w"12#line 92 "./wordtest.w"
13 13
14#include <stdio.h> 14#include <stdio.h>
15#include <stdlib.h>
15 16
16/*4:*/17/*4:*/
17#line 107 "wordtest.w"18#line 108 "./wordtest.w"
18 19
19typedef unsigned char byte;20typedef unsigned char byte;
20 21
21/*:4*//*9:*/22/*:4*//*9:*/
22#line 195 "wordtest.w"23#line 196 "./wordtest.w"
23 24
24typedef struct node_struct{25typedef struct node_struct{
25struct node_struct*left,*right;26struct node_struct*left,*right;
@@ -28,7 +29,7 @@ unsigned long rank; · 2 unmodified lines
28}node;29}node;
29 30
30/*:9*//*20:*/31/*:9*//*20:*/
31#line 391 "wordtest.w"32#line 392 "./wordtest.w"
32 33
33typedef struct filenode_struct{34typedef struct filenode_struct{
34struct filenode_struct*link;35struct filenode_struct*link;
@@ -40,14 +41,14 @@ byte*endword; · 5 unmodified lines
40}filenode;41}filenode;
41 42
42/*:20*/43/*:20*/
43#line 95 "wordtest.w"44#line 96 "./wordtest.w"
44 45
45int main(argc,argv)46int main(argc,argv)
46int argc;47int argc;
47char*argv[];48char*argv[];
48{49{
49/*5:*/50/*5:*/
50#line 110 "wordtest.w"51#line 111 "./wordtest.w"
51 52
52int targc;53int targc;
53byte**targv;54byte**targv;
@@ -59,12 +60,12 @@ register int c; · 5 unmodified lines
59register byte*u,*v;60register byte*u,*v;
60 61
61/*:5*//*12:*/62/*:5*//*12:*/
62#line 251 "wordtest.w"63#line 252 "./wordtest.w"
63 64
64unsigned long current_rank= 0;65unsigned long current_rank= 0;
65 66
66/*:12*//*16:*/67/*:12*//*16:*/
67#line 309 "wordtest.w"68#line 310 "./wordtest.w"
68 69
69node*next_node= NULL,*bad_node= NULL;70node*next_node= NULL,*bad_node= NULL;
70byte*next_string= NULL,*bad_string= NULL;71byte*next_string= NULL,*bad_string= NULL;
@@ -73,23 +74,23 @@ byte*buffer; · 2 unmodified lines
73int l;74int l;
74 75
75/*:16*//*22:*/76/*:16*//*22:*/
76#line 409 "wordtest.w"77#line 410 "./wordtest.w"
77 78
78filenode*curfile;79filenode*curfile;
79filenode*f;80filenode*f;
80 81
81/*:22*/82/*:22*/
82#line 100 "wordtest.w"83#line 101 "./wordtest.w"
83;84;
84/*6:*/85/*6:*/
85#line 122 "wordtest.w"86#line 123 "./wordtest.w"
86 87
87for(c= 0;c<256;c++)ord[c]= c;88for(c= 0;c<256;c++)ord[c]= c;
88delta= 0;89delta= 0;
89targc= argc-1;targv= (byte**)argv+1;90targc= argc-1;targv= (byte**)argv+1;
90while(targc&&**targv=='-'){91while(targc&&**targv=='-'){
91/*7:*/92/*7:*/
92#line 139 "wordtest.w"93#line 140 "./wordtest.w"
93 94
94switch((*targv)[1]){95switch((*targv)[1]){
95case'a':for(c= delta,u= *targv+2;*u;u++)ord[*u]= ++c;break;96case'a':for(c= delta,u= *targv+2;*u;u++)ord[*u]= ++c;break;
@@ -110,7 +111,7 @@ return-1; · 14 unmodified lines
110}111}
111 112
112/*:7*/113/*:7*/
113#line 127 "wordtest.w"114#line 128 "./wordtest.w"
114;115;
115targc--;targv++;116targc--;targv++;
116}117}
@@ -119,7 +120,7 @@ else{ · 2 unmodified lines
119breakchar= '\0';120breakchar= '\0';
120for(c= 255;c;c--)if(ord[c]<0)breakchar= c;121for(c= 255;c;c--)if(ord[c]<0)breakchar= c;
121if(!breakchar)/*8:*/122if(!breakchar)/*8:*/
122#line 158 "wordtest.w"123#line 159 "./wordtest.w"
123 124
124{125{
125ord['\n']= -1;126ord['\n']= -1;
@@ -128,11 +129,11 @@ for(c= 1;c<=26;c++)ord['a'-1+c]= 'A'-1+c; · 2 unmodified lines
128}129}
129 130
130/*:8*/131/*:8*/
131#line 134 "wordtest.w"132#line 135 "./wordtest.w"
132;133;
133}134}
134/*21:*/135/*21:*/
135#line 401 "wordtest.w"136#line 402 "./wordtest.w"
136 137
137if(targc){138if(targc){
138curfile= (filenode*)calloc(targc,sizeof(filenode));139curfile= (filenode*)calloc(targc,sizeof(filenode));
@@ -142,10 +143,10 @@ f->link= curfile; · 3 unmodified lines
142}else curfile= NULL;143}else curfile= NULL;
143 144
144/*:21*/145/*:21*/
145#line 136 "wordtest.w"146#line 137 "./wordtest.w"
146;147;
147for(;targc;targc--,targv++)/*23:*/148for(;targc;targc--,targv++)/*23:*/
148#line 413 "wordtest.w"149#line 414 "./wordtest.w"
149 150
150{151{
151curfile->dfile= fopen((char*)*targv,"r");152curfile->dfile= fopen((char*)*targv,"r");
@@ -161,20 +162,20 @@ curfile= curfile->link; · 9 unmodified lines
161}162}
162 163
163/*:23*/164/*:23*/
164#line 137 "wordtest.w"165#line 138 "./wordtest.w"
165;166;
166 167
167/*:6*/168/*:6*/
168#line 101 "wordtest.w"169#line 102 "./wordtest.w"
169;170;
170/*17:*/171/*17:*/
171#line 319 "wordtest.w"172#line 320 "./wordtest.w"
172 173
173buffer= (byte*)malloc(max_length+1);174buffer= (byte*)malloc(max_length+1);
174if(buffer==NULL)out_of_mem(-5);175if(buffer==NULL)out_of_mem(-5);
175while(1){176while(1){
176/*18:*/177/*18:*/
177#line 332 "wordtest.w"178#line 333 "./wordtest.w"
178 179
179u= buffer;l= 0;180u= buffer;l= 0;
180while(l<max_length){181while(l<max_length){
@@ -196,11 +197,11 @@ l++; · 15 unmodified lines
196*u= breakchar;197*u= breakchar;
197 198
198/*:18*/199/*:18*/
199#line 323 "wordtest.w"200#line 324 "./wordtest.w"
200;201;
201if(l){202if(l){
202/*10:*/203/*10:*/
203#line 213 "wordtest.w"204#line 214 "./wordtest.w"
204 205
205{register node*p= root;206{register node*p= root;
206while(p){207while(p){
@@ -212,10 +213,10 @@ else p= p->right; · 5 unmodified lines
212}213}
213 214
214/*:10*/215/*:10*/
215#line 325 "wordtest.w"216#line 326 "./wordtest.w"
216;217;
217/*11:*/218/*11:*/
218#line 235 "wordtest.w"219#line 236 "./wordtest.w"
219 220
220{register node*p,**q,**qq,*r;221{register node*p,**q,**qq,*r;
221current_rank+= PHICLONE;222current_rank+= PHICLONE;
@@ -227,7 +228,7 @@ if(ord[*u]<ord[*v])q= &(p->left),p= *q; · 5 unmodified lines
227else q= &(p->right),p= *q;228else q= &(p->right),p= *q;
228}229}
229/*14:*/230/*14:*/
230#line 285 "wordtest.w"231#line 286 "./wordtest.w"
231 232
232if(next_node==bad_node){233if(next_node==bad_node){
233next_node= (node*)calloc(NODES_PER_BLOCK,sizeof(node));234next_node= (node*)calloc(NODES_PER_BLOCK,sizeof(node));
@@ -236,7 +237,7 @@ bad_node= next_node+NODES_PER_BLOCK; · 2 unmodified lines
236}237}
237r= next_node++;238r= next_node++;
238/*15:*/239/*15:*/
239#line 295 "wordtest.w"240#line 296 "./wordtest.w"
240 241
241if(next_string+l+1>=bad_string){int block_size= CHARS_PER_BLOCK+l+1;242if(next_string+l+1>=bad_string){int block_size= CHARS_PER_BLOCK+l+1;
242next_string= (byte*)malloc(block_size);243next_string= (byte*)malloc(block_size);
@@ -249,16 +250,16 @@ for(u= buffer,v= next_string;ord[*u]> 0;u++,v++)*v= *u; · 6 unmodified lines
249next_string= v+1;250next_string= v+1;
250 251
251/*:15*/252/*:15*/
252#line 293 "wordtest.w"253#line 294 "./wordtest.w"
253;254;
254 255
255/*:14*/256/*:14*/
256#line 245 "wordtest.w"257#line 246 "./wordtest.w"
257;258;
258r->rank= current_rank;259r->rank= current_rank;
259*q= r;260*q= r;
260/*13:*/261/*13:*/
261#line 259 "wordtest.w"262#line 260 "./wordtest.w"
262 263
263q= &(r->left);qq= &(r->right);264q= &(r->left);qq= &(r->right);
264while(p){265while(p){
@@ -276,12 +277,12 @@ p= *q; · 11 unmodified lines
276*q= *qq= NULL;277*q= *qq= NULL;
277 278
278/*:13*/279/*:13*/
279#line 248 "wordtest.w"280#line 249 "./wordtest.w"
280;281;
281}282}
282 283
283/*:11*/284/*:11*/
284#line 326 "wordtest.w"285#line 327 "./wordtest.w"
285;286;
286found:;287found:;
287}288}
@@ -289,10 +290,10 @@ found:; · 1 unmodified line
289done:;290done:;
290 291
291/*:17*/292/*:17*/
292#line 102 "wordtest.w"293#line 103 "./wordtest.w"
293;294;
294/*19:*/295/*19:*/
295#line 358 "wordtest.w"296#line 359 "./wordtest.w"
296 297
297if(root!=NULL){register node*p,*q;298if(root!=NULL){register node*p,*q;
298p= root;299p= root;
@@ -305,7 +306,7 @@ root= p; · 6 unmodified lines
305p= q;306p= q;
306}307}
307visit:/*25:*/308visit:/*25:*/
308#line 437 "wordtest.w"309#line 438 "./wordtest.w"
309 310
310while(curfile!=NULL){311while(curfile!=NULL){
311for(u= p->keyword,v= curfile->curword;ord[*u]==ord[*v];u++,v++);312for(u= p->keyword,v= curfile->curword;ord[*u]==ord[*v];u++,v++);
@@ -313,10 +314,10 @@ if(*u=='\0'&&*v==breakchar)goto word_done; · 1 unmodified line
313 314
314if(ord[*u]<ord[*v])break;315if(ord[*u]<ord[*v])break;
315/*27:*/316/*27:*/
316#line 452 "wordtest.w"317#line 453 "./wordtest.w"
317 318
318/*28:*/319/*28:*/
319#line 472 "wordtest.w"320#line 473 "./wordtest.w"
320 321
321v= curfile->curword;322v= curfile->curword;
322l= max_length;323l= max_length;
@@ -342,7 +343,7 @@ break; · 19 unmodified lines
342}343}
343if(u==w){344if(u==w){
344/*29:*/345/*29:*/
345#line 504 "wordtest.w"346#line 505 "./wordtest.w"
346 347
347if(ferror(curfile->dfile)){348if(ferror(curfile->dfile)){
348fprintf(stderr,"%s: File read error on dictionary file!\n",*argv);349fprintf(stderr,"%s: File read error on dictionary file!\n",*argv);
@@ -363,7 +364,7 @@ curfile->limit= curfile->buf+fread(curfile->buf,1,BUFSIZ,curfile->dfile); · 14 unmodified lines
363curfile->pos= curfile->buf;364curfile->pos= curfile->buf;
364 365
365/*:29*/366/*:29*/
366#line 497 "wordtest.w"367#line 498 "./wordtest.w"
367;368;
368}else curfile->pos= u+1;369}else curfile->pos= u+1;
369}370}
@@ -372,15 +373,15 @@ curfile->endword= v; · 2 unmodified lines
372update_done:;373update_done:;
373 374
374/*:28*/375/*:28*/
375#line 453 "wordtest.w"376#line 454 "./wordtest.w"
376;377;
377/*30:*/378/*30:*/
378#line 523 "wordtest.w"379#line 524 "./wordtest.w"
379 380
380if(curfile!=NULL){filenode*sentinel= curfile;381if(curfile!=NULL){filenode*sentinel= curfile;
381for(f= curfile->link;f!=sentinel;f= f->link)382for(f= curfile->link;f!=sentinel;f= f->link)
382/*31:*/383/*31:*/
383#line 529 "wordtest.w"384#line 530 "./wordtest.w"
384 385
385{386{
386*f->endword= '\0';387*f->endword= '\0';
@@ -390,31 +391,31 @@ if(ord[*u]<ord[*v])curfile= f; · 3 unmodified lines
390}391}
391 392
392/*:31*/393/*:31*/
393#line 526 "wordtest.w"394#line 527 "./wordtest.w"
394;395;
395}396}
396 397
397/*:30*/398/*:30*/
398#line 455 "wordtest.w"399#line 456 "./wordtest.w"
399;400;
400 401
401/*:27*/402/*:27*/
402#line 443 "wordtest.w"403#line 444 "./wordtest.w"
403;404;
404}405}
405/*26:*/406/*26:*/
406#line 448 "wordtest.w"407#line 449 "./wordtest.w"
407 408
408for(u= p->keyword;*u;u++)putchar(*u);409for(u= p->keyword;*u;u++)putchar(*u);
409putchar(breakchar);410putchar(breakchar);
410 411
411/*:26*/412/*:26*/
412#line 445 "wordtest.w"413#line 446 "./wordtest.w"
413 414
414word_done:;415word_done:;
415 416
416/*:25*/417/*:25*/
417#line 369 "wordtest.w"418#line 370 "./wordtest.w"
418;419;
419if(p->right==NULL){420if(p->right==NULL){
420if(root==NULL)break;421if(root==NULL)break;
@@ -426,7 +427,7 @@ goto visit; · 5 unmodified lines
426}427}
427 428
428/*:19*/429/*:19*/
429#line 103 "wordtest.w"430#line 104 "./wordtest.w"
430;431;
431return 0;432return 0;
432}433}
examples/wordtest.w+1−0
@@ -91,6 +91,7 @@ a nonzero value is returned. · 90 unmodified lines
91 91
92@p92@p
93#include <stdio.h>93#include <stdio.h>
94#include <stdlib.h>
94@#95@#
95@<Typedefs@>@;96@<Typedefs@>@;
96int main(argc,argv)97int main(argc,argv)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t