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/cwebboot.cin | 539 ++++++++++++++++++----------------- 1 file changed, 273 insertions(+), 266 deletions(-) (limited to 'Build/source/texk/web2c/cwebboot.cin') diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin index 8e957a576a7..150c303a346 100644 --- a/Build/source/texk/web2c/cwebboot.cin +++ b/Build/source/texk/web2c/cwebboot.cin @@ -1,8 +1,8 @@ /*1:*/ -#line 62 "cwebdir/common.w" +#line 66 "cwebdir/common.w" /*3:*/ -#line 51 "cwebdir/comm-w2c.h" +#line 53 "cwebdir/comm-w2c.h" #ifndef HAVE_GETTEXT #define HAVE_GETTEXT 0 @@ -23,7 +23,7 @@ #include /*:3*//*89:*/ -#line 712 "cwebdir/comm-w2c.ch" +#line 709 "cwebdir/comm-w2c.ch" #if HAVE_GETTEXT #include @@ -34,7 +34,7 @@ #endif /*:89*//*91:*/ -#line 759 "cwebdir/comm-w2c.ch" +#line 756 "cwebdir/comm-w2c.ch" typedef bool boolean; #define HAVE_BOOLEAN @@ -44,13 +44,13 @@ typedef bool boolean; #include /*:91*//*94:*/ -#line 798 "cwebdir/comm-w2c.ch" +#line 795 "cwebdir/comm-w2c.ch" #define CWEB #include "help.h" /*:94*/ -#line 63 "cwebdir/common.w" +#line 67 "cwebdir/common.w" #define _(S) gettext(S) \ @@ -70,18 +70,12 @@ typedef bool boolean; #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 \ @@ -112,12 +106,15 @@ typedef bool boolean; #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 \ @@ -134,8 +131,7 @@ typedef bool boolean; #define lines_dont_match (change_limit-change_buffer!=limit-buffer|| \ strncmp(buffer,change_buffer,(size_t) (limit-buffer) ) ) \ -#define if_section_start_make_pending(b) { \ -*limit= '!'; \ +#define if_section_start_make_pending(b) {*limit= '!'; \ for(loc= buffer;xisspace(*loc) ;loc++) ; \ *limit= ' '; \ if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b; \ @@ -175,10 +171,10 @@ err_print(_("! Include file name too long") ) ;goto restart;} \ #define kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true) \ -#line 64 "cwebdir/common.w" +#line 68 "cwebdir/common.w" /*2:*/ -#line 33 "cwebdir/comm-w2c.h" +#line 35 "cwebdir/comm-w2c.h" typedef bool boolean; typedef uint8_t eight_bits; @@ -198,7 +194,7 @@ extern char*id_first; extern char*id_loc; /*:4*//*5:*/ -#line 109 "cwebdir/comm-w2c.h" +#line 105 "cwebdir/comm-w2c.h" extern char buffer[]; extern char*buffer_end; @@ -206,7 +202,7 @@ extern char*loc; extern char*limit; /*:5*//*6:*/ -#line 126 "cwebdir/comm-w2c.h" +#line 122 "cwebdir/comm-w2c.h" extern int include_depth; extern FILE*file[]; @@ -223,7 +219,7 @@ extern boolean changing; extern boolean web_file_open; /*:6*//*8:*/ -#line 147 "cwebdir/comm-w2c.h" +#line 143 "cwebdir/comm-w2c.h" extern sixteen_bits section_count; extern boolean changed_section[]; @@ -231,7 +227,7 @@ extern boolean change_pending; extern boolean print_where; /*:8*//*9:*/ -#line 161 "cwebdir/comm-w2c.h" +#line 157 "cwebdir/comm-w2c.h" typedef struct name_info{ char*byte_start; @@ -256,12 +252,12 @@ extern hash_pointer hash_end; extern hash_pointer h; /*:9*//*11:*/ -#line 205 "cwebdir/comm-w2c.h" +#line 201 "cwebdir/comm-w2c.h" extern int history; /*:11*//*13:*/ -#line 222 "cwebdir/comm-w2c.h" +#line 218 "cwebdir/comm-w2c.h" extern int argc; extern char**argv; @@ -273,7 +269,7 @@ extern boolean flags[]; extern const char*use_language; /*:13*//*14:*/ -#line 237 "cwebdir/comm-w2c.h" +#line 235 "cwebdir/comm-w2c.h" extern FILE*C_file; extern FILE*tex_file; @@ -283,22 +279,22 @@ extern FILE*active_file; extern FILE*check_file; /*:14*/ -#line 65 "cwebdir/common.w" +#line 69 "cwebdir/common.w" /*18:*/ -#line 79 "cwebdir/common.w" +#line 83 "cwebdir/common.w" #line 72 "cwebdir/comm-w2c.ch" cweb program; -#line 81 "cwebdir/common.w" +#line 85 "cwebdir/common.w" /*:18*//*19:*/ -#line 88 "cwebdir/common.w" +#line 92 "cwebdir/common.w" int phase; /*:19*//*21:*/ -#line 126 "cwebdir/common.w" +#line 130 "cwebdir/common.w" char section_text[longest_name+1]; char*section_text_end= section_text+longest_name; @@ -306,7 +302,7 @@ char*id_first; char*id_loc; /*:21*//*22:*/ -#line 146 "cwebdir/common.w" +#line 150 "cwebdir/common.w" char buffer[long_buf_size]; char*buffer_end= buffer+buf_size-2; @@ -314,7 +310,7 @@ char*loc= buffer; char*limit= buffer; /*:22*//*25:*/ -#line 190 "cwebdir/common.w" +#line 194 "cwebdir/common.w" int include_depth; FILE*file[max_include_depth]; @@ -322,7 +318,7 @@ FILE*change_file; char file_name[max_include_depth][max_file_name_length]; char change_file_name[max_file_name_length]; -#line 198 "cwebdir/common.w" +#line 202 "cwebdir/common.w" int line[max_include_depth]; int change_line; int change_depth; @@ -331,13 +327,13 @@ boolean changing; boolean web_file_open= false; /*:25*//*26:*/ -#line 216 "cwebdir/common.w" +#line 220 "cwebdir/common.w" static char change_buffer[buf_size]; static char*change_limit; /*:26*//*37:*/ -#line 396 "cwebdir/common.w" +#line 399 "cwebdir/common.w" sixteen_bits section_count; boolean changed_section[max_sections]; @@ -346,7 +342,7 @@ boolean change_pending; boolean print_where= false; /*:37*//*43:*/ -#line 593 "cwebdir/common.w" +#line 596 "cwebdir/common.w" char byte_mem[max_bytes]; char*byte_mem_end= byte_mem+max_bytes-1; @@ -354,60 +350,60 @@ name_info name_dir[max_names]; name_pointer name_dir_end= name_dir+max_names-1; /*:43*//*44:*/ -#line 604 "cwebdir/common.w" +#line 607 "cwebdir/common.w" char*byte_ptr; name_pointer name_ptr; /*:44*//*46:*/ -#line 624 "cwebdir/common.w" +#line 627 "cwebdir/common.w" name_pointer hash[hash_size]; hash_pointer hash_end= hash+hash_size-1; hash_pointer h; /*:46*//*65:*/ -#line 1006 "cwebdir/common.w" +#line 1014 "cwebdir/common.w" int history= spotless; /*:65*//*73:*/ -#line 1129 "cwebdir/common.w" +#line 1135 "cwebdir/common.w" int argc; char**argv; char C_file_name[max_file_name_length]; char tex_file_name[max_file_name_length]; char idx_file_name[max_file_name_length]; -#line 441 "cwebdir/comm-w2c.ch" +#line 431 "cwebdir/comm-w2c.ch" char scn_file_name[max_file_name_length]; char check_file_name[max_file_name_length]; -#line 1136 "cwebdir/common.w" +#line 1142 "cwebdir/common.w" boolean flags[128]; /*:73*//*83:*/ -#line 1273 "cwebdir/common.w" +#line 1282 "cwebdir/common.w" FILE*C_file; FILE*tex_file; FILE*idx_file; -#line 572 "cwebdir/comm-w2c.ch" +#line 569 "cwebdir/comm-w2c.ch" FILE*scn_file; FILE*check_file; -#line 579 "cwebdir/comm-w2c.ch" +#line 576 "cwebdir/comm-w2c.ch" FILE*active_file; char*found_filename; -#line 1279 "cwebdir/common.w" +#line 1288 "cwebdir/common.w" -#line 596 "cwebdir/comm-w2c.ch" +#line 593 "cwebdir/comm-w2c.ch" /*:83*//*86:*/ -#line 641 "cwebdir/comm-w2c.ch" +#line 638 "cwebdir/comm-w2c.ch" const char*use_language= ""; /*:86*//*87:*/ -#line 654 "cwebdir/comm-w2c.ch" +#line 651 "cwebdir/comm-w2c.ch" char cb_banner[max_banner]; string texmf_locale; @@ -417,22 +413,22 @@ string texmf_locale; char separators[]= SEPARATORS; /*:87*/ -#line 66 "cwebdir/common.w" +#line 70 "cwebdir/common.w" /*7:*/ -#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); /*:7*//*10:*/ -#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); @@ -440,7 +436,7 @@ extern void print_section_name(name_pointer); extern void sprint_section_name(char*,name_pointer); /*:10*//*12:*/ -#line 208 "cwebdir/comm-w2c.h" +#line 204 "cwebdir/comm-w2c.h" extern int wrap_up(void); extern void err_print(const char*); @@ -448,59 +444,59 @@ extern void fatal(const char*,const char*); extern void overflow(const char*); /*:12*//*15:*/ -#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); /*:15*//*24:*/ -#line 176 "cwebdir/common.w" +#line 180 "cwebdir/common.w" static boolean input_ln(FILE*); /*:24*//*28:*/ -#line 237 "cwebdir/common.w" +#line 241 "cwebdir/common.w" static void prime_the_change_buffer(void); /*:28*//*33:*/ -#line 337 "cwebdir/common.w" +#line 340 "cwebdir/common.w" static void check_change(void); /*:33*//*55:*/ -#line 767 "cwebdir/common.w" +#line 774 "cwebdir/common.w" static int web_strcmp(char*,int,char*,int); -static name_pointer add_section_name(name_pointer,int,char*,char*,boolean); -static void extend_section_name(name_pointer,char*,char*,boolean); +static name_pointer add_section_name(name_pointer,int,char*,char*,int); +static void extend_section_name(name_pointer,char*,char*,int); /*:55*//*64:*/ -#line 994 "cwebdir/common.w" +#line 1002 "cwebdir/common.w" static int section_name_cmp(char**,int,name_pointer); /*:64*//*76:*/ -#line 1190 "cwebdir/common.w" +#line 1197 "cwebdir/common.w" static void scan_args(void); -#line 502 "cwebdir/comm-w2c.ch" +#line 496 "cwebdir/comm-w2c.ch" /*:76*//*96:*/ -#line 811 "cwebdir/comm-w2c.ch" +#line 808 "cwebdir/comm-w2c.ch" static void cb_usage(const_string str); static void cb_usagehelp(const_string*message,const_string bug_email); /*:96*/ -#line 67 "cwebdir/common.w" +#line 71 "cwebdir/common.w" /*:1*//*20:*/ -#line 95 "cwebdir/common.w" +#line 99 "cwebdir/common.w" void common_init(void) { #line 78 "cwebdir/comm-w2c.ch" /*45:*/ -#line 608 "cwebdir/common.w" +#line 611 "cwebdir/common.w" name_dir->byte_start= byte_ptr= byte_mem; name_ptr= name_dir+1; @@ -508,7 +504,7 @@ name_ptr->byte_start= byte_mem; root= NULL; /*:45*//*47:*/ -#line 631 "cwebdir/common.w" +#line 634 "cwebdir/common.w" for(h= hash;h<=hash_end;*h++= NULL); @@ -516,7 +512,7 @@ for(h= hash;h<=hash_end;*h++= NULL); #line 78 "cwebdir/comm-w2c.ch" /*92:*/ -#line 773 "cwebdir/comm-w2c.ch" +#line 770 "cwebdir/comm-w2c.ch" kpse_set_program_name(argv[0],"cweb"); @@ -525,7 +521,7 @@ kpse_set_program_name(argv[0],"cweb"); #line 85 "cwebdir/comm-w2c.ch" /*90:*/ -#line 721 "cwebdir/comm-w2c.ch" +#line 718 "cwebdir/comm-w2c.ch" setlocale(LC_MESSAGES,setlocale(LC_CTYPE,"")); texmf_locale= kpse_var_expand("${TEXMFLOCALEDIR}"); @@ -544,20 +540,20 @@ textdomain("cweb"); #line 85 "cwebdir/comm-w2c.ch" /*74:*/ -#line 1142 "cwebdir/common.w" +#line 1148 "cwebdir/common.w" -#line 448 "cwebdir/comm-w2c.ch" +#line 438 "cwebdir/comm-w2c.ch" make_xrefs= true; -check_for_change= true; -#line 1144 "cwebdir/common.w" +temporary_output= true; +#line 1150 "cwebdir/common.w" show_stats= false; /*:74*/ #line 86 "cwebdir/comm-w2c.ch" -#line 101 "cwebdir/common.w" +#line 105 "cwebdir/common.w" /*84:*/ -#line 596 "cwebdir/comm-w2c.ch" +#line 593 "cwebdir/comm-w2c.ch" scan_args(); if(program==ctangle){ @@ -588,16 +584,16 @@ else strcpy(dot_pos,".wtp"); if((tex_file= fopen(check_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),check_file_name); } -#line 1291 "cwebdir/common.w" +#line 1300 "cwebdir/common.w" -#line 631 "cwebdir/comm-w2c.ch" +#line 628 "cwebdir/comm-w2c.ch" /*:84*/ -#line 101 "cwebdir/common.w" +#line 105 "cwebdir/common.w" } /*:20*//*23:*/ -#line 156 "cwebdir/common.w" +#line 160 "cwebdir/common.w" static boolean input_ln( FILE*fp) @@ -609,12 +605,12 @@ limit= k= buffer; while(k<=buffer_end&&(c= getc(fp))!=EOF&&c!='\n') #line 92 "cwebdir/comm-w2c.ch" if((*(k++)= c)!=' '&&c!='\r')limit= k; -#line 166 "cwebdir/common.w" +#line 170 "cwebdir/common.w" if(k> buffer_end) if((c= getc(fp))!=EOF&&c!='\n'){ #line 98 "cwebdir/comm-w2c.ch" ungetc(c,fp);loc= buffer;err_print(_("! Input line too long")); -#line 169 "cwebdir/common.w" +#line 173 "cwebdir/common.w" } if(c==EOF&&limit==buffer)return false; @@ -623,14 +619,14 @@ return true; } /*:23*//*27:*/ -#line 227 "cwebdir/common.w" +#line 231 "cwebdir/common.w" static void prime_the_change_buffer(void) { change_limit= change_buffer; /*29:*/ -#line 243 "cwebdir/common.w" +#line 247 "cwebdir/common.w" while(true){ change_line++; @@ -643,33 +639,33 @@ if(buffer[1]=='y'||buffer[1]=='z'||buffer[1]=='i'){ loc= buffer+2; #line 109 "cwebdir/comm-w2c.ch" err_print(_("! Missing @x in change file")); -#line 254 "cwebdir/common.w" +#line 258 "cwebdir/common.w" } } /*:29*/ -#line 232 "cwebdir/common.w" +#line 236 "cwebdir/common.w" /*30:*/ -#line 260 "cwebdir/common.w" +#line 264 "cwebdir/common.w" do{ change_line++; if(!input_ln(change_file)){ #line 115 "cwebdir/comm-w2c.ch" err_print(_("! Change file ended after @x")); -#line 265 "cwebdir/common.w" +#line 269 "cwebdir/common.w" return; } }while(limit==buffer); /*:30*/ -#line 233 "cwebdir/common.w" +#line 237 "cwebdir/common.w" /*31:*/ -#line 270 "cwebdir/common.w" +#line 274 "cwebdir/common.w" { change_limit= change_buffer+(ptrdiff_t)(limit-buffer); @@ -677,12 +673,12 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:31*/ -#line 234 "cwebdir/common.w" +#line 238 "cwebdir/common.w" } /*:27*//*32:*/ -#line 299 "cwebdir/common.w" +#line 302 "cwebdir/common.w" static void check_change(void) @@ -695,11 +691,11 @@ if_section_start_make_pending(true); if(!change_pending)changed_section[section_count]= true; } while(true){ -changing= print_where= true;change_line++; +changing= true;print_where= true;change_line++; if(!input_ln(change_file)){ #line 121 "cwebdir/comm-w2c.ch" err_print(_("! Change file ended before @y")); -#line 314 "cwebdir/common.w" +#line 317 "cwebdir/common.w" change_limit= change_buffer;changing= false; return; @@ -707,12 +703,12 @@ return; if(limit> buffer+1&&buffer[0]=='@'){ char xyz_code= xisupper(buffer[1])?tolower((eight_bits)buffer[1]):buffer[1]; /*34:*/ -#line 339 "cwebdir/common.w" +#line 342 "cwebdir/common.w" if(xyz_code=='x'||xyz_code=='z'){ #line 133 "cwebdir/comm-w2c.ch" loc= buffer+2;err_print(_("! Where is the matching @y?")); -#line 342 "cwebdir/common.w" +#line 345 "cwebdir/common.w" } else if(xyz_code=='y'){ @@ -721,7 +717,7 @@ loc= buffer+2; printf("\n! Hmm... %d ",n); #line 139 "cwebdir/comm-w2c.ch" err_print(_("of the preceding lines failed to match")); -#line 349 "cwebdir/common.w" +#line 352 "cwebdir/common.w" } change_depth= include_depth; @@ -729,11 +725,11 @@ return; } /*:34*/ -#line 321 "cwebdir/common.w" +#line 324 "cwebdir/common.w" } /*31:*/ -#line 270 "cwebdir/common.w" +#line 274 "cwebdir/common.w" { change_limit= change_buffer+(ptrdiff_t)(limit-buffer); @@ -741,14 +737,14 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:31*/ -#line 323 "cwebdir/common.w" +#line 326 "cwebdir/common.w" changing= false;cur_line++; while(!input_ln(cur_file)){ if(include_depth==0){ #line 127 "cwebdir/comm-w2c.ch" err_print(_("! CWEB file ended during a change")); -#line 328 "cwebdir/common.w" +#line 331 "cwebdir/common.w" input_has_ended= true;return; } @@ -759,67 +755,67 @@ if(lines_dont_match)n++; } /*:32*//*35:*/ -#line 359 "cwebdir/common.w" +#line 362 "cwebdir/common.w" void reset_input(void) { limit= buffer;loc= buffer+1;buffer[0]= ' '; /*36:*/ -#line 374 "cwebdir/common.w" +#line 377 "cwebdir/common.w" #line 149 "cwebdir/comm-w2c.ch" -if((found_filename= kpse_find_cweb(web_file_name))==NULL -||(web_file= fopen(found_filename,"r"))==NULL) +if((found_filename= kpse_find_cweb(web_file_name))==NULL|| +(web_file= fopen(found_filename,"r"))==NULL){ fatal(_("! Cannot open input file "),web_file_name); -else if(strlen(found_filename) change_depth){ /*40:*/ -#line 494 "cwebdir/common.w" +#line 497 "cwebdir/common.w" { cur_line++; while(!input_ln(cur_file)){ @@ -871,7 +867,7 @@ if(change_limit> change_buffer)check_change(); } /*:40*/ -#line 410 "cwebdir/common.w" +#line 413 "cwebdir/common.w" if(changing&&include_depth==change_depth)goto restart; } @@ -883,25 +879,25 @@ while(*loc==' '||*loc=='\t')loc++; if(loc>=limit){ #line 180 "cwebdir/comm-w2c.ch" err_print(_("! Include file name not given")); -#line 420 "cwebdir/common.w" +#line 423 "cwebdir/common.w" goto restart; } if(include_depth>=max_include_depth-1){ #line 186 "cwebdir/comm-w2c.ch" err_print(_("! Too many nested includes")); -#line 425 "cwebdir/common.w" +#line 428 "cwebdir/common.w" goto restart; } include_depth++; /*39:*/ -#line 448 "cwebdir/common.w" +#line 451 "cwebdir/common.w" { #line 223 "cwebdir/comm-w2c.ch" char*cur_file_name_end= cur_file_name+max_file_name_length-1; char*k= cur_file_name; -#line 453 "cwebdir/common.w" +#line 456 "cwebdir/common.w" if(*loc=='"'){ loc++; @@ -913,8 +909,8 @@ if(k> cur_file_name_end)too_long(); *k= '\0'; #line 230 "cwebdir/comm-w2c.ch" -if((found_filename= kpse_find_cweb(cur_file_name))!=NULL -&&(cur_file= fopen(found_filename,"r"))!=NULL){ +if((found_filename= kpse_find_cweb(cur_file_name))!=NULL&& +(cur_file= fopen(found_filename,"r"))!=NULL){ if(strlen(found_filename)link; @@ -991,28 +987,28 @@ p->link= hash[h];hash[h]= p; } /*:50*/ -#line 650 "cwebdir/common.w" +#line 653 "cwebdir/common.w" if(p==name_ptr)/*51:*/ -#line 679 "cwebdir/common.w" +#line 681 "cwebdir/common.w" { #line 293 "cwebdir/comm-w2c.ch" if(byte_ptr+l> byte_mem_end)overflow(_("byte memory")); if(name_ptr>=name_dir_end)overflow(_("name")); -#line 682 "cwebdir/common.w" +#line 684 "cwebdir/common.w" strncpy(byte_ptr,first,l); (++name_ptr)->byte_start= byte_ptr+= l; init_p(p,t); } /*:51*/ -#line 651 "cwebdir/common.w" +#line 654 "cwebdir/common.w" return p; } /*:48*//*52:*/ -#line 711 "cwebdir/common.w" +#line 713 "cwebdir/common.w" void print_section_name( @@ -1022,16 +1018,18 @@ char*ss,*s= first_chunk(p); name_pointer q= p+1; while(p!=name_dir){ ss= (p+1)->byte_start-1; -if(*ss==' '&&ss>=s)p= q->link,q= p; -else ss++,p= name_dir,q= NULL; -term_write(s,(size_t)(ss-s)); +if(*ss==' '&&ss>=s){ +term_write(s,(size_t)(ss-s));p= q->link;q= p; +}else{ +term_write(s,(size_t)(ss+1-s));p= name_dir;q= NULL; +} s= p->byte_start; } if(q)term_write("...",3); } /*:52*//*53:*/ -#line 728 "cwebdir/common.w" +#line 732 "cwebdir/common.w" void sprint_section_name( @@ -1042,8 +1040,11 @@ char*ss,*s= first_chunk(p); name_pointer q= p+1; while(p!=name_dir){ ss= (p+1)->byte_start-1; -if(*ss==' '&&ss>=s)p= q->link,q= p; -else ss++,p= name_dir; +if(*ss==' '&&ss>=s){ +p= q->link;q= p; +}else{ +ss++;p= name_dir; +} strncpy(dest,s,(size_t)(ss-s)),dest+= ss-s; s= p->byte_start; } @@ -1051,7 +1052,7 @@ s= p->byte_start; } /*:53*//*54:*/ -#line 746 "cwebdir/common.w" +#line 753 "cwebdir/common.w" void print_prefix_name( @@ -1064,7 +1065,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); } /*:54*//*56:*/ -#line 772 "cwebdir/common.w" +#line 779 "cwebdir/common.w" static int web_strcmp( char*j, @@ -1082,7 +1083,7 @@ else return greater; } /*:56*//*57:*/ -#line 801 "cwebdir/common.w" +#line 808 "cwebdir/common.w" static name_pointer add_section_name( @@ -1090,7 +1091,7 @@ name_pointer par, int c, char*first, char*last, -boolean ispref) +int ispref) { name_pointer p= name_ptr; char*s= first_chunk(p); @@ -1098,7 +1099,7 @@ int name_len= (int)(last-first)+ispref; #line 301 "cwebdir/comm-w2c.ch" if(s+name_len> byte_mem_end)overflow(_("byte memory")); if(name_ptr+1>=name_dir_end)overflow(_("name")); -#line 815 "cwebdir/common.w" +#line 822 "cwebdir/common.w" (++name_ptr)->byte_start= byte_ptr= s+name_len; if(ispref){ *(byte_ptr-1)= ' '; @@ -1108,48 +1109,49 @@ name_ptr->link= name_dir; } set_prefix_length(p,name_len); strncpy(s,first,name_len); -p->llink= p->rlink= NULL; +p->llink= NULL; +p->rlink= NULL; init_node(p); return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); } /*:57*//*58:*/ -#line 829 "cwebdir/common.w" +#line 837 "cwebdir/common.w" static void extend_section_name( name_pointer p, char*first, char*last, -boolean ispref) +int ispref) { char*s; name_pointer q= p+1; int name_len= (int)(last-first)+ispref; #line 308 "cwebdir/comm-w2c.ch" if(name_ptr>=name_dir_end)overflow(_("name")); -#line 841 "cwebdir/common.w" +#line 849 "cwebdir/common.w" while(q->link!=name_dir)q= q->link; q->link= name_ptr; s= name_ptr->byte_start; name_ptr->link= name_dir; #line 314 "cwebdir/comm-w2c.ch" if(s+name_len> byte_mem_end)overflow(_("byte memory")); -#line 846 "cwebdir/common.w" +#line 854 "cwebdir/common.w" (++name_ptr)->byte_start= byte_ptr= s+name_len; strncpy(s,first,name_len); if(ispref)*(byte_ptr-1)= ' '; } /*:58*//*59:*/ -#line 857 "cwebdir/common.w" +#line 865 "cwebdir/common.w" name_pointer section_lookup( char*first,char*last, -boolean ispref) +int ispref) { -int c= less; +int c= 0; name_pointer p= root; name_pointer q= NULL; name_pointer r= NULL; @@ -1157,7 +1159,7 @@ name_pointer par= NULL; int name_len= (int)(last-first)+1; /*60:*/ -#line 881 "cwebdir/common.w" +#line 889 "cwebdir/common.w" while(p){ c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); @@ -1169,12 +1171,12 @@ p= (c==less?p->llink:p->rlink); if(r!=NULL){ #line 320 "cwebdir/comm-w2c.ch" fputs(_("\n! Ambiguous prefix: matches <"),stdout); -#line 891 "cwebdir/common.w" +#line 899 "cwebdir/common.w" print_prefix_name(p); #line 326 "cwebdir/comm-w2c.ch" fputs(_(">\n and <"),stdout); -#line 894 "cwebdir/common.w" +#line 902 "cwebdir/common.w" print_prefix_name(r); err_print(">"); return name_dir; @@ -1188,19 +1190,19 @@ p= q,q= NULL; } /*:60*/ -#line 871 "cwebdir/common.w" +#line 879 "cwebdir/common.w" /*61:*/ -#line 906 "cwebdir/common.w" +#line 914 "cwebdir/common.w" if(r==NULL) return add_section_name(par,c,first,last+1,ispref); /*:61*/ -#line 872 "cwebdir/common.w" +#line 880 "cwebdir/common.w" /*62:*/ -#line 914 "cwebdir/common.w" +#line 922 "cwebdir/common.w" switch(section_name_cmp(&first,name_len,r)){ @@ -1208,46 +1210,46 @@ case prefix: if(!ispref){ #line 332 "cwebdir/comm-w2c.ch" fputs(_("\n! New name is a prefix of <"),stdout); -#line 920 "cwebdir/common.w" +#line 928 "cwebdir/common.w" print_section_name(r); err_print(">"); } else if(name_len"); -break; +return r; default: #line 344 "cwebdir/comm-w2c.ch" fputs(_("\n! Section name incompatible with <"),stdout); -#line 938 "cwebdir/common.w" +#line 946 "cwebdir/common.w" print_prefix_name(r); #line 350 "cwebdir/comm-w2c.ch" fputs(_(">,\n which abbreviates <"),stdout); -#line 941 "cwebdir/common.w" +#line 949 "cwebdir/common.w" print_section_name(r); err_print(">"); -} return r; +} /*:62*/ -#line 873 "cwebdir/common.w" +#line 881 "cwebdir/common.w" } /*:59*//*63:*/ -#line 962 "cwebdir/common.w" +#line 970 "cwebdir/common.w" static int section_name_cmp( char**pfirst, @@ -1257,12 +1259,12 @@ name_pointer r) char*first= *pfirst; name_pointer q= r+1; char*ss,*s= first_chunk(r); -int c= less; -boolean ispref; +int c; +int ispref; while(true){ ss= (r+1)->byte_start-1; -if(*ss==' '&&ss>=r->byte_start)ispref= true,q= q->link; -else ispref= false,ss++,q= name_dir; +if(*ss==' '&&ss>=r->byte_start)ispref= 1,q= q->link; +else ispref= 0,ss++,q= name_dir; switch(c= web_strcmp(first,len,s,ss-s)){ case equal:if(q==name_dir) if(ispref){ @@ -1281,7 +1283,7 @@ default:return c; } /*:63*//*66:*/ -#line 1016 "cwebdir/common.w" +#line 1024 "cwebdir/common.w" void err_print( @@ -1290,20 +1292,20 @@ const char*s) char*k,*l; printf(*s=='!'?"\n%s":"%s",s); if(web_file_open)/*67:*/ -#line 1036 "cwebdir/common.w" +#line 1044 "cwebdir/common.w" {if(changing&&include_depth==change_depth) #line 358 "cwebdir/comm-w2c.ch" printf(_(". (l. %d of change file)\n"),change_line); else if(include_depth==0)printf(_(". (l. %d)\n"),cur_line); else printf(_(". (l. %d of include file %s)\n"),cur_line,cur_file_name); -#line 1041 "cwebdir/common.w" +#line 1049 "cwebdir/common.w" l= (loc>=limit?limit:loc); if(l> buffer){ for(k= buffer;k 0){ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ -#line 1251 "cwebdir/common.w" +#line 510 "cwebdir/comm-w2c.ch" -#line 515 "cwebdir/comm-w2c.ch" { if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0) /*95:*/ -#line 802 "cwebdir/comm-w2c.ch" +#line 799 "cwebdir/comm-w2c.ch" cb_usagehelp(program==ctangle?CTANGLEHELP: program==cweave?CWEAVEHELP:CTWILLHELP,NULL); /*:95*/ -#line 518 "cwebdir/comm-w2c.ch" +#line 514 "cwebdir/comm-w2c.ch" if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0) /*98:*/ -#line 850 "cwebdir/comm-w2c.ch" +#line 846 "cwebdir/comm-w2c.ch" printversionandexit(cb_banner, program==ctwill?"Donald E. Knuth":"Silvio Levy and Donald E. Knuth", @@ -1441,68 +1444,72 @@ NULL,"Contemporary development on https://github.com/ascherer/cweb.\n"); /*:98*/ -#line 521 "cwebdir/comm-w2c.ch" +#line 517 "cwebdir/comm-w2c.ch" if(strcmp("-verbose",*argv)==0||strcmp("--verbose",*argv)==0) -strcpy(*argv,"-v"); +{show_banner= show_progress= show_happiness= 1;continue;} if(strcmp("-quiet",*argv)==0||strcmp("--quiet",*argv)==0) -strcpy(*argv,"-q"); -for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++){ -switch(*dot_pos){ -case'v':show_banner= show_progress= show_happiness= true;continue; -case'q':show_banner= show_progress= show_happiness= false;continue; -case'd': +{show_banner= show_progress= show_happiness= 0;continue;} +for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) +if(*dot_pos=='v'){ +show_banner= show_progress= show_happiness= true; +}else +if(*dot_pos=='q'){ +show_banner= show_progress= show_happiness= false; +}else +if(*dot_pos=='d'){ if(sscanf(++dot_pos,"%u",&kpathsea_debug)!=1)/*81:*/ -#line 558 "cwebdir/comm-w2c.ch" +#line 555 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1266 "cwebdir/common.w" +#line 1275 "cwebdir/common.w" -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" /*:81*/ -#line 533 "cwebdir/comm-w2c.ch" +#line 532 "cwebdir/comm-w2c.ch" while(isdigit(*dot_pos))dot_pos++; dot_pos--; -continue; -case'l':use_language= ++dot_pos;break; -default:flags[(eight_bits)*dot_pos]= flag_change;continue; -} +}else +if(*dot_pos=='l'){ +use_language= ++dot_pos; break; +}else +#line 1261 "cwebdir/common.w" + flags[(eight_bits)*dot_pos]= flag_change; } -} -#line 1254 "cwebdir/common.w" -#line 558 "cwebdir/comm-w2c.ch" +#line 555 "cwebdir/comm-w2c.ch" /*:80*/ -#line 1173 "cwebdir/common.w" +#line 1179 "cwebdir/common.w" else{ s= name_pos= *argv;dot_pos= NULL; -#line 489 "cwebdir/comm-w2c.ch" -while(*s) +#line 482 "cwebdir/comm-w2c.ch" +while(*s){ if(*s=='.')dot_pos= s++; else if(*s==DIR_SEPARATOR||*s==DEVICE_SEPARATOR||*s=='/') dot_pos= NULL,name_pos= ++s; else s++; +} -#line 1180 "cwebdir/common.w" +#line 1187 "cwebdir/common.w" if(!found_web)/*77:*/ -#line 1199 "cwebdir/common.w" +#line 1206 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1268 "cwebdir/common.w" +#line 1277 "cwebdir/common.w" /*:82*/ -#line 1202 "cwebdir/common.w" +#line 1209 "cwebdir/common.w" if(dot_pos==NULL) sprintf(web_file_name,"%s.w",*argv); @@ -1510,7 +1517,7 @@ else{ strcpy(web_file_name,*argv); *dot_pos= 0; } -#line 1210 "cwebdir/common.w" +#line 1217 "cwebdir/common.w" sprintf(tex_file_name,"%s.tex",name_pos); sprintf(idx_file_name,"%s.idx",name_pos); sprintf(scn_file_name,"%s.scn",name_pos); @@ -1519,22 +1526,22 @@ found_web= true; } /*:77*/ -#line 1181 "cwebdir/common.w" +#line 1188 "cwebdir/common.w" else if(!found_change)/*78:*/ -#line 1217 "cwebdir/common.w" +#line 1224 "cwebdir/common.w" { if(strcmp(*argv,"-")!=0){ if(s-*argv> max_file_name_length-4) /*82:*/ -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1268 "cwebdir/common.w" +#line 1277 "cwebdir/common.w" /*:82*/ -#line 1221 "cwebdir/common.w" +#line 1228 "cwebdir/common.w" if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); @@ -1544,21 +1551,21 @@ found_change= true; } /*:78*/ -#line 1182 "cwebdir/common.w" +#line 1189 "cwebdir/common.w" else if(!found_out)/*79:*/ -#line 1229 "cwebdir/common.w" +#line 1236 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1268 "cwebdir/common.w" +#line 1277 "cwebdir/common.w" /*:82*/ -#line 1232 "cwebdir/common.w" +#line 1239 "cwebdir/common.w" if(dot_pos==NULL){ sprintf(tex_file_name,"%s.tex",*argv); @@ -1578,36 +1585,36 @@ found_out= true; } /*:79*/ -#line 1183 "cwebdir/common.w" +#line 1190 "cwebdir/common.w" else/*81:*/ -#line 558 "cwebdir/comm-w2c.ch" +#line 555 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1266 "cwebdir/common.w" +#line 1275 "cwebdir/common.w" -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" /*:81*/ -#line 1184 "cwebdir/common.w" +#line 1191 "cwebdir/common.w" } } if(!found_web)/*81:*/ -#line 558 "cwebdir/comm-w2c.ch" +#line 555 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1266 "cwebdir/common.w" +#line 1275 "cwebdir/common.w" -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" /*:81*/ -#line 1187 "cwebdir/common.w" +#line 1194 "cwebdir/common.w" } /*:75*//*97:*/ -#line 815 "cwebdir/comm-w2c.ch" +#line 812 "cwebdir/comm-w2c.ch" static void cb_usage(const_string str) { @@ -1628,7 +1635,6 @@ bug_email= "tex-k@tug.org"; textdomain("web2c-help"); while(*message){ - printf("%s\n",strcmp("",*message)?_(*message):*message); ++message; } @@ -1641,10 +1647,11 @@ history= spotless;exit(wrap_up()); } /*:97*//*99:*/ -#line 858 "cwebdir/comm-w2c.ch" +#line 854 "cwebdir/comm-w2c.ch" void cb_show_banner(void) { +assert(cb_banner[0]!='\0'); textdomain("cweb-tl"); printf("%s%s\n",_(cb_banner),versionstring); -- cgit v1.2.3