texlive[54920] Build/source/texk/web2c: [CWEB] Purge standard

commits+ascherer at tug.org commits+ascherer at tug.org
Tue Apr 28 09:10:49 CEST 2020


Revision: 54920
          http://tug.org/svn/texlive?view=revision&revision=54920
Author:   ascherer
Date:     2020-04-28 09:10:49 +0200 (Tue, 28 Apr 2020)
Log Message:
-----------
[CWEB] Purge standard interface of common.w.

<kpathsea/kpathsea.h> #include's a large set of standard C header files.
With some CWEB magic, redundant inclusion is greatly reduced---just for
fun and education.

Note that neither ctangle.w nor cweave.w can be treated in a similar
fashion, because they do not include the KPathSea interface, not even
through comm-w2c.h.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/ChangeLog
    trunk/Build/source/texk/web2c/cwebboot.cin
    trunk/Build/source/texk/web2c/cwebdir/ChangeLog
    trunk/Build/source/texk/web2c/cwebdir/comm-w2c.ch

Modified: trunk/Build/source/texk/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ChangeLog	2020-04-27 23:55:27 UTC (rev 54919)
+++ trunk/Build/source/texk/web2c/ChangeLog	2020-04-28 07:10:49 UTC (rev 54920)
@@ -1,3 +1,7 @@
+2020-04-28  Andreas Scherer  <https://ascherer.github.io>
+
+	* cwebboot.cin: Purge standard headers already in KPathSea.
+
 2020-04-27  Andreas Scherer  <https://ascherer.github.io>
 
 	* ctangleboot.cin,

Modified: trunk/Build/source/texk/web2c/cwebboot.cin
===================================================================
--- trunk/Build/source/texk/web2c/cwebboot.cin	2020-04-27 23:55:27 UTC (rev 54919)
+++ trunk/Build/source/texk/web2c/cwebboot.cin	2020-04-28 07:10:49 UTC (rev 54920)
@@ -1,37 +1,14 @@
 /*1:*/
 #line 58 "cwebdir/common.w"
 
-/*5:*/
-#line 102 "cwebdir/common.w"
+/*85:*/
+#line 1201 "cwebdir/comm-w2c.ch"
 
-#include <ctype.h> 
-
-/*:5*//*8:*/
-#line 165 "cwebdir/common.w"
-
-#include <stdio.h> 
-
-/*:8*//*22:*/
-#line 471 "cwebdir/common.w"
-
-#include <stdlib.h>  
-
-/*:22*//*81:*/
-#line 1135 "cwebdir/comm-w2c.ch"
-
-#include <string.h> 
-#line 1417 "cwebdir/common.w"
-
-#line 1142 "cwebdir/comm-w2c.ch"
-/*:81*//*85:*/
-#line 1181 "cwebdir/comm-w2c.ch"
-
 #include <stdbool.h>  
 #include <stddef.h>  
-#include <stdint.h>  
 
 /*:85*//*88:*/
-#line 1223 "cwebdir/comm-w2c.ch"
+#line 1242 "cwebdir/comm-w2c.ch"
 
 #ifndef HAVE_GETTEXT
 #define HAVE_GETTEXT 0
@@ -48,7 +25,7 @@
 #endif
 
 /*:88*//*90:*/
-#line 1313 "cwebdir/comm-w2c.ch"
+#line 1332 "cwebdir/comm-w2c.ch"
 
 typedef bool boolean;
 #define HAVE_BOOLEAN
@@ -107,6 +84,7 @@
 
 #define too_long() {include_depth--; \
 err_print(_("! Include file name too long") ) ;goto restart;} \
+ \
 
 #define max_bytes 1000000 \
 
@@ -195,7 +173,7 @@
 #line 76 "cwebdir/common.w"
 
 /*:2*//*6:*/
-#line 95 "cwebdir/comm-w2c.ch"
+#line 104 "cwebdir/comm-w2c.ch"
 
 char section_text[longest_name+1];
 char*section_text_end= section_text+longest_name;
@@ -211,6 +189,7 @@
 char*limit= buffer;
 char*loc= buffer;
 
+#line 129 "cwebdir/comm-w2c.ch"
 /*:7*//*10:*/
 #line 214 "cwebdir/common.w"
 
@@ -258,7 +237,7 @@
 }dummy;
 
 /*:40*//*55:*/
-#line 718 "cwebdir/comm-w2c.ch"
+#line 740 "cwebdir/comm-w2c.ch"
 
 void*equiv_or_xref;
 #line 1064 "cwebdir/common.w"
@@ -300,10 +279,10 @@
 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 879 "cwebdir/comm-w2c.ch"
+#line 901 "cwebdir/comm-w2c.ch"
 char scn_file_name[max_file_name_length];
 char check_file_name[max_file_name_length];
-#line 886 "cwebdir/comm-w2c.ch"
+#line 908 "cwebdir/comm-w2c.ch"
 boolean flags[128];
 const char*use_language= "";
 #line 1228 "cwebdir/common.w"
@@ -314,15 +293,15 @@
 FILE*C_file;
 FILE*tex_file;
 FILE*idx_file;
-#line 1068 "cwebdir/comm-w2c.ch"
+#line 1090 "cwebdir/comm-w2c.ch"
 FILE*scn_file;
 FILE*check_file;
-#line 1075 "cwebdir/comm-w2c.ch"
+#line 1097 "cwebdir/comm-w2c.ch"
 FILE*active_file;
 char*found_filename;
 #line 1376 "cwebdir/common.w"
 
-#line 1092 "cwebdir/comm-w2c.ch"
+#line 1114 "cwebdir/comm-w2c.ch"
 /*:77*/
 #line 61 "cwebdir/common.w"
 
