diff options
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/web2c/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/ctangleboot.cin | 83 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebboot.cin | 249 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 10 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/comm-mac.ch | 24 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/comm-mini.ch | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/comm-vms.ch | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/comm-w2c.ch | 72 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/comm-w2c.h | 21 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/common.bux | 18 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/common.c | 176 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/common.h | 18 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/common.w | 96 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctangle.c | 74 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctangle.w | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctwill-mini.ch | 36 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctwill.bux | 16 |
17 files changed, 479 insertions, 435 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index ecf6989ac18..f39e410d2eb 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,8 @@ +2023-06-21 Andreas Scherer <https://ascherer.github.io> + + * ctangleboot.cin, + * cwebboot.cin: Match common.w with common.h. + 2023-07-18 Andreas Scherer <https://ascherer.github.io> * cwebboot.cin: Discard rest of overfull input line. diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index 340a9c48f65..c8588527078 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -1,8 +1,8 @@ /*1:*/ #line 66 "cwebdir/ctangle.w" -/*4:*/ -#line 54 "cwebdir/comm-w2c.h" +/*5:*/ +#line 61 "cwebdir/comm-w2c.h" #include <ctype.h> #include <kpathsea/simpletypes.h> @@ -15,17 +15,17 @@ #ifndef HAVE_GETTEXT #define HAVE_GETTEXT 0 #endif -#line 66 "cwebdir/comm-w2c.h" +#line 73 "cwebdir/comm-w2c.h" #if HAVE_GETTEXT #include <libintl.h> #else -#line 70 "cwebdir/comm-w2c.h" +#line 77 "cwebdir/comm-w2c.h" #define gettext(a) a #endif -#line 72 "cwebdir/comm-w2c.h" +#line 79 "cwebdir/comm-w2c.h" -/*:4*/ +/*:5*/ #line 67 "cwebdir/ctangle.w" #define banner "This is CTANGLE, Version 4.9" \ @@ -186,24 +186,24 @@ ctangle,cweave,ctwill extern cweb program; extern int phase; -/*:3*//*5:*/ -#line 94 "cwebdir/comm-w2c.h" +/*:3*//*6:*/ +#line 101 "cwebdir/comm-w2c.h" extern char section_text[]; extern char*section_text_end; extern char*id_first; extern char*id_loc; -/*:5*//*6:*/ -#line 112 "cwebdir/comm-w2c.h" +/*:6*//*7:*/ +#line 119 "cwebdir/comm-w2c.h" extern char buffer[]; extern char*buffer_end; extern char*loc; extern char*limit; -/*:6*//*7:*/ -#line 129 "cwebdir/comm-w2c.h" +/*:7*//*8:*/ +#line 136 "cwebdir/comm-w2c.h" extern int include_depth; extern FILE*file[]; @@ -219,16 +219,16 @@ extern boolean input_has_ended; extern boolean changing; extern boolean web_file_open; -/*:7*//*9:*/ -#line 150 "cwebdir/comm-w2c.h" +/*:8*//*10:*/ +#line 157 "cwebdir/comm-w2c.h" extern sixteen_bits section_count; extern boolean changed_section[]; extern boolean change_pending; extern boolean print_where; -/*:9*//*10:*/ -#line 164 "cwebdir/comm-w2c.h" +/*:10*//*11:*/ +#line 171 "cwebdir/comm-w2c.h" typedef struct name_info{ char*byte_start; @@ -252,13 +252,13 @@ extern name_pointer hash[]; extern hash_pointer hash_end; extern hash_pointer h; -/*:10*//*12:*/ -#line 208 "cwebdir/comm-w2c.h" +/*:11*//*13:*/ +#line 217 "cwebdir/comm-w2c.h" extern int history; -/*:12*//*14:*/ -#line 225 "cwebdir/comm-w2c.h" +/*:13*//*15:*/ +#line 234 "cwebdir/comm-w2c.h" extern int argc; extern char**argv; @@ -270,8 +270,8 @@ extern char check_file_name[]; extern boolean flags[]; extern const char*use_language; -/*:14*//*15:*/ -#line 241 "cwebdir/comm-w2c.h" +/*:15*//*16:*/ +#line 250 "cwebdir/comm-w2c.h" extern FILE*C_file; extern FILE*tex_file; @@ -280,7 +280,7 @@ extern FILE*scn_file; extern FILE*active_file; extern FILE*check_file; -/*:15*//*116:*/ +/*:16*//*116:*/ #line 553 "cwebdir/ctang-w2c.ch" extern char cb_banner[]; @@ -388,42 +388,45 @@ static eight_bits next_control; /*:82*/ #line 71 "cwebdir/ctangle.w" -/*8:*/ -#line 144 "cwebdir/comm-w2c.h" +/*4:*/ +#line 44 "cwebdir/comm-w2c.h" + +extern void common_init(void); +extern void cb_show_banner(void); + +extern void print_stats(void); + +/*:4*//*9:*/ +#line 151 "cwebdir/comm-w2c.h" extern boolean get_line(void); extern void check_complete(void); extern void reset_input(void); -/*:8*//*11:*/ -#line 187 "cwebdir/comm-w2c.h" +/*:9*//*12:*/ +#line 194 "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*,eight_bits); extern name_pointer section_lookup(char*,char*,boolean); -extern void init_node(name_pointer); -extern void init_p(name_pointer,eight_bits); extern void print_prefix_name(name_pointer); extern void print_section_name(name_pointer); extern void sprint_section_name(char*,name_pointer); -/*:11*//*13:*/ -#line 211 "cwebdir/comm-w2c.h" +extern boolean names_match(name_pointer,const char*,size_t,eight_bits); + +extern void init_node(name_pointer); +extern void init_p(name_pointer,eight_bits); + +/*:12*//*14:*/ +#line 220 "cwebdir/comm-w2c.h" extern int wrap_up(void); extern void err_print(const char*); extern void fatal(const char*,const char*); extern void overflow(const char*); -/*:13*//*16:*/ -#line 250 "cwebdir/comm-w2c.h" - -extern void common_init(void); -extern void print_stats(void); -extern void cb_show_banner(void); - -/*:16*//*30:*/ +/*:14*//*30:*/ #line 246 "cwebdir/ctangle.w" static void store_two_bytes(sixteen_bits); diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin index adc605332d2..ccca99d5cbb 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" -/*3:*/ -#line 54 "cwebdir/comm-w2c.h" +/*4:*/ +#line 61 "cwebdir/comm-w2c.h" #include <ctype.h> #include <kpathsea/simpletypes.h> @@ -15,17 +15,17 @@ #ifndef HAVE_GETTEXT #define HAVE_GETTEXT 0 #endif -#line 66 "cwebdir/comm-w2c.h" +#line 73 "cwebdir/comm-w2c.h" #if HAVE_GETTEXT #include <libintl.h> #else -#line 70 "cwebdir/comm-w2c.h" +#line 77 "cwebdir/comm-w2c.h" #define gettext(a) a #endif -#line 72 "cwebdir/comm-w2c.h" +#line 79 "cwebdir/comm-w2c.h" -/*:3*//*91:*/ +/*:4*//*91:*/ #line 733 "cwebdir/comm-w2c.ch" #if HAVE_GETTEXT @@ -188,24 +188,24 @@ ctangle,cweave,ctwill extern cweb program; extern int phase; -/*:2*//*4:*/ -#line 94 "cwebdir/comm-w2c.h" +/*:2*//*5:*/ +#line 101 "cwebdir/comm-w2c.h" extern char section_text[]; extern char*section_text_end; extern char*id_first; extern char*id_loc; -/*:4*//*5:*/ -#line 112 "cwebdir/comm-w2c.h" +/*:5*//*6:*/ +#line 119 "cwebdir/comm-w2c.h" extern char buffer[]; extern char*buffer_end; extern char*loc; extern char*limit; -/*:5*//*6:*/ -#line 129 "cwebdir/comm-w2c.h" +/*:6*//*7:*/ +#line 136 "cwebdir/comm-w2c.h" extern int include_depth; extern FILE*file[]; @@ -221,16 +221,16 @@ extern boolean input_has_ended; extern boolean changing; extern boolean web_file_open; -/*:6*//*8:*/ -#line 150 "cwebdir/comm-w2c.h" +/*:7*//*9:*/ +#line 157 "cwebdir/comm-w2c.h" extern sixteen_bits section_count; extern boolean changed_section[]; extern boolean change_pending; extern boolean print_where; -/*:8*//*9:*/ -#line 164 "cwebdir/comm-w2c.h" +/*:9*//*10:*/ +#line 171 "cwebdir/comm-w2c.h" typedef struct name_info{ char*byte_start; @@ -254,13 +254,13 @@ extern name_pointer hash[]; extern hash_pointer hash_end; extern hash_pointer h; -/*:9*//*11:*/ -#line 208 "cwebdir/comm-w2c.h" +/*:10*//*12:*/ +#line 217 "cwebdir/comm-w2c.h" extern int history; -/*:11*//*13:*/ -#line 225 "cwebdir/comm-w2c.h" +/*:12*//*14:*/ +#line 234 "cwebdir/comm-w2c.h" extern int argc; extern char**argv; @@ -272,8 +272,8 @@ extern char check_file_name[]; extern boolean flags[]; extern const char*use_language; -/*:13*//*14:*/ -#line 241 "cwebdir/comm-w2c.h" +/*:14*//*15:*/ +#line 250 "cwebdir/comm-w2c.h" extern FILE*C_file; extern FILE*tex_file; @@ -282,7 +282,7 @@ extern FILE*scn_file; extern FILE*active_file; extern FILE*check_file; -/*:14*/ +/*:15*/ #line 65 "cwebdir/common.w" /*18:*/ @@ -338,8 +338,8 @@ boolean web_file_open= false; static char change_buffer[buf_size]; static char*change_limit; -/*:26*//*37:*/ -#line 393 "cwebdir/common.w" +/*:26*//*42:*/ +#line 545 "cwebdir/common.w" sixteen_bits section_count; boolean changed_section[max_sections]; @@ -347,7 +347,7 @@ boolean change_pending; boolean print_where= false; -/*:37*//*43:*/ +/*:42*//*43:*/ #line 590 "cwebdir/common.w" char byte_mem[max_bytes]; @@ -420,42 +420,45 @@ string texmf_locale; /*:87*/ #line 66 "cwebdir/common.w" -/*7:*/ -#line 144 "cwebdir/comm-w2c.h" +/*3:*/ +#line 44 "cwebdir/comm-w2c.h" + +extern void common_init(void); +extern void cb_show_banner(void); + +extern void print_stats(void); + +/*:3*//*8:*/ +#line 151 "cwebdir/comm-w2c.h" extern boolean get_line(void); extern void check_complete(void); extern void reset_input(void); -/*:7*//*10:*/ -#line 187 "cwebdir/comm-w2c.h" +/*:8*//*11:*/ +#line 194 "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*,eight_bits); extern name_pointer section_lookup(char*,char*,boolean); -extern void init_node(name_pointer); -extern void init_p(name_pointer,eight_bits); extern void print_prefix_name(name_pointer); extern void print_section_name(name_pointer); extern void sprint_section_name(char*,name_pointer); -/*:10*//*12:*/ -#line 211 "cwebdir/comm-w2c.h" +extern boolean names_match(name_pointer,const char*,size_t,eight_bits); + +extern void init_node(name_pointer); +extern void init_p(name_pointer,eight_bits); + +/*:11*//*13:*/ +#line 220 "cwebdir/comm-w2c.h" extern int wrap_up(void); extern void err_print(const char*); extern void fatal(const char*,const char*); extern void overflow(const char*); -/*:12*//*15:*/ -#line 250 "cwebdir/comm-w2c.h" - -extern void common_init(void); -extern void print_stats(void); -extern void cb_show_banner(void); - -/*:15*//*24:*/ +/*:13*//*24:*/ #line 176 "cwebdir/common.w" static boolean input_ln(FILE*); @@ -775,67 +778,20 @@ if(lines_dont_match)n++; } /*:32*//*35:*/ -#line 356 "cwebdir/common.w" - -void -reset_input(void) -{ -limit= buffer;loc= buffer+1;buffer[0]= ' '; -/*36:*/ -#line 371 "cwebdir/common.w" - -#line 150 "cwebdir/comm-w2c.ch" -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)<max_file_name_length){ - -if(strcmp(web_file_name,found_filename)) -strcpy(web_file_name,found_filename+ -((strncmp(found_filename,"./",2)==0)?2:0)); -free(found_filename); -}else fatal(_("! Filename too long\n"),found_filename); -#line 377 "cwebdir/common.w" - - -web_file_open= true; -#line 166 "cwebdir/comm-w2c.ch" -if((found_filename= kpse_find_cweb(change_file_name))==NULL -||(change_file= fopen(found_filename,"r"))==NULL) -fatal(_("! Cannot open change file "),change_file_name); -else if(strlen(found_filename)<max_file_name_length){ - -if(strcmp(change_file_name,found_filename)) -strcpy(change_file_name,found_filename+ -((strncmp(found_filename,"./",2)==0)?2:0)); -free(found_filename); -}else fatal(_("! Filename too long\n"),found_filename); -#line 382 "cwebdir/common.w" - -/*:36*/ -#line 361 "cwebdir/common.w" - -include_depth= cur_line= change_line= 0; -change_depth= include_depth; -changing= true;prime_the_change_buffer();changing= !changing; -limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; -} - -/*:35*//*38:*/ -#line 400 "cwebdir/common.w" +#line 362 "cwebdir/common.w" boolean get_line(void) { restart: if(changing&&include_depth==change_depth) -/*41:*/ -#line 508 "cwebdir/common.w" +/*38:*/ +#line 470 "cwebdir/common.w" { change_line++; if(!input_ln(change_file)){ -#line 275 "cwebdir/comm-w2c.ch" +#line 240 "cwebdir/comm-w2c.ch" err_print(_("! Change file ended without @z")); -#line 512 "cwebdir/common.w" +#line 474 "cwebdir/common.w" buffer[0]= '@';buffer[1]= 'z';limit= buffer+2; } @@ -851,9 +807,9 @@ if(buffer[0]=='@'){ if(xisupper(buffer[1]))buffer[1]= tolower((int)buffer[1]); if(buffer[1]=='x'||buffer[1]=='y'){ loc= buffer+2; -#line 281 "cwebdir/comm-w2c.ch" +#line 246 "cwebdir/comm-w2c.ch" err_print(_("! Where is the matching @z?")); -#line 528 "cwebdir/common.w" +#line 490 "cwebdir/common.w" } else if(buffer[1]=='z'){ @@ -863,12 +819,12 @@ prime_the_change_buffer();changing= !changing;print_where= true; } } -/*:41*/ -#line 405 "cwebdir/common.w" +/*:38*/ +#line 367 "cwebdir/common.w" if(!changing||include_depth> change_depth){ -/*40:*/ -#line 491 "cwebdir/common.w" +/*37:*/ +#line 453 "cwebdir/common.w" { cur_line++; while(!input_ln(cur_file)){ @@ -886,8 +842,8 @@ if(buffer[0]==change_buffer[0]) if(change_limit> change_buffer)check_change(); } -/*:40*/ -#line 407 "cwebdir/common.w" +/*:37*/ +#line 369 "cwebdir/common.w" if(changing&&include_depth==change_depth)goto restart; } @@ -897,27 +853,27 @@ if(buffer[0]=='@'&&(buffer[1]=='i'||buffer[1]=='I')){ loc= buffer+2;*limit= '"'; while(*loc==' '||*loc=='\t')loc++; if(loc>=limit){ -#line 181 "cwebdir/comm-w2c.ch" +#line 146 "cwebdir/comm-w2c.ch" err_print(_("! Include file name not given")); -#line 417 "cwebdir/common.w" +#line 379 "cwebdir/common.w" goto restart; } if(include_depth>=max_include_depth-1){ -#line 187 "cwebdir/comm-w2c.ch" +#line 152 "cwebdir/comm-w2c.ch" err_print(_("! Too many nested includes")); -#line 422 "cwebdir/common.w" +#line 384 "cwebdir/common.w" goto restart; } include_depth++; -/*39:*/ -#line 445 "cwebdir/common.w" +/*36:*/ +#line 407 "cwebdir/common.w" { -#line 224 "cwebdir/comm-w2c.ch" +#line 189 "cwebdir/comm-w2c.ch" char*cur_file_name_end= cur_file_name+max_file_name_length-1; char*k= cur_file_name; -#line 450 "cwebdir/common.w" +#line 412 "cwebdir/common.w" if(*loc=='"'){ loc++; @@ -928,7 +884,7 @@ while(*loc!=' '&&*loc!='\t'&&*loc!='"'&&k<=cur_file_name_end)*k++= *loc++; if(k> cur_file_name_end)too_long(); *k= '\0'; -#line 231 "cwebdir/comm-w2c.ch" +#line 196 "cwebdir/comm-w2c.ch" if((found_filename= kpse_find_cweb(cur_file_name))!=NULL &&(cur_file= fopen(found_filename,"r"))!=NULL){ @@ -938,25 +894,25 @@ strcpy(cur_file_name,found_filename+ ((strncmp(found_filename,"./",2)==0)?2:0)); free(found_filename); }else fatal(_("! Filename too long\n"),found_filename); -#line 461 "cwebdir/common.w" +#line 423 "cwebdir/common.w" cur_line= 0;print_where= true; goto restart; } -#line 269 "cwebdir/comm-w2c.ch" +#line 234 "cwebdir/comm-w2c.ch" include_depth--;err_print(_("! Cannot open include file"));goto restart; -#line 489 "cwebdir/common.w" +#line 451 "cwebdir/common.w" } -/*:39*/ -#line 426 "cwebdir/common.w" +/*:36*/ +#line 388 "cwebdir/common.w" } return true; } -#line 202 "cwebdir/comm-w2c.ch" -/*:38*//*42:*/ -#line 540 "cwebdir/common.w" +#line 167 "cwebdir/comm-w2c.ch" +/*:35*//*39:*/ +#line 502 "cwebdir/common.w" void check_complete(void){ @@ -964,14 +920,61 @@ if(change_limit!=change_buffer){ strncpy(buffer,change_buffer,(size_t)(change_limit-change_buffer+1)); limit= buffer+(ptrdiff_t)(change_limit-change_buffer); changing= true;change_depth= include_depth;loc= buffer; -#line 287 "cwebdir/comm-w2c.ch" +#line 252 "cwebdir/comm-w2c.ch" err_print(_("! Change file entry did not match")); -#line 548 "cwebdir/common.w" +#line 510 "cwebdir/common.w" } } -/*:42*//*48:*/ +/*:39*//*40:*/ +#line 518 "cwebdir/common.w" + +void +reset_input(void) +{ +limit= buffer;loc= buffer+1;buffer[0]= ' '; +/*41:*/ +#line 533 "cwebdir/common.w" + +#line 262 "cwebdir/comm-w2c.ch" +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)<max_file_name_length){ + +if(strcmp(web_file_name,found_filename)) +strcpy(web_file_name,found_filename+ +((strncmp(found_filename,"./",2)==0)?2:0)); +free(found_filename); +}else fatal(_("! Filename too long\n"),found_filename); +#line 539 "cwebdir/common.w" + + +web_file_open= true; +#line 278 "cwebdir/comm-w2c.ch" +if((found_filename= kpse_find_cweb(change_file_name))==NULL +||(change_file= fopen(found_filename,"r"))==NULL) +fatal(_("! Cannot open change file "),change_file_name); +else if(strlen(found_filename)<max_file_name_length){ + +if(strcmp(change_file_name,found_filename)) +strcpy(change_file_name,found_filename+ +((strncmp(found_filename,"./",2)==0)?2:0)); +free(found_filename); +}else fatal(_("! Filename too long\n"),found_filename); +#line 544 "cwebdir/common.w" + +/*:41*/ +#line 523 "cwebdir/common.w" + +include_depth= cur_line= change_line= 0; +change_depth= include_depth; +changing= true;prime_the_change_buffer();changing= !changing; +limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; +} + +/*:40*//*48:*/ #line 633 "cwebdir/common.w" name_pointer diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index 0c494d4b877..57caa0f4386 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,13 @@ +2023-07-21 Andreas Scherer <https://ascherer.github.io> + + * comm-{mac,mini,vms,w2c}.ch, + * comm-w2c.h, + * common.bux, + * common.{c,h,w}, + * ctangle.{c,w}, + * ctwill-mini.ch, + * ctwill.bux: Match common.w with common.h. + 2023-07-18 Andreas Scherer <https://ascherer.github.io> * cwebdir/comm-mac.ch, diff --git a/Build/source/texk/web2c/cwebdir/comm-mac.ch b/Build/source/texk/web2c/cwebdir/comm-mac.ch index d5529f3b2a4..b549260b72c 100644 --- a/Build/source/texk/web2c/cwebdir/comm-mac.ch +++ b/Build/source/texk/web2c/cwebdir/comm-mac.ch @@ -81,16 +81,6 @@ FILE *fp) /* what file to read from */ @<Skip over comment lines in the change file; |return| if end of file@>@; @z -@x section 36, don't try to open a change file if none was specified -if ((change_file=fopen(change_file_name,"r"))==NULL) - fatal("! Cannot open change file ", change_file_name); -@y -if (change_file_name[0] == '\0') /* no change file specified */ - change_file = NULL; /* reset at least the |change_file| */ -else if ((change_file=fopen(change_file_name,"r"))==NULL) - fatal("! Cannot open change file ", change_file_name); -@z - @x section 39, declare colon as Mac's path separator (Colon-separated paths are not supported.) The remainder of the \.{@@i} line after the file name is ignored. @@ -110,6 +100,16 @@ The remainder of the \.{@@i} line after the file name is ignored. cur_file_name[l]=PATH_SEP; /* pathname separator */ @z +@x section 41, don't try to open a change file if none was specified +if ((change_file=fopen(change_file_name,"r"))==NULL) + fatal("! Cannot open change file ", change_file_name); +@y +if (change_file_name[0] == '\0') /* no change file specified */ + change_file = NULL; /* reset at least the |change_file| */ +else if ((change_file=fopen(change_file_name,"r"))==NULL) + fatal("! Cannot open change file ", change_file_name); +@z + @x section 75, explain the convention for omitted change files An omitted change file argument means that |"/dev/null"| should be used, @y @@ -134,7 +134,7 @@ An omitted change file argument means that no change file should be used, @z @x section 85, insert an extra module before the index -@** Index. +@* Index. @y by putting the new module here, we preserve all the previous section numbers @ We assume an interface to \CEE/ command-line emulation as supplied by the |ccommand| function of Metrowerks CodeWarrior, as defined in @@ -144,5 +144,5 @@ the header file \.{console.h}. #include <console.h> @^system dependencies@> -@** Index. +@* Index. @z diff --git a/Build/source/texk/web2c/cwebdir/comm-mini.ch b/Build/source/texk/web2c/cwebdir/comm-mini.ch index 3f809f9de9b..8c4ff65d0c8 100644 --- a/Build/source/texk/web2c/cwebdir/comm-mini.ch +++ b/Build/source/texk/web2c/cwebdir/comm-mini.ch @@ -7,7 +7,7 @@ Limbo. \def\contentspagenumber{0} @z -Section 3. +Section 4. @x internationalization. @@ -17,7 +17,7 @@ internationalization. @-S@> @z -Section 5. +Section 6. @x @ Code related to input routines: @@ -26,7 +26,7 @@ Section 5. @-c@> @z -Section 9. +Section 10. @x @ Code related to identifier and section name storage: @@ -35,7 +35,7 @@ Section 9. @-c@> @z -Section 14. +Section 15. @x @ Code related to output: diff --git a/Build/source/texk/web2c/cwebdir/comm-vms.ch b/Build/source/texk/web2c/cwebdir/comm-vms.ch index a5ddc252f35..fe72d604fdb 100644 --- a/Build/source/texk/web2c/cwebdir/comm-vms.ch +++ b/Build/source/texk/web2c/cwebdir/comm-vms.ch @@ -75,7 +75,7 @@ null device |"NL:"| should be used, when no changes are desired. @z @x section 85 (01-FEB-1992 ST) -@** Index. +@* Index. @y @* VAX/VMS specific code. We have used |SS$_NORMAL| and |SS$_ABORT| as return codes, @@ -84,5 +84,5 @@ so we have to include the system message codes. @<Include files@>= #include ssdef /* we need VAX/VMS system messages */ -@** Index. +@* Index. @z diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch index 1b38a538818..ecc3ff2b460 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch @@ -141,41 +141,6 @@ char *found_filename; /* filename found by |kpse_find_file| */ @z @x -if ((web_file=fopen(web_file_name,"r"))==NULL) { - strcpy(web_file_name,alt_web_file_name); - if ((web_file=fopen(web_file_name,"r"))==NULL) - fatal("! Cannot open input file ", web_file_name); -} -@y -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) < max_file_name_length) { - /* Copy name for \#\&{line} directives. */ - if (strcmp(web_file_name, found_filename)) - strcpy(web_file_name, found_filename + - ((strncmp(found_filename,"./",2)==0) ? 2 : 0)); - free(found_filename); -} else fatal(_("! Filename too long\n"), found_filename); -@z - -@x -if ((change_file=fopen(change_file_name,"r"))==NULL) - fatal("! Cannot open change file ", change_file_name); -@y -if ((found_filename=kpse_find_cweb(change_file_name))==NULL @| - || (change_file=fopen(found_filename,"r"))==NULL) - fatal(_("! Cannot open change file "), change_file_name); -else if (strlen(found_filename) < max_file_name_length) { - /* Copy name for \#\&{line} directives. */ - if (strcmp(change_file_name, found_filename)) - strcpy(change_file_name, found_filename + - ((strncmp(found_filename,"./",2)==0) ? 2 : 0)); - free(found_filename); -} else fatal(_("! Filename too long\n"), found_filename); -@z - -@x err_print("! Include file name not given"); @y err_print(_("! Include file name not given")); @@ -288,6 +253,41 @@ The remainder of the \.{@@i} line after the file name is ignored. @z @x +if ((web_file=fopen(web_file_name,"r"))==NULL) { + strcpy(web_file_name,alt_web_file_name); + if ((web_file=fopen(web_file_name,"r"))==NULL) + fatal("! Cannot open input file ", web_file_name); +} +@y +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) < max_file_name_length) { + /* Copy name for \#\&{line} directives. */ + if (strcmp(web_file_name, found_filename)) + strcpy(web_file_name, found_filename + + ((strncmp(found_filename,"./",2)==0) ? 2 : 0)); + free(found_filename); +} else fatal(_("! Filename too long\n"), found_filename); +@z + +@x +if ((change_file=fopen(change_file_name,"r"))==NULL) + fatal("! Cannot open change file ", change_file_name); +@y +if ((found_filename=kpse_find_cweb(change_file_name))==NULL @| + || (change_file=fopen(found_filename,"r"))==NULL) + fatal(_("! Cannot open change file "), change_file_name); +else if (strlen(found_filename) < max_file_name_length) { + /* Copy name for \#\&{line} directives. */ + if (strcmp(change_file_name, found_filename)) + strcpy(change_file_name, found_filename + + ((strncmp(found_filename,"./",2)==0) ? 2 : 0)); + free(found_filename); +} else fatal(_("! Filename too long\n"), found_filename); +@z + +@x @d hash_size 353 /* should be prime */ @y @d hash_size 8501 /* should be prime */ @@ -608,7 +608,7 @@ else { @z @x -@** Index. +@* Index. @y @** Extensions to {\tentex CWEB}. The following sections introduce new or improved features that have been created by numerous contributors over the diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.h b/Build/source/texk/web2c/cwebdir/comm-w2c.h index a2b58f705cd..0ff9ac9b836 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.h +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.h @@ -40,6 +40,13 @@ typedef enum { extern cweb program; /* \.{CTANGLE} or \.{CWEAVE} or \.{CTWILL}? */ extern int phase; /* which phase are we in? */ +@ The procedure that gets everything rolling: +@<Predecl...@>= +extern void common_init(void);@/ +extern void cb_show_banner(void); +@# +extern void print_stats(void); /* defined in \.{ctangle.w} and \.{cweave.w} */ + @ You may have noticed that almost all \.{"strings"} in the \.{CWEB} sources are placed in the context of the `|_|'~macro. This is just a shortcut for the `|@!gettext|' function from the ``GNU~gettext utilities.'' For systems that do @@ -185,15 +192,17 @@ extern hash_pointer hash_end; /* end of |hash| */ extern hash_pointer h; /* index into hash-head array */ @ @<Predecl...@>= -extern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/ extern name_pointer id_lookup(const char *,const char *,eight_bits); /* looks up a string in the identifier table */ extern name_pointer section_lookup(char *,char *,boolean); /* finds section name */ -extern void init_node(name_pointer);@/ -extern void init_p(name_pointer,eight_bits);@/ extern void print_prefix_name(name_pointer);@/ extern void print_section_name(name_pointer);@/ extern void sprint_section_name(char *,name_pointer); +@# +extern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/ +/* three routines defined in \.{ctangle.w} and \.{cweave.w} */ +extern void init_node(name_pointer);@/ +extern void init_p(name_pointer,eight_bits);@/ @ Code related to error handling: @d spotless 0 /* |history| value for normal jobs */ @@ -246,12 +255,6 @@ extern FILE *scn_file; /* where list of sections from \.{CWEAVE} goes */ extern FILE *active_file; /* currently active file for \.{CWEAVE} output */ extern FILE *check_file; /* temporary output file */ -@ The procedure that gets everything rolling: -@<Predecl...@>= -extern void common_init(void);@/ -extern void print_stats(void);@/ -extern void cb_show_banner(void); - @ The following parameters are sufficient to handle \TEX/ (converted to \.{CWEB}), so they should be sufficient for most applications of \.{CWEB}. diff --git a/Build/source/texk/web2c/cwebdir/common.bux b/Build/source/texk/web2c/cwebdir/common.bux index d5d2a399f34..96c3fdfe0b4 100644 --- a/Build/source/texk/web2c/cwebdir/common.bux +++ b/Build/source/texk/web2c/cwebdir/common.bux @@ -4,25 +4,25 @@ @$HAVE_GETTEXT "common.h" \zip@> -@$init_p {CWEAVE.W}32 \&{void} (\,)@> -@$init_node {CWEAVE.W}32 \&{void} (\,)@> -@$names_match {CWEAVE.W}32 \&{boolean} (\,)@> +@$DEV_NULL {COMMON.W}75 macro@> +@$_DEV_NULL {COMMON.W}75 macro@> @$ac {CWEAVE.W}2 \&{int}@> @$av {CWEAVE.W}2 \&{char} ${*}{*}$@> @$main {CWEAVE.W}2 \&{int} (\,)@> -@$print_stats {CWEAVE.W}262 \&{void} (\,)@> +@$ilk {CWEAVE.W}20 \\{dummy.Ilk}@> @$xmem {CWEAVE.W}23 \&{xref\_info} [\,]@> @$xref {CWEAVE.W}24 \\{equiv\_or\_xref}@> -@$text_info {CTANGLE.W}20 \&{text} [\,]@> +@$init_p {CWEAVE.W}32 \&{void} (\,)@> +@$init_node {CWEAVE.W}32 \&{void} (\,)@> +@$names_match {CWEAVE.W}32 \&{boolean} (\,)@> -@$equiv {CTANGLE.W}22 \\{equiv\_or\_xref}@> +@$print_stats {CWEAVE.W}270 \&{void} (\,)@> -@$ilk {CWEAVE.W}20 \\{dummy.Ilk}@> +@$text_info {CTANGLE.W}20 \&{text} [\,]@> -@$DEV_NULL {COMMON.W}75 macro@> -@$_DEV_NULL {COMMON.W}75 macro@> +@$equiv {CTANGLE.W}22 \\{equiv\_or\_xref}@> diff --git a/Build/source/texk/web2c/cwebdir/common.c b/Build/source/texk/web2c/cwebdir/common.c index 49cfa476d35..15e0e45ee3e 100644 --- a/Build/source/texk/web2c/cwebdir/common.c +++ b/Build/source/texk/web2c/cwebdir/common.c @@ -1,8 +1,8 @@ /*1:*/ #line 62 "common.w" -/*3:*/ -#line 44 "common.h" +/*4:*/ +#line 49 "common.h" #include <ctype.h> #include <stdbool.h> @@ -12,7 +12,7 @@ #include <stdlib.h> #include <string.h> -/*:3*/ +/*:4*/ #line 63 "common.w" #define ctangle false @@ -133,24 +133,24 @@ typedef uint16_t sixteen_bits; extern boolean program; extern int phase; -/*:2*//*4:*/ -#line 74 "common.h" +/*:2*//*5:*/ +#line 79 "common.h" extern char section_text[]; extern char*section_text_end; extern char*id_first; extern char*id_loc; -/*:4*//*5:*/ -#line 92 "common.h" +/*:5*//*6:*/ +#line 97 "common.h" extern char buffer[]; extern char*buffer_end; extern char*loc; extern char*limit; -/*:5*//*6:*/ -#line 109 "common.h" +/*:6*//*7:*/ +#line 114 "common.h" extern int include_depth; extern FILE*file[]; @@ -165,16 +165,16 @@ extern boolean input_has_ended; extern boolean changing; extern boolean web_file_open; -/*:6*//*8:*/ -#line 129 "common.h" +/*:7*//*9:*/ +#line 134 "common.h" extern sixteen_bits section_count; extern boolean changed_section[]; extern boolean change_pending; extern boolean print_where; -/*:8*//*9:*/ -#line 143 "common.h" +/*:9*//*10:*/ +#line 148 "common.h" typedef struct name_info{ char*byte_start; @@ -198,13 +198,13 @@ extern name_pointer hash[]; extern hash_pointer hash_end; extern hash_pointer h; -/*:9*//*11:*/ -#line 187 "common.h" +/*:10*//*12:*/ +#line 194 "common.h" extern int history; -/*:11*//*13:*/ -#line 203 "common.h" +/*:12*//*14:*/ +#line 210 "common.h" extern int argc; extern char**argv; @@ -214,8 +214,8 @@ extern char idx_file_name[]; extern char scn_file_name[]; extern boolean flags[]; -/*:13*//*14:*/ -#line 217 "common.h" +/*:14*//*15:*/ +#line 224 "common.h" extern FILE*C_file; extern FILE*tex_file; @@ -223,7 +223,7 @@ extern FILE*idx_file; extern FILE*scn_file; extern FILE*active_file; -/*:14*/ +/*:15*/ #line 65 "common.w" /*18:*/ @@ -275,8 +275,8 @@ boolean web_file_open= false; static char change_buffer[buf_size]; static char*change_limit; -/*:26*//*37:*/ -#line 393 "common.w" +/*:26*//*42:*/ +#line 545 "common.w" sixteen_bits section_count; boolean changed_section[max_sections]; @@ -284,7 +284,7 @@ boolean change_pending; boolean print_where= false; -/*:37*//*43:*/ +/*:42*//*43:*/ #line 590 "common.w" char byte_mem[max_bytes]; @@ -333,41 +333,43 @@ FILE*active_file; /*:83*/ #line 66 "common.w" -/*7:*/ -#line 123 "common.h" +/*3:*/ +#line 43 "common.h" + +extern void common_init(void); +extern void print_stats(void); + +/*:3*//*8:*/ +#line 128 "common.h" extern boolean get_line(void); extern void check_complete(void); extern void reset_input(void); -/*:7*//*10:*/ -#line 166 "common.h" +/*:8*//*11:*/ +#line 171 "common.h" -extern boolean names_match(name_pointer,const char*,size_t,eight_bits); extern name_pointer id_lookup(const char*,const char*,eight_bits); extern name_pointer section_lookup(char*,char*,boolean); -extern void init_node(name_pointer); -extern void init_p(name_pointer,eight_bits); extern void print_prefix_name(name_pointer); extern void print_section_name(name_pointer); extern void sprint_section_name(char*,name_pointer); -/*:10*//*12:*/ -#line 190 "common.h" +extern boolean names_match(name_pointer,const char*,size_t,eight_bits); + +extern void init_node(name_pointer); +extern void init_p(name_pointer,eight_bits); + +/*:11*//*13:*/ +#line 197 "common.h" extern int wrap_up(void); extern void err_print(const char*); extern void fatal(const char*,const char*); extern void overflow(const char*); -/*:12*//*15:*/ -#line 225 "common.h" - -extern void common_init(void); -extern void print_stats(void); - -/*:15*//*24:*/ +/*:13*//*24:*/ #line 176 "common.w" static boolean input_ln(FILE*); @@ -590,44 +592,14 @@ if(lines_dont_match)n++; } /*:32*//*35:*/ -#line 356 "common.w" - -void -reset_input(void) -{ -limit= buffer;loc= buffer+1;buffer[0]= ' '; -/*36:*/ -#line 371 "common.w" - -if((web_file= fopen(web_file_name,"r"))==NULL){ -strcpy(web_file_name,alt_web_file_name); -if((web_file= fopen(web_file_name,"r"))==NULL) -fatal("! Cannot open input file ",web_file_name); -} - - -web_file_open= true; -if((change_file= fopen(change_file_name,"r"))==NULL) -fatal("! Cannot open change file ",change_file_name); - -/*:36*/ -#line 361 "common.w" - -include_depth= cur_line= change_line= 0; -change_depth= include_depth; -changing= true;prime_the_change_buffer();changing= !changing; -limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; -} - -/*:35*//*38:*/ -#line 400 "common.w" +#line 362 "common.w" boolean get_line(void) { restart: if(changing&&include_depth==change_depth) -/*41:*/ -#line 508 "common.w" +/*38:*/ +#line 470 "common.w" { change_line++; if(!input_ln(change_file)){ @@ -657,12 +629,12 @@ prime_the_change_buffer();changing= !changing;print_where= true; } } -/*:41*/ -#line 405 "common.w" +/*:38*/ +#line 367 "common.w" if(!changing||include_depth> change_depth){ -/*40:*/ -#line 491 "common.w" +/*37:*/ +#line 453 "common.w" { cur_line++; while(!input_ln(cur_file)){ @@ -680,8 +652,8 @@ if(buffer[0]==change_buffer[0]) if(change_limit> change_buffer)check_change(); } -/*:40*/ -#line 407 "common.w" +/*:37*/ +#line 369 "common.w" if(changing&&include_depth==change_depth)goto restart; } @@ -701,8 +673,8 @@ err_print("! Too many nested includes"); goto restart; } include_depth++; -/*39:*/ -#line 445 "common.w" +/*36:*/ +#line 407 "common.w" { char temp_file_name[max_file_name_length]; char*cur_file_name_end= cur_file_name+max_file_name_length-1; @@ -732,10 +704,10 @@ else{ if((l= strlen(CWEBINPUTS))> max_file_name_length-2)too_long(); strcpy(temp_file_name,CWEBINPUTS); #else -#line 474 "common.w" +#line 436 "common.w" l= 0; #endif -#line 476 "common.w" +#line 438 "common.w" } if(l> 0){ if(k+l+2>=cur_file_name_end)too_long(); @@ -751,15 +723,15 @@ goto restart; include_depth--;err_print("! Cannot open include file");goto restart; } -/*:39*/ -#line 426 "common.w" +/*:36*/ +#line 388 "common.w" } return true; } -/*:38*//*42:*/ -#line 540 "common.w" +/*:35*//*39:*/ +#line 502 "common.w" void check_complete(void){ @@ -772,7 +744,37 @@ err_print("! Change file entry did not match"); } } -/*:42*//*48:*/ +/*:39*//*40:*/ +#line 518 "common.w" + +void +reset_input(void) +{ +limit= buffer;loc= buffer+1;buffer[0]= ' '; +/*41:*/ +#line 533 "common.w" + +if((web_file= fopen(web_file_name,"r"))==NULL){ +strcpy(web_file_name,alt_web_file_name); +if((web_file= fopen(web_file_name,"r"))==NULL) +fatal("! Cannot open input file ",web_file_name); +} + + +web_file_open= true; +if((change_file= fopen(change_file_name,"r"))==NULL) +fatal("! Cannot open change file ",change_file_name); + +/*:41*/ +#line 523 "common.w" + +include_depth= cur_line= change_line= 0; +change_depth= include_depth; +changing= true;prime_the_change_buffer();changing= !changing; +limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; +} + +/*:40*//*48:*/ #line 633 "common.w" name_pointer diff --git a/Build/source/texk/web2c/cwebdir/common.h b/Build/source/texk/web2c/cwebdir/common.h index 914c04f1436..f8c8af34d4e 100644 --- a/Build/source/texk/web2c/cwebdir/common.h +++ b/Build/source/texk/web2c/cwebdir/common.h @@ -39,6 +39,11 @@ typedef uint16_t sixteen_bits; extern boolean program; /* \.{CWEAVE} or \.{CTANGLE}? */ extern int phase; /* which phase are we in? */ +@ The procedure that gets everything rolling: +@<Predecl...@>= +extern void common_init(void);@/ +extern void print_stats(void); /* defined in \.{ctangle.w} and \.{cweave.w} */ + @ Interface to the standard \CEE/ library: @<Include files@>= @@ -164,15 +169,17 @@ extern hash_pointer hash_end; /* end of |hash| */ extern hash_pointer h; /* index into hash-head array */ @ @<Predecl...@>= -extern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/ extern name_pointer id_lookup(const char *,const char *,eight_bits); /* looks up a string in the identifier table */ extern name_pointer section_lookup(char *,char *,boolean); /* finds section name */ -extern void init_node(name_pointer);@/ -extern void init_p(name_pointer,eight_bits);@/ extern void print_prefix_name(name_pointer);@/ extern void print_section_name(name_pointer);@/ extern void sprint_section_name(char *,name_pointer); +@# +extern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/ +/* three routines defined in \.{ctangle.w} and \.{cweave.w} */ +extern void init_node(name_pointer);@/ +extern void init_p(name_pointer,eight_bits);@/ @ Code related to error handling: @d spotless 0 /* |history| value for normal jobs */ @@ -221,11 +228,6 @@ extern FILE *idx_file; /* where index from \.{CWEAVE} goes */ extern FILE *scn_file; /* where list of sections from \.{CWEAVE} goes */ extern FILE *active_file; /* currently active file for \.{CWEAVE} output */ -@ The procedure that gets everything rolling: -@<Predecl...@>= -extern void common_init(void);@/ -extern void print_stats(void); - @ The following parameters are sufficient to handle \TEX/ (converted to \.{CWEB}), so they should be sufficient for most applications of \.{CWEB}. diff --git a/Build/source/texk/web2c/cwebdir/common.w b/Build/source/texk/web2c/cwebdir/common.w index 32516880491..3491ba00e6e 100644 --- a/Build/source/texk/web2c/cwebdir/common.w +++ b/Build/source/texk/web2c/cwebdir/common.w @@ -47,7 +47,7 @@ under the terms of a permission notice identical to this one. \pageno=\contentspagenumber \advance\pageno by 1 \let\maybe=\iftrue -@** Introduction. This file contains code common +@* Introduction. This file contains code common to both \.{CTANGLE} and \.{CWEAVE}, which roughly concerns the following problems: character uniformity, input routines, error handling and parsing of command line. We have tried to concentrate in this file @@ -129,7 +129,7 @@ char *section_text_end = section_text+longest_name; /* end of |section_text| */ char *id_first; /* where the current identifier begins in the buffer */ char *id_loc; /* just after the current identifier in the buffer */ -@** Input routines. The lowest level of input to the \.{CWEB} programs +@* Input routines. The lowest level of input to the \.{CWEB} programs is performed by |input_ln|, which must be told which file to read from. The return value of |input_ln| is |true| if the read is successful and |false| if not (generally this means the file has ended). The conventions @@ -175,8 +175,8 @@ FILE *fp) /* what file to read from */ @ @<Predecl...@>=@+static boolean input_ln(FILE *); -@ Now comes the problem of deciding which file to read from next. -Recall that the actual text that \.{CWEB} should process comes from two +@* File handling. Now comes the problem of deciding which file to read from +next. Recall that the actual text that \.{CWEB} should process comes from two streams: a |web_file|, which can contain possibly nested include commands~\.{@@i}, and a |change_file|, which might also contain includes. The |web_file| together with the currently open include @@ -349,37 +349,6 @@ else if (xyz_code=='y') { return; } -@ The |reset_input| procedure, which gets \.{CWEB} ready to read the -user's \.{CWEB} input, is used at the beginning of phase one of \.{CTANGLE}, -phases one and two of \.{CWEAVE}. - -@c -void -reset_input(void) -{ - limit=buffer; loc=buffer+1; buffer[0]=' '; - @<Open input files@>@; - include_depth=cur_line=change_line=0; - change_depth=include_depth; - changing=true; prime_the_change_buffer(); changing=!changing; - limit=buffer; loc=buffer+1; buffer[0]=' '; input_has_ended=false; -} - -@ The following code opens the input files. -@^system dependencies@> - -@<Open input files@>= -if ((web_file=fopen(web_file_name,"r"))==NULL) { - strcpy(web_file_name,alt_web_file_name); - if ((web_file=fopen(web_file_name,"r"))==NULL) - fatal("! Cannot open input file ", web_file_name); -} -@.Cannot open input file@> -@.Cannot open change file@> -web_file_open=true; -if ((change_file=fopen(change_file_name,"r"))==NULL) - fatal("! Cannot open change file ", change_file_name); - @ The |get_line| procedure is called when |loc>limit|; it puts the next line of merged input into the buffer and updates the other variables appropriately. A space is placed at the right end of the line. @@ -390,14 +359,7 @@ If we've just changed from the |cur_file| to the |change_file|, or if the |cur_file| has changed, we tell \.{CTANGLE} to print this information in the \CEE/ file by means of the |print_where| flag. -@<Global var...@>= -sixteen_bits section_count; /* the current section number */ -boolean changed_section[max_sections]; /* is the section changed? */ -boolean change_pending; /* if the current change is not yet recorded in - |changed_section[section_count]| */ -boolean print_where=false; /* should \.{CTANGLE} print line and file info? */ - -@ @c +@c boolean get_line(void) /* inputs the next line */ { restart: @@ -549,7 +511,45 @@ check_complete(void) { } } -@** Storage of names and strings. +@ The |reset_input| procedure, which gets \.{CWEB} ready to read the +user's \.{CWEB} input, is used at the beginning of phase one of \.{CTANGLE}, +phases one and two of \.{CWEAVE}. + +@c +void +reset_input(void) +{ + limit=buffer; loc=buffer+1; buffer[0]=' '; + @<Open input files@>@; + include_depth=cur_line=change_line=0; + change_depth=include_depth; + changing=true; prime_the_change_buffer(); changing=!changing; + limit=buffer; loc=buffer+1; buffer[0]=' '; input_has_ended=false; +} + +@ The following code opens the input files. +@^system dependencies@> + +@<Open input files@>= +if ((web_file=fopen(web_file_name,"r"))==NULL) { + strcpy(web_file_name,alt_web_file_name); + if ((web_file=fopen(web_file_name,"r"))==NULL) + fatal("! Cannot open input file ", web_file_name); +} +@.Cannot open input file@> +@.Cannot open change file@> +web_file_open=true; +if ((change_file=fopen(change_file_name,"r"))==NULL) + fatal("! Cannot open change file ", change_file_name); + +@ @<Global var...@>= +sixteen_bits section_count; /* the current section number */ +boolean changed_section[max_sections]; /* is the section changed? */ +boolean change_pending; /* if the current change is not yet recorded in + |changed_section[section_count]| */ +boolean print_where=false; /* should \.{CTANGLE} print line and file info? */ + +@* Storage of names and strings. Both \.{CWEAVE} and \.{CTANGLE} store identifiers, section names and other strings in a large array of |char|s, called |byte_mem|. Information about the names is kept in the array |name_dir|, whose @@ -990,7 +990,7 @@ name_pointer r) /* section name being compared */ @ @<Predec...@>=@+static int section_name_cmp(char **,size_t,name_pointer); -@** Reporting errors to the user. +@* Reporting errors to the user. A global variable called |history| will contain one of four values at the end of every run: |spotless| means that no unusual messages were printed; |harmless_message| means that a message of possible interest @@ -1114,7 +1114,7 @@ and \.{CWEB} prints an error message that is really for the \.{CWEB} maintenance person, not the user. In such cases the program says |confusion("indication of where we are")|. -@** Command line arguments. +@* Command line arguments. The user calls \.{CWEAVE} and \.{CTANGLE} with arguments on the command line. These are either file names or flags to be turned off (beginning with |"-"|) or flags to be turned on (beginning with |"+"|). @@ -1261,7 +1261,7 @@ else fatal( @ @<Complain about arg...@>= fatal("! Filename too long\n", *argv); @.Filename too long@> -@** Output. Here is the code that opens the output file: +@* Output. Here is the code that opens the output file: @^system dependencies@> @<Global var...@>= @@ -1283,4 +1283,4 @@ else { fatal("! Cannot open output file ", tex_file_name); } -@** Index. +@* Index. diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c index 8f18594c465..c4b8d8197ce 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.c +++ b/Build/source/texk/web2c/cwebdir/ctangle.c @@ -1,8 +1,8 @@ /*1:*/ #line 66 "ctangle.w" -/*4:*/ -#line 44 "common.h" +/*5:*/ +#line 49 "common.h" #include <ctype.h> #include <stdbool.h> @@ -12,7 +12,7 @@ #include <stdlib.h> #include <string.h> -/*:4*/ +/*:5*/ #line 67 "ctangle.w" #define banner "This is CTANGLE (Version 4.9)" \ @@ -166,24 +166,24 @@ typedef uint16_t sixteen_bits; extern boolean program; extern int phase; -/*:3*//*5:*/ -#line 74 "common.h" +/*:3*//*6:*/ +#line 79 "common.h" extern char section_text[]; extern char*section_text_end; extern char*id_first; extern char*id_loc; -/*:5*//*6:*/ -#line 92 "common.h" +/*:6*//*7:*/ +#line 97 "common.h" extern char buffer[]; extern char*buffer_end; extern char*loc; extern char*limit; -/*:6*//*7:*/ -#line 109 "common.h" +/*:7*//*8:*/ +#line 114 "common.h" extern int include_depth; extern FILE*file[]; @@ -198,16 +198,16 @@ extern boolean input_has_ended; extern boolean changing; extern boolean web_file_open; -/*:7*//*9:*/ -#line 129 "common.h" +/*:8*//*10:*/ +#line 134 "common.h" extern sixteen_bits section_count; extern boolean changed_section[]; extern boolean change_pending; extern boolean print_where; -/*:9*//*10:*/ -#line 143 "common.h" +/*:10*//*11:*/ +#line 148 "common.h" typedef struct name_info{ char*byte_start; @@ -231,13 +231,13 @@ extern name_pointer hash[]; extern hash_pointer hash_end; extern hash_pointer h; -/*:10*//*12:*/ -#line 187 "common.h" +/*:11*//*13:*/ +#line 194 "common.h" extern int history; -/*:12*//*14:*/ -#line 203 "common.h" +/*:13*//*15:*/ +#line 210 "common.h" extern int argc; extern char**argv; @@ -247,8 +247,8 @@ extern char idx_file_name[]; extern char scn_file_name[]; extern boolean flags[]; -/*:14*//*15:*/ -#line 217 "common.h" +/*:15*//*16:*/ +#line 224 "common.h" extern FILE*C_file; extern FILE*tex_file; @@ -256,7 +256,7 @@ extern FILE*idx_file; extern FILE*scn_file; extern FILE*active_file; -/*:15*/ +/*:16*/ #line 69 "ctangle.w" /*19:*/ @@ -358,41 +358,43 @@ static eight_bits next_control; /*:82*/ #line 71 "ctangle.w" -/*8:*/ -#line 123 "common.h" +/*4:*/ +#line 43 "common.h" + +extern void common_init(void); +extern void print_stats(void); + +/*:4*//*9:*/ +#line 128 "common.h" extern boolean get_line(void); extern void check_complete(void); extern void reset_input(void); -/*:8*//*11:*/ -#line 166 "common.h" +/*:9*//*12:*/ +#line 171 "common.h" -extern boolean names_match(name_pointer,const char*,size_t,eight_bits); extern name_pointer id_lookup(const char*,const char*,eight_bits); extern name_pointer section_lookup(char*,char*,boolean); -extern void init_node(name_pointer); -extern void init_p(name_pointer,eight_bits); extern void print_prefix_name(name_pointer); extern void print_section_name(name_pointer); extern void sprint_section_name(char*,name_pointer); -/*:11*//*13:*/ -#line 190 "common.h" +extern boolean names_match(name_pointer,const char*,size_t,eight_bits); + +extern void init_node(name_pointer); +extern void init_p(name_pointer,eight_bits); + +/*:12*//*14:*/ +#line 197 "common.h" extern int wrap_up(void); extern void err_print(const char*); extern void fatal(const char*,const char*); extern void overflow(const char*); -/*:13*//*16:*/ -#line 225 "common.h" - -extern void common_init(void); -extern void print_stats(void); - -/*:16*//*30:*/ +/*:14*//*30:*/ #line 246 "ctangle.w" static void store_two_bytes(sixteen_bits); diff --git a/Build/source/texk/web2c/cwebdir/ctangle.w b/Build/source/texk/web2c/cwebdir/ctangle.w index 309f4387a9a..82a83ba2b7a 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.w +++ b/Build/source/texk/web2c/cwebdir/ctangle.w @@ -162,8 +162,8 @@ eight_bits t) /* not used by \.{CTANGLE} */ return length(p)==l && strncmp(first,p->byte_start,l)==0; } -@ The common lookup routine refers to separate routines |init_node| and -|init_p| when the data structure grows. Actually |init_p| is called only by +@ The common lookup routine |id_lookup| refers to separate routines |init_node| +and |init_p| when the data structure grows. Actually |init_p| is called only by \.{CWEAVE}, but we need to declare a dummy version so that the loader won't complain of its absence. diff --git a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch index 9505600ff6a..1234139742c 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch @@ -80,7 +80,7 @@ Section 2. @$show_progress {CTWILL}14 =\\{flags}[\.{'p'}]@> @z -Section 4. +Section 5. @x For backward compatibility with pre-{\mc ANSI} compilers, we replace the @@ -97,7 +97,7 @@ And we replace the @-HAVE_GETTEXT@> @z -Section 5. +Section 6. @x @d compress(c) if (loc++<=limit) return c @@ -106,7 +106,7 @@ Section 5. @-c@> @z -Section 6. +Section 7. @x @ Code related to input routines: @@ -115,7 +115,13 @@ Section 6. @-c@> @z -Section 7. +Section 8. + +@x +@f line x /* make |line| an unreserved word */ +@y +@s line x @q/* make |line| an unreserved word */@> +@z @x @d cur_line line[include_depth] /* number of current line in current file */ @@ -129,7 +135,7 @@ Section 7. @$cur_line {CTWILL}7 =\\{line}[\\{include\_depth}]@> @z -Section 10. +Section 11. @x @ Code related to identifier and section name storage: @@ -144,7 +150,7 @@ Section 10. @$root {CTWILL}10 =\\{name\_dir}$\MG$\\{rlink}@> @z -Section 12. +Section 13. @x @ Code related to error handling: @@ -173,7 +179,7 @@ extern const char *use_language; /* prefix to \.{ctwimac.tex} in \TEX/ output */ @$check_for_change {CTWILL}14 =\\{flags}[\.{'c'}]@> @z -Section 15. +Section 16. @x @ Code related to output: @@ -188,16 +194,14 @@ Section 15. @$new_line {CTWILL}15 =\\{putchar}(\.{'\\n'})@> @z -Section 16. +Section 17. @x -@ The procedure that gets everything rolling: +@ The following parameters are sufficient to handle \TEX/ (converted to @y -@r @ The procedure that gets everything rolling: +@r @ The following parameters are sufficient to handle \TEX/ (converted to @z -Section 17. - @x @d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */ @y @@ -1292,6 +1296,14 @@ scrap_pointer p) return; /* this happens, for example, in \&{case} \\{found}: */ @z +Section 141. + +@x + while (q != xmem) { +@y + while (q != xmem) { @+ +@z + Section 143. @x diff --git a/Build/source/texk/web2c/cwebdir/ctwill.bux b/Build/source/texk/web2c/cwebdir/ctwill.bux index 85757e07ce5..ddb98790274 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill.bux +++ b/Build/source/texk/web2c/cwebdir/ctwill.bux @@ -23,15 +23,17 @@ @$changing {COMMON.W}25 \&{boolean}@> @$web_file_open {COMMON.W}25 \&{boolean}@> -@$reset_input {COMMON.W}35 \&{void} (\,)@> +@$get_line {COMMON.W}35 \&{boolean} (\,)@> -@$section_count {COMMON.W}37 \&{sixteen\_bits}@> -@$changed_section {COMMON.W}37 \&{boolean} [\,]@> -@$change_pending {COMMON.W}37 \&{boolean}@> -@$print_where {COMMON.W}37 \&{boolean}@> -@$get_line {COMMON.W}38 \&{boolean} (\,)@> +@$check_complete {COMMON.W}39 \&{void} (\,)@> + +@$reset_input {COMMON.W}40 \&{void} (\,)@> + +@$section_count {COMMON.W}42 \&{sixteen\_bits}@> +@$changed_section {COMMON.W}42 \&{boolean} [\,]@> +@$change_pending {COMMON.W}42 \&{boolean}@> +@$print_where {COMMON.W}42 \&{boolean}@> -@$check_complete {COMMON.W}42 \&{void} (\,)@> @$byte_mem {COMMON.W}43 \&{char} [\,]@> @$byte_mem_end {COMMON.W}43 \&{char} ${*}$@> @$name_dir {COMMON.W}43 \&{name\_info} [\,]@> |