From d28619b4358aaa5c7ae210ce855df17e80b042a5 Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Sun, 2 May 2021 13:12:20 +0000 Subject: Revert "[CWEB] New release 4.3." This reverts commit 3ccac2a7d0f4a19dde861c6f4c178e853d90f0cc. CWEB 4.3 is seriously broken. git-svn-id: svn://tug.org/texlive/trunk@59048 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/ctangleboot.cin | 458 +++++++++++++++----------------- 1 file changed, 219 insertions(+), 239 deletions(-) (limited to 'Build/source/texk/web2c/ctangleboot.cin') diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index 04a63ad133a..4f5f78b7ee0 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -2,7 +2,7 @@ #line 66 "cwebdir/ctangle.w" /*4:*/ -#line 51 "cwebdir/comm-w2c.h" +#line 53 "cwebdir/comm-w2c.h" #ifndef HAVE_GETTEXT #define HAVE_GETTEXT 0 @@ -25,7 +25,7 @@ /*:4*/ #line 67 "cwebdir/ctangle.w" -#define banner "This is CTANGLE, Version 4.3" \ +#define banner "This is CTANGLE, Version 4.2" \ \ #define _(S) gettext(S) \ @@ -46,18 +46,12 @@ #define period_ast 026 #define minus_gt_ast 027 \ -#define compress(c) if(loc++<=limit) return c \ - -#define xisalpha(c) (isalpha((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisdigit(c) (isdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisspace(c) (isspace((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xislower(c) (islower((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisupper(c) (isupper((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisxdigit(c) (isxdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define isxalpha(c) ((c) =='_'||(c) =='$') \ - -#define ishigh(c) ((eight_bits) (c) > 0177) \ - \ +#define xisalpha(c) (isalpha((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisdigit(c) (isdigit((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) ) +#define xislower(c) (islower((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \ #define max_include_depth 10 \ @@ -88,12 +82,15 @@ #define show_progress flags['p'] #define show_stats flags['s'] #define show_happiness flags['h'] -#define make_xrefs flags['x'] -#define check_for_change flags['c'] \ +#define temporary_output flags['t'] +#define make_xrefs flags['x'] \ #define update_terminal fflush(stdout) #define new_line putchar('\n') -#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ +#define putxchar putchar +#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) +#define C_printf(c,a) fprintf(C_file,c,a) +#define C_putc(c) putc(c,C_file) \ #define max_bytes 1000000 \ @@ -109,11 +106,9 @@ #define equiv equiv_or_xref \ -#define macro 0 #define section_flag max_texts \ #define string 02 -#define constant 03 #define join 0177 #define output_defs_flag (2*024000-1) \ @@ -133,12 +128,9 @@ #define verbatim 4 \ #define max_files 256 -#define C_printf(c,a) fprintf(C_file,c,a) -#define C_putc(c) putc(c,C_file) \ - #define translit_length 10 \ -#define ignore 00 +#define ignore 0 #define ord 0302 #define control_text 0303 #define translit_code 0304 @@ -149,9 +141,17 @@ #define section_name 0311 #define new_section 0312 \ -#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow(_("token") ) ;*tok_ptr++= c;} \ +#define constant 03 \ -#define keep_digit_separators flags['k'] \ +#define isxalpha(c) ((c) =='_'||(c) =='$') \ + +#define ishigh(c) ((eight_bits) (c) > 0177) \ + \ + +#define compress(c) if(loc++<=limit) return c \ + +#define macro 0 +#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow(_("token") ) ;*tok_ptr++= c;} \ #define max_banner 50 \ @@ -159,7 +159,7 @@ #line 68 "cwebdir/ctangle.w" /*3:*/ -#line 33 "cwebdir/comm-w2c.h" +#line 35 "cwebdir/comm-w2c.h" typedef bool boolean; typedef uint8_t eight_bits; @@ -179,7 +179,7 @@ extern char*id_first; extern char*id_loc; /*:5*//*6:*/ -#line 109 "cwebdir/comm-w2c.h" +#line 105 "cwebdir/comm-w2c.h" extern char buffer[]; extern char*buffer_end; @@ -187,7 +187,7 @@ extern char*loc; extern char*limit; /*:6*//*7:*/ -#line 126 "cwebdir/comm-w2c.h" +#line 122 "cwebdir/comm-w2c.h" extern int include_depth; extern FILE*file[]; @@ -204,7 +204,7 @@ extern boolean changing; extern boolean web_file_open; /*:7*//*9:*/ -#line 147 "cwebdir/comm-w2c.h" +#line 143 "cwebdir/comm-w2c.h" extern sixteen_bits section_count; extern boolean changed_section[]; @@ -212,7 +212,7 @@ extern boolean change_pending; extern boolean print_where; /*:9*//*10:*/ -#line 161 "cwebdir/comm-w2c.h" +#line 157 "cwebdir/comm-w2c.h" typedef struct name_info{ char*byte_start; @@ -237,12 +237,12 @@ extern hash_pointer hash_end; extern hash_pointer h; /*:10*//*12:*/ -#line 205 "cwebdir/comm-w2c.h" +#line 201 "cwebdir/comm-w2c.h" extern int history; /*:12*//*14:*/ -#line 222 "cwebdir/comm-w2c.h" +#line 218 "cwebdir/comm-w2c.h" extern int argc; extern char**argv; @@ -254,7 +254,7 @@ extern boolean flags[]; extern const char*use_language; /*:14*//*15:*/ -#line 237 "cwebdir/comm-w2c.h" +#line 235 "cwebdir/comm-w2c.h" extern FILE*C_file; extern FILE*tex_file; @@ -281,7 +281,7 @@ sixteen_bits text_link; typedef text*text_pointer; /*:19*//*31:*/ -#line 273 "cwebdir/ctangle.w" +#line 269 "cwebdir/ctangle.w" typedef struct{ eight_bits*end_field; @@ -306,12 +306,12 @@ static eight_bits*tok_mem_end= tok_mem+max_toks-1; static eight_bits*tok_ptr; /*:20*//*26:*/ -#line 199 "cwebdir/ctangle.w" +#line 198 "cwebdir/ctangle.w" static text_pointer last_unnamed; /*:26*//*32:*/ -#line 289 "cwebdir/ctangle.w" +#line 285 "cwebdir/ctangle.w" static output_state cur_state; @@ -320,18 +320,18 @@ static stack_pointer stack_end= stack+stack_size; static stack_pointer stack_ptr; /*:32*//*37:*/ -#line 365 "cwebdir/ctangle.w" +#line 361 "cwebdir/ctangle.w" static int cur_val; /*:37*//*42:*/ -#line 456 "cwebdir/ctangle.w" +#line 452 "cwebdir/ctangle.w" static eight_bits out_state; static boolean protect; /*:42*//*45:*/ -#line 487 "cwebdir/ctangle.w" +#line 483 "cwebdir/ctangle.w" static name_pointer output_files[max_files]; static name_pointer*cur_out_file,*end_output_files,*an_output_file; @@ -339,33 +339,33 @@ static char cur_section_name_char; static char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 584 "cwebdir/ctangle.w" +#line 582 "cwebdir/ctangle.w" static boolean output_defs_seen= false; /*:52*//*57:*/ -#line 696 "cwebdir/ctangle.w" +#line 691 "cwebdir/ctangle.w" static char translit[128][translit_length]; /*:57*//*62:*/ -#line 775 "cwebdir/ctangle.w" +#line 770 "cwebdir/ctangle.w" static eight_bits ccode[256]; /*:62*//*66:*/ -#line 835 "cwebdir/ctangle.w" +#line 830 "cwebdir/ctangle.w" static boolean comment_continues= false; /*:66*//*68:*/ -#line 872 "cwebdir/ctangle.w" +#line 869 "cwebdir/ctangle.w" static name_pointer cur_section_name; static boolean no_where; /*:68*//*82:*/ -#line 1189 "cwebdir/ctangle.w" +#line 1182 "cwebdir/ctangle.w" static text_pointer cur_text; static eight_bits next_control; @@ -374,19 +374,19 @@ static eight_bits next_control; #line 71 "cwebdir/ctangle.w" /*8:*/ -#line 141 "cwebdir/comm-w2c.h" +#line 137 "cwebdir/comm-w2c.h" extern boolean get_line(void); extern void check_complete(void); extern void reset_input(void); /*:8*//*11:*/ -#line 184 "cwebdir/comm-w2c.h" +#line 180 "cwebdir/comm-w2c.h" extern boolean names_match(name_pointer,const char*,size_t,eight_bits); extern name_pointer id_lookup(const char*,const char*,char); -extern name_pointer section_lookup(char*,char*,boolean); +extern name_pointer section_lookup(char*,char*,int); extern void init_node(name_pointer); extern void init_p(name_pointer,eight_bits); extern void print_prefix_name(name_pointer); @@ -394,7 +394,7 @@ extern void print_section_name(name_pointer); extern void sprint_section_name(char*,name_pointer); /*:11*//*13:*/ -#line 208 "cwebdir/comm-w2c.h" +#line 204 "cwebdir/comm-w2c.h" extern int wrap_up(void); extern void err_print(const char*); @@ -402,64 +402,64 @@ extern void fatal(const char*,const char*); extern void overflow(const char*); /*:13*//*16:*/ -#line 246 "cwebdir/comm-w2c.h" +#line 244 "cwebdir/comm-w2c.h" extern void common_init(void); extern void print_stats(void); extern void cb_show_banner(void); /*:16*//*30:*/ -#line 245 "cwebdir/ctangle.w" +#line 241 "cwebdir/ctangle.w" static void store_two_bytes(sixteen_bits); /*:30*//*35:*/ -#line 328 "cwebdir/ctangle.w" +#line 324 "cwebdir/ctangle.w" static void push_level(name_pointer); static void pop_level(boolean); /*:35*//*39:*/ -#line 401 "cwebdir/ctangle.w" +#line 397 "cwebdir/ctangle.w" static void get_output(void); /*:39*//*44:*/ -#line 477 "cwebdir/ctangle.w" +#line 473 "cwebdir/ctangle.w" static void flush_buffer(void); /*:44*//*49:*/ -#line 551 "cwebdir/ctangle.w" +#line 549 "cwebdir/ctangle.w" static void phase_two(void); /*:49*//*53:*/ -#line 587 "cwebdir/ctangle.w" +#line 585 "cwebdir/ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*65:*/ -#line 815 "cwebdir/ctangle.w" +#line 810 "cwebdir/ctangle.w" static eight_bits skip_ahead(void); static boolean skip_comment(boolean); /*:65*//*70:*/ -#line 922 "cwebdir/ctangle.w" +#line 924 "cwebdir/ctangle.w" static eight_bits get_next(void); /*:70*//*84:*/ -#line 1215 "cwebdir/ctangle.w" +#line 1208 "cwebdir/ctangle.w" static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1396 "cwebdir/ctangle.w" +#line 1379 "cwebdir/ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1477 "cwebdir/ctangle.w" +#line 1460 "cwebdir/ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1511 "cwebdir/ctangle.w" +#line 1494 "cwebdir/ctangle.w" static void skip_limbo(void); /*:101*/ @@ -488,16 +488,16 @@ text_ptr= text_info+1;text_ptr->tok_start= tok_mem; init_node(name_dir); /*:23*//*27:*/ -#line 202 "cwebdir/ctangle.w" -last_unnamed= text_info;text_info->text_link= macro; +#line 201 "cwebdir/ctangle.w" +last_unnamed= text_info;text_info->text_link= 0; /*:27*//*46:*/ -#line 497 "cwebdir/ctangle.w" +#line 493 "cwebdir/ctangle.w" cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 699 "cwebdir/ctangle.w" +#line 694 "cwebdir/ctangle.w" { int i; @@ -505,7 +505,7 @@ for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i)); } /*:58*//*63:*/ -#line 778 "cwebdir/ctangle.w" +#line 773 "cwebdir/ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -525,7 +525,7 @@ ccode['\'']= ord; } /*:63*//*78:*/ -#line 1111 "cwebdir/ctangle.w" +#line 1103 "cwebdir/ctangle.w" section_text[0]= ' '; /*:78*//*116:*/ @@ -571,7 +571,7 @@ void init_p(name_pointer p,eight_bits t){(void)p;(void)t;} /*:25*//*29:*/ -#line 235 "cwebdir/ctangle.w" +#line 231 "cwebdir/ctangle.w" static void store_two_bytes( @@ -579,13 +579,13 @@ sixteen_bits x) { #line 65 "cwebdir/ctang-w2c.ch" if(tok_ptr+2> tok_mem_end)overflow(_("token")); -#line 241 "cwebdir/ctangle.w" +#line 237 "cwebdir/ctangle.w" *tok_ptr++= x>>8; *tok_ptr++= x&0377; } /*:29*//*34:*/ -#line 313 "cwebdir/ctangle.w" +#line 309 "cwebdir/ctangle.w" static void push_level( @@ -593,7 +593,7 @@ name_pointer p) { #line 71 "cwebdir/ctang-w2c.ch" if(stack_ptr==stack_end)overflow(_("stack")); -#line 319 "cwebdir/ctangle.w" +#line 315 "cwebdir/ctangle.w" *stack_ptr= cur_state; stack_ptr++; if(p!=NULL){ @@ -604,7 +604,7 @@ cur_section= 0; } /*:34*//*36:*/ -#line 336 "cwebdir/ctangle.w" +#line 332 "cwebdir/ctangle.w" static void pop_level( @@ -620,7 +620,7 @@ if(stack_ptr> stack)cur_state= *stack_ptr; } /*:36*//*38:*/ -#line 372 "cwebdir/ctangle.w" +#line 368 "cwebdir/ctangle.w" static void get_output(void) @@ -643,7 +643,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 "cwebdir/ctangle.w" +#line 402 "cwebdir/ctangle.w" { a-= 024000; @@ -651,7 +651,7 @@ if((a+name_dir)->equiv!=(void*)text_info)push_level(a+name_dir); else if(a!=0){ #line 77 "cwebdir/ctang-w2c.ch" fputs(_("\n! Not present: <"),stdout); -#line 412 "cwebdir/ctangle.w" +#line 408 "cwebdir/ctangle.w" print_section_name(a+name_dir);err_print(">"); } @@ -659,7 +659,7 @@ goto restart; } /*:40*/ -#line 393 "cwebdir/ctangle.w" +#line 389 "cwebdir/ctangle.w" break; default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val; @@ -669,14 +669,14 @@ out_char(section_number); } /*:38*//*43:*/ -#line 464 "cwebdir/ctangle.w" +#line 460 "cwebdir/ctangle.w" static void flush_buffer(void) { C_putc('\n'); if(cur_line%100==0&&show_progress){ -putchar('.'); +printf("."); if(cur_line%500==0)printf("%d",cur_line); update_terminal; } @@ -684,34 +684,34 @@ cur_line++; } /*:43*//*48:*/ -#line 516 "cwebdir/ctangle.w" +#line 514 "cwebdir/ctangle.w" static void phase_two(void){ web_file_open= false; cur_line= 1; /*33:*/ -#line 302 "cwebdir/ctangle.w" +#line 298 "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; /*:33*/ -#line 521 "cwebdir/ctangle.w" +#line 519 "cwebdir/ctangle.w" /*51:*/ -#line 580 "cwebdir/ctangle.w" +#line 578 "cwebdir/ctangle.w" if(!output_defs_seen) output_defs(); /*:51*/ -#line 522 "cwebdir/ctangle.w" +#line 520 "cwebdir/ctangle.w" -if(text_info->text_link==macro&&cur_out_file==end_output_files){ +if(text_info->text_link==0&&cur_out_file==end_output_files){ #line 89 "cwebdir/ctang-w2c.ch" fputs(_("\n! No program text was specified."),stdout);mark_harmless; -#line 525 "cwebdir/ctangle.w" +#line 523 "cwebdir/ctangle.w" } else{ @@ -719,18 +719,18 @@ if(cur_out_file==end_output_files){ if(show_progress) #line 95 "cwebdir/ctang-w2c.ch" printf(_("\nWriting the output file (%s):"),C_file_name); -#line 531 "cwebdir/ctangle.w" +#line 529 "cwebdir/ctangle.w" } else{ if(show_progress){ #line 101 "cwebdir/ctang-w2c.ch" fputs(_("\nWriting the output files:"),stdout); -#line 535 "cwebdir/ctangle.w" +#line 533 "cwebdir/ctangle.w" printf(" (%s)",C_file_name); update_terminal; } -if(text_info->text_link==macro)goto writeloop; +if(text_info->text_link==0)goto writeloop; } while(stack_ptr> stack)get_output(); flush_buffer(); @@ -752,7 +752,7 @@ if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); -if(check_for_change)/*107:*/ +if(temporary_output)/*107:*/ #line 378 "cwebdir/ctang-w2c.ch" do{ @@ -927,7 +927,7 @@ if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); -if(check_for_change)/*107:*/ +if(temporary_output)/*107:*/ #line 378 "cwebdir/ctang-w2c.ch" do{ @@ -969,22 +969,22 @@ rename(check_file_name,output_file_name); } strcpy(check_file_name,""); -#line 575 "cwebdir/ctangle.w" +#line 573 "cwebdir/ctangle.w" /*:50*/ -#line 543 "cwebdir/ctangle.w" +#line 541 "cwebdir/ctangle.w" if(show_happiness){ if(show_progress)new_line; #line 107 "cwebdir/ctang-w2c.ch" fputs(_("Done."),stdout); -#line 547 "cwebdir/ctangle.w" +#line 545 "cwebdir/ctangle.w" } } } /*:48*//*54:*/ -#line 594 "cwebdir/ctangle.w" +#line 589 "cwebdir/ctangle.w" static void output_defs(void) @@ -992,7 +992,7 @@ output_defs(void) sixteen_bits a; push_level(NULL); for(cur_text= text_info+1;cur_texttext_link==macro){ +if(cur_text->text_link==0){ cur_byte= cur_text->tok_start; cur_end= (cur_text+1)->tok_start; C_printf("%s","#define "); @@ -1011,8 +1011,8 @@ if(a<024000){ cur_val= a;out_char(identifier); } #line 159 "cwebdir/ctang-w2c.ch" -else if(a<050000)confusion(_("macro defs have strange char")); -#line 620 "cwebdir/ctangle.w" +else if(a<050000){confusion(_("macro defs have strange char"));} +#line 615 "cwebdir/ctangle.w" else{ cur_val= a-050000;cur_section= cur_val;out_char(section_number); } @@ -1026,7 +1026,7 @@ pop_level(false); } /*:54*//*55:*/ -#line 637 "cwebdir/ctangle.w" +#line 632 "cwebdir/ctangle.w" static void out_char( @@ -1039,7 +1039,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 705 "cwebdir/ctangle.w" +#line 700 "cwebdir/ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); @@ -1054,10 +1054,10 @@ j++; out_state= num_or_id;break; /*:59*/ -#line 648 "cwebdir/ctangle.w" +#line 643 "cwebdir/ctangle.w" /*60:*/ -#line 718 "cwebdir/ctangle.w" +#line 713 "cwebdir/ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -1079,15 +1079,15 @@ j');C_putc('*');out_state= normal; break; /*:56*/ -#line 650 "cwebdir/ctangle.w" +#line 645 "cwebdir/ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -1127,7 +1127,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*64:*/ -#line 799 "cwebdir/ctangle.w" +#line 794 "cwebdir/ctangle.w" static eight_bits skip_ahead(void) @@ -1145,7 +1145,7 @@ if(c!=ignore||*(loc-1)=='>')return c; } /*:64*//*67:*/ -#line 838 "cwebdir/ctangle.w" +#line 833 "cwebdir/ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -1158,7 +1158,7 @@ if(get_line())return comment_continues= true; else{ #line 165 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in mid-comment")); -#line 849 "cwebdir/ctangle.w" +#line 844 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1173,7 +1173,7 @@ if(c=='@'){ if(ccode[(eight_bits)*loc]==new_section){ #line 171 "cwebdir/ctang-w2c.ch" err_print(_("! Section name ended in mid-comment"));loc--; -#line 862 "cwebdir/ctangle.w" +#line 857 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1183,23 +1183,22 @@ else loc++; } /*:67*//*69:*/ -#line 879 "cwebdir/ctangle.w" +#line 881 "cwebdir/ctangle.w" static eight_bits get_next(void) { -static boolean preprocessing= false; +static int preprocessing= 0; eight_bits c; while(true){ if(loc> limit){ -if(preprocessing&&*(limit-1)!='\\')preprocessing= false; +if(preprocessing&&*(limit-1)!='\\')preprocessing= 0; if(get_line()==false)return new_section; else if(print_where&&!no_where){ print_where= false; /*85:*/ -#line 1221 "cwebdir/ctangle.w" +#line 1214 "cwebdir/ctangle.w" -{ store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1211,10 +1210,9 @@ store_two_bytes((sixteen_bits)cur_line); id_loc= id_first+strlen(id_first); {int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200); app_repl(a_l%0400);} -} /*:85*/ -#line 891 "cwebdir/ctangle.w" +#line 893 "cwebdir/ctangle.w" } else return'\n'; @@ -1228,32 +1226,23 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 963 "cwebdir/ctangle.w" +#line 964 "cwebdir/ctangle.w" { -boolean hex_flag= false; id_first= loc-1; if(*id_first=='.'&&!xisdigit(*loc))goto mistake; if(*id_first=='0'){ if(*loc=='x'||*loc=='X'){ -hex_flag= true; -loc++;while(xisxdigit(*loc)||*loc=='\'')loc++; -} -else if(*loc=='b'||*loc=='B'){ -loc++;while(*loc=='0'||*loc=='1'||*loc=='\'')loc++;goto found; +loc++;while(xisxdigit(*loc))loc++;goto found; } } -while(xisdigit(*loc)||*loc=='\'')loc++; +while(xisdigit(*loc))loc++; if(*loc=='.'){ loc++; -while((hex_flag&&xisxdigit(*loc))||xisdigit(*loc)||*loc=='\'')loc++; +while(xisdigit(*loc))loc++; } if(*loc=='e'||*loc=='E'){ if(*++loc=='+'||*loc=='-')loc++; -while(xisdigit(*loc)||*loc=='\'')loc++; -} -else if(hex_flag&&(*loc=='p'||*loc=='P')){ -if(*++loc=='+'||*loc=='-')loc++; -while(xisxdigit(*loc)||*loc=='\'')loc++; +while(xisdigit(*loc))loc++; } found:while(*loc=='u'||*loc=='U'||*loc=='l'||*loc=='L' ||*loc=='f'||*loc=='F')loc++; @@ -1262,19 +1251,19 @@ return constant; } /*:73*/ -#line 903 "cwebdir/ctangle.w" +#line 905 "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 1000 "cwebdir/ctangle.w" +#line 992 "cwebdir/ctangle.w" { char delim= c; id_first= section_text+1; id_loc= section_text;*++id_loc= delim; if(delim=='L'||delim=='u'||delim=='U'){ -if(delim=='u'&&*loc=='8')*++id_loc= *loc++; +if(delim=='u'&&*loc=='8'){*++id_loc= *loc++;} delim= *loc++;*++id_loc= delim; } while(true){ @@ -1282,13 +1271,13 @@ if(loc>=limit){ if(*(limit-1)!='\\'){ #line 177 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit;break; -#line 1012 "cwebdir/ctangle.w" +#line 1004 "cwebdir/ctangle.w" } if(get_line()==false){ #line 183 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in middle of string"));loc= buffer;break; -#line 1016 "cwebdir/ctangle.w" +#line 1008 "cwebdir/ctangle.w" } else if(++id_loc<=section_text_end)*id_loc= '\n'; @@ -1308,7 +1297,7 @@ if(++id_loc<=section_text_end)*id_loc= c; if(id_loc>=section_text_end){ #line 189 "cwebdir/ctang-w2c.ch" fputs(_("\n! String too long: "),stdout); -#line 1034 "cwebdir/ctangle.w" +#line 1026 "cwebdir/ctangle.w" term_write(section_text+1,25); err_print("..."); @@ -1318,61 +1307,60 @@ return string; } /*:74*/ -#line 907 "cwebdir/ctangle.w" +#line 909 "cwebdir/ctangle.w" else if(isalpha(c)||isxalpha(c)||ishigh(c)) /*72:*/ -#line 954 "cwebdir/ctangle.w" +#line 957 "cwebdir/ctangle.w" { id_first= --loc; -do{ -++loc; -}while(isalpha((eight_bits)*loc)||isdigit((eight_bits)*loc) +while(isalpha((eight_bits)*++loc)||isdigit((eight_bits)*loc) ||isxalpha((eight_bits)*loc)||ishigh((eight_bits)*loc)); id_loc= loc;return identifier; } /*:72*/ -#line 909 "cwebdir/ctangle.w" +#line 911 "cwebdir/ctangle.w" else if(c=='@')/*75:*/ -#line 1045 "cwebdir/ctangle.w" +#line 1037 "cwebdir/ctangle.w" { -switch(c= ccode[(eight_bits)*loc++]){ +c= ccode[(eight_bits)*loc++]; +switch(c){ case ignore:continue; #line 195 "cwebdir/ctang-w2c.ch" case translit_code:err_print(_("! Use @l in limbo only"));continue; -#line 1049 "cwebdir/ctangle.w" +#line 1042 "cwebdir/ctangle.w" case control_text:while((c= skip_ahead())=='@'); if(*(loc-1)!='>') #line 201 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1054 "cwebdir/ctangle.w" +#line 1047 "cwebdir/ctangle.w" continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1091 "cwebdir/ctangle.w" +#line 1085 "cwebdir/ctangle.w" { char*k; /*79:*/ -#line 1113 "cwebdir/ctangle.w" +#line 1105 "cwebdir/ctangle.w" k= section_text; while(true){ if(loc> limit&&get_line()==false){ #line 219 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in section name")); -#line 1118 "cwebdir/ctangle.w" +#line 1110 "cwebdir/ctangle.w" loc= buffer+1;break; } c= *loc; /*80:*/ -#line 1137 "cwebdir/ctangle.w" +#line 1129 "cwebdir/ctangle.w" if(c=='@'){ c= *(loc+1); @@ -1382,20 +1370,20 @@ loc+= 2;break; if(ccode[(eight_bits)c]==new_section){ #line 231 "cwebdir/ctang-w2c.ch" err_print(_("! Section name didn't end"));break; -#line 1145 "cwebdir/ctangle.w" +#line 1137 "cwebdir/ctangle.w" } if(ccode[(eight_bits)c]==section_name){ #line 237 "cwebdir/ctang-w2c.ch" err_print(_("! Nesting of section names not allowed"));break; -#line 1149 "cwebdir/ctangle.w" +#line 1141 "cwebdir/ctangle.w" } *(++k)= '@';loc++; } /*:80*/ -#line 1122 "cwebdir/ctangle.w" +#line 1114 "cwebdir/ctangle.w" loc++;if(k=section_text_end){ #line 225 "cwebdir/ctang-w2c.ch" fputs(_("\n! Section name too long: "),stdout); -#line 1131 "cwebdir/ctangle.w" +#line 1123 "cwebdir/ctangle.w" term_write(section_text+1,25); printf("...");mark_harmless; @@ -1414,16 +1402,14 @@ printf("...");mark_harmless; if(*k==' '&&k> section_text)k--; /*:79*/ -#line 1093 "cwebdir/ctangle.w" +#line 1087 "cwebdir/ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) -cur_section_name= section_lookup(section_text+1,k-3,true); - -else cur_section_name= section_lookup(section_text+1,k,false); - +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 501 "cwebdir/ctangle.w" +#line 497 "cwebdir/ctangle.w" { for(an_output_file= cur_out_file; @@ -1432,49 +1418,52 @@ if(*an_output_file==cur_section_name)break; if(an_output_file==end_output_files){ if(cur_out_file> output_files) *--cur_out_file= cur_section_name; +else{ #line 83 "cwebdir/ctang-w2c.ch" -else overflow(_("output files")); -#line 510 "cwebdir/ctangle.w" +overflow(_("output files")); +#line 507 "cwebdir/ctangle.w" +} } } /*:47*/ -#line 1101 "cwebdir/ctangle.w" +#line 1093 "cwebdir/ctangle.w" return section_name; } /*:77*/ -#line 1058 "cwebdir/ctangle.w" +#line 1051 "cwebdir/ctangle.w" case string:/*81:*/ -#line 1159 "cwebdir/ctangle.w" +#line 1151 "cwebdir/ctangle.w" { id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; #line 243 "cwebdir/ctang-w2c.ch" if(loc>=limit)err_print(_("! Verbatim string didn't end")); -#line 1163 "cwebdir/ctangle.w" +#line 1155 "cwebdir/ctangle.w" id_loc= loc;loc+= 2; return string; } /*:81*/ -#line 1059 "cwebdir/ctangle.w" +#line 1052 "cwebdir/ctangle.w" case ord:/*76:*/ -#line 1071 "cwebdir/ctangle.w" +#line 1064 "cwebdir/ctangle.w" id_first= loc; -if(*loc=='\\') +if(*loc=='\\'){ if(*++loc=='\'')loc++; +} while(*loc!='\''){ if(*loc=='@'){ if(*(loc+1)!='@') #line 207 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in ASCII constant")); -#line 1079 "cwebdir/ctangle.w" +#line 1073 "cwebdir/ctangle.w" else loc++; } @@ -1482,7 +1471,7 @@ loc++; if(loc> limit){ #line 213 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit-1;break; -#line 1085 "cwebdir/ctangle.w" +#line 1079 "cwebdir/ctangle.w" } } @@ -1490,35 +1479,34 @@ loc++; return ord; /*:76*/ -#line 1060 "cwebdir/ctangle.w" +#line 1053 "cwebdir/ctangle.w" default:return c; } } /*:75*/ -#line 910 "cwebdir/ctangle.w" +#line 912 "cwebdir/ctangle.w" else if(xisspace(c)){ if(!preprocessing||loc> limit)continue; else return' '; } -else if(c=='#'&&loc==buffer+1)preprocessing= true; +else if(c=='#'&&loc==buffer+1)preprocessing= 1; mistake:/*71:*/ -#line 931 "cwebdir/ctangle.w" +#line 935 "cwebdir/ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; case'-':if(*loc=='-'){compress(minus_minus);} -else if(*loc=='>'){ -if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);} -else compress(minus_gt); -}break; +else{if(*loc=='>'){if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);} +else compress(minus_gt);}}break; case'.':if(*loc=='*'){compress(period_ast);} else if(*loc=='.'&&*(loc+1)=='.'){ loc++;compress(dot_dot_dot); -}break; +} +break; case':':if(*loc==':')compress(colon_colon);break; case'=':if(*loc=='=')compress(eq_eq);break; case'>':if(*loc=='='){compress(gt_eq);} @@ -1531,24 +1519,23 @@ case'!':if(*loc=='=')compress(non_eq);break; } /*:71*/ -#line 917 "cwebdir/ctangle.w" +#line 919 "cwebdir/ctangle.w" return c; } } /*:69*//*83:*/ -#line 1193 "cwebdir/ctangle.w" +#line 1186 "cwebdir/ctangle.w" static void scan_repl( eight_bits t) { sixteen_bits a; -if(t==section_name)/*85:*/ -#line 1221 "cwebdir/ctangle.w" +if(t==section_name){/*85:*/ +#line 1214 "cwebdir/ctangle.w" -{ store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1560,14 +1547,13 @@ store_two_bytes((sixteen_bits)cur_line); id_loc= id_first+strlen(id_first); {int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200); app_repl(a_l%0400);} -} /*:85*/ -#line 1199 "cwebdir/ctangle.w" - +#line 1192 "cwebdir/ctangle.w" +} while(true)switch(a= get_next()){ /*86:*/ -#line 1236 "cwebdir/ctangle.w" +#line 1227 "cwebdir/ctangle.w" case identifier:a= id_lookup(id_first,id_loc,0)-name_dir; app_repl((a/0400)+0200); @@ -1575,7 +1561,7 @@ app_repl(a%0400);break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1269 "cwebdir/ctangle.w" +#line 1260 "cwebdir/ctangle.w" { char*try_loc= loc; while(*try_loc==' '&&try_loc text_info_end)overflow(_("text")); -#line 1212 "cwebdir/ctangle.w" +#line 1205 "cwebdir/ctangle.w" cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1363 "cwebdir/ctangle.w" +#line 1346 "cwebdir/ctangle.w" static void scan_section(void) @@ -1763,10 +1743,10 @@ section_count++;no_where= true; if(*(loc-1)=='*'&&show_progress){ printf("*%d",section_count);update_terminal; } -next_control= ignore; +next_control= 0; while(true){ /*92:*/ -#line 1404 "cwebdir/ctangle.w" +#line 1387 "cwebdir/ctangle.w" while(next_controltext_link= macro; } /*:93*/ -#line 1379 "cwebdir/ctangle.w" +#line 1362 "cwebdir/ctangle.w" continue; } @@ -1810,14 +1790,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1436 "cwebdir/ctangle.w" +#line 1419 "cwebdir/ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1387 "cwebdir/ctangle.w" +#line 1370 "cwebdir/ctangle.w" break; } @@ -1825,22 +1805,22 @@ return; } no_where= print_where= false; /*95:*/ -#line 1441 "cwebdir/ctangle.w" +#line 1424 "cwebdir/ctangle.w" /*96:*/ -#line 1446 "cwebdir/ctangle.w" +#line 1429 "cwebdir/ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1442 "cwebdir/ctangle.w" +#line 1425 "cwebdir/ctangle.w" scan_repl(section_name); /*97:*/ -#line 1450 "cwebdir/ctangle.w" +#line 1433 "cwebdir/ctangle.w" -if(p==name_dir||p==NULL){ +if(p==name_dir||p==0){ (last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text; } else if(p->equiv==(void*)text_info)p->equiv= (void*)cur_text; @@ -1855,16 +1835,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1444 "cwebdir/ctangle.w" +#line 1427 "cwebdir/ctangle.w" /*:95*/ -#line 1393 "cwebdir/ctangle.w" +#line 1376 "cwebdir/ctangle.w" } /*:90*//*98:*/ -#line 1465 "cwebdir/ctangle.w" +#line 1448 "cwebdir/ctangle.w" static void phase_one(void){ @@ -1878,7 +1858,7 @@ phase= 2; } /*:98*//*100:*/ -#line 1482 "cwebdir/ctangle.w" +#line 1465 "cwebdir/ctangle.w" static void skip_limbo(void) @@ -1893,7 +1873,7 @@ c= *loc++; if(ccode[(eight_bits)c]==new_section)break; switch(ccode[(eight_bits)c]){ case translit_code:/*102:*/ -#line 1513 "cwebdir/ctangle.w" +#line 1496 "cwebdir/ctangle.w" while(xisspace(*loc)&&loc limit||!xisxdigit(*(loc-3))||!xisxdigit(*(loc-2)) ||(*(loc-3)>='0'&&*(loc-3)<='7')||!xisspace(*(loc-1))) #line 309 "cwebdir/ctang-w2c.ch" err_print(_("! Improper hex number following @l")); -#line 1519 "cwebdir/ctangle.w" +#line 1502 "cwebdir/ctangle.w" else{ unsigned int i; @@ -1913,7 +1893,7 @@ while(loc=translit_length) #line 315 "cwebdir/ctang-w2c.ch" err_print(_("! Replacement string in @l too long")); -#line 1529 "cwebdir/ctangle.w" +#line 1512 "cwebdir/ctangle.w" else{ strncpy(translit[i-0200],beg,(size_t)(loc-beg)); @@ -1922,7 +1902,7 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1495 "cwebdir/ctangle.w" +#line 1478 "cwebdir/ctangle.w" break; case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ @@ -1930,13 +1910,13 @@ while((c= skip_ahead())=='@'); if(*(loc-1)!='>') #line 297 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1501 "cwebdir/ctangle.w" +#line 1484 "cwebdir/ctangle.w" break; } #line 303 "cwebdir/ctang-w2c.ch" default:err_print(_("! Double @ should be used in limbo")); -#line 1505 "cwebdir/ctangle.w" +#line 1488 "cwebdir/ctangle.w" } } @@ -1944,7 +1924,7 @@ default:err_print(_("! Double @ should be used in limbo")); } /*:100*//*103:*/ -#line 1539 "cwebdir/ctangle.w" +#line 1522 "cwebdir/ctangle.w" void print_stats(void){ @@ -1957,7 +1937,7 @@ printf(_("%ld replacement texts (out of %ld)\n"), printf(_("%ld bytes (out of %ld)\n"), (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes); printf(_("%ld tokens (out of %ld)\n"), -#line 1550 "cwebdir/ctangle.w" +#line 1533 "cwebdir/ctangle.w" (ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks); } -- cgit v1.2.3