From 21789d78376b470876b5e1f80a10fb5c7c653b37 Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Mon, 8 Feb 2021 08:21:23 +0000 Subject: [CWEB] Don't repeat yourself. Purge repeated lines in *.w by uncommenting line in common.h. Unfortunately, this shifts all #line numbers. ;o) git-svn-id: svn://tug.org/texlive/trunk@57676 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/cwebdir/ChangeLog | 10 ++ Build/source/texk/web2c/cwebdir/comm-w2c.h | 2 +- Build/source/texk/web2c/cwebdir/common.c | 198 ++++++++++++------------ Build/source/texk/web2c/cwebdir/common.h | 2 +- Build/source/texk/web2c/cwebdir/common.w | 2 - Build/source/texk/web2c/cwebdir/ctangle.c | 236 ++++++++++++++--------------- Build/source/texk/web2c/cwebdir/ctangle.w | 2 - Build/source/texk/web2c/cwebdir/cweave.w | 2 - 8 files changed, 229 insertions(+), 225 deletions(-) (limited to 'Build/source/texk/web2c/cwebdir') diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index 2d0dac80f0c..8abb63037fd 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,13 @@ +2021-02-08 Andreas Scherer + + * comm-w2c.ch, + * common.c, + * common.h, + * common.w, + * ctangle.c, + * ctangle.w, + * cweave.w: Don't repeat yourself. + 2021-02-07 Andreas Scherer * comm-w2c.ch: Fix 'reading error'; diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.h b/Build/source/texk/web2c/cwebdir/comm-w2c.h index cc01a9caaec..3b4c0d5a6aa 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.h +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.h @@ -25,7 +25,7 @@ % file |"common.h"|, which is also included in |"common.w"| to propagate % possible changes from this single source consistently. -% First comes general stuff: +First comes general stuff: @s boolean int @s uint8_t int diff --git a/Build/source/texk/web2c/cwebdir/common.c b/Build/source/texk/web2c/cwebdir/common.c index a01cb2d89ba..b65227e1e80 100644 --- a/Build/source/texk/web2c/cwebdir/common.c +++ b/Build/source/texk/web2c/cwebdir/common.c @@ -227,16 +227,16 @@ extern FILE*active_file; #line 69 "common.w" /*18:*/ -#line 85 "common.w" +#line 83 "common.w" boolean program; /*:18*//*19:*/ -#line 94 "common.w" +#line 92 "common.w" int phase; /*:19*//*21:*/ -#line 131 "common.w" +#line 129 "common.w" char section_text[longest_name+1]; char*section_text_end= section_text+longest_name; @@ -244,7 +244,7 @@ char*id_first; char*id_loc; /*:21*//*22:*/ -#line 151 "common.w" +#line 149 "common.w" char buffer[long_buf_size]; char*buffer_end= buffer+buf_size-2; @@ -252,7 +252,7 @@ char*limit= buffer; char*loc= buffer; /*:22*//*25:*/ -#line 196 "common.w" +#line 194 "common.w" int include_depth; FILE*file[max_include_depth]; @@ -269,13 +269,13 @@ boolean changing; boolean web_file_open= 0; /*:25*//*26:*/ -#line 222 "common.w" +#line 220 "common.w" char change_buffer[buf_size]; char*change_limit; /*:26*//*37:*/ -#line 403 "common.w" +#line 401 "common.w" sixteen_bits section_count; boolean changed_section[max_sections]; @@ -284,7 +284,7 @@ boolean change_pending; boolean print_where= 0; /*:37*//*43:*/ -#line 600 "common.w" +#line 598 "common.w" char byte_mem[max_bytes]; char*byte_mem_end= byte_mem+max_bytes-1; @@ -292,25 +292,25 @@ name_info name_dir[max_names]; name_pointer name_dir_end= name_dir+max_names-1; /*:43*//*44:*/ -#line 611 "common.w" +#line 609 "common.w" name_pointer name_ptr; char*byte_ptr; /*:44*//*46:*/ -#line 631 "common.w" +#line 629 "common.w" name_pointer hash[hash_size]; hash_pointer hash_end= hash+hash_size-1; hash_pointer h; /*:46*//*65:*/ -#line 1019 "common.w" +#line 1017 "common.w" int history= spotless; /*:65*//*73:*/ -#line 1140 "common.w" +#line 1138 "common.w" int argc; char**argv; @@ -321,7 +321,7 @@ char scn_file_name[max_file_name_length]; boolean flags[128]; /*:73*//*83:*/ -#line 1288 "common.w" +#line 1286 "common.w" FILE*C_file; FILE*tex_file; @@ -367,34 +367,34 @@ extern void common_init(void); extern void print_stats(void); /*:15*//*23:*/ -#line 161 "common.w" +#line 159 "common.w" static boolean input_ln(FILE*); /*:23*//*27:*/ -#line 233 "common.w" +#line 231 "common.w" static void prime_the_change_buffer(void); /*:27*//*32:*/ -#line 305 "common.w" +#line 303 "common.w" static void check_change(void); /*:32*//*55:*/ -#line 778 "common.w" +#line 776 "common.w" static int web_strcmp(char*,int,char*,int); static name_pointer add_section_name(name_pointer,int,char*,char*,int); static void extend_section_name(name_pointer,char*,char*,int); /*:55*//*63:*/ -#line 974 "common.w" +#line 972 "common.w" static int section_name_cmp(char**,int,name_pointer); /*:63*//*75:*/ -#line 1172 "common.w" +#line 1170 "common.w" static void scan_args(void); @@ -403,13 +403,13 @@ static void scan_args(void); /*:1*//*20:*/ -#line 100 "common.w" +#line 98 "common.w" void common_init(void) { /*45:*/ -#line 615 "common.w" +#line 613 "common.w" name_dir->byte_start= byte_ptr= byte_mem; name_ptr= name_dir+1; @@ -417,24 +417,24 @@ name_ptr->byte_start= byte_mem; root= NULL; /*:45*//*47:*/ -#line 638 "common.w" +#line 636 "common.w" for(h= hash;h<=hash_end;*h++= NULL); /*:47*/ -#line 104 "common.w" +#line 102 "common.w" /*74:*/ -#line 1153 "common.w" +#line 1151 "common.w" show_banner= show_happiness= show_progress= make_xrefs= true; show_stats= false; /*:74*/ -#line 105 "common.w" +#line 103 "common.w" /*84:*/ -#line 1295 "common.w" +#line 1293 "common.w" scan_args(); if(program==ctangle){ @@ -448,12 +448,12 @@ fatal("! Cannot open output file ",tex_file_name); } /*:84*/ -#line 106 "common.w" +#line 104 "common.w" } /*:20*//*24:*/ -#line 164 "common.w" +#line 162 "common.w" static boolean input_ln( FILE*fp) @@ -475,14 +475,14 @@ return(1); } /*:24*//*28:*/ -#line 236 "common.w" +#line 234 "common.w" static void prime_the_change_buffer(void) { change_limit= change_buffer; /*29:*/ -#line 250 "common.w" +#line 248 "common.w" while(1){ change_line++; @@ -499,10 +499,10 @@ err_print("! Missing @x in change file"); } /*:29*/ -#line 241 "common.w" +#line 239 "common.w" /*30:*/ -#line 267 "common.w" +#line 265 "common.w" do{ change_line++; @@ -514,10 +514,10 @@ return; }while(limit==buffer); /*:30*/ -#line 242 "common.w" +#line 240 "common.w" /*31:*/ -#line 277 "common.w" +#line 275 "common.w" { change_limit= change_buffer+(ptrdiff_t)(limit-buffer); @@ -525,12 +525,12 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:31*/ -#line 243 "common.w" +#line 241 "common.w" } /*:28*//*33:*/ -#line 308 "common.w" +#line 306 "common.w" static void check_change(void) @@ -553,7 +553,7 @@ return; if(limit> buffer+1&&buffer[0]=='@'){ char xyz_code= xisupper(buffer[1])?tolower((eight_bits)buffer[1]):buffer[1]; /*34:*/ -#line 346 "common.w" +#line 344 "common.w" if(xyz_code=='x'||xyz_code=='z'){ loc= buffer+2;err_print("! Where is the matching @y?"); @@ -571,11 +571,11 @@ return; } /*:34*/ -#line 330 "common.w" +#line 328 "common.w" } /*31:*/ -#line 277 "common.w" +#line 275 "common.w" { change_limit= change_buffer+(ptrdiff_t)(limit-buffer); @@ -583,7 +583,7 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:31*/ -#line 332 "common.w" +#line 330 "common.w" changing= 0;cur_line++; while(!input_ln(cur_file)){ @@ -599,14 +599,14 @@ if(lines_dont_match)n++; } /*:33*//*35:*/ -#line 366 "common.w" +#line 364 "common.w" void reset_input(void) { limit= buffer;loc= buffer+1;buffer[0]= ' '; /*36:*/ -#line 381 "common.w" +#line 379 "common.w" if((web_file= fopen(web_file_name,"r"))==NULL){ strcpy(web_file_name,alt_web_file_name); @@ -620,7 +620,7 @@ if((change_file= fopen(change_file_name,"r"))==NULL) fatal("! Cannot open change file ",change_file_name); /*:36*/ -#line 371 "common.w" +#line 369 "common.w" include_depth= 0;cur_line= 0;change_line= 0; change_depth= include_depth; @@ -629,14 +629,14 @@ limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= 0; } /*:35*//*38:*/ -#line 410 "common.w" +#line 408 "common.w" boolean get_line(void) { restart: if(changing&&include_depth==change_depth) /*41:*/ -#line 518 "common.w" +#line 516 "common.w" { change_line++; if(!input_ln(change_file)){ @@ -667,11 +667,11 @@ prime_the_change_buffer();changing= !changing;print_where= 1; } /*:41*/ -#line 415 "common.w" +#line 413 "common.w" if(!changing||include_depth> change_depth){ /*40:*/ -#line 501 "common.w" +#line 499 "common.w" { cur_line++; while(!input_ln(cur_file)){ @@ -690,7 +690,7 @@ if(change_limit> change_buffer)check_change(); } /*:40*/ -#line 417 "common.w" +#line 415 "common.w" if(changing&&include_depth==change_depth)goto restart; } @@ -711,7 +711,7 @@ goto restart; } include_depth++; /*39:*/ -#line 455 "common.w" +#line 453 "common.w" { char temp_file_name[max_file_name_length]; char*cur_file_name_end= cur_file_name+max_file_name_length-1; @@ -759,14 +759,14 @@ include_depth--;err_print("! Cannot open include file");goto restart; } /*:39*/ -#line 436 "common.w" +#line 434 "common.w" } return 1; } /*:38*//*42:*/ -#line 550 "common.w" +#line 548 "common.w" void check_complete(void){ @@ -780,7 +780,7 @@ err_print("! Change file entry did not match"); } /*:42*//*48:*/ -#line 643 "common.w" +#line 641 "common.w" name_pointer id_lookup( @@ -795,17 +795,17 @@ name_pointer p; if(last==NULL)for(last= first;*last!='\0';last++); l= (int)(last-first); /*49:*/ -#line 666 "common.w" +#line 664 "common.w" h= (eight_bits)*i; while(++ilink; @@ -815,10 +815,10 @@ p->link= hash[h];hash[h]= p; } /*:50*/ -#line 657 "common.w" +#line 655 "common.w" if(p==name_ptr)/*51:*/ -#line 685 "common.w" +#line 683 "common.w" { if(byte_ptr+l> byte_mem_end)overflow("byte memory"); if(name_ptr>=name_dir_end)overflow("name"); @@ -828,13 +828,13 @@ init_p(p,t); } /*:51*/ -#line 658 "common.w" +#line 656 "common.w" return(p); } /*:48*//*52:*/ -#line 717 "common.w" +#line 715 "common.w" void print_section_name( @@ -855,7 +855,7 @@ if(q)term_write("...",3); } /*:52*//*53:*/ -#line 736 "common.w" +#line 734 "common.w" void sprint_section_name( @@ -878,7 +878,7 @@ s= p->byte_start; } /*:53*//*54:*/ -#line 757 "common.w" +#line 755 "common.w" void print_prefix_name( @@ -891,7 +891,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); } /*:54*//*56:*/ -#line 783 "common.w" +#line 781 "common.w" static int web_strcmp( char*j, @@ -909,7 +909,7 @@ else return greater; } /*:56*//*57:*/ -#line 812 "common.w" +#line 810 "common.w" static name_pointer add_section_name( @@ -940,7 +940,7 @@ return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); } /*:57*//*58:*/ -#line 841 "common.w" +#line 839 "common.w" static void extend_section_name( @@ -964,7 +964,7 @@ if(ispref)*(byte_ptr-1)= ' '; } /*:58*//*59:*/ -#line 869 "common.w" +#line 867 "common.w" name_pointer section_lookup( @@ -979,7 +979,7 @@ name_pointer par= NULL; int name_len= (int)(last-first)+1; /*60:*/ -#line 893 "common.w" +#line 891 "common.w" while(p){ c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); @@ -1006,19 +1006,19 @@ p= q,q= NULL; } /*:60*/ -#line 883 "common.w" +#line 881 "common.w" /*61:*/ -#line 918 "common.w" +#line 916 "common.w" if(r==NULL) return add_section_name(par,c,first,last+1,ispref); /*:61*/ -#line 884 "common.w" +#line 882 "common.w" /*62:*/ -#line 926 "common.w" +#line 924 "common.w" switch(section_name_cmp(&first,name_len,r)){ @@ -1052,12 +1052,12 @@ return r; } /*:62*/ -#line 885 "common.w" +#line 883 "common.w" } /*:59*//*64:*/ -#line 977 "common.w" +#line 975 "common.w" static int section_name_cmp( char**pfirst, @@ -1091,7 +1091,7 @@ default:return c; } /*:64*//*66:*/ -#line 1029 "common.w" +#line 1027 "common.w" void err_print( @@ -1100,7 +1100,7 @@ const char*s) char*k,*l; printf(*s=='!'?"\n%s":"%s",s); if(web_file_open)/*67:*/ -#line 1049 "common.w" +#line 1047 "common.w" {if(changing&&include_depth==change_depth) printf(". (l. %d of change file)\n",change_line); @@ -1120,20 +1120,20 @@ putchar(' '); } /*:67*/ -#line 1036 "common.w" +#line 1034 "common.w" update_terminal;mark_error; } /*:66*//*68:*/ -#line 1081 "common.w" +#line 1079 "common.w" int wrap_up(void){ if(show_progress)new_line; if(show_stats) print_stats(); /*69:*/ -#line 1091 "common.w" +#line 1089 "common.w" switch(history){ case spotless:if(show_happiness)puts("(No errors were found.)");break; @@ -1145,14 +1145,14 @@ case fatal_message:puts("(That was a fatal error, my friend.)"); } /*:69*/ -#line 1086 "common.w" +#line 1084 "common.w" if(history> harmless_message)return(1); else return(0); } /*:68*//*70:*/ -#line 1107 "common.w" +#line 1105 "common.w" void fatal( const char*s,const char*t) @@ -1163,7 +1163,7 @@ history= fatal_message;exit(wrap_up()); } /*:70*//*71:*/ -#line 1118 "common.w" +#line 1116 "common.w" void overflow( const char*t) @@ -1173,7 +1173,7 @@ printf("\n! Sorry, %s capacity exceeded",t);fatal("",""); /*:71*//*76:*/ -#line 1175 "common.w" +#line 1173 "common.w" static void scan_args(void) @@ -1187,7 +1187,7 @@ boolean found_web= 0,found_change= 0,found_out= 0; strcpy(change_file_name,"/dev/null"); while(--argc> 0){ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ -#line 1264 "common.w" +#line 1262 "common.w" { for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) @@ -1195,7 +1195,7 @@ flags[(eight_bits)*dot_pos]= flag_change; } /*:80*/ -#line 1187 "common.w" +#line 1185 "common.w" else{ s= name_pos= *argv;dot_pos= NULL; @@ -1205,17 +1205,17 @@ else if(*s=='/')dot_pos= NULL,name_pos= ++s; else s++; } if(!found_web)/*77:*/ -#line 1212 "common.w" +#line 1210 "common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 1282 "common.w" +#line 1280 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1215 "common.w" +#line 1213 "common.w" if(dot_pos==NULL) sprintf(web_file_name,"%s.w",*argv); @@ -1232,21 +1232,21 @@ found_web= 1; } /*:77*/ -#line 1196 "common.w" +#line 1194 "common.w" else if(!found_change)/*78:*/ -#line 1230 "common.w" +#line 1228 "common.w" { if(strcmp(*argv,"-")!=0){ if(s-*argv> max_file_name_length-4) /*82:*/ -#line 1282 "common.w" +#line 1280 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1234 "common.w" +#line 1232 "common.w" if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); @@ -1256,20 +1256,20 @@ found_change= 1; } /*:78*/ -#line 1197 "common.w" +#line 1195 "common.w" else if(!found_out)/*79:*/ -#line 1242 "common.w" +#line 1240 "common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 1282 "common.w" +#line 1280 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1245 "common.w" +#line 1243 "common.w" if(dot_pos==NULL){ sprintf(tex_file_name,"%s.tex",*argv); @@ -1289,10 +1289,10 @@ found_out= 1; } /*:79*/ -#line 1198 "common.w" +#line 1196 "common.w" else/*81:*/ -#line 1270 "common.w" +#line 1268 "common.w" { if(program==ctangle) @@ -1306,12 +1306,12 @@ else fatal( } /*:81*/ -#line 1199 "common.w" +#line 1197 "common.w" } } if(!found_web)/*81:*/ -#line 1270 "common.w" +#line 1268 "common.w" { if(program==ctangle) @@ -1325,7 +1325,7 @@ else fatal( } /*:81*/ -#line 1202 "common.w" +#line 1200 "common.w" } diff --git a/Build/source/texk/web2c/cwebdir/common.h b/Build/source/texk/web2c/cwebdir/common.h index b33dfc10556..71ceaa8f432 100644 --- a/Build/source/texk/web2c/cwebdir/common.h +++ b/Build/source/texk/web2c/cwebdir/common.h @@ -25,7 +25,7 @@ % file |"common.h"|, which is also included in |"common.w"| to propagate % possible changes from this single source consistently. -% First comes general stuff: +First comes general stuff: @s boolean int @s uint8_t int diff --git a/Build/source/texk/web2c/cwebdir/common.w b/Build/source/texk/web2c/cwebdir/common.w index 79083985c6a..66236aca6bf 100644 --- a/Build/source/texk/web2c/cwebdir/common.w +++ b/Build/source/texk/web2c/cwebdir/common.w @@ -73,8 +73,6 @@ The file begins with a few basic definitions. @ The details will be filled in due course. The interface of this module is included first. It is also used by the main programs. -First comes general stuff: - @i common.h @ In certain cases \.{CTANGLE} and \.{CWEAVE} should do almost, but not diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c index 3c8b2649da0..83d3780e1fa 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.c +++ b/Build/source/texk/web2c/cwebdir/ctangle.c @@ -249,7 +249,7 @@ extern FILE*active_file; #line 69 "ctangle.w" /*19:*/ -#line 124 "ctangle.w" +#line 122 "ctangle.w" typedef struct{ eight_bits*tok_start; @@ -258,7 +258,7 @@ sixteen_bits text_link; typedef text*text_pointer; /*:19*//*31:*/ -#line 272 "ctangle.w" +#line 270 "ctangle.w" typedef struct{ eight_bits*end_field; @@ -273,7 +273,7 @@ typedef output_state*stack_pointer; #line 70 "ctangle.w" /*20:*/ -#line 131 "ctangle.w" +#line 129 "ctangle.w" text text_info[max_texts]; text_pointer text_info_end= text_info+max_texts-1; @@ -283,12 +283,12 @@ eight_bits*tok_mem_end= tok_mem+max_toks-1; eight_bits*tok_ptr; /*:20*//*26:*/ -#line 200 "ctangle.w" +#line 198 "ctangle.w" text_pointer last_unnamed; /*:26*//*32:*/ -#line 288 "ctangle.w" +#line 286 "ctangle.w" output_state cur_state; @@ -297,18 +297,18 @@ stack_pointer stack_ptr; stack_pointer stack_end= stack+stack_size; /*:32*//*37:*/ -#line 364 "ctangle.w" +#line 362 "ctangle.w" int cur_val; /*:37*//*42:*/ -#line 456 "ctangle.w" +#line 454 "ctangle.w" eight_bits out_state; boolean protect; /*:42*//*45:*/ -#line 488 "ctangle.w" +#line 486 "ctangle.w" name_pointer output_files[max_files]; name_pointer*cur_out_file,*end_output_files,*an_output_file; @@ -316,39 +316,39 @@ char cur_section_name_char; char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 588 "ctangle.w" +#line 586 "ctangle.w" boolean output_defs_seen= 0; /*:52*//*57:*/ -#line 697 "ctangle.w" +#line 695 "ctangle.w" char translit[128][translit_length]; /*:57*//*62:*/ -#line 776 "ctangle.w" +#line 774 "ctangle.w" eight_bits ccode[256]; /*:62*//*66:*/ -#line 836 "ctangle.w" +#line 834 "ctangle.w" boolean comment_continues= 0; /*:66*//*68:*/ -#line 875 "ctangle.w" +#line 873 "ctangle.w" name_pointer cur_section_name; int no_where; /*:68*//*82:*/ -#line 1189 "ctangle.w" +#line 1187 "ctangle.w" text_pointer cur_text; eight_bits next_control; /*:82*//*90:*/ -#line 1350 "ctangle.w" +#line 1348 "ctangle.w" extern sixteen_bits section_count; @@ -390,65 +390,65 @@ extern void common_init(void); extern void print_stats(void); /*:16*//*29:*/ -#line 233 "ctangle.w" +#line 231 "ctangle.w" static void store_two_bytes(sixteen_bits); /*:29*//*34:*/ -#line 312 "ctangle.w" +#line 310 "ctangle.w" static void push_level(name_pointer); static void pop_level(int); /*:34*//*38:*/ -#line 371 "ctangle.w" +#line 369 "ctangle.w" static void get_output(void); /*:38*//*43:*/ -#line 464 "ctangle.w" +#line 462 "ctangle.w" static void flush_buffer(void); /*:43*//*48:*/ -#line 519 "ctangle.w" +#line 517 "ctangle.w" static void phase_two(void); /*:48*//*53:*/ -#line 591 "ctangle.w" +#line 589 "ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*64:*/ -#line 800 "ctangle.w" +#line 798 "ctangle.w" static eight_bits skip_ahead(void); static boolean skip_comment(boolean); /*:64*//*69:*/ -#line 887 "ctangle.w" +#line 885 "ctangle.w" static eight_bits get_next(void); /*:69*//*83:*/ -#line 1193 "ctangle.w" +#line 1191 "ctangle.w" static void scan_repl(eight_bits); /*:83*//*91:*/ -#line 1357 "ctangle.w" +#line 1355 "ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1460 "ctangle.w" +#line 1458 "ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1478 "ctangle.w" +#line 1476 "ctangle.w" static void skip_limbo(void); @@ -466,28 +466,28 @@ char**av) argc= ac;argv= av; program= ctangle; /*21:*/ -#line 139 "ctangle.w" +#line 137 "ctangle.w" text_info->tok_start= tok_ptr= tok_mem; text_ptr= text_info+1;text_ptr->tok_start= tok_mem; /*:21*//*23:*/ -#line 149 "ctangle.w" +#line 147 "ctangle.w" init_node(name_dir); /*:23*//*27:*/ -#line 203 "ctangle.w" +#line 201 "ctangle.w" last_unnamed= text_info;text_info->text_link= 0; /*:27*//*46:*/ -#line 498 "ctangle.w" +#line 496 "ctangle.w" cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 700 "ctangle.w" +#line 698 "ctangle.w" { int i; @@ -495,7 +495,7 @@ for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i)); } /*:58*//*63:*/ -#line 779 "ctangle.w" +#line 777 "ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -515,7 +515,7 @@ ccode['\'']= ord; } /*:63*//*78:*/ -#line 1110 "ctangle.w" +#line 1108 "ctangle.w" section_text[0]= ' '; /*:78*/ @@ -529,7 +529,7 @@ return wrap_up(); } /*:2*//*24:*/ -#line 155 "ctangle.w" +#line 153 "ctangle.w" boolean names_match( name_pointer p, @@ -542,7 +542,7 @@ return!strncmp(first,p->byte_start,l); } /*:24*//*25:*/ -#line 171 "ctangle.w" +#line 169 "ctangle.w" void init_node( @@ -554,7 +554,7 @@ void init_p(name_pointer p,eight_bits t){(void)p;(void)t;} /*:25*//*30:*/ -#line 236 "ctangle.w" +#line 234 "ctangle.w" void store_two_bytes( @@ -566,7 +566,7 @@ if(tok_ptr+2> tok_mem_end)overflow("token"); } /*:30*//*35:*/ -#line 316 "ctangle.w" +#line 314 "ctangle.w" static void push_level( @@ -583,7 +583,7 @@ cur_section= 0; } /*:35*//*36:*/ -#line 335 "ctangle.w" +#line 333 "ctangle.w" static void pop_level( @@ -599,7 +599,7 @@ if(stack_ptr> stack)cur_state= *stack_ptr; } /*:36*//*39:*/ -#line 374 "ctangle.w" +#line 372 "ctangle.w" static void get_output(void) @@ -622,7 +622,7 @@ switch(a/024000){ case 0:cur_val= a;out_char(identifier);break; case 1:if(a==output_defs_flag)output_defs(); else/*40:*/ -#line 406 "ctangle.w" +#line 404 "ctangle.w" { a-= 024000; @@ -636,7 +636,7 @@ goto restart; } /*:40*/ -#line 395 "ctangle.w" +#line 393 "ctangle.w" break; default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val; @@ -646,7 +646,7 @@ out_char(section_number); } /*:39*//*44:*/ -#line 467 "ctangle.w" +#line 465 "ctangle.w" static void flush_buffer(void) @@ -661,29 +661,29 @@ cur_line++; } /*:44*//*49:*/ -#line 522 "ctangle.w" +#line 520 "ctangle.w" static void phase_two(void){ web_file_open= 0; cur_line= 1; /*33:*/ -#line 301 "ctangle.w" +#line 299 "ctangle.w" stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info; cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;cur_section= 0; /*:33*/ -#line 527 "ctangle.w" +#line 525 "ctangle.w" /*51:*/ -#line 584 "ctangle.w" +#line 582 "ctangle.w" if(!output_defs_seen) output_defs(); /*:51*/ -#line 528 "ctangle.w" +#line 526 "ctangle.w" if(text_info->text_link==0&&cur_out_file==end_output_files){ fputs("\n! No program text was specified.",stdout);mark_harmless; @@ -706,7 +706,7 @@ if(text_info->text_link==0)goto writeloop; while(stack_ptr> stack)get_output(); flush_buffer(); writeloop:/*50:*/ -#line 561 "ctangle.w" +#line 559 "ctangle.w" for(an_output_file= end_output_files;an_output_file> cur_out_file;){ an_output_file--; @@ -727,7 +727,7 @@ flush_buffer(); } /*:50*/ -#line 549 "ctangle.w" +#line 547 "ctangle.w" if(show_happiness){ if(show_progress)new_line; @@ -737,7 +737,7 @@ fputs("Done.",stdout); } /*:49*//*54:*/ -#line 595 "ctangle.w" +#line 593 "ctangle.w" static void output_defs(void) @@ -777,7 +777,7 @@ pop_level(0); } /*:54*//*55:*/ -#line 638 "ctangle.w" +#line 636 "ctangle.w" static void out_char( @@ -790,7 +790,7 @@ case'\n':if(protect&&out_state!=verbatim)C_putc(' '); if(protect||out_state==verbatim)C_putc('\\'); flush_buffer();if(out_state!=verbatim)out_state= normal;break; /*59:*/ -#line 706 "ctangle.w" +#line 704 "ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); @@ -805,10 +805,10 @@ j++; out_state= num_or_id;break; /*:59*/ -#line 649 "ctangle.w" +#line 647 "ctangle.w" /*60:*/ -#line 719 "ctangle.w" +#line 717 "ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -835,10 +835,10 @@ C_printf("%s","\"\n"); break; /*:60*/ -#line 650 "ctangle.w" +#line 648 "ctangle.w" /*56:*/ -#line 668 "ctangle.w" +#line 666 "ctangle.w" case plus_plus:C_putc('+');C_putc('+');out_state= normal;break; case minus_minus:C_putc('-');C_putc('-');out_state= normal;break; @@ -859,7 +859,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; break; /*:56*/ -#line 651 "ctangle.w" +#line 649 "ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -878,7 +878,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*65:*/ -#line 804 "ctangle.w" +#line 802 "ctangle.w" static eight_bits skip_ahead(void) @@ -896,7 +896,7 @@ if(c!=ignore||*(loc-1)=='>')return(c); } /*:65*//*67:*/ -#line 839 "ctangle.w" +#line 837 "ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -930,7 +930,7 @@ else loc++; } /*:67*//*70:*/ -#line 890 "ctangle.w" +#line 888 "ctangle.w" static eight_bits get_next(void) @@ -944,7 +944,7 @@ if(get_line()==0)return(new_section); else if(print_where&&!no_where){ print_where= 0; /*85:*/ -#line 1222 "ctangle.w" +#line 1220 "ctangle.w" store_two_bytes(0150000); if(changing&&include_depth==change_depth){ @@ -959,7 +959,7 @@ id_loc= id_first+strlen(id_first); app_repl(a_l%0400);} /*:85*/ -#line 902 "ctangle.w" +#line 900 "ctangle.w" } else return('\n'); @@ -973,7 +973,7 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 971 "ctangle.w" +#line 969 "ctangle.w" { id_first= loc-1; if(*id_first=='.'&&!xisdigit(*loc))goto mistake; @@ -998,13 +998,13 @@ return(constant); } /*:73*/ -#line 914 "ctangle.w" +#line 912 "ctangle.w" else if(c=='\''||c=='"' ||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"')) ||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"'))) /*74:*/ -#line 999 "ctangle.w" +#line 997 "ctangle.w" { char delim= c; id_first= section_text+1; @@ -1048,11 +1048,11 @@ return(string); } /*:74*/ -#line 918 "ctangle.w" +#line 916 "ctangle.w" else if(isalpha(c)||isxalpha(c)||ishigh(c)) /*72:*/ -#line 964 "ctangle.w" +#line 962 "ctangle.w" { id_first= --loc; while(isalpha((eight_bits)*++loc)||isdigit((eight_bits)*loc) @@ -1061,10 +1061,10 @@ id_loc= loc;return(identifier); } /*:72*/ -#line 920 "ctangle.w" +#line 918 "ctangle.w" else if(c=='@')/*75:*/ -#line 1044 "ctangle.w" +#line 1042 "ctangle.w" { c= ccode[(eight_bits)*loc++]; switch(c){ @@ -1080,11 +1080,11 @@ continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1092 "ctangle.w" +#line 1090 "ctangle.w" { char*k; /*79:*/ -#line 1112 "ctangle.w" +#line 1110 "ctangle.w" k= section_text; while(1){ @@ -1095,7 +1095,7 @@ loc= buffer+1;break; } c= *loc; /*80:*/ -#line 1136 "ctangle.w" +#line 1134 "ctangle.w" if(c=='@'){ c= *(loc+1); @@ -1114,7 +1114,7 @@ err_print("! Nesting of section names not allowed");break; } /*:80*/ -#line 1121 "ctangle.w" +#line 1119 "ctangle.w" loc++;if(k section_text)k--; /*:79*/ -#line 1094 "ctangle.w" +#line 1092 "ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) cur_section_name= section_lookup(section_text+1,k-3,1); else cur_section_name= section_lookup(section_text+1,k,0); if(cur_section_name_char=='(') /*47:*/ -#line 502 "ctangle.w" +#line 500 "ctangle.w" { for(an_output_file= cur_out_file; @@ -1154,16 +1154,16 @@ overflow("output files"); } /*:47*/ -#line 1100 "ctangle.w" +#line 1098 "ctangle.w" return(section_name); } /*:77*/ -#line 1058 "ctangle.w" +#line 1056 "ctangle.w" case string:/*81:*/ -#line 1158 "ctangle.w" +#line 1156 "ctangle.w" { id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; @@ -1174,10 +1174,10 @@ return(string); } /*:81*/ -#line 1059 "ctangle.w" +#line 1057 "ctangle.w" case ord:/*76:*/ -#line 1071 "ctangle.w" +#line 1069 "ctangle.w" id_first= loc; if(*loc=='\\'){ @@ -1200,14 +1200,14 @@ loc++; return(ord); /*:76*/ -#line 1060 "ctangle.w" +#line 1058 "ctangle.w" default:return(c); } } /*:75*/ -#line 921 "ctangle.w" +#line 919 "ctangle.w" else if(xisspace(c)){ if(!preprocessing||loc> limit)continue; @@ -1216,7 +1216,7 @@ else return(' '); } else if(c=='#'&&loc==buffer+1)preprocessing= 1; mistake:/*71:*/ -#line 942 "ctangle.w" +#line 940 "ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; @@ -1240,14 +1240,14 @@ case'!':if(*loc=='=')compress(non_eq);break; } /*:71*/ -#line 928 "ctangle.w" +#line 926 "ctangle.w" return(c); } } /*:70*//*84:*/ -#line 1196 "ctangle.w" +#line 1194 "ctangle.w" static void scan_repl( @@ -1255,7 +1255,7 @@ eight_bits t) { sixteen_bits a; if(t==section_name){/*85:*/ -#line 1222 "ctangle.w" +#line 1220 "ctangle.w" store_two_bytes(0150000); if(changing&&include_depth==change_depth){ @@ -1270,11 +1270,11 @@ id_loc= id_first+strlen(id_first); app_repl(a_l%0400);} /*:85*/ -#line 1202 "ctangle.w" +#line 1200 "ctangle.w" } while(1)switch(a= get_next()){ /*86:*/ -#line 1235 "ctangle.w" +#line 1233 "ctangle.w" case identifier:a= id_lookup(id_first,id_loc,0)-name_dir; app_repl((a/0400)+0200); @@ -1282,7 +1282,7 @@ app_repl(a%0400);break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1268 "ctangle.w" +#line 1266 "ctangle.w" { char*try_loc= loc; while(*try_loc==' '&&try_loctok_start= tok_ptr; } /*:84*//*92:*/ -#line 1360 "ctangle.w" +#line 1358 "ctangle.w" static void scan_section(void) @@ -1455,7 +1455,7 @@ printf("*%d",section_count);update_terminal; next_control= 0; while(1){ /*93:*/ -#line 1399 "ctangle.w" +#line 1397 "ctangle.w" while(next_controltext_link= 0; } /*:94*/ -#line 1376 "ctangle.w" +#line 1374 "ctangle.w" continue; } @@ -1497,14 +1497,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*95:*/ -#line 1431 "ctangle.w" +#line 1429 "ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:95*/ -#line 1384 "ctangle.w" +#line 1382 "ctangle.w" break; } @@ -1512,20 +1512,20 @@ return; } no_where= print_where= 0; /*96:*/ -#line 1436 "ctangle.w" +#line 1434 "ctangle.w" /*97:*/ -#line 1441 "ctangle.w" +#line 1439 "ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:97*/ -#line 1437 "ctangle.w" +#line 1435 "ctangle.w" scan_repl(section_name); /*98:*/ -#line 1445 "ctangle.w" +#line 1443 "ctangle.w" if(p==name_dir||p==0){ (last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text; @@ -1542,16 +1542,16 @@ cur_text->text_link= section_flag; /*:98*/ -#line 1439 "ctangle.w" +#line 1437 "ctangle.w" /*:96*/ -#line 1390 "ctangle.w" +#line 1388 "ctangle.w" } /*:92*//*100:*/ -#line 1463 "ctangle.w" +#line 1461 "ctangle.w" static void phase_one(void){ @@ -1565,7 +1565,7 @@ phase= 2; } /*:100*//*102:*/ -#line 1481 "ctangle.w" +#line 1479 "ctangle.w" static void skip_limbo(void) @@ -1580,7 +1580,7 @@ c= *loc++; if(ccode[(eight_bits)c]==new_section)break; switch(ccode[(eight_bits)c]){ case translit_code:/*103:*/ -#line 1510 "ctangle.w" +#line 1508 "ctangle.w" while(xisspace(*loc)&&loc