From 52b720b66b564af6ee328050f2278cb4fec53fd1 Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Wed, 16 Aug 2023 09:45:45 +0000 Subject: [PATCH] [CWEB] Section 36 of COMMON is system-dependent. git-svn-id: svn://tug.org/texlive/trunk/Build/source@67943 c570f23f-e606-0410-a88d-b1316a301751 --- texk/web2c/cwebboot.cin | 330 ++++++++++++++++----------------- texk/web2c/cwebdir/ChangeLog | 6 + texk/web2c/cwebdir/comm-w2c.ch | 1 + texk/web2c/cwebdir/common.c | 137 +++++++------- texk/web2c/cwebdir/common.w | 1 + 5 files changed, 242 insertions(+), 233 deletions(-) diff --git a/texk/web2c/cwebboot.cin b/texk/web2c/cwebboot.cin index 79e1b0b9e8..acc31ead5f 100644 --- a/texk/web2c/cwebboot.cin +++ b/texk/web2c/cwebboot.cin @@ -26,20 +26,20 @@ #line 75 "cwebdir/comm-w2c.h" /*:4*//*91:*/ -#line 738 "cwebdir/comm-w2c.ch" +#line 739 "cwebdir/comm-w2c.ch" #if HAVE_GETTEXT #include #else -#line 742 "cwebdir/comm-w2c.ch" +#line 743 "cwebdir/comm-w2c.ch" #define setlocale(a,b) "" #define bindtextdomain(a,b) "" #define textdomain(a) "" #endif -#line 746 "cwebdir/comm-w2c.ch" +#line 747 "cwebdir/comm-w2c.ch" /*:91*//*93:*/ -#line 785 "cwebdir/comm-w2c.ch" +#line 786 "cwebdir/comm-w2c.ch" #include @@ -47,7 +47,7 @@ #include /*:93*//*96:*/ -#line 822 "cwebdir/comm-w2c.ch" +#line 823 "cwebdir/comm-w2c.ch" #define CWEB #include "help.h" @@ -340,7 +340,7 @@ static char change_buffer[buf_size]; static char*change_limit; /*:26*//*42:*/ -#line 544 "cwebdir/common.w" +#line 545 "cwebdir/common.w" sixteen_bits section_count; boolean changed_section[max_sections]; @@ -349,7 +349,7 @@ boolean change_pending; boolean print_where= false; /*:42*//*43:*/ -#line 589 "cwebdir/common.w" +#line 590 "cwebdir/common.w" char byte_mem[max_bytes]; char*byte_mem_end= byte_mem+max_bytes-1; @@ -357,65 +357,65 @@ name_info name_dir[max_names]; name_pointer name_dir_end= name_dir+max_names-1; /*:43*//*44:*/ -#line 600 "cwebdir/common.w" +#line 601 "cwebdir/common.w" char*byte_ptr; name_pointer name_ptr; /*:44*//*46:*/ -#line 620 "cwebdir/common.w" +#line 621 "cwebdir/common.w" name_pointer hash[hash_size]; hash_pointer hash_end= hash+hash_size-1; hash_pointer h; /*:46*//*65:*/ -#line 1001 "cwebdir/common.w" +#line 1002 "cwebdir/common.w" int history= spotless; /*:65*//*73:*/ -#line 1124 "cwebdir/common.w" +#line 1125 "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 453 "cwebdir/comm-w2c.ch" +#line 454 "cwebdir/comm-w2c.ch" char scn_file_name[max_file_name_length]; char check_file_name[max_file_name_length]; -#line 1131 "cwebdir/common.w" +#line 1132 "cwebdir/common.w" boolean flags[128]; /*:73*//*83:*/ -#line 1265 "cwebdir/common.w" +#line 1266 "cwebdir/common.w" FILE*C_file; FILE*tex_file; FILE*idx_file; FILE*scn_file; -#line 583 "cwebdir/comm-w2c.ch" +#line 584 "cwebdir/comm-w2c.ch" FILE*active_file; FILE*check_file; -#line 1271 "cwebdir/common.w" +#line 1272 "cwebdir/common.w" -#line 600 "cwebdir/comm-w2c.ch" +#line 601 "cwebdir/comm-w2c.ch" /*:83*//*86:*/ -#line 628 "cwebdir/comm-w2c.ch" +#line 629 "cwebdir/comm-w2c.ch" const char*use_language= ""; /*:86*//*87:*/ -#line 641 "cwebdir/comm-w2c.ch" +#line 642 "cwebdir/comm-w2c.ch" char cb_banner[max_banner]; string texmf_locale; #ifndef SEPARATORS #define SEPARATORS "://" #endif -#line 647 "cwebdir/comm-w2c.ch" +#line 648 "cwebdir/comm-w2c.ch" char separators[]= SEPARATORS; /*:87*/ @@ -472,23 +472,23 @@ static void prime_the_change_buffer(void); static void check_change(void); /*:33*//*55:*/ -#line 762 "cwebdir/common.w" +#line 763 "cwebdir/common.w" static int web_strcmp(char*,size_t,char*,size_t); static name_pointer add_section_name(name_pointer,int,char*,char*,boolean); static void extend_section_name(name_pointer,char*,char*,boolean); /*:55*//*64:*/ -#line 989 "cwebdir/common.w" +#line 990 "cwebdir/common.w" static int section_name_cmp(char**,size_t,name_pointer); /*:64*//*76:*/ -#line 1184 "cwebdir/common.w" +#line 1185 "cwebdir/common.w" static void scan_args(void); -#line 513 "cwebdir/comm-w2c.ch" +#line 514 "cwebdir/comm-w2c.ch" /*:76*//*98:*/ -#line 835 "cwebdir/comm-w2c.ch" +#line 836 "cwebdir/comm-w2c.ch" static void cb_usage(const_string str); static void cb_usagehelp(const_string*message); @@ -505,7 +505,7 @@ common_init(void) { #line 78 "cwebdir/comm-w2c.ch" /*45:*/ -#line 604 "cwebdir/common.w" +#line 605 "cwebdir/common.w" name_dir->byte_start= byte_ptr= byte_mem; name_ptr= name_dir+1; @@ -513,7 +513,7 @@ name_ptr->byte_start= byte_mem; root= NULL; /*:45*//*47:*/ -#line 627 "cwebdir/common.w" +#line 628 "cwebdir/common.w" for(h= hash;h<=hash_end;*h++= NULL); @@ -521,7 +521,7 @@ for(h= hash;h<=hash_end;*h++= NULL); #line 78 "cwebdir/comm-w2c.ch" /*94:*/ -#line 797 "cwebdir/comm-w2c.ch" +#line 798 "cwebdir/comm-w2c.ch" kpse_set_program_name(argv[0],"cweb"); @@ -530,7 +530,7 @@ kpse_set_program_name(argv[0],"cweb"); #line 85 "cwebdir/comm-w2c.ch" /*92:*/ -#line 747 "cwebdir/comm-w2c.ch" +#line 748 "cwebdir/comm-w2c.ch" setlocale(LC_MESSAGES,setlocale(LC_CTYPE,"")); texmf_locale= kpse_var_expand("${TEXMFLOCALEDIR}"); @@ -549,23 +549,23 @@ textdomain("cweb"); #line 85 "cwebdir/comm-w2c.ch" /*74:*/ -#line 1137 "cwebdir/common.w" +#line 1138 "cwebdir/common.w" -#line 460 "cwebdir/comm-w2c.ch" +#line 461 "cwebdir/comm-w2c.ch" make_xrefs= true; -#line 1139 "cwebdir/common.w" +#line 1140 "cwebdir/common.w" /*:74*/ #line 86 "cwebdir/comm-w2c.ch" #line 101 "cwebdir/common.w" /*84:*/ -#line 600 "cwebdir/comm-w2c.ch" +#line 601 "cwebdir/comm-w2c.ch" scan_args(); if(program==ctangle){ if(check_for_change)/*88:*/ -#line 658 "cwebdir/comm-w2c.ch" +#line 659 "cwebdir/comm-w2c.ch" { if((C_file= fopen(C_file_name,"a"))==NULL) fatal(_("! Cannot open output file "),C_file_name); @@ -582,7 +582,7 @@ fatal(_("! Cannot open output file "),check_file_name); } /*:88*/ -#line 603 "cwebdir/comm-w2c.ch" +#line 604 "cwebdir/comm-w2c.ch" else if((C_file= fopen(C_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),C_file_name); @@ -590,7 +590,7 @@ fatal(_("! Cannot open output file "),C_file_name); } else{ if(check_for_change)/*89:*/ -#line 673 "cwebdir/comm-w2c.ch" +#line 674 "cwebdir/comm-w2c.ch" { if((tex_file= fopen(tex_file_name,"a"))==NULL) fatal(_("! Cannot open output file "),tex_file_name); @@ -607,14 +607,14 @@ fatal(_("! Cannot open output file "),check_file_name); } /*:89*/ -#line 609 "cwebdir/comm-w2c.ch" +#line 610 "cwebdir/comm-w2c.ch" else if((tex_file= fopen(tex_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),tex_file_name); } -#line 1283 "cwebdir/common.w" +#line 1284 "cwebdir/common.w" -#line 618 "cwebdir/comm-w2c.ch" +#line 619 "cwebdir/comm-w2c.ch" /*:84*/ #line 101 "cwebdir/common.w" @@ -786,13 +786,13 @@ boolean get_line(void) restart: if(changing&&include_depth==change_depth) /*38:*/ -#line 469 "cwebdir/common.w" +#line 470 "cwebdir/common.w" { change_line++; if(!input_ln(change_file)){ -#line 239 "cwebdir/comm-w2c.ch" +#line 240 "cwebdir/comm-w2c.ch" err_print(_("! Change file ended without @z")); -#line 473 "cwebdir/common.w" +#line 474 "cwebdir/common.w" buffer[0]= '@';buffer[1]= 'z';limit= buffer+2; } @@ -808,9 +808,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 245 "cwebdir/comm-w2c.ch" +#line 246 "cwebdir/comm-w2c.ch" err_print(_("! Where is the matching @z?")); -#line 489 "cwebdir/common.w" +#line 490 "cwebdir/common.w" } else if(buffer[1]=='z'){ @@ -825,7 +825,7 @@ prime_the_change_buffer();changing= !changing;print_where= true; if(!changing||include_depth> change_depth){ /*37:*/ -#line 452 "cwebdir/common.w" +#line 453 "cwebdir/common.w" { cur_line++; while(!input_ln(cur_file)){ @@ -899,9 +899,9 @@ free(found_filename); cur_line= 0;print_where= true; goto restart; } -#line 233 "cwebdir/comm-w2c.ch" +#line 234 "cwebdir/comm-w2c.ch" include_depth--;err_print(_("! Cannot open include file"));goto restart; -#line 450 "cwebdir/common.w" +#line 451 "cwebdir/common.w" } /*:36*/ @@ -913,7 +913,7 @@ return true; #line 167 "cwebdir/comm-w2c.ch" /*:35*//*39:*/ -#line 501 "cwebdir/common.w" +#line 502 "cwebdir/common.w" void check_complete(void){ @@ -921,24 +921,24 @@ 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 251 "cwebdir/comm-w2c.ch" +#line 252 "cwebdir/comm-w2c.ch" err_print(_("! Change file entry did not match")); -#line 509 "cwebdir/common.w" +#line 510 "cwebdir/common.w" } } /*:39*//*40:*/ -#line 517 "cwebdir/common.w" +#line 518 "cwebdir/common.w" void reset_input(void) { limit= buffer;loc= buffer+1;buffer[0]= ' '; /*41:*/ -#line 532 "cwebdir/common.w" +#line 533 "cwebdir/common.w" -#line 261 "cwebdir/comm-w2c.ch" +#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); @@ -949,11 +949,11 @@ 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 538 "cwebdir/common.w" +#line 539 "cwebdir/common.w" web_file_open= true; -#line 277 "cwebdir/comm-w2c.ch" +#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); @@ -964,10 +964,10 @@ 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 543 "cwebdir/common.w" +#line 544 "cwebdir/common.w" /*:41*/ -#line 522 "cwebdir/common.w" +#line 523 "cwebdir/common.w" include_depth= cur_line= change_line= 0; change_depth= include_depth; @@ -976,7 +976,7 @@ limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; } /*:40*//*48:*/ -#line 632 "cwebdir/common.w" +#line 633 "cwebdir/common.w" name_pointer id_lookup( @@ -991,17 +991,17 @@ name_pointer p; if(last==NULL)for(last= first;*last!='\0';last++); l= (size_t)(last-first); /*49:*/ -#line 655 "cwebdir/common.w" +#line 656 "cwebdir/common.w" h= (int)((eight_bits)*i); while(++ilink; @@ -1011,30 +1011,30 @@ p->link= hash[h];hash[h]= p; } /*:50*/ -#line 646 "cwebdir/common.w" +#line 647 "cwebdir/common.w" if(p==name_ptr)/*51:*/ -#line 674 "cwebdir/common.w" +#line 675 "cwebdir/common.w" { -#line 299 "cwebdir/comm-w2c.ch" +#line 300 "cwebdir/comm-w2c.ch" if(byte_ptr+l> byte_mem_end)overflow(_("byte memory")); if(name_ptr>=name_dir_end)overflow(_("name")); -#line 677 "cwebdir/common.w" +#line 678 "cwebdir/common.w" strncpy(byte_ptr,first,l); (++name_ptr)->byte_start= byte_ptr+= l; -#line 306 "cwebdir/comm-w2c.ch" +#line 307 "cwebdir/comm-w2c.ch" if(program!=ctangle)p->ilk= t,init_node(p); -#line 680 "cwebdir/common.w" +#line 681 "cwebdir/common.w" } /*:51*/ -#line 647 "cwebdir/common.w" +#line 648 "cwebdir/common.w" return p; } /*:48*//*52:*/ -#line 706 "cwebdir/common.w" +#line 707 "cwebdir/common.w" void print_section_name( @@ -1053,7 +1053,7 @@ if(q)term_write("...",3); } /*:52*//*53:*/ -#line 723 "cwebdir/common.w" +#line 724 "cwebdir/common.w" void sprint_section_name( @@ -1073,7 +1073,7 @@ s= p->byte_start; } /*:53*//*54:*/ -#line 741 "cwebdir/common.w" +#line 742 "cwebdir/common.w" void print_prefix_name( @@ -1086,7 +1086,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); } /*:54*//*56:*/ -#line 767 "cwebdir/common.w" +#line 768 "cwebdir/common.w" static int web_strcmp( char*j, @@ -1104,7 +1104,7 @@ else return greater; } /*:56*//*57:*/ -#line 796 "cwebdir/common.w" +#line 797 "cwebdir/common.w" static name_pointer add_section_name( @@ -1117,10 +1117,10 @@ boolean ispref) name_pointer p= name_ptr; char*s= first_chunk(p); size_t name_len= (size_t)(last-first+(int)ispref); -#line 313 "cwebdir/comm-w2c.ch" +#line 314 "cwebdir/comm-w2c.ch" if(s+name_len> byte_mem_end)overflow(_("byte memory")); if(name_ptr+1>=name_dir_end)overflow(_("name")); -#line 810 "cwebdir/common.w" +#line 811 "cwebdir/common.w" (++name_ptr)->byte_start= byte_ptr= s+name_len; if(ispref){ *(byte_ptr-1)= ' '; @@ -1136,7 +1136,7 @@ return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); } /*:57*//*58:*/ -#line 824 "cwebdir/common.w" +#line 825 "cwebdir/common.w" static void extend_section_name( @@ -1148,23 +1148,23 @@ boolean ispref) char*s; name_pointer q= p+1; size_t name_len= (size_t)(last-first+(int)ispref); -#line 320 "cwebdir/comm-w2c.ch" +#line 321 "cwebdir/comm-w2c.ch" if(name_ptr>=name_dir_end)overflow(_("name")); -#line 836 "cwebdir/common.w" +#line 837 "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 326 "cwebdir/comm-w2c.ch" +#line 327 "cwebdir/comm-w2c.ch" if(s+name_len> byte_mem_end)overflow(_("byte memory")); -#line 841 "cwebdir/common.w" +#line 842 "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 852 "cwebdir/common.w" +#line 853 "cwebdir/common.w" name_pointer section_lookup( @@ -1179,7 +1179,7 @@ name_pointer par= NULL; size_t name_len= (size_t)(last-first+1); /*60:*/ -#line 876 "cwebdir/common.w" +#line 877 "cwebdir/common.w" while(p){ c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); @@ -1189,14 +1189,14 @@ par= p; p= (c==less?p->llink:p->rlink); }else{ if(r!=NULL){ -#line 332 "cwebdir/comm-w2c.ch" +#line 333 "cwebdir/comm-w2c.ch" fputs(_("\n! Ambiguous prefix: matches <"),stdout); -#line 886 "cwebdir/common.w" +#line 887 "cwebdir/common.w" print_prefix_name(p); -#line 338 "cwebdir/comm-w2c.ch" +#line 339 "cwebdir/comm-w2c.ch" fputs(_(">\n and <"),stdout); -#line 889 "cwebdir/common.w" +#line 890 "cwebdir/common.w" print_prefix_name(r); err_print(">"); return name_dir; @@ -1210,27 +1210,27 @@ p= q,q= NULL; } /*:60*/ -#line 866 "cwebdir/common.w" +#line 867 "cwebdir/common.w" /*61:*/ -#line 901 "cwebdir/common.w" +#line 902 "cwebdir/common.w" if(r==NULL) return add_section_name(par,c,first,last+1,ispref); /*:61*/ -#line 867 "cwebdir/common.w" +#line 868 "cwebdir/common.w" /*62:*/ -#line 909 "cwebdir/common.w" +#line 910 "cwebdir/common.w" switch(section_name_cmp(&first,name_len,r)){ case prefix: if(!ispref){ -#line 344 "cwebdir/comm-w2c.ch" +#line 345 "cwebdir/comm-w2c.ch" fputs(_("\n! New name is a prefix of <"),stdout); -#line 915 "cwebdir/common.w" +#line 916 "cwebdir/common.w" print_section_name(r); err_print(">"); @@ -1242,34 +1242,34 @@ case extension:if(!ispref||first<=last) extend_section_name(r,first,last+1,ispref); break; case bad_extension: -#line 350 "cwebdir/comm-w2c.ch" +#line 351 "cwebdir/comm-w2c.ch" fputs(_("\n! New name extends <"),stdout); -#line 927 "cwebdir/common.w" +#line 928 "cwebdir/common.w" print_section_name(r); err_print(">"); break; default: -#line 356 "cwebdir/comm-w2c.ch" +#line 357 "cwebdir/comm-w2c.ch" fputs(_("\n! Section name incompatible with <"),stdout); -#line 933 "cwebdir/common.w" +#line 934 "cwebdir/common.w" print_prefix_name(r); -#line 362 "cwebdir/comm-w2c.ch" +#line 363 "cwebdir/comm-w2c.ch" fputs(_(">,\n which abbreviates <"),stdout); -#line 936 "cwebdir/common.w" +#line 937 "cwebdir/common.w" print_section_name(r); err_print(">"); } return r; /*:62*/ -#line 868 "cwebdir/common.w" +#line 869 "cwebdir/common.w" } /*:59*//*63:*/ -#line 957 "cwebdir/common.w" +#line 958 "cwebdir/common.w" static int section_name_cmp( char**pfirst, @@ -1303,7 +1303,7 @@ default:return c; } /*:63*//*66:*/ -#line 1011 "cwebdir/common.w" +#line 1012 "cwebdir/common.w" void err_print( @@ -1311,15 +1311,15 @@ const char*s) { *s=='!'?printf("\n%s",s):printf("%s",s); if(web_file_open)/*67:*/ -#line 1030 "cwebdir/common.w" +#line 1031 "cwebdir/common.w" {char*k,*l; if(changing&&include_depth==change_depth) -#line 370 "cwebdir/comm-w2c.ch" +#line 371 "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 1036 "cwebdir/common.w" +#line 1037 "cwebdir/common.w" l= (loc>=limit?limit:loc); if(l> buffer){ for(k= buffer;k 0){ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ -#line 1243 "cwebdir/common.w" +#line 1244 "cwebdir/common.w" -#line 526 "cwebdir/comm-w2c.ch" +#line 527 "cwebdir/comm-w2c.ch" { if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0) /*97:*/ -#line 826 "cwebdir/comm-w2c.ch" +#line 827 "cwebdir/comm-w2c.ch" cb_usagehelp(program==ctangle?CTANGLEHELP: program==cweave?CWEAVEHELP:CTWILLHELP); /*:97*/ -#line 529 "cwebdir/comm-w2c.ch" +#line 530 "cwebdir/comm-w2c.ch" if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0) /*100:*/ -#line 872 "cwebdir/comm-w2c.ch" +#line 873 "cwebdir/comm-w2c.ch" printversionandexit(cb_banner, program==ctwill?"Donald E. Knuth":"Silvio Levy and Donald E. Knuth", @@ -1465,7 +1465,7 @@ NULL,"Contemporary development on https://github.com/ascherer/cweb.\n"); /*:100*/ -#line 532 "cwebdir/comm-w2c.ch" +#line 533 "cwebdir/comm-w2c.ch" if(strcmp("-verbose",*argv)==0||strcmp("--verbose",*argv)==0) @@ -1479,15 +1479,15 @@ case'v':show_banner= show_progress= show_happiness= true;continue; case'q':show_banner= show_progress= show_happiness= false;continue; case'd': if(sscanf(++dot_pos,"%u",&kpathsea_debug)!=1)/*81:*/ -#line 569 "cwebdir/comm-w2c.ch" +#line 570 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1258 "cwebdir/common.w" +#line 1259 "cwebdir/common.w" -#line 577 "cwebdir/comm-w2c.ch" +#line 578 "cwebdir/comm-w2c.ch" /*:81*/ -#line 544 "cwebdir/comm-w2c.ch" +#line 545 "cwebdir/comm-w2c.ch" while(isdigit(*dot_pos))dot_pos++; dot_pos--; @@ -1498,35 +1498,35 @@ default:flags[(eight_bits)*dot_pos]= flag_change;continue; break; } } -#line 1246 "cwebdir/common.w" +#line 1247 "cwebdir/common.w" -#line 569 "cwebdir/comm-w2c.ch" +#line 570 "cwebdir/comm-w2c.ch" /*:80*/ -#line 1167 "cwebdir/common.w" +#line 1168 "cwebdir/common.w" else{ s= name_pos= *argv;dot_pos= NULL; -#line 500 "cwebdir/comm-w2c.ch" +#line 501 "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 1174 "cwebdir/common.w" +#line 1175 "cwebdir/common.w" if(!found_web)/*77:*/ -#line 1193 "cwebdir/common.w" +#line 1194 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 577 "cwebdir/comm-w2c.ch" +#line 578 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1260 "cwebdir/common.w" +#line 1261 "cwebdir/common.w" /*:82*/ -#line 1196 "cwebdir/common.w" +#line 1197 "cwebdir/common.w" if(dot_pos==NULL) sprintf(web_file_name,"%s.w",*argv); @@ -1534,7 +1534,7 @@ else{ strcpy(web_file_name,*argv); *dot_pos= '\0'; } -#line 1204 "cwebdir/common.w" +#line 1205 "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); @@ -1543,22 +1543,22 @@ found_web= true; } /*:77*/ -#line 1175 "cwebdir/common.w" +#line 1176 "cwebdir/common.w" else if(!found_change)/*78:*/ -#line 1211 "cwebdir/common.w" +#line 1212 "cwebdir/common.w" { if(strcmp(*argv,"-")!=0){ if(s-*argv> max_file_name_length-4) /*82:*/ -#line 577 "cwebdir/comm-w2c.ch" +#line 578 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1260 "cwebdir/common.w" +#line 1261 "cwebdir/common.w" /*:82*/ -#line 1215 "cwebdir/common.w" +#line 1216 "cwebdir/common.w" if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); @@ -1568,21 +1568,21 @@ found_change= true; } /*:78*/ -#line 1176 "cwebdir/common.w" +#line 1177 "cwebdir/common.w" else if(!found_out)/*79:*/ -#line 1223 "cwebdir/common.w" +#line 1224 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 577 "cwebdir/comm-w2c.ch" +#line 578 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1260 "cwebdir/common.w" +#line 1261 "cwebdir/common.w" /*:82*/ -#line 1226 "cwebdir/common.w" +#line 1227 "cwebdir/common.w" if(dot_pos==NULL){ sprintf(tex_file_name,"%s.tex",*argv); @@ -1600,36 +1600,36 @@ found_out= true; } /*:79*/ -#line 1177 "cwebdir/common.w" +#line 1178 "cwebdir/common.w" else/*81:*/ -#line 569 "cwebdir/comm-w2c.ch" +#line 570 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1258 "cwebdir/common.w" +#line 1259 "cwebdir/common.w" -#line 577 "cwebdir/comm-w2c.ch" +#line 578 "cwebdir/comm-w2c.ch" /*:81*/ -#line 1178 "cwebdir/common.w" +#line 1179 "cwebdir/common.w" } } if(!found_web)/*81:*/ -#line 569 "cwebdir/comm-w2c.ch" +#line 570 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1258 "cwebdir/common.w" +#line 1259 "cwebdir/common.w" -#line 577 "cwebdir/comm-w2c.ch" +#line 578 "cwebdir/comm-w2c.ch" /*:81*/ -#line 1181 "cwebdir/common.w" +#line 1182 "cwebdir/common.w" } /*:75*//*99:*/ -#line 839 "cwebdir/comm-w2c.ch" +#line 840 "cwebdir/comm-w2c.ch" static void cb_usage(const_string str) { @@ -1661,7 +1661,7 @@ history= spotless;exit(wrap_up()); } /*:99*//*101:*/ -#line 880 "cwebdir/comm-w2c.ch" +#line 881 "cwebdir/comm-w2c.ch" void cb_show_banner(void) { diff --git a/texk/web2c/cwebdir/ChangeLog b/texk/web2c/cwebdir/ChangeLog index 9a2108a91e..dca3f68410 100644 --- a/texk/web2c/cwebdir/ChangeLog +++ b/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,9 @@ +2023-08-16 Andreas Scherer + + * comm-w2c.ch, + * common.c, + * common.w: Section 36 of COMMON is system-dependent. + 2023-08-13 Andreas Scherer * comm-w2c.h, diff --git a/texk/web2c/cwebdir/comm-w2c.ch b/texk/web2c/cwebdir/comm-w2c.ch index 76721f5701..a14240a22a 100644 --- a/texk/web2c/cwebdir/comm-w2c.ch +++ b/texk/web2c/cwebdir/comm-w2c.ch @@ -223,6 +223,7 @@ The remainder of the \.{@@i} line after the file name is ignored. for (; k>=cur_file_name; k--) *(k+l+1)=*k; strcpy(cur_file_name,temp_file_name); cur_file_name[l]='/'; /* \UNIX/ pathname separator */ +@^system dependencies@> if ((cur_file=fopen(cur_file_name,"r"))!=NULL) { cur_line=0; print_where=true; goto restart; /* success */ diff --git a/texk/web2c/cwebdir/common.c b/texk/web2c/cwebdir/common.c index 2f43a1278d..ccedc5e914 100644 --- a/texk/web2c/cwebdir/common.c +++ b/texk/web2c/cwebdir/common.c @@ -277,7 +277,7 @@ static char change_buffer[buf_size]; static char*change_limit; /*:26*//*42:*/ -#line 544 "common.w" +#line 545 "common.w" sixteen_bits section_count; boolean changed_section[max_sections]; @@ -286,7 +286,7 @@ boolean change_pending; boolean print_where= false; /*:42*//*43:*/ -#line 589 "common.w" +#line 590 "common.w" char byte_mem[max_bytes]; char*byte_mem_end= byte_mem+max_bytes-1; @@ -294,25 +294,25 @@ name_info name_dir[max_names]; name_pointer name_dir_end= name_dir+max_names-1; /*:43*//*44:*/ -#line 600 "common.w" +#line 601 "common.w" char*byte_ptr; name_pointer name_ptr; /*:44*//*46:*/ -#line 620 "common.w" +#line 621 "common.w" name_pointer hash[hash_size]; hash_pointer hash_end= hash+hash_size-1; hash_pointer h; /*:46*//*65:*/ -#line 1001 "common.w" +#line 1002 "common.w" int history= spotless; /*:65*//*73:*/ -#line 1124 "common.w" +#line 1125 "common.w" int argc; char**argv; @@ -323,7 +323,7 @@ char scn_file_name[max_file_name_length]; boolean flags[128]; /*:73*//*83:*/ -#line 1265 "common.w" +#line 1266 "common.w" FILE*C_file; FILE*tex_file; @@ -383,18 +383,18 @@ static void prime_the_change_buffer(void); static void check_change(void); /*:33*//*55:*/ -#line 762 "common.w" +#line 763 "common.w" static int web_strcmp(char*,size_t,char*,size_t); static name_pointer add_section_name(name_pointer,int,char*,char*,boolean); static void extend_section_name(name_pointer,char*,char*,boolean); /*:55*//*64:*/ -#line 989 "common.w" +#line 990 "common.w" static int section_name_cmp(char**,size_t,name_pointer); /*:64*//*76:*/ -#line 1184 "common.w" +#line 1185 "common.w" static void scan_args(void); /*:76*/ @@ -408,7 +408,7 @@ void common_init(void) { /*45:*/ -#line 604 "common.w" +#line 605 "common.w" name_dir->byte_start= byte_ptr= byte_mem; name_ptr= name_dir+1; @@ -416,7 +416,7 @@ name_ptr->byte_start= byte_mem; root= NULL; /*:45*//*47:*/ -#line 627 "common.w" +#line 628 "common.w" for(h= hash;h<=hash_end;*h++= NULL); @@ -424,7 +424,7 @@ for(h= hash;h<=hash_end;*h++= NULL); #line 99 "common.w" /*74:*/ -#line 1137 "common.w" +#line 1138 "common.w" show_banner= show_happiness= show_progress= make_xrefs= true; @@ -432,7 +432,7 @@ show_banner= show_happiness= show_progress= make_xrefs= true; #line 100 "common.w" /*84:*/ -#line 1272 "common.w" +#line 1273 "common.w" scan_args(); if(program==ctangle){ @@ -600,7 +600,7 @@ boolean get_line(void) restart: if(changing&&include_depth==change_depth) /*38:*/ -#line 469 "common.w" +#line 470 "common.w" { change_line++; if(!input_ln(change_file)){ @@ -635,7 +635,7 @@ prime_the_change_buffer();changing= !changing;print_where= true; if(!changing||include_depth> change_depth){ /*37:*/ -#line 452 "common.w" +#line 453 "common.w" { cur_line++; while(!input_ln(cur_file)){ @@ -715,6 +715,7 @@ if(k+l+2>=cur_file_name_end)too_long(); for(;k>=cur_file_name;k--)*(k+l+1)= *k; strcpy(cur_file_name,temp_file_name); cur_file_name[l]= '/'; + if((cur_file= fopen(cur_file_name,"r"))!=NULL){ cur_line= 0;print_where= true; goto restart; @@ -731,7 +732,7 @@ return true; } /*:35*//*39:*/ -#line 501 "common.w" +#line 502 "common.w" void check_complete(void){ @@ -745,14 +746,14 @@ err_print("! Change file entry did not match"); } /*:39*//*40:*/ -#line 517 "common.w" +#line 518 "common.w" void reset_input(void) { limit= buffer;loc= buffer+1;buffer[0]= ' '; /*41:*/ -#line 532 "common.w" +#line 533 "common.w" if((web_file= fopen(web_file_name,"r"))==NULL){ strcpy(web_file_name,alt_web_file_name); @@ -766,7 +767,7 @@ if((change_file= fopen(change_file_name,"r"))==NULL) fatal("! Cannot open change file ",change_file_name); /*:41*/ -#line 522 "common.w" +#line 523 "common.w" include_depth= cur_line= change_line= 0; change_depth= include_depth; @@ -775,7 +776,7 @@ limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; } /*:40*//*48:*/ -#line 632 "common.w" +#line 633 "common.w" name_pointer id_lookup( @@ -790,17 +791,17 @@ name_pointer p; if(last==NULL)for(last= first;*last!='\0';last++); l= (size_t)(last-first); /*49:*/ -#line 655 "common.w" +#line 656 "common.w" h= (int)((eight_bits)*i); while(++ilink; @@ -810,10 +811,10 @@ p->link= hash[h];hash[h]= p; } /*:50*/ -#line 646 "common.w" +#line 647 "common.w" if(p==name_ptr)/*51:*/ -#line 674 "common.w" +#line 675 "common.w" { if(byte_ptr+l> byte_mem_end)overflow("byte memory"); if(name_ptr>=name_dir_end)overflow("name"); @@ -823,13 +824,13 @@ if(program==cweave)p->ilk= t,init_node(p); } /*:51*/ -#line 647 "common.w" +#line 648 "common.w" return p; } /*:48*//*52:*/ -#line 706 "common.w" +#line 707 "common.w" void print_section_name( @@ -848,7 +849,7 @@ if(q)term_write("...",3); } /*:52*//*53:*/ -#line 723 "common.w" +#line 724 "common.w" void sprint_section_name( @@ -868,7 +869,7 @@ s= p->byte_start; } /*:53*//*54:*/ -#line 741 "common.w" +#line 742 "common.w" void print_prefix_name( @@ -881,7 +882,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); } /*:54*//*56:*/ -#line 767 "common.w" +#line 768 "common.w" static int web_strcmp( char*j, @@ -899,7 +900,7 @@ else return greater; } /*:56*//*57:*/ -#line 796 "common.w" +#line 797 "common.w" static name_pointer add_section_name( @@ -929,7 +930,7 @@ return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); } /*:57*//*58:*/ -#line 824 "common.w" +#line 825 "common.w" static void extend_section_name( @@ -953,7 +954,7 @@ if(ispref)*(byte_ptr-1)= ' '; } /*:58*//*59:*/ -#line 852 "common.w" +#line 853 "common.w" name_pointer section_lookup( @@ -968,7 +969,7 @@ name_pointer par= NULL; size_t name_len= (size_t)(last-first+1); /*60:*/ -#line 876 "common.w" +#line 877 "common.w" while(p){ c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); @@ -995,19 +996,19 @@ p= q,q= NULL; } /*:60*/ -#line 866 "common.w" +#line 867 "common.w" /*61:*/ -#line 901 "common.w" +#line 902 "common.w" if(r==NULL) return add_section_name(par,c,first,last+1,ispref); /*:61*/ -#line 867 "common.w" +#line 868 "common.w" /*62:*/ -#line 909 "common.w" +#line 910 "common.w" switch(section_name_cmp(&first,name_len,r)){ @@ -1041,12 +1042,12 @@ err_print(">"); return r; /*:62*/ -#line 868 "common.w" +#line 869 "common.w" } /*:59*//*63:*/ -#line 957 "common.w" +#line 958 "common.w" static int section_name_cmp( char**pfirst, @@ -1080,7 +1081,7 @@ default:return c; } /*:63*//*66:*/ -#line 1011 "common.w" +#line 1012 "common.w" void err_print( @@ -1088,7 +1089,7 @@ const char*s) { *s=='!'?printf("\n%s",s):printf("%s",s); if(web_file_open)/*67:*/ -#line 1030 "common.w" +#line 1031 "common.w" {char*k,*l; if(changing&&include_depth==change_depth) @@ -1109,20 +1110,20 @@ putchar(' '); } /*:67*/ -#line 1017 "common.w" +#line 1018 "common.w" update_terminal();mark_error(); } /*:66*//*68:*/ -#line 1063 "common.w" +#line 1064 "common.w" int wrap_up(void){ if(show_progress)new_line(); if(show_stats) print_stats(); /*69:*/ -#line 1073 "common.w" +#line 1074 "common.w" switch(history){ case spotless: @@ -1136,14 +1137,14 @@ puts("(That was a fatal error, my friend.)"); } /*:69*/ -#line 1068 "common.w" +#line 1069 "common.w" if(history> harmless_message)return EXIT_FAILURE; else return EXIT_SUCCESS; } /*:68*//*70:*/ -#line 1091 "common.w" +#line 1092 "common.w" void fatal( const char*s,const char*t) @@ -1154,7 +1155,7 @@ history= fatal_message;exit(wrap_up()); } /*:70*//*71:*/ -#line 1102 "common.w" +#line 1103 "common.w" void overflow( const char*t) @@ -1164,7 +1165,7 @@ printf("\n! Sorry, %s capacity exceeded",t);fatal("",""); /*:71*//*75:*/ -#line 1155 "common.w" +#line 1156 "common.w" static void scan_args(void) @@ -1178,13 +1179,13 @@ boolean found_web= false,found_change= false,found_out= false; strcpy(change_file_name,"/dev/null"); while(--argc> 0){ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ -#line 1243 "common.w" +#line 1244 "common.w" for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) flags[(eight_bits)*dot_pos]= flag_change; /*:80*/ -#line 1167 "common.w" +#line 1168 "common.w" else{ s= name_pos= *argv;dot_pos= NULL; @@ -1193,17 +1194,17 @@ if(*s=='.')dot_pos= s++; else if(*s=='/')dot_pos= NULL,name_pos= ++s; else s++; if(!found_web)/*77:*/ -#line 1193 "common.w" +#line 1194 "common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 1259 "common.w" +#line 1260 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1196 "common.w" +#line 1197 "common.w" if(dot_pos==NULL) sprintf(web_file_name,"%s.w",*argv); @@ -1220,21 +1221,21 @@ found_web= true; } /*:77*/ -#line 1175 "common.w" +#line 1176 "common.w" else if(!found_change)/*78:*/ -#line 1211 "common.w" +#line 1212 "common.w" { if(strcmp(*argv,"-")!=0){ if(s-*argv> max_file_name_length-4) /*82:*/ -#line 1259 "common.w" +#line 1260 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1215 "common.w" +#line 1216 "common.w" if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); @@ -1244,20 +1245,20 @@ found_change= true; } /*:78*/ -#line 1176 "common.w" +#line 1177 "common.w" else if(!found_out)/*79:*/ -#line 1223 "common.w" +#line 1224 "common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 1259 "common.w" +#line 1260 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1226 "common.w" +#line 1227 "common.w" if(dot_pos==NULL){ sprintf(tex_file_name,"%s.tex",*argv); @@ -1275,10 +1276,10 @@ found_out= true; } /*:79*/ -#line 1177 "common.w" +#line 1178 "common.w" else/*81:*/ -#line 1247 "common.w" +#line 1248 "common.w" { if(program==ctangle) @@ -1292,12 +1293,12 @@ else fatal( } /*:81*/ -#line 1178 "common.w" +#line 1179 "common.w" } } if(!found_web)/*81:*/ -#line 1247 "common.w" +#line 1248 "common.w" { if(program==ctangle) @@ -1311,7 +1312,7 @@ else fatal( } /*:81*/ -#line 1181 "common.w" +#line 1182 "common.w" } diff --git a/texk/web2c/cwebdir/common.w b/texk/web2c/cwebdir/common.w index 83e37c14ac..b95dfdaa6b 100644 --- a/texk/web2c/cwebdir/common.w +++ b/texk/web2c/cwebdir/common.w @@ -441,6 +441,7 @@ The remainder of the \.{@@i} line after the file name is ignored. for (; k>=cur_file_name; k--) *(k+l+1)=*k; strcpy(cur_file_name,temp_file_name); cur_file_name[l]='/'; /* \UNIX/ pathname separator */ +@^system dependencies@> if ((cur_file=fopen(cur_file_name,"r"))!=NULL) { cur_line=0; print_where=true; goto restart; /* success */