@@ -337,7 +316,7 @@
 char*change_limit;
 
 /*:11*//*86:*/
-#line 1197 "cwebdir/comm-w2c.ch"
+#line 1216 "cwebdir/comm-w2c.ch"
 
 char cb_banner[max_banner];
 string texmf_locale;
@@ -352,7 +331,7 @@
 /*33:*/
 #line 650 "cwebdir/common.w"
 
-#line 447 "cwebdir/comm-w2c.ch"
+#line 469 "cwebdir/comm-w2c.ch"
 extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
 #line 652 "cwebdir/common.w"
 
@@ -359,7 +338,7 @@
 /*:33*//*38:*/
 #line 703 "cwebdir/common.w"
 
-#line 477 "cwebdir/comm-w2c.ch"
+#line 499 "cwebdir/comm-w2c.ch"
 extern void init_p(name_pointer,eight_bits);
 #line 705 "cwebdir/common.w"
 
@@ -366,7 +345,7 @@
 /*:38*//*46:*/
 #line 852 "cwebdir/common.w"
 
-#line 557 "cwebdir/comm-w2c.ch"
+#line 579 "cwebdir/comm-w2c.ch"
 extern void init_node(name_pointer);
 #line 854 "cwebdir/common.w"
 
@@ -373,7 +352,7 @@
 /*:46*//*53:*/
 #line 1017 "cwebdir/common.w"
 
-#line 683 "cwebdir/comm-w2c.ch"
+#line 705 "cwebdir/comm-w2c.ch"
 static int section_name_cmp(char**,int,name_pointer);
 #line 1019 "cwebdir/common.w"
 
@@ -380,7 +359,7 @@
 /*:53*//*57:*/
 #line 1092 "cwebdir/common.w"
 
-#line 725 "cwebdir/comm-w2c.ch"
+#line 747 "cwebdir/comm-w2c.ch"
 extern void err_print(const char*);
 #line 1094 "cwebdir/common.w"
 
@@ -387,16 +366,16 @@
 /*:57*//*60:*/
 #line 1140 "cwebdir/common.w"
 
-#line 752 "cwebdir/comm-w2c.ch"
+#line 774 "cwebdir/comm-w2c.ch"
 extern int wrap_up(void);
 extern void print_stats(void);
 #line 1143 "cwebdir/common.w"
 
-#line 763 "cwebdir/comm-w2c.ch"
+#line 785 "cwebdir/comm-w2c.ch"
 /*:60*//*63:*/
 #line 1173 "cwebdir/common.w"
 
-#line 826 "cwebdir/comm-w2c.ch"
+#line 848 "cwebdir/comm-w2c.ch"
 extern void fatal(const char*,const char*);
 extern void overflow(const char*);
 #line 1175 "cwebdir/common.w"
@@ -404,12 +383,12 @@
 /*:63*//*69:*/
 #line 1251 "cwebdir/common.w"
 
-#line 908 "cwebdir/comm-w2c.ch"
+#line 930 "cwebdir/comm-w2c.ch"
 static void scan_args(void);
 #line 1253 "cwebdir/common.w"
 
 /*:69*//*83:*/
-#line 1157 "cwebdir/comm-w2c.ch"
+#line 1176 "cwebdir/comm-w2c.ch"
 
 boolean get_line(void);
 name_pointer id_lookup(const char*,const char*,char);
@@ -422,7 +401,7 @@
 void sprint_section_name(char*,name_pointer);
 
 /*:83*//*84:*/
-#line 1170 "cwebdir/comm-w2c.ch"
+#line 1189 "cwebdir/comm-w2c.ch"
 
 static boolean input_ln(FILE*);
 static int web_strcmp(char*,int,char*,int);
@@ -432,7 +411,7 @@
 static void prime_the_change_buffer(void);
 
 /*:84*//*98:*/
-#line 1414 "cwebdir/comm-w2c.ch"
+#line 1433 "cwebdir/comm-w2c.ch"
 
 static void cb_usage(const_string str);
 static void cb_usagehelp(const_string*message,const_string bug_email);
@@ -472,7 +451,7 @@
 #line 77 "cwebdir/comm-w2c.ch"
 
 /*91:*/
-#line 1328 "cwebdir/comm-w2c.ch"
+#line 1347 "cwebdir/comm-w2c.ch"
 
 kpse_set_program_name(argv[0],"cweb");
 
@@ -480,7 +459,7 @@
 #line 78 "cwebdir/comm-w2c.ch"
 
 /*89:*/
-#line 1279 "cwebdir/comm-w2c.ch"
+#line 1298 "cwebdir/comm-w2c.ch"
 
 setlocale(LC_MESSAGES,setlocale(LC_CTYPE,""));
 texmf_locale= kpse_var_expand("${TEXMFLOCALEDIR}");
@@ -501,7 +480,7 @@
 /*68:*/
 #line 1233 "cwebdir/common.w"
 
-#line 893 "cwebdir/comm-w2c.ch"
+#line 915 "cwebdir/comm-w2c.ch"
 temporary_output= 1;
 #line 1235 "cwebdir/common.w"
 
@@ -509,7 +488,7 @@
 #line 80 "cwebdir/comm-w2c.ch"
 
 /*78:*/
