diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2023-07-13 15:11:14 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2023-07-13 15:11:14 +0000 |
commit | ca30997845b1703ad8e59906576ea0617cdb939d (patch) | |
tree | 04a200caa13d5bf01fb70453e1860d55a47f44bf /Build/source/texk/web2c/ctangleboot.cin | |
parent | 0bd21c70a19f1a5e5b8efcb0addf7204d2de5fc5 (diff) |
[CWEB] Merge 'cur_state' into 'stack'.
git-svn-id: svn://tug.org/texlive/trunk@67618 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/ctangleboot.cin')
-rw-r--r-- | Build/source/texk/web2c/ctangleboot.cin | 447 |
1 files changed, 222 insertions, 225 deletions
diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index 500d7b141b7..340a9c48f65 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -121,11 +121,13 @@ #define output_defs_flag (2*024000-1) \ #define stack_size 50 -#define cur_end cur_state.end_field +#define cur_state stack[stack_size+1] \ + #define cur_byte cur_state.byte_field #define cur_name cur_state.name_field #define cur_repl cur_state.repl_field -#define cur_section cur_state.section_field \ +#define cur_section cur_state.section_field +#define cur_end (cur_repl+1) ->tok_start \ #define section_number 0201 #define identifier 0202 \ @@ -140,6 +142,8 @@ #define C_printf(c,a) fprintf(C_file,c,a) #define C_putc(c) putc((int) (c) ,C_file) \ +#define macro_end (cur_text+1) ->tok_start \ + #define translit_length 10 \ #define transliterate_utf_eight flags['u'] \ @@ -277,7 +281,7 @@ extern FILE*active_file; extern FILE*check_file; /*:15*//*116:*/ -#line 555 "cwebdir/ctang-w2c.ch" +#line 553 "cwebdir/ctang-w2c.ch" extern char cb_banner[]; @@ -295,10 +299,9 @@ typedef text*text_pointer; #line 66 "cwebdir/ctang-w2c.ch" /*:19*//*31:*/ -#line 274 "cwebdir/ctangle.w" +#line 271 "cwebdir/ctangle.w" typedef struct{ -eight_bits*end_field; eight_bits*byte_field; name_pointer name_field; text_pointer repl_field; @@ -325,27 +328,25 @@ static eight_bits*tok_ptr; static text_pointer last_unnamed; /*:26*//*32:*/ -#line 291 "cwebdir/ctangle.w" +#line 289 "cwebdir/ctangle.w" -static output_state cur_state; - -static output_state stack[stack_size+1]; +static output_state stack[stack_size+2]; static stack_pointer stack_end= stack+stack_size; static stack_pointer stack_ptr; /*:32*//*37:*/ -#line 367 "cwebdir/ctangle.w" +#line 361 "cwebdir/ctangle.w" static int cur_val; /*:37*//*42:*/ -#line 459 "cwebdir/ctangle.w" +#line 453 "cwebdir/ctangle.w" static eight_bits out_state; static boolean protect; /*:42*//*45:*/ -#line 490 "cwebdir/ctangle.w" +#line 484 "cwebdir/ctangle.w" static name_pointer output_files[max_files]; static name_pointer*cur_out_file,*end_output_files,*an_output_file; @@ -353,33 +354,33 @@ static char cur_section_name_char; static char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 590 "cwebdir/ctangle.w" +#line 583 "cwebdir/ctangle.w" static boolean output_defs_seen= false; /*:52*//*57:*/ -#line 703 "cwebdir/ctangle.w" +#line 697 "cwebdir/ctangle.w" static char translit[0200][translit_length]; /*:57*//*62:*/ -#line 779 "cwebdir/ctangle.w" +#line 773 "cwebdir/ctangle.w" static eight_bits ccode[256]; /*:62*//*66:*/ -#line 839 "cwebdir/ctangle.w" +#line 833 "cwebdir/ctangle.w" static boolean comment_continues= false; /*:66*//*68:*/ -#line 876 "cwebdir/ctangle.w" +#line 870 "cwebdir/ctangle.w" static name_pointer cur_section_name; static boolean no_where; /*:68*//*82:*/ -#line 1193 "cwebdir/ctangle.w" +#line 1187 "cwebdir/ctangle.w" static text_pointer cur_text; static eight_bits next_control; @@ -427,53 +428,53 @@ extern void cb_show_banner(void); static void store_two_bytes(sixteen_bits); /*:30*//*35:*/ -#line 330 "cwebdir/ctangle.w" +#line 325 "cwebdir/ctangle.w" static void push_level(name_pointer); static void pop_level(boolean); /*:35*//*39:*/ -#line 404 "cwebdir/ctangle.w" +#line 398 "cwebdir/ctangle.w" static void get_output(void); /*:39*//*44:*/ -#line 480 "cwebdir/ctangle.w" +#line 474 "cwebdir/ctangle.w" static void flush_buffer(void); /*:44*//*49:*/ -#line 557 "cwebdir/ctangle.w" +#line 551 "cwebdir/ctangle.w" static void phase_two(void); /*:49*//*53:*/ -#line 593 "cwebdir/ctangle.w" +#line 586 "cwebdir/ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*65:*/ -#line 819 "cwebdir/ctangle.w" +#line 813 "cwebdir/ctangle.w" static eight_bits skip_ahead(void); static boolean skip_comment(boolean); /*:65*//*70:*/ -#line 926 "cwebdir/ctangle.w" +#line 920 "cwebdir/ctangle.w" static eight_bits get_next(void); /*:70*//*84:*/ -#line 1219 "cwebdir/ctangle.w" +#line 1213 "cwebdir/ctangle.w" static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1411 "cwebdir/ctangle.w" +#line 1405 "cwebdir/ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1488 "cwebdir/ctangle.w" +#line 1482 "cwebdir/ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1521 "cwebdir/ctangle.w" +#line 1515 "cwebdir/ctangle.w" static void skip_limbo(void); /*:101*/ @@ -506,21 +507,21 @@ init_node(name_dir); last_unnamed= text_info;text_info->text_link= macro; /*:27*//*46:*/ -#line 500 "cwebdir/ctangle.w" +#line 494 "cwebdir/ctangle.w" cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 706 "cwebdir/ctangle.w" +#line 700 "cwebdir/ctangle.w" { int i; for(i= 0;i<0200;i++)sprintf(translit[i],"X%02X",(unsigned int)(0200+i)); } -#line 180 "cwebdir/ctang-w2c.ch" +#line 178 "cwebdir/ctang-w2c.ch" /*:58*//*63:*/ -#line 782 "cwebdir/ctangle.w" +#line 776 "cwebdir/ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -540,11 +541,11 @@ ccode['<']= ccode['(']= section_name; ccode['\'']= ord; /*:63*//*78:*/ -#line 1114 "cwebdir/ctangle.w" +#line 1108 "cwebdir/ctangle.w" section_text[0]= ' '; /*:78*//*117:*/ -#line 558 "cwebdir/ctang-w2c.ch" +#line 556 "cwebdir/ctang-w2c.ch" strncpy(cb_banner,banner,max_banner-1); @@ -599,7 +600,7 @@ if(tok_ptr+2> tok_mem_end)overflow(_("token")); } /*:29*//*34:*/ -#line 315 "cwebdir/ctangle.w" +#line 311 "cwebdir/ctangle.w" static void push_level( @@ -607,18 +608,17 @@ name_pointer p) { #line 79 "cwebdir/ctang-w2c.ch" if(stack_ptr==stack_end)overflow(_("stack")); -#line 321 "cwebdir/ctangle.w" +#line 317 "cwebdir/ctangle.w" *stack_ptr= cur_state; stack_ptr++; if(p!=NULL){ cur_name= p;cur_repl= (text_pointer)p->equiv; -cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start; -cur_section= 0; +cur_byte= cur_repl->tok_start;cur_section= 0; } } /*:34*//*36:*/ -#line 338 "cwebdir/ctangle.w" +#line 333 "cwebdir/ctangle.w" static void pop_level( @@ -626,15 +626,14 @@ boolean flag) { if(flag&&cur_repl->text_link<section_flag){ cur_repl= cur_repl->text_link+text_info; -cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start; -return; +cur_byte= cur_repl->tok_start;return; } stack_ptr--; if(stack_ptr> stack)cur_state= *stack_ptr; } /*:36*//*38:*/ -#line 374 "cwebdir/ctangle.w" +#line 368 "cwebdir/ctangle.w" static void get_output(void) @@ -657,7 +656,7 @@ switch(a/024000){ case 0:cur_val= (int)a;out_char(identifier);break; case 1:if(a==output_defs_flag)output_defs(); else/*40:*/ -#line 409 "cwebdir/ctangle.w" +#line 403 "cwebdir/ctangle.w" { a-= 024000; @@ -665,7 +664,7 @@ if((a+name_dir)->equiv!=(void*)text_info)push_level(a+name_dir); else if(a!=0){ #line 85 "cwebdir/ctang-w2c.ch" fputs(_("\n! Not present: <"),stdout); -#line 415 "cwebdir/ctangle.w" +#line 409 "cwebdir/ctangle.w" print_section_name(a+name_dir);err_print(">"); } @@ -673,7 +672,7 @@ goto restart; } /*:40*/ -#line 395 "cwebdir/ctangle.w" +#line 389 "cwebdir/ctangle.w" break; default:cur_val= (int)a-050000; @@ -684,7 +683,7 @@ out_char(section_number); } /*:38*//*43:*/ -#line 467 "cwebdir/ctangle.w" +#line 461 "cwebdir/ctangle.w" static void flush_buffer(void) @@ -699,7 +698,7 @@ cur_line++; } /*:43*//*48:*/ -#line 519 "cwebdir/ctangle.w" +#line 513 "cwebdir/ctangle.w" static void phase_two(void){ @@ -707,27 +706,27 @@ phase= 2; web_file_open= false; cur_line= 1; /*33:*/ -#line 304 "cwebdir/ctangle.w" +#line 300 "cwebdir/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; +cur_byte= cur_repl->tok_start;cur_section= 0; /*:33*/ -#line 525 "cwebdir/ctangle.w" +#line 519 "cwebdir/ctangle.w" /*51:*/ -#line 586 "cwebdir/ctangle.w" +#line 579 "cwebdir/ctangle.w" if(!output_defs_seen) output_defs(); /*:51*/ -#line 526 "cwebdir/ctangle.w" +#line 520 "cwebdir/ctangle.w" if(text_info->text_link==macro&&cur_out_file==end_output_files){ #line 97 "cwebdir/ctang-w2c.ch" fputs(_("\n! No program text was specified."),stdout);mark_harmless; -#line 529 "cwebdir/ctangle.w" +#line 523 "cwebdir/ctangle.w" } else{ @@ -735,7 +734,7 @@ if(cur_out_file==end_output_files){ if(show_progress){ #line 103 "cwebdir/ctang-w2c.ch" printf(_("\nWriting the output file (%s):"),C_file_name); -#line 535 "cwebdir/ctangle.w" +#line 529 "cwebdir/ctangle.w" update_terminal; } } @@ -743,7 +742,7 @@ else{ if(show_progress){ #line 109 "cwebdir/ctang-w2c.ch" fputs(_("\nWriting the output files:"),stdout); -#line 541 "cwebdir/ctangle.w" +#line 535 "cwebdir/ctangle.w" printf(" (%s)",C_file_name); update_terminal; @@ -753,16 +752,16 @@ if(text_info->text_link==macro)goto writeloop; while(stack_ptr> stack)get_output(); flush_buffer(); writeloop:/*50:*/ -#line 138 "cwebdir/ctang-w2c.ch" +#line 137 "cwebdir/ctang-w2c.ch" if(check_for_change){ fclose(C_file);C_file= NULL; /*106:*/ -#line 438 "cwebdir/ctang-w2c.ch" +#line 436 "cwebdir/ctang-w2c.ch" if((C_file= fopen(C_file_name,"r"))!=NULL){ /*107:*/ -#line 445 "cwebdir/ctang-w2c.ch" +#line 443 "cwebdir/ctang-w2c.ch" boolean comparison= false; @@ -771,7 +770,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*108:*/ -#line 459 "cwebdir/ctang-w2c.ch" +#line 457 "cwebdir/ctang-w2c.ch" do{ char x[BUFSIZ],y[BUFSIZ]; @@ -781,17 +780,17 @@ comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); /*:108*/ -#line 452 "cwebdir/ctang-w2c.ch" +#line 450 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; /*:107*/ -#line 440 "cwebdir/ctang-w2c.ch" +#line 438 "cwebdir/ctang-w2c.ch" /*109:*/ -#line 470 "cwebdir/ctang-w2c.ch" +#line 468 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -801,20 +800,20 @@ rename(check_file_name,C_file_name); } /*:109*/ -#line 441 "cwebdir/ctang-w2c.ch" +#line 439 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,C_file_name); /*:106*/ -#line 141 "cwebdir/ctang-w2c.ch" +#line 140 "cwebdir/ctang-w2c.ch" } for(an_output_file= end_output_files;an_output_file> cur_out_file;){ an_output_file--; sprint_section_name(output_file_name,*an_output_file); if(check_for_change)/*105:*/ -#line 429 "cwebdir/ctang-w2c.ch" +#line 427 "cwebdir/ctang-w2c.ch" { if((C_file= fopen(output_file_name,"a"))==NULL) fatal(_("! Cannot open output file "),output_file_name); @@ -825,7 +824,7 @@ fatal(_("! Cannot open output file "),check_file_name); } /*:105*/ -#line 146 "cwebdir/ctang-w2c.ch" +#line 145 "cwebdir/ctang-w2c.ch" else{ fclose(C_file); @@ -839,20 +838,19 @@ stack_ptr= stack+1; cur_name= *an_output_file; cur_repl= (text_pointer)cur_name->equiv; cur_byte= cur_repl->tok_start; -cur_end= (cur_repl+1)->tok_start; while(stack_ptr> stack)get_output(); flush_buffer(); if(check_for_change){ fclose(C_file);C_file= NULL; /*110:*/ -#line 483 "cwebdir/ctang-w2c.ch" +#line 481 "cwebdir/ctang-w2c.ch" if(0==strcmp("/dev/stdout",output_file_name)) /*112:*/ -#line 510 "cwebdir/ctang-w2c.ch" +#line 508 "cwebdir/ctang-w2c.ch" { /*115:*/ -#line 541 "cwebdir/ctang-w2c.ch" +#line 539 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; int in_size; @@ -862,7 +860,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*:115*/ -#line 511 "cwebdir/ctang-w2c.ch" +#line 509 "cwebdir/ctang-w2c.ch" do{ in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); @@ -871,7 +869,7 @@ fprintf(stdout,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; /*111:*/ -#line 500 "cwebdir/ctang-w2c.ch" +#line 498 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -881,19 +879,19 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 518 "cwebdir/ctang-w2c.ch" +#line 516 "cwebdir/ctang-w2c.ch" } /*:112*/ -#line 485 "cwebdir/ctang-w2c.ch" +#line 483 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/stderr",output_file_name)) /*113:*/ -#line 523 "cwebdir/ctang-w2c.ch" +#line 521 "cwebdir/ctang-w2c.ch" { /*115:*/ -#line 541 "cwebdir/ctang-w2c.ch" +#line 539 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; int in_size; @@ -903,7 +901,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*:115*/ -#line 524 "cwebdir/ctang-w2c.ch" +#line 522 "cwebdir/ctang-w2c.ch" do{ in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); @@ -912,7 +910,7 @@ fprintf(stderr,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; /*111:*/ -#line 500 "cwebdir/ctang-w2c.ch" +#line 498 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -922,20 +920,20 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 531 "cwebdir/ctang-w2c.ch" +#line 529 "cwebdir/ctang-w2c.ch" } /*:113*/ -#line 487 "cwebdir/ctang-w2c.ch" +#line 485 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/null",output_file_name)) /*114:*/ -#line 536 "cwebdir/ctang-w2c.ch" +#line 534 "cwebdir/ctang-w2c.ch" { boolean comparison= true; /*111:*/ -#line 500 "cwebdir/ctang-w2c.ch" +#line 498 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -945,17 +943,17 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 538 "cwebdir/ctang-w2c.ch" +#line 536 "cwebdir/ctang-w2c.ch" } /*:114*/ -#line 489 "cwebdir/ctang-w2c.ch" +#line 487 "cwebdir/ctang-w2c.ch" else{ if((C_file= fopen(output_file_name,"r"))!=NULL){ /*107:*/ -#line 445 "cwebdir/ctang-w2c.ch" +#line 443 "cwebdir/ctang-w2c.ch" boolean comparison= false; @@ -964,7 +962,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*108:*/ -#line 459 "cwebdir/ctang-w2c.ch" +#line 457 "cwebdir/ctang-w2c.ch" do{ char x[BUFSIZ],y[BUFSIZ]; @@ -974,17 +972,17 @@ comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); /*:108*/ -#line 452 "cwebdir/ctang-w2c.ch" +#line 450 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; /*:107*/ -#line 492 "cwebdir/ctang-w2c.ch" +#line 490 "cwebdir/ctang-w2c.ch" /*111:*/ -#line 500 "cwebdir/ctang-w2c.ch" +#line 498 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -994,35 +992,35 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 493 "cwebdir/ctang-w2c.ch" +#line 491 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,output_file_name); } /*:110*/ -#line 164 "cwebdir/ctang-w2c.ch" +#line 162 "cwebdir/ctang-w2c.ch" } } if(check_for_change) strcpy(check_file_name,""); -#line 581 "cwebdir/ctangle.w" +#line 574 "cwebdir/ctangle.w" /*:50*/ -#line 549 "cwebdir/ctangle.w" +#line 543 "cwebdir/ctangle.w" if(show_happiness){ if(show_progress)new_line; #line 115 "cwebdir/ctang-w2c.ch" fputs(_("Done."),stdout); -#line 553 "cwebdir/ctangle.w" +#line 547 "cwebdir/ctangle.w" } } } /*:48*//*54:*/ -#line 600 "cwebdir/ctangle.w" +#line 595 "cwebdir/ctangle.w" static void output_defs(void) @@ -1032,13 +1030,12 @@ push_level(NULL); for(cur_text= text_info+1;cur_text<text_ptr;cur_text++) if(cur_text->text_link==macro){ cur_byte= cur_text->tok_start; -cur_end= (cur_text+1)->tok_start; C_printf("%s","#define "); out_state= normal; protect= true; -while(cur_byte<cur_end){ +while(cur_byte<macro_end){ a= *cur_byte++; -if(cur_byte==cur_end&&a=='\n')break; +if(cur_byte==macro_end&&a=='\n')break; if(out_state==verbatim&&a!=string&&a!=constant&&a!='\n') C_putc(a); @@ -1048,9 +1045,9 @@ a= (a-0200)*0400+*cur_byte++; if(a<024000){ cur_val= (int)a;out_char(identifier); } -#line 174 "cwebdir/ctang-w2c.ch" +#line 172 "cwebdir/ctang-w2c.ch" else if(a<050000)confusion(_("macro defs have strange char")); -#line 626 "cwebdir/ctangle.w" +#line 620 "cwebdir/ctangle.w" else{ cur_val= (int)a-050000;cur_section= (sixteen_bits)cur_val; out_char(section_number); @@ -1065,7 +1062,7 @@ pop_level(false); } /*:54*//*55:*/ -#line 644 "cwebdir/ctangle.w" +#line 638 "cwebdir/ctangle.w" static void out_char( @@ -1078,14 +1075,14 @@ 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 206 "cwebdir/ctang-w2c.ch" +#line 204 "cwebdir/ctang-w2c.ch" -#line 713 "cwebdir/ctangle.w" +#line 707 "cwebdir/ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); for(j= (cur_val+name_dir)->byte_start,k= (cur_val+name_dir+1)->byte_start; j<k;j++) -#line 214 "cwebdir/ctang-w2c.ch" +#line 212 "cwebdir/ctang-w2c.ch" if(ishigh(*j)){ if(transliterate_utf_eight){ @@ -1096,14 +1093,14 @@ else if((eight_bits)(*j)>=0300)j+= 1; C_printf("%s",translit[(eight_bits)(*j)-0200]); } else C_putc(*j); -#line 720 "cwebdir/ctangle.w" +#line 714 "cwebdir/ctangle.w" out_state= num_or_id;break; /*:59*/ -#line 655 "cwebdir/ctangle.w" +#line 649 "cwebdir/ctangle.w" /*60:*/ -#line 722 "cwebdir/ctangle.w" +#line 716 "cwebdir/ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -1130,10 +1127,10 @@ C_putc('"');C_putc('\n'); break; /*:60*/ -#line 656 "cwebdir/ctangle.w" +#line 650 "cwebdir/ctangle.w" /*56:*/ -#line 674 "cwebdir/ctangle.w" +#line 668 "cwebdir/ctangle.w" case plus_plus:C_putc('+');C_putc('+');out_state= normal;break; case minus_minus:C_putc('-');C_putc('-');out_state= normal;break; @@ -1154,7 +1151,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; break; /*:56*/ -#line 657 "cwebdir/ctangle.w" +#line 651 "cwebdir/ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -1173,7 +1170,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*64:*/ -#line 803 "cwebdir/ctangle.w" +#line 797 "cwebdir/ctangle.w" static eight_bits skip_ahead(void) @@ -1191,7 +1188,7 @@ if(c!=ignore||*(loc-1)=='>')return c; } /*:64*//*67:*/ -#line 842 "cwebdir/ctangle.w" +#line 836 "cwebdir/ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -1202,9 +1199,9 @@ if(loc> limit){ if(is_long_comment){ if(get_line())return comment_continues= true; else{ -#line 229 "cwebdir/ctang-w2c.ch" +#line 227 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in mid-comment")); -#line 853 "cwebdir/ctangle.w" +#line 847 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1217,9 +1214,9 @@ loc++;return comment_continues= false; } if(c=='@'){ if(ccode[(eight_bits)*loc]==new_section){ -#line 235 "cwebdir/ctang-w2c.ch" +#line 233 "cwebdir/ctang-w2c.ch" err_print(_("! Section name ended in mid-comment"));loc--; -#line 866 "cwebdir/ctangle.w" +#line 860 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1229,7 +1226,7 @@ else loc++; } /*:67*//*69:*/ -#line 883 "cwebdir/ctangle.w" +#line 877 "cwebdir/ctangle.w" static eight_bits get_next(void) @@ -1243,7 +1240,7 @@ if(get_line()==false)return new_section; else if(print_where&&!no_where){ print_where= false; /*85:*/ -#line 1229 "cwebdir/ctangle.w" +#line 1223 "cwebdir/ctangle.w" { eight_bits a; @@ -1260,7 +1257,7 @@ store_id(a); } /*:85*/ -#line 895 "cwebdir/ctangle.w" +#line 889 "cwebdir/ctangle.w" } else return(eight_bits)'\n'; @@ -1273,7 +1270,7 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 967 "cwebdir/ctangle.w" +#line 961 "cwebdir/ctangle.w" { boolean hex_flag= false; id_first= loc-1; @@ -1307,13 +1304,13 @@ return constant; } /*:73*/ -#line 906 "cwebdir/ctangle.w" +#line 900 "cwebdir/ctangle.w" else if(c=='\''||c=='"' ||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"')) ||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"'))) /*74:*/ -#line 1004 "cwebdir/ctangle.w" +#line 998 "cwebdir/ctangle.w" { char delim= (char)c; id_first= section_text+1; @@ -1325,15 +1322,15 @@ delim= *loc++;*++id_loc= delim; while(true){ if(loc>=limit){ if(*(limit-1)!='\\'){ -#line 241 "cwebdir/ctang-w2c.ch" +#line 239 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit;break; -#line 1016 "cwebdir/ctangle.w" +#line 1010 "cwebdir/ctangle.w" } if(get_line()==false){ -#line 247 "cwebdir/ctang-w2c.ch" +#line 245 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in middle of string"));loc= buffer;break; -#line 1020 "cwebdir/ctangle.w" +#line 1014 "cwebdir/ctangle.w" } else if(++id_loc<=section_text_end)*id_loc= '\n'; @@ -1351,9 +1348,9 @@ c= (eight_bits)*loc++; if(++id_loc<=section_text_end)*id_loc= (char)c; } if(id_loc>=section_text_end){ -#line 253 "cwebdir/ctang-w2c.ch" +#line 251 "cwebdir/ctang-w2c.ch" fputs(_("\n! String too long: "),stdout); -#line 1038 "cwebdir/ctangle.w" +#line 1032 "cwebdir/ctangle.w" term_write(section_text+1,25); err_print("..."); @@ -1363,11 +1360,11 @@ return string; } /*:74*/ -#line 910 "cwebdir/ctangle.w" +#line 904 "cwebdir/ctangle.w" else if(isalpha((int)c)||isxalpha(c)||ishigh(c)) /*72:*/ -#line 958 "cwebdir/ctangle.w" +#line 952 "cwebdir/ctangle.w" { id_first= --loc; do @@ -1378,45 +1375,45 @@ id_loc= loc;return identifier; } /*:72*/ -#line 912 "cwebdir/ctangle.w" +#line 906 "cwebdir/ctangle.w" else if(c=='@')/*75:*/ -#line 1049 "cwebdir/ctangle.w" +#line 1043 "cwebdir/ctangle.w" switch(c= ccode[(eight_bits)*loc++]){ case ignore:continue; -#line 259 "cwebdir/ctang-w2c.ch" +#line 257 "cwebdir/ctang-w2c.ch" case translit_code:err_print(_("! Use @l in limbo only"));continue; -#line 1053 "cwebdir/ctangle.w" +#line 1047 "cwebdir/ctangle.w" case control_text:while((c= skip_ahead())=='@'); if(*(loc-1)!='>') -#line 265 "cwebdir/ctang-w2c.ch" +#line 263 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1058 "cwebdir/ctangle.w" +#line 1052 "cwebdir/ctangle.w" continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1094 "cwebdir/ctangle.w" +#line 1088 "cwebdir/ctangle.w" { char*k= section_text; /*79:*/ -#line 1116 "cwebdir/ctangle.w" +#line 1110 "cwebdir/ctangle.w" while(true){ if(loc> limit&&get_line()==false){ -#line 283 "cwebdir/ctang-w2c.ch" +#line 281 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in section name")); -#line 1120 "cwebdir/ctangle.w" +#line 1114 "cwebdir/ctangle.w" loc= buffer+1;break; } c= (eight_bits)*loc; /*80:*/ -#line 1139 "cwebdir/ctangle.w" +#line 1133 "cwebdir/ctangle.w" if(c=='@'){ c= (eight_bits)*(loc+1); @@ -1424,22 +1421,22 @@ if(c=='>'){ loc+= 2;break; } if(ccode[(eight_bits)c]==new_section){ -#line 295 "cwebdir/ctang-w2c.ch" +#line 293 "cwebdir/ctang-w2c.ch" err_print(_("! Section name didn't end"));break; -#line 1147 "cwebdir/ctangle.w" +#line 1141 "cwebdir/ctangle.w" } if(ccode[(eight_bits)c]==section_name){ -#line 301 "cwebdir/ctang-w2c.ch" +#line 299 "cwebdir/ctang-w2c.ch" err_print(_("! Nesting of section names not allowed"));break; -#line 1151 "cwebdir/ctangle.w" +#line 1145 "cwebdir/ctangle.w" } *(++k)= '@';loc++; } /*:80*/ -#line 1124 "cwebdir/ctangle.w" +#line 1118 "cwebdir/ctangle.w" loc++;if(k<section_text_end)k++; if(xisspace(c)){ @@ -1448,9 +1445,9 @@ c= (eight_bits)' ';if(*(k-1)==' ')k--; *k= (char)c; } if(k>=section_text_end){ -#line 289 "cwebdir/ctang-w2c.ch" +#line 287 "cwebdir/ctang-w2c.ch" fputs(_("\n! Section name too long: "),stdout); -#line 1133 "cwebdir/ctangle.w" +#line 1127 "cwebdir/ctangle.w" term_write(section_text+1,25); printf("...");mark_harmless; @@ -1458,7 +1455,7 @@ printf("...");mark_harmless; if(*k==' '&&k> section_text)k--; /*:79*/ -#line 1096 "cwebdir/ctangle.w" +#line 1090 "cwebdir/ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) cur_section_name= section_lookup(section_text+1,k-3,true); @@ -1467,7 +1464,7 @@ else cur_section_name= section_lookup(section_text+1,k,false); if(cur_section_name_char=='(') /*47:*/ -#line 504 "cwebdir/ctangle.w" +#line 498 "cwebdir/ctangle.w" { for(an_output_file= cur_out_file; @@ -1478,36 +1475,36 @@ if(cur_out_file> output_files) *--cur_out_file= cur_section_name; #line 91 "cwebdir/ctang-w2c.ch" else overflow(_("output files")); -#line 513 "cwebdir/ctangle.w" +#line 507 "cwebdir/ctangle.w" } } /*:47*/ -#line 1104 "cwebdir/ctangle.w" +#line 1098 "cwebdir/ctangle.w" return section_name; } /*:77*/ -#line 1062 "cwebdir/ctangle.w" +#line 1056 "cwebdir/ctangle.w" case string:/*81:*/ -#line 1161 "cwebdir/ctangle.w" +#line 1155 "cwebdir/ctangle.w" id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; -#line 307 "cwebdir/ctang-w2c.ch" +#line 305 "cwebdir/ctang-w2c.ch" if(loc>=limit)err_print(_("! Verbatim string didn't end")); -#line 1165 "cwebdir/ctangle.w" +#line 1159 "cwebdir/ctangle.w" id_loc= loc;loc+= 2; return string; /*:81*/ -#line 1063 "cwebdir/ctangle.w" +#line 1057 "cwebdir/ctangle.w" case ord:/*76:*/ -#line 1074 "cwebdir/ctangle.w" +#line 1068 "cwebdir/ctangle.w" id_first= loc; if(*loc=='\\') @@ -1515,17 +1512,17 @@ if(*++loc=='\'')loc++; while(*loc!='\''){ if(*loc=='@'){ if(*(loc+1)!='@') -#line 271 "cwebdir/ctang-w2c.ch" +#line 269 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in ASCII constant")); -#line 1082 "cwebdir/ctangle.w" +#line 1076 "cwebdir/ctangle.w" else loc++; } loc++; if(loc> limit){ -#line 277 "cwebdir/ctang-w2c.ch" +#line 275 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit-1;break; -#line 1088 "cwebdir/ctangle.w" +#line 1082 "cwebdir/ctangle.w" } } @@ -1533,13 +1530,13 @@ loc++; return ord; /*:76*/ -#line 1064 "cwebdir/ctangle.w" +#line 1058 "cwebdir/ctangle.w" default:return c; } /*:75*/ -#line 913 "cwebdir/ctangle.w" +#line 907 "cwebdir/ctangle.w" else if(xisspace(c)){ if(!preprocessing||loc> limit)continue; @@ -1549,7 +1546,7 @@ else return(eight_bits)' '; } else if(c=='#'&&loc==buffer+1)preprocessing= true; mistake:/*71:*/ -#line 935 "cwebdir/ctangle.w" +#line 929 "cwebdir/ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; @@ -1574,14 +1571,14 @@ case'!':if(*loc=='=')compress(non_eq);break; } /*:71*/ -#line 921 "cwebdir/ctangle.w" +#line 915 "cwebdir/ctangle.w" return c; } } /*:69*//*83:*/ -#line 1197 "cwebdir/ctangle.w" +#line 1191 "cwebdir/ctangle.w" static void scan_repl( @@ -1589,7 +1586,7 @@ eight_bits t) { sixteen_bits a; if(t==section_name)/*85:*/ -#line 1229 "cwebdir/ctangle.w" +#line 1223 "cwebdir/ctangle.w" { eight_bits a; @@ -1606,11 +1603,11 @@ store_id(a); } /*:85*/ -#line 1203 "cwebdir/ctangle.w" +#line 1197 "cwebdir/ctangle.w" while(true)switch(a= get_next()){ /*86:*/ -#line 1244 "cwebdir/ctangle.w" +#line 1238 "cwebdir/ctangle.w" case identifier:store_id(a); if(*buffer=='#'&&( @@ -1623,28 +1620,28 @@ break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1285 "cwebdir/ctangle.w" +#line 1279 "cwebdir/ctangle.w" { char*try_loc= loc; while(*try_loc==' '&&try_loc<limit)try_loc++; if(*try_loc=='+'&&try_loc<limit)try_loc++; while(*try_loc==' '&&try_loc<limit)try_loc++; -#line 343 "cwebdir/ctang-w2c.ch" +#line 341 "cwebdir/ctang-w2c.ch" if(*try_loc=='=')err_print(_("! Missing `@ ' before a named section")); -#line 1291 "cwebdir/ctangle.w" +#line 1285 "cwebdir/ctangle.w" } /*:87*/ -#line 1255 "cwebdir/ctangle.w" +#line 1249 "cwebdir/ctangle.w" a= cur_section_name-name_dir; app_repl((a/0400)+0250); app_repl(a%0400); /*85:*/ -#line 1229 "cwebdir/ctangle.w" +#line 1223 "cwebdir/ctangle.w" { eight_bits a; @@ -1661,13 +1658,13 @@ store_id(a); } /*:85*/ -#line 1259 "cwebdir/ctangle.w" +#line 1253 "cwebdir/ctangle.w" } break; -#line 331 "cwebdir/ctang-w2c.ch" +#line 329 "cwebdir/ctang-w2c.ch" case output_defs_code:if(t!=section_name)err_print(_("! Misplaced @h")); -#line 1263 "cwebdir/ctangle.w" +#line 1257 "cwebdir/ctangle.w" else{ output_defs_seen= true; @@ -1675,7 +1672,7 @@ a= output_defs_flag; app_repl((a/0400)+0200); app_repl(a%0400); /*85:*/ -#line 1229 "cwebdir/ctangle.w" +#line 1223 "cwebdir/ctangle.w" { eight_bits a; @@ -1692,21 +1689,21 @@ store_id(a); } /*:85*/ -#line 1269 "cwebdir/ctangle.w" +#line 1263 "cwebdir/ctangle.w" } break; case constant:case string: /*88:*/ -#line 1302 "cwebdir/ctangle.w" +#line 1296 "cwebdir/ctangle.w" app_repl(a); while(id_first<id_loc){ if(*id_first=='@'){ if(*(id_first+1)=='@')id_first++; -#line 349 "cwebdir/ctang-w2c.ch" +#line 347 "cwebdir/ctang-w2c.ch" else err_print(_("! Double @ should be used in string")); -#line 1308 "cwebdir/ctangle.w" +#line 1302 "cwebdir/ctangle.w" } else if(a==constant&&*id_first=='\''&&!keep_digit_separators) @@ -1716,12 +1713,12 @@ app_repl(*id_first++); app_repl(a); /*:88*/ -#line 1273 "cwebdir/ctangle.w" +#line 1267 "cwebdir/ctangle.w" break; case ord: /*89:*/ -#line 1320 "cwebdir/ctangle.w" +#line 1314 "cwebdir/ctangle.w" { int c= (int)((eight_bits)*id_first); if(c=='\\'){ @@ -1758,9 +1755,9 @@ break; case'\\':c= '\\';break; case'\'':c= '\'';break; case'\"':c= '\"';break; -#line 355 "cwebdir/ctang-w2c.ch" +#line 353 "cwebdir/ctang-w2c.ch" default:err_print(_("! Unrecognized escape sequence")); -#line 1357 "cwebdir/ctangle.w" +#line 1351 "cwebdir/ctangle.w" } } @@ -1773,20 +1770,20 @@ app_repl(constant); } /*:89*/ -#line 1276 "cwebdir/ctangle.w" +#line 1270 "cwebdir/ctangle.w" break; case definition:case format_code:case begin_C:if(t!=section_name)goto done; else{ -#line 337 "cwebdir/ctang-w2c.ch" +#line 335 "cwebdir/ctang-w2c.ch" err_print(_("! @d, @f and @c are ignored in C text"));continue; -#line 1281 "cwebdir/ctangle.w" +#line 1275 "cwebdir/ctangle.w" } case new_section:goto done; /*:86*/ -#line 1208 "cwebdir/ctangle.w" +#line 1202 "cwebdir/ctangle.w" case')':app_repl(a); if(t==macro)app_repl(' '); @@ -1794,14 +1791,14 @@ break; default:app_repl(a); } done:next_control= (eight_bits)a; -#line 325 "cwebdir/ctang-w2c.ch" +#line 323 "cwebdir/ctang-w2c.ch" if(text_ptr> text_info_end)overflow(_("text")); -#line 1216 "cwebdir/ctangle.w" +#line 1210 "cwebdir/ctangle.w" cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1378 "cwebdir/ctangle.w" +#line 1372 "cwebdir/ctangle.w" static void scan_section(void) @@ -1816,7 +1813,7 @@ printf("*%d",(int)section_count);update_terminal; next_control= ignore; while(true){ /*92:*/ -#line 1419 "cwebdir/ctangle.w" +#line 1413 "cwebdir/ctangle.w" while(next_control<definition) @@ -1825,17 +1822,17 @@ loc-= 2;next_control= get_next(); } /*:92*/ -#line 1392 "cwebdir/ctangle.w" +#line 1386 "cwebdir/ctangle.w" if(next_control==definition){ /*93:*/ -#line 1426 "cwebdir/ctangle.w" +#line 1420 "cwebdir/ctangle.w" while((next_control= get_next())=='\n'); if(next_control!=identifier){ -#line 361 "cwebdir/ctang-w2c.ch" +#line 359 "cwebdir/ctang-w2c.ch" err_print(_("! Definition flushed, must start with identifier")); -#line 1430 "cwebdir/ctangle.w" +#line 1424 "cwebdir/ctangle.w" continue; } @@ -1847,7 +1844,7 @@ scan_repl(macro); cur_text->text_link= macro; /*:93*/ -#line 1394 "cwebdir/ctangle.w" +#line 1388 "cwebdir/ctangle.w" continue; } @@ -1857,14 +1854,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1448 "cwebdir/ctangle.w" +#line 1442 "cwebdir/ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1402 "cwebdir/ctangle.w" +#line 1396 "cwebdir/ctangle.w" break; } @@ -1872,20 +1869,20 @@ return; } no_where= print_where= false; /*95:*/ -#line 1453 "cwebdir/ctangle.w" +#line 1447 "cwebdir/ctangle.w" /*96:*/ -#line 1458 "cwebdir/ctangle.w" +#line 1452 "cwebdir/ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1454 "cwebdir/ctangle.w" +#line 1448 "cwebdir/ctangle.w" scan_repl(section_name); /*97:*/ -#line 1462 "cwebdir/ctangle.w" +#line 1456 "cwebdir/ctangle.w" if(p==name_dir||p==NULL){ last_unnamed->text_link= cur_text-text_info;last_unnamed= cur_text; @@ -1902,16 +1899,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1456 "cwebdir/ctangle.w" +#line 1450 "cwebdir/ctangle.w" /*:95*/ -#line 1408 "cwebdir/ctangle.w" +#line 1402 "cwebdir/ctangle.w" } /*:90*//*98:*/ -#line 1477 "cwebdir/ctangle.w" +#line 1471 "cwebdir/ctangle.w" static void phase_one(void){ @@ -1924,7 +1921,7 @@ check_complete(); } /*:98*//*100:*/ -#line 1493 "cwebdir/ctangle.w" +#line 1487 "cwebdir/ctangle.w" static void skip_limbo(void) @@ -1938,15 +1935,15 @@ char c= *loc++; switch(ccode[(eight_bits)c]){ case new_section:return; case translit_code:/*102:*/ -#line 1523 "cwebdir/ctangle.w" +#line 1517 "cwebdir/ctangle.w" while(xisspace(*loc)&&loc<limit)loc++; loc+= 3; if(loc> limit||!xisxdigit(*(loc-3))||!xisxdigit(*(loc-2)) ||(*(loc-3)>='0'&&*(loc-3)<='7')||!xisspace(*(loc-1))) -#line 381 "cwebdir/ctang-w2c.ch" +#line 379 "cwebdir/ctang-w2c.ch" err_print(_("! Improper hex number following @l")); -#line 1529 "cwebdir/ctangle.w" +#line 1523 "cwebdir/ctangle.w" else{ unsigned int i; @@ -1956,9 +1953,9 @@ while(xisspace(*loc)&&loc<limit)loc++; beg= loc; while(loc<limit&&(xisalpha(*loc)||xisdigit(*loc)||isxalpha(*loc)))loc++; if(loc-beg>=translit_length) -#line 387 "cwebdir/ctang-w2c.ch" +#line 385 "cwebdir/ctang-w2c.ch" err_print(_("! Replacement string in @l too long")); -#line 1539 "cwebdir/ctangle.w" +#line 1533 "cwebdir/ctangle.w" else{ strncpy(translit[i-0200],beg,(size_t)(loc-beg)); @@ -1967,21 +1964,21 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1505 "cwebdir/ctangle.w" +#line 1499 "cwebdir/ctangle.w" break; case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ while((c= (char)skip_ahead())=='@'); if(*(loc-1)!='>') -#line 367 "cwebdir/ctang-w2c.ch" +#line 365 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1511 "cwebdir/ctangle.w" +#line 1505 "cwebdir/ctangle.w" break; -#line 374 "cwebdir/ctang-w2c.ch" +#line 372 "cwebdir/ctang-w2c.ch" }/* otherwise fall through */ default:err_print(_("! Double @ should be used in limbo")); -#line 1515 "cwebdir/ctangle.w" +#line 1509 "cwebdir/ctangle.w" } } @@ -1989,11 +1986,11 @@ default:err_print(_("! Double @ should be used in limbo")); } /*:100*//*103:*/ -#line 1549 "cwebdir/ctangle.w" +#line 1543 "cwebdir/ctangle.w" void print_stats(void){ -#line 400 "cwebdir/ctang-w2c.ch" +#line 398 "cwebdir/ctang-w2c.ch" puts(_("\nMemory usage statistics:")); printf(_("%td names (out of %ld)\n"), (ptrdiff_t)(name_ptr-name_dir),(long)max_names); @@ -2002,9 +1999,9 @@ printf(_("%td replacement texts (out of %ld)\n"), printf(_("%td bytes (out of %ld)\n"), (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes); printf(_("%td tokens (out of %ld)\n"), -#line 1560 "cwebdir/ctangle.w" +#line 1554 "cwebdir/ctangle.w" (ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks); } -#line 413 "cwebdir/ctang-w2c.ch" +#line 411 "cwebdir/ctang-w2c.ch" /*:103*/ |