-#line 1092 "cwebdir/comm-w2c.ch"
+#line 1114 "cwebdir/comm-w2c.ch"
 
 scan_args();
 if(program==ctangle){
@@ -544,7 +523,7 @@
 /*:4*//*9:*/
 #line 172 "cwebdir/common.w"
 
-#line 120 "cwebdir/comm-w2c.ch"
+#line 136 "cwebdir/comm-w2c.ch"
 static boolean input_ln(
 FILE*fp)
 #line 175 "cwebdir/common.w"
@@ -554,12 +533,12 @@
 if(feof(fp))return(0);
 limit= k= buffer;
 while(k<=buffer_end&&(c= getc(fp))!=EOF&&c!='\n')
-#line 127 "cwebdir/comm-w2c.ch"
+#line 143 "cwebdir/comm-w2c.ch"
 if((*(k++)= c)!=' '&&c!='\r')limit= k;
 #line 182 "cwebdir/common.w"
 if(k> buffer_end)
 if((c= getc(fp))!=EOF&&c!='\n'){
-#line 133 "cwebdir/comm-w2c.ch"
+#line 149 "cwebdir/comm-w2c.ch"
 ungetc(c,fp);loc= buffer;err_print(_("! Input line too long"));
 #line 185 "cwebdir/common.w"
 
@@ -572,7 +551,7 @@
 /*:9*//*12:*/
 #line 251 "cwebdir/common.w"
 
-#line 159 "cwebdir/comm-w2c.ch"
+#line 175 "cwebdir/comm-w2c.ch"
 static void
 prime_the_change_buffer(void)
 #line 254 "cwebdir/common.w"
@@ -586,13 +565,13 @@
 if(!input_ln(change_file))return;
 if(limit<buffer+2)continue;
 if(buffer[0]!='@')continue;
-#line 166 "cwebdir/comm-w2c.ch"
+#line 182 "cwebdir/comm-w2c.ch"
 if(xisupper(buffer[1]))buffer[1]= tolower((eight_bits)buffer[1]);
 #line 272 "cwebdir/common.w"
 if(buffer[1]=='x')break;
 if(buffer[1]=='y'||buffer[1]=='z'||buffer[1]=='i'){
 loc= buffer+2;
-#line 172 "cwebdir/comm-w2c.ch"
+#line 188 "cwebdir/comm-w2c.ch"
 err_print(_("! Missing @x in change file"));
 #line 276 "cwebdir/common.w"
 
@@ -608,7 +587,7 @@
 do{
 change_line++;
 if(!input_ln(change_file)){
-#line 178 "cwebdir/comm-w2c.ch"
+#line 194 "cwebdir/comm-w2c.ch"
 err_print(_("! Change file ended after @x"));
 #line 287 "cwebdir/common.w"
 
@@ -623,7 +602,7 @@
 #line 292 "cwebdir/common.w"
 
 {
-#line 185 "cwebdir/comm-w2c.ch"
+#line 201 "cwebdir/comm-w2c.ch"
 change_limit= change_buffer+(ptrdiff_t)(limit-buffer);
 strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
 #line 296 "cwebdir/common.w"
@@ -637,7 +616,7 @@
 /*:12*//*16:*/
 #line 320 "cwebdir/common.w"
 
-#line 193 "cwebdir/comm-w2c.ch"
+#line 209 "cwebdir/comm-w2c.ch"
 static void
 check_change(void)
 #line 323 "cwebdir/common.w"
@@ -652,7 +631,7 @@
 while(1){
 changing= 1;print_where= 1;change_line++;
 if(!input_ln(change_file)){
-#line 200 "cwebdir/comm-w2c.ch"
+#line 216 "cwebdir/comm-w2c.ch"
 err_print(_("! Change file ended before @y"));
 #line 335 "cwebdir/common.w"
 
@@ -660,7 +639,7 @@
 return;
 }
 if(limit> buffer+1&&buffer[0]=='@'){
-#line 206 "cwebdir/comm-w2c.ch"
+#line 222 "cwebdir/comm-w2c.ch"
 char xyz_code= xisupper(buffer[1])?tolower((eight_bits)buffer[1]):buffer[1];
 #line 341 "cwebdir/common.w"
 /*17:*/
@@ -667,7 +646,7 @@
 #line 358 "cwebdir/common.w"
 
 if(xyz_code=='x'||xyz_code=='z'){
-#line 218 "cwebdir/comm-w2c.ch"
+#line 234 "cwebdir/comm-w2c.ch"
 loc= buffer+2;err_print(_("! Where is the matching @y?"));
 #line 361 "cwebdir/common.w"
 
@@ -676,7 +655,7 @@
 if(n> 0){
 loc= buffer+2;
 printf("\n! Hmm... %d ",n);
-#line 224 "cwebdir/comm-w2c.ch"
+#line 240 "cwebdir/comm-w2c.ch"
 err_print(_("of the preceding lines failed to match"));
 #line 368 "cwebdir/common.w"
 
@@ -693,7 +672,7 @@
 #line 292 "cwebdir/common.w"
 
 {
-#line 185 "cwebdir/comm-w2c.ch"
+#line 201 "cwebdir/comm-w2c.ch"
 change_limit= change_buffer+(ptrdiff_t)(limit-buffer);
 strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
 #line 296 "cwebdir/common.w"
@@ -705,7 +684,7 @@
 changing= 0;cur_line++;
 while(!input_ln(cur_file)){
 if(include_depth==0){
-#line 212 "cwebdir/comm-w2c.ch"
+#line 228 "cwebdir/comm-w2c.ch"
 err_print(_("! CWEB file ended during a change"));
 #line 349 "cwebdir/common.w"
 
@@ -720,7 +699,7 @@
 /*:16*//*18:*/
 #line 378 "cwebdir/common.w"
 
-#line 231 "cwebdir/comm-w2c.ch"
+#line 247 "cwebdir/comm-w2c.ch"
 void
 reset_input(void)
 #line 381 "cwebdir/common.w"
@@ -729,7 +708,7 @@
 /*19:*/
 #line 393 "cwebdir/common.w"
 
-#line 242 "cwebdir/comm-w2c.ch"
+#line 258 "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);
@@ -744,7 +723,7 @@
 
 
 web_file_open= 1;
-#line 258 "cwebdir/comm-w2c.ch"
+#line 274 "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);
@@ -769,7 +748,7 @@
 /*:18*//*21:*/
 #line 426 "cwebdir/common.w"
 
-#line 286 "cwebdir/comm-w2c.ch"
+#line 302 "cwebdir/comm-w2c.ch"
 boolean get_line(void)
 #line 428 "cwebdir/common.w"
 {
@@ -780,7 +759,7 @@
 {
 change_line++;
 if(!input_ln(change_file)){
-#line 385 "cwebdir/comm-w2c.ch"
+#line 407 "cwebdir/comm-w2c.ch"
 err_print(_("! Change file ended without @z"));
 #line 541 "cwebdir/common.w"
 
@@ -795,12 +774,12 @@
 }
 *limit= ' ';
 if(buffer[0]=='@'){
-#line 391 "cwebdir/comm-w2c.ch"
+#line 413 "cwebdir/comm-w2c.ch"
 if(xisupper(buffer[1]))buffer[1]= tolower((eight_bits)buffer[1]);
 #line 554 "cwebdir/common.w"
 if(buffer[1]=='x'||buffer[1]=='y'){
 loc= buffer+2;
-#line 397 "cwebdir/comm-w2c.ch"
+#line 419 "cwebdir/comm-w2c.ch"
 err_print(_("! Where is the matching @z?"));
 #line 557 "cwebdir/common.w"
 
@@ -846,7 +825,7 @@
 loc= buffer+2;*limit= '"';
 while(*loc==' '||*loc=='\t')loc++;
 if(loc>=limit){
-#line 292 "cwebdir/comm-w2c.ch"
+#line 308 "cwebdir/comm-w2c.ch"
 err_print(_("! Include file name not given"));
 #line 443 "cwebdir/common.w"
 
@@ -853,7 +832,7 @@
 goto restart;
 }
 if(include_depth>=max_include_depth-1){
-#line 298 "cwebdir/comm-w2c.ch"
+#line 314 "cwebdir/comm-w2c.ch"
 err_print(_("! Too many nested includes"));
 #line 448 "cwebdir/common.w"
 
@@ -863,7 +842,7 @@
 /*23:*/
 #line 474 "cwebdir/common.w"
 {
-#line 334 "cwebdir/comm-w2c.ch"
+#line 356 "cwebdir/comm-w2c.ch"
 char*cur_file_name_end= cur_file_name+max_file_name_length-1;
 char*k= cur_file_name;
 #line 479 "cwebdir/common.w"
@@ -877,7 +856,7 @@
 if(k> cur_file_name_end)too_long();
 
 *k= '\0';
-#line 341 "cwebdir/comm-w2c.ch"
+#line 363 "cwebdir/comm-w2c.ch"
 if((found_filename= kpse_find_cweb(cur_file_name))!=NULL&&
 (cur_file= fopen(found_filename,"r"))!=NULL){
 
@@ -891,7 +870,7 @@
 cur_line= 0;print_where= 1;
 goto restart;
 }
-#line 379 "cwebdir/comm-w2c.ch"
+#line 401 "cwebdir/comm-w2c.ch"
 include_depth--;err_print(_("! Cannot open include file"));goto restart;
 #line 518 "cwebdir/common.w"
 }
@@ -903,11 +882,11 @@
 return 1;
 }
 
-#line 313 "cwebdir/comm-w2c.ch"
+#line 329 "cwebdir/comm-w2c.ch"
 /*:21*//*26:*/
 #line 569 "cwebdir/common.w"
 
-#line 407 "cwebdir/comm-w2c.ch"
+#line 429 "cwebdir/comm-w2c.ch"
 void
 check_complete(void){
 if(change_limit!=change_buffer){
@@ -915,7 +894,7 @@
 limit= buffer+(ptrdiff_t)(change_limit-change_buffer);
 #line 575 "cwebdir/common.w"
 changing= 1;change_depth= include_depth;loc= buffer;
-#line 417 "cwebdir/comm-w2c.ch"
+#line 439 "cwebdir/comm-w2c.ch"
 err_print(_("! Change file entry did not match"));
 #line 577 "cwebdir/common.w"
 
@@ -925,7 +904,7 @@
 /*:26*//*35:*/
 #line 660 "cwebdir/common.w"
 
-#line 459 "cwebdir/comm-w2c.ch"
+#line 481 "cwebdir/comm-w2c.ch"
 name_pointer
 id_lookup(
 const char*first,
@@ -938,7 +917,7 @@
 int l;
 name_pointer p;
 if(last==NULL)for(last= first;*last!='\0';last++);
-#line 471 "cwebdir/comm-w2c.ch"
+#line 493 "cwebdir/comm-w2c.ch"
 l= (int)(last-first);
 #line 673 "cwebdir/common.w"
 /*36:*/
@@ -967,13 +946,13 @@
 if(p==name_ptr)/*39:*/
 #line 706 "cwebdir/common.w"
 {
-#line 484 "cwebdir/comm-w2c.ch"
+#line 506 "cwebdir/comm-w2c.ch"
 if(byte_ptr+l> byte_mem_end)overflow(_("byte memory"));
 if(name_ptr>=name_dir_end)overflow(_("name"));
 #line 709 "cwebdir/common.w"
 strncpy(byte_ptr,first,l);
 (++name_ptr)->byte_start= byte_ptr+= l;
-#line 491 "cwebdir/comm-w2c.ch"
+#line 513 "cwebdir/comm-w2c.ch"
 init_p(p,t);
 #line 712 "cwebdir/common.w"
 }
@@ -987,7 +966,7 @@
 /*:35*//*42:*/
 #line 764 "cwebdir/common.w"
 
-#line 499 "cwebdir/comm-w2c.ch"
+#line 521 "cwebdir/comm-w2c.ch"
 void
 print_section_name(
 name_pointer p)
@@ -998,7 +977,7 @@
 while(p!=name_dir){
 ss= (p+1)->byte_start-1;
 if(*ss==' '&&ss>=s){
-#line 509 "cwebdir/comm-w2c.ch"
+#line 531 "cwebdir/comm-w2c.ch"
 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;
@@ -1012,7 +991,7 @@
 /*:42*//*43:*/
 #line 783 "cwebdir/common.w"
 
-#line 520 "cwebdir/comm-w2c.ch"
+#line 542 "cwebdir/comm-w2c.ch"
 void
 sprint_section_name(
 char*dest,
@@ -1028,7 +1007,7 @@
 }else{
 ss++;p= name_dir;
 }
-#line 529 "cwebdir/comm-w2c.ch"
+#line 551 "cwebdir/comm-w2c.ch"
 strncpy(dest,s,(size_t)(ss-s)),dest+= ss-s;
 #line 799 "cwebdir/common.w"
 s= p->byte_start;
@@ -1039,7 +1018,7 @@
 /*:43*//*44:*/
 #line 804 "cwebdir/common.w"
 
-#line 537 "cwebdir/comm-w2c.ch"
+#line 559 "cwebdir/comm-w2c.ch"
 void
 print_prefix_name(
 name_pointer p)
@@ -1054,7 +1033,7 @@
 /*:44*//*45:*/
 #line 825 "cwebdir/common.w"
 
-#line 547 "cwebdir/comm-w2c.ch"
+#line 569 "cwebdir/comm-w2c.ch"
 static int web_strcmp(
 char*j,
 int j_len,
@@ -1074,7 +1053,7 @@
 /*:45*//*47:*/
 #line 855 "cwebdir/common.w"
 
-#line 569 "cwebdir/comm-w2c.ch"
+#line 591 "cwebdir/comm-w2c.ch"
 static name_pointer
 add_section_name(
 name_pointer par,
@@ -1086,9 +1065,9 @@
 {
 name_pointer p= name_ptr;
 char*s= first_chunk(p);
-#line 581 "cwebdir/comm-w2c.ch"
+#line 603 "cwebdir/comm-w2c.ch"
 int name_len= (int)(last-first)+ispref;
-#line 588 "cwebdir/comm-w2c.ch"
+#line 610 "cwebdir/comm-w2c.ch"
 if(s+name_len> byte_mem_end)overflow(_("byte memory"));
 if(name_ptr+1>=name_dir_end)overflow(_("name"));
 #line 869 "cwebdir/common.w"
@@ -1110,7 +1089,7 @@
 /*:47*//*48:*/
 #line 884 "cwebdir/common.w"
 
-#line 600 "cwebdir/comm-w2c.ch"
+#line 622 "cwebdir/comm-w2c.ch"
 static void
 extend_section_name(
 name_pointer p,
@@ -1121,9 +1100,9 @@
 {
 char*s;
 name_pointer q= p+1;
-#line 611 "cwebdir/comm-w2c.ch"
+#line 633 "cwebdir/comm-w2c.ch"
 int name_len= (int)(last-first)+ispref;
-#line 617 "cwebdir/comm-w2c.ch"
+#line 639 "cwebdir/comm-w2c.ch"
 if(name_ptr>=name_dir_end)overflow(_("name"));
 #line 896 "cwebdir/common.w"
 while(q->link!=name_dir)q= q->link;
@@ -1130,7 +1109,7 @@
 q->link= name_ptr;
 s= name_ptr->byte_start;
 name_ptr->link= name_dir;
-#line 623 "cwebdir/comm-w2c.ch"
+#line 645 "cwebdir/comm-w2c.ch"
 if(s+name_len> byte_mem_end)overflow(_("byte memory"));
 #line 901 "cwebdir/common.w"
 (++name_ptr)->byte_start= byte_ptr= s+name_len;
@@ -1141,7 +1120,7 @@
 /*:48*//*49:*/
 #line 912 "cwebdir/common.w"
 
-#line 632 "cwebdir/comm-w2c.ch"
+#line 654 "cwebdir/comm-w2c.ch"
 name_pointer
 section_lookup(
 char*first,char*last,
@@ -1154,7 +1133,7 @@
 name_pointer r= NULL;
 name_pointer par= NULL;
 
-#line 641 "cwebdir/comm-w2c.ch"
+#line 663 "cwebdir/comm-w2c.ch"
 int name_len= (int)(last-first)+1;
 #line 925 "cwebdir/common.w"
 /*50:*/
@@ -1168,12 +1147,12 @@
 p= (c==less?p->llink:p->rlink);
 }else{
 if(r!=NULL){
-#line 647 "cwebdir/comm-w2c.ch"
+#line 669 "cwebdir/comm-w2c.ch"
 fputs(_("\n! Ambiguous prefix: matches <"),stdout);
 #line 946 "cwebdir/common.w"
 
 print_prefix_name(p);
-#line 653 "cwebdir/comm-w2c.ch"
+#line 675 "cwebdir/comm-w2c.ch"
 fputs(_(">\n and <"),stdout);
 #line 949 "cwebdir/common.w"
 print_prefix_name(r);
@@ -1207,7 +1186,7 @@
 
 case prefix:
 if(!ispref){
-#line 659 "cwebdir/comm-w2c.ch"
+#line 681 "cwebdir/comm-w2c.ch"
 fputs(_("\n! New name is a prefix of <"),stdout);
 #line 975 "cwebdir/common.w"
 
@@ -1221,7 +1200,7 @@
 extend_section_name(r,first,last+1,ispref);
 return r;
 case bad_extension:
-#line 665 "cwebdir/comm-w2c.ch"
+#line 687 "cwebdir/comm-w2c.ch"
 fputs(_("\n! New name extends <"),stdout);
 #line 987 "cwebdir/common.w"
 
@@ -1229,12 +1208,12 @@
 err_print(">");
 return r;
 default:
-#line 671 "cwebdir/comm-w2c.ch"
+#line 693 "cwebdir/comm-w2c.ch"
 fputs(_("\n! Section name incompatible with <"),stdout);
 #line 993 "cwebdir/common.w"
 
 print_prefix_name(r);
-#line 677 "cwebdir/comm-w2c.ch"
+#line 699 "cwebdir/comm-w2c.ch"
 fputs(_(">,\n which abbreviates <"),stdout);
 #line 996 "cwebdir/common.w"
 print_section_name(r);
@@ -1250,7 +1229,7 @@
 /*:49*//*54:*/
 #line 1020 "cwebdir/common.w"
 
-#line 692 "cwebdir/comm-w2c.ch"
+#line 714 "cwebdir/comm-w2c.ch"
 static int section_name_cmp(
 char**pfirst,
 int len,
@@ -1269,7 +1248,7 @@
 switch(c= web_strcmp(first,len,s,ss-s)){
 case equal:if(q==name_dir)
 if(ispref){
-#line 701 "cwebdir/comm-w2c.ch"
+#line 723 "cwebdir/comm-w2c.ch"
 *pfirst= first+(ptrdiff_t)(ss-s);
 #line 1039 "cwebdir/common.w"
 return extension;
@@ -1278,7 +1257,7 @@
 case extension:
 if(!ispref)return bad_extension;
 first+= ss-s;
-#line 707 "cwebdir/comm-w2c.ch"
+#line 729 "cwebdir/comm-w2c.ch"
 if(q!=name_dir){len-= (int)(ss-s);s= q->byte_start;r= q;continue;}
 #line 1046 "cwebdir/common.w"
 *pfirst= first;return extension;
@@ -1290,7 +1269,7 @@
 /*:54*//*58:*/
 #line 1095 "cwebdir/common.w"
 
-#line 733 "cwebdir/comm-w2c.ch"
+#line 755 "cwebdir/comm-w2c.ch"
 void
 err_print(
 const char*s)
@@ -1302,7 +1281,7 @@
 #line 1115 "cwebdir/common.w"
 
 {if(changing&&include_depth==change_depth)
-#line 743 "cwebdir/comm-w2c.ch"
+#line 765 "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);
@@ -1329,18 +1308,18 @@
 /*:58*//*61:*/
 #line 1150 "cwebdir/common.w"
 
-#line 782 "cwebdir/comm-w2c.ch"
+#line 804 "cwebdir/comm-w2c.ch"
 int wrap_up(void){
 if(show_progress)new_line;
 #line 1153 "cwebdir/common.w"
 if(show_stats)
 print_stats();
-#line 789 "cwebdir/comm-w2c.ch"
+#line 811 "cwebdir/comm-w2c.ch"
 /*62:*/
 #line 1160 "cwebdir/common.w"
 
 switch(history){
-#line 813 "cwebdir/comm-w2c.ch"
+#line 835 "cwebdir/comm-w2c.ch"
 case spotless:
 if(show_happiness)puts(_("(No errors were found.)"));break;
 case harmless_message:
@@ -1353,10 +1332,10 @@
 }
 
 /*:62*/
-#line 789 "cwebdir/comm-w2c.ch"
+#line 811 "cwebdir/comm-w2c.ch"
 
 /*87:*/
-#line 1208 "cwebdir/comm-w2c.ch"
+#line 1227 "cwebdir/comm-w2c.ch"
 
 if(C_file)fclose(C_file);
 if(tex_file)fclose(tex_file);
@@ -1365,9 +1344,9 @@
 remove(check_file_name);
 
 /*:87*/
-#line 790 "cwebdir/comm-w2c.ch"
+#line 812 "cwebdir/comm-w2c.ch"
 
-#line 797 "cwebdir/comm-w2c.ch"
+#line 819 "cwebdir/comm-w2c.ch"
 switch(history){
 case harmless_message:return RETURN_WARN;
 case error_message:return RETURN_ERROR;
@@ -1378,13 +1357,13 @@
 }
 
 /*:61*//*64:*/
-#line 835 "cwebdir/comm-w2c.ch"
+#line 857 "cwebdir/comm-w2c.ch"
 void
 fatal(
 const char*s,const char*t)
 #line 1182 "cwebdir/common.w"
 {
-#line 843 "cwebdir/comm-w2c.ch"
+#line 865 "cwebdir/comm-w2c.ch"
 if(*s)fputs(s,stdout);
 #line 1184 "cwebdir/common.w"
 err_print(t);
@@ -1392,13 +1371,13 @@
 }
 
 /*:64*//*65:*/
-#line 851 "cwebdir/comm-w2c.ch"
+#line 873 "cwebdir/comm-w2c.ch"
 void
 overflow(
 const char*t)
 #line 1193 "cwebdir/common.w"
 {
-#line 859 "cwebdir/comm-w2c.ch"
+#line 881 "cwebdir/comm-w2c.ch"
 printf(_("\n! Sorry, %s capacity exceeded"),t);fatal("","");
 #line 1195 "cwebdir/common.w"
 }
@@ -1407,7 +1386,7 @@
 /*:65*//*70:*/
 #line 1254 "cwebdir/common.w"
 
-#line 915 "cwebdir/comm-w2c.ch"
+#line 937 "cwebdir/comm-w2c.ch"
 static void
 scan_args(void)
 #line 1257 "cwebdir/common.w"
@@ -1419,7 +1398,7 @@
 
 #line 1264 "cwebdir/common.w"
 
-#line 927 "cwebdir/comm-w2c.ch"
+#line 949 "cwebdir/comm-w2c.ch"
 
 #if defined DEV_NULL
 strncpy(change_file_name,DEV_NULL,max_file_name_length-2);
@@ -1434,13 +1413,13 @@
 while(--argc> 0){
 #line 1266 "cwebdir/common.w"
 if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*74:*/
-#line 1005 "cwebdir/comm-w2c.ch"
+#line 1027 "cwebdir/comm-w2c.ch"
 
 {
 if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0)
 
 /*94:*/
-#line 1353 "cwebdir/comm-w2c.ch"
+#line 1372 "cwebdir/comm-w2c.ch"
 
 cb_usagehelp(program==ctangle?CTANGLEHELP:
 program==cweave?CWEAVEHELP:CTWILLHELP,NULL);
@@ -1447,12 +1426,12 @@
 
 
 /*:94*/
-#line 1009 "cwebdir/comm-w2c.ch"
+#line 1031 "cwebdir/comm-w2c.ch"
 
 if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0)
 
 /*96:*/
-#line 1395 "cwebdir/comm-w2c.ch"
+#line 1414 "cwebdir/comm-w2c.ch"
 
 printversionandexit(cb_banner,
 program==ctwill?"Donald E. Knuth":"Silvio Levy and Donald E. Knuth",
@@ -1460,7 +1439,7 @@
 
 
 /*:96*/
-#line 1012 "cwebdir/comm-w2c.ch"
+#line 1034 "cwebdir/comm-w2c.ch"
 
 if(strcmp("-verbose",*argv)==0||strcmp("--verbose",*argv)==0)
 
@@ -1479,14 +1458,14 @@
 if(sscanf(++dot_pos,"%u",&kpathsea_debug)!=1)/*75:*/
 #line 1352 "cwebdir/common.w"
 
-#line 1055 "cwebdir/comm-w2c.ch"
+#line 1077 "cwebdir/comm-w2c.ch"
 cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill");
 
 #line 1363 "cwebdir/common.w"
 
-#line 1062 "cwebdir/comm-w2c.ch"
+#line 1084 "cwebdir/comm-w2c.ch"
 /*:75*/
-#line 1027 "cwebdir/comm-w2c.ch"
+#line 1049 "cwebdir/comm-w2c.ch"
 
 while(isdigit(*dot_pos))dot_pos++;
 dot_pos--;
@@ -1495,7 +1474,7 @@
 use_language= ++dot_pos;
 break;
 }else
-#line 1040 "cwebdir/comm-w2c.ch"
+#line 1062 "cwebdir/comm-w2c.ch"
  flags[(eight_bits)*dot_pos]= flag_change;
 #line 1350 "cwebdir/common.w"
 }
@@ -1505,7 +1484,7 @@
 
 else{
 s= name_pos= *argv;dot_pos= NULL;
-#line 948 "cwebdir/comm-w2c.ch"
+#line 970 "cwebdir/comm-w2c.ch"
 while(*s){
 if(*s=='.')dot_pos= s++;
 else if(*s==DIR_SEPARATOR||*s==DEVICE_SEPARATOR||*s=='/')
@@ -1520,7 +1499,7 @@
 {
 if(s-*argv> max_file_name_length-5)
 /*76:*/
-#line 1062 "cwebdir/comm-w2c.ch"
+#line 1084 "cwebdir/comm-w2c.ch"
 fatal(_("! Filename too long\n"),*argv);
 #line 1365 "cwebdir/common.w"
 
@@ -1549,12 +1528,12 @@
 #line 1310 "cwebdir/common.w"
 
 {
-#line 980 "cwebdir/comm-w2c.ch"
+#line 1002 "cwebdir/comm-w2c.ch"
 if(strcmp(*argv,"-")!=0){
 #line 1314 "cwebdir/common.w"
 if(s-*argv> max_file_name_length-4)
 /*76:*/
-#line 1062 "cwebdir/comm-w2c.ch"
+#line 1084 "cwebdir/comm-w2c.ch"
 fatal(_("! Filename too long\n"),*argv);
 #line 1365 "cwebdir/common.w"
 
@@ -1565,7 +1544,7 @@
 if(dot_pos==NULL)
 sprintf(change_file_name,"%s.ch",*argv);
 else strcpy(change_file_name,*argv);
-#line 987 "cwebdir/comm-w2c.ch"
+#line 1009 "cwebdir/comm-w2c.ch"
 }
 found_change= 1;
 #line 1321 "cwebdir/common.w"
@@ -1580,7 +1559,7 @@
 {
 if(s-*argv> max_file_name_length-5)
 /*76:*/
-#line 1062 "cwebdir/comm-w2c.ch"
+#line 1084 "cwebdir/comm-w2c.ch"
 fatal(_("! Filename too long\n"),*argv);
 #line 1365 "cwebdir/common.w"
 
@@ -1596,7 +1575,7 @@
 }else{
 strcpy(tex_file_name,*argv);
 strcpy(C_file_name,*argv);
-#line 994 "cwebdir/comm-w2c.ch"
+#line 1016 "cwebdir/comm-w2c.ch"
 if(make_xrefs){
 #line 1336 "cwebdir/common.w"
 *dot_pos= 0;
@@ -1607,7 +1586,7 @@
 found_out= 1;
 }
 
-#line 1004 "cwebdir/comm-w2c.ch"
+#line 1026 "cwebdir/comm-w2c.ch"
 /*:73*/
 #line 1277 "cwebdir/common.w"
 
@@ -1614,12 +1593,12 @@
 else/*75:*/
 #line 1352 "cwebdir/common.w"
 
-#line 1055 "cwebdir/comm-w2c.ch"
+#line 1077 "cwebdir/comm-w2c.ch"
  cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill");
 
 #line 1363 "cwebdir/common.w"
 
-#line 1062 "cwebdir/comm-w2c.ch"
+#line 1084 "cwebdir/comm-w2c.ch"
 /*:75*/
 #line 1278 "cwebdir/common.w"
 ;
@@ -1628,12 +1607,12 @@
 if(!found_web)/*75:*/
 #line 1352 "cwebdir/common.w"
 
-#line 1055 "cwebdir/comm-w2c.ch"
+#line 1077 "cwebdir/comm-w2c.ch"
 cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill");
 
 #line 1363 "cwebdir/common.w"
 
-#line 1062 "cwebdir/comm-w2c.ch"
+#line 1084 "cwebdir/comm-w2c.ch"
 /*:75*/
 #line 1281 "cwebdir/common.w"
 ;
@@ -1640,9 +1619,9 @@
 #line 1283 "cwebdir/common.w"
 }
 
-#line 967 "cwebdir/comm-w2c.ch"
+#line 989 "cwebdir/comm-w2c.ch"
 /*:70*//*95:*/
-#line 1361 "cwebdir/comm-w2c.ch"
+#line 1380 "cwebdir/comm-w2c.ch"
 
 static void cb_usage(const_string str)
 {
@@ -1675,7 +1654,7 @@
 }
 
 /*:95*//*97:*/
-#line 1403 "cwebdir/comm-w2c.ch"
+#line 1422 "cwebdir/comm-w2c.ch"
 
 void cb_show_banner(void)
 {

Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2020-04-27 23:55:27 UTC (rev 54919)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2020-04-28 07:10:49 UTC (rev 54920)
@@ -1,3 +1,7 @@
+2020-04-28  Andreas Scherer  <https://ascherer.github.io>
+
+	* comm-w2c.ch: Purge standard headers already in KPathSea.
+
 2020-04-27  Andreas Scherer  <https://ascherer.github.io>
 
 	* comm-w2c.ch,

Modified: trunk/Build/source/texk/web2c/cwebdir/comm-w2c.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/comm-w2c.ch	2020-04-27 23:55:27 UTC (rev 54919)
+++ trunk/Build/source/texk/web2c/cwebdir/comm-w2c.ch	2020-04-28 07:10:49 UTC (rev 54920)
@@ -82,6 +82,15 @@
 @z
 
 @x
+\.{ctype.h} header file.
+
+@<Include files@>=
+#include <ctype.h>
+ at y
+\.{ctype.h} header file, included through the \Kpathsea/ interface.
+ at z
+
+ at x
 @d not_eq 032 /* `\.{!=}'\,;  corresponds to MIT's {\tentex\char'32} */
 @y
 @d non_eq 032 /* `\.{!=}'\,;  corresponds to MIT's {\tentex\char'32} */
@@ -114,6 +123,13 @@
 @z
 
 @x
+@ @<Include files@>=
+#include <stdio.h>
+ at y
+@ Most of the standard \CEE/ interface comes from \Kpathsea/.
+ at z
+
+ at x
 int input_ln(fp) /* copies a line into |buffer| or returns 0 */
 FILE *fp; /* what file to read from */
 @y
@@ -326,6 +342,12 @@
 @z
 
 @x
+@<Include...@>=
+#include <stdlib.h> /* declaration of |getenv| and |exit| */
+ at y
+ at z
+
+ at x
   char temp_file_name[max_file_name_length];
   char *cur_file_name_end=cur_file_name+max_file_name_length-1;
   char *k=cur_file_name, *kk;
@@ -1127,13 +1149,10 @@
 extern int strncmp(); /* compare up to $n$ string characters */
 extern char* strncpy(); /* copy up to $n$ string characters */
 @y
-@ For string handling we include the {\mc ANSI C} system header file instead
-of predeclaring the standard system functions |strlen|, |strcmp|, |strcpy|,
-|strncmp|, and |strncpy|.
+@ For string handling we include the {\mc ANSI C} system header file---through
+the \Kpathsea/ interface---instead of predeclaring the standard system
+functions |strlen|, |strcmp|, |strcpy|, |strncmp|, and |strncpy|.
 @^system dependencies@>
-
-@<Include...@>=
-#include <string.h>
 @z
 
 @x
@@ -1176,12 +1195,12 @@
 static void prime_the_change_buffer(void);@/
 
 @* Standard C library interfaces.  This updated version of \.{CWEB} uses
-standard C types for boolean values, pointers, and objects with fixed sizes.
+standard C types for boolean values, pointers, and objects with fixed sizes
+(already in \Kpathsea/).
 
 @<Include files@>=
 #include <stdbool.h> /* type definition of |bool| */
 #include <stddef.h> /* type definition of |ptrdiff_t| */
-#include <stdint.h> /* type definition of |uint8_t| et al. */
 
 @ The |scan_args| and |cb_show_banner| routines and the |bindtextdomain|
 argument string need a few extra variables.



More information about the tex-live-commits mailing list.