texlive[68343] Build/source/texk/web2c/cwebdir: [CWEB] Reuse code for

commits+ascherer at tug.org commits+ascherer at tug.org
Fri Sep 22 16:22:50 CEST 2023


Revision: 68343
          https://tug.org/svn/texlive?view=revision&revision=68343
Author:   ascherer
Date:     2023-09-22 16:22:50 +0200 (Fri, 22 Sep 2023)
Log Message:
-----------
[CWEB] Reuse code for secondary output.

We try to keep the total section count of CTANGLE (104) intact.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/cwebdir/ChangeLog
    trunk/Build/source/texk/web2c/cwebdir/ctang-w2c.ch
    trunk/Build/source/texk/web2c/cwebdir/ctangle.c
    trunk/Build/source/texk/web2c/cwebdir/ctangle.w

Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2023-09-21 23:43:49 UTC (rev 68342)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2023-09-22 14:22:50 UTC (rev 68343)
@@ -1,5 +1,11 @@
 2023-09-22  Andreas Scherer  <https://ascherer.github.io>
 
+	* ctang-w2c.ch,
+	* ctangle.c,
+	* ctangle.w: Reuse code for secondary output.
+
+2023-09-22  Andreas Scherer  <https://ascherer.github.io>
+
 	* cwebacromac.tex: Factor out PDF/HINT macros.
 
 2023-09-03  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>

Modified: trunk/Build/source/texk/web2c/cwebdir/ctang-w2c.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctang-w2c.ch	2023-09-21 23:43:49 UTC (rev 68342)
+++ trunk/Build/source/texk/web2c/cwebdir/ctang-w2c.ch	2023-09-22 14:22:50 UTC (rev 68343)
@@ -122,12 +122,8 @@
 @.Cannot open output file@>
     if (show_progress) { printf("\n(%s)",output_file_name); update_terminal(); }
     cur_line=1;
-    stack_ptr=stack+1;
-    cur_name=*an_output_file;
-    cur_repl=(text_pointer)cur_name->equiv;
-    cur_byte=cur_repl->tok_start;
-    while (stack_ptr > stack) get_output();
-    flush_buffer();
+    @<Initialize the secondary output@>@;
+    @<Output material...@>@;
 }
 @y
 @<Write all the named output files@>=
@@ -147,12 +143,8 @@
   }
   if (show_progress) { printf("\n(%s)",output_file_name); update_terminal(); }
   cur_line=1;
-  stack_ptr=stack+1;
-  cur_name=*an_output_file;
-  cur_repl=(text_pointer)cur_name->equiv;
-  cur_byte=cur_repl->tok_start;
-  while (stack_ptr > stack) get_output();
-  flush_buffer();
+  @<Initialize the secondary output@>@;
+  @<Output material...@>@;
   if (check_for_change) {
     fclose(C_file); C_file=NULL;
     @<Update the secondary results when they have changed@>@;

Modified: trunk/Build/source/texk/web2c/cwebdir/ctangle.c
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctangle.c	2023-09-21 23:43:49 UTC (rev 68342)
+++ trunk/Build/source/texk/web2c/cwebdir/ctangle.c	2023-09-22 14:22:50 UTC (rev 68343)
@@ -305,19 +305,19 @@
 static stack_pointer stack_end= stack+stack_size;
 static stack_pointer stack_ptr;
 
-/*:32*//*37:*/
-#line 357 "ctangle.w"
+/*:32*//*38:*/
+#line 367 "ctangle.w"
 
 static int cur_val;
 
-/*:37*//*42:*/
-#line 449 "ctangle.w"
+/*:38*//*42:*/
+#line 457 "ctangle.w"
 
 static eight_bits out_state;
 static boolean protect;
 
 /*:42*//*45:*/
-#line 480 "ctangle.w"
+#line 488 "ctangle.w"
 
 static name_pointer output_files[max_files];
 static name_pointer*cur_out_file,*end_output_files,*an_output_file;
@@ -324,34 +324,34 @@
 static char cur_section_name_char;
 static char output_file_name[longest_name+1];
 
-/*:45*//*52:*/
-#line 573 "ctangle.w"
+/*:45*//*53:*/
+#line 584 "ctangle.w"
 
 static boolean output_defs_seen= false;
 
-/*:52*//*57:*/
-#line 687 "ctangle.w"
+/*:53*//*57:*/
+#line 694 "ctangle.w"
 
 static char translit[0200][translit_length];
 
 /*:57*//*62:*/
-#line 763 "ctangle.w"
+#line 770 "ctangle.w"
 
 static eight_bits ccode[256];
 
 /*:62*//*66:*/
-#line 823 "ctangle.w"
+#line 830 "ctangle.w"
 
 static boolean comment_continues= false;
 
 /*:66*//*68:*/
-#line 860 "ctangle.w"
+#line 867 "ctangle.w"
 
 static name_pointer cur_section_name;
 static boolean no_where;
 
 /*:68*//*82:*/
-#line 1177 "ctangle.w"
+#line 1184 "ctangle.w"
 
 static text_pointer cur_text;
 static eight_bits next_control;
@@ -399,54 +399,48 @@
 #line 242 "ctangle.w"
 static void store_two_bytes(sixteen_bits);
 
-/*:30*//*35:*/
-#line 321 "ctangle.w"
+/*:30*//*37:*/
+#line 347 "ctangle.w"
 
 static void push_level(name_pointer);
 static void pop_level(boolean);
-
-/*:35*//*39:*/
-#line 394 "ctangle.w"
 static void get_output(void);
 
-/*:39*//*44:*/
-#line 470 "ctangle.w"
+/*:37*//*44:*/
+#line 478 "ctangle.w"
 static void flush_buffer(void);
 
 /*:44*//*49:*/
-#line 541 "ctangle.w"
+#line 547 "ctangle.w"
+
 static void phase_two(void);
-
-/*:49*//*53:*/
-#line 576 "ctangle.w"
-
 static void output_defs(void);
 static void out_char(eight_bits);
 
-/*:53*//*65:*/
-#line 803 "ctangle.w"
+/*:49*//*65:*/
+#line 810 "ctangle.w"
 
 static eight_bits skip_ahead(void);
 static boolean skip_comment(boolean);
 
 /*:65*//*70:*/
-#line 910 "ctangle.w"
+#line 917 "ctangle.w"
 static eight_bits get_next(void);
 
 /*:70*//*84:*/
-#line 1203 "ctangle.w"
+#line 1210 "ctangle.w"
 static void scan_repl(eight_bits);
 
 /*:84*//*91:*/
-#line 1395 "ctangle.w"
+#line 1402 "ctangle.w"
 static void scan_section(void);
 
 /*:91*//*99:*/
-#line 1472 "ctangle.w"
+#line 1479 "ctangle.w"
 static void phase_one(void);
 
 /*:99*//*101:*/
-#line 1505 "ctangle.w"
+#line 1512 "ctangle.w"
 static void skip_limbo(void);
 
 /*:101*/
@@ -479,12 +473,12 @@
 last_unnamed= text_info;text_info->text_link= macro;
 
 /*:27*//*46:*/
-#line 490 "ctangle.w"
+#line 498 "ctangle.w"
 
 cur_out_file= end_output_files= output_files+max_files;
 
 /*:46*//*58:*/
-#line 690 "ctangle.w"
+#line 697 "ctangle.w"
 
 {int i;
 for(i= 0;i<0200;i++)
@@ -492,7 +486,7 @@
 }
 
 /*:58*//*63:*/
-#line 766 "ctangle.w"
+#line 773 "ctangle.w"
 {
 int c;
 for(c= 0;c<256;c++)ccode[c]= ignore;
@@ -512,7 +506,7 @@
 ccode['\'']= ord;
 
 /*:63*//*78:*/
-#line 1098 "ctangle.w"
+#line 1105 "ctangle.w"
 section_text[0]= ' ';
 
 /*:78*/
@@ -559,8 +553,8 @@
 *tok_ptr++= x&0377;
 }
 
-/*:29*//*34:*/
-#line 307 "ctangle.w"
+/*:29*//*35:*/
+#line 315 "ctangle.w"
 
 static void
 push_level(
@@ -575,9 +569,10 @@
 }
 }
 
-/*:34*//*36:*/
-#line 329 "ctangle.w"
 
+/*:35*//*36:*/
+#line 334 "ctangle.w"
+
 static void
 pop_level(
 boolean flag)
@@ -590,8 +585,8 @@
 if(stack_ptr> stack)cur_state= *stack_ptr;
 }
 
-/*:36*//*38:*/
-#line 364 "ctangle.w"
+/*:36*//*39:*/
+#line 374 "ctangle.w"
 
 static void
 get_output(void)
@@ -614,7 +609,7 @@
 case 0:cur_val= (int)a;out_char(identifier);break;
 case 1:if(a==output_defs_flag)output_defs();
 else/*40:*/
-#line 399 "ctangle.w"
+#line 407 "ctangle.w"
 
 {
 a-= 024000;
@@ -628,7 +623,7 @@
 }
 
 /*:40*/
-#line 385 "ctangle.w"
+#line 395 "ctangle.w"
 
 break;
 default:cur_val= (int)a-050000;
@@ -638,8 +633,8 @@
 }
 }
 
-/*:38*//*43:*/
-#line 457 "ctangle.w"
+/*:39*//*43:*/
+#line 465 "ctangle.w"
 
 static void
 flush_buffer(void)
@@ -654,7 +649,7 @@
 }
 
 /*:43*//*48:*/
-#line 509 "ctangle.w"
+#line 517 "ctangle.w"
 
 static void
 phase_two(void){
@@ -664,20 +659,21 @@
 /*33:*/
 #line 296 "ctangle.w"
 
-stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info;
+stack_ptr= stack+1;cur_name= name_dir;
+cur_repl= text_info->text_link+text_info;
 cur_byte= cur_repl->tok_start;cur_section= 0;
 
 /*:33*/
-#line 515 "ctangle.w"
+#line 523 "ctangle.w"
 
-/*51:*/
-#line 569 "ctangle.w"
+/*52:*/
+#line 580 "ctangle.w"
 
 if(!output_defs_seen)
 output_defs();
 
-/*:51*/
-#line 516 "ctangle.w"
+/*:52*/
+#line 524 "ctangle.w"
 
 if(text_info->text_link==macro&&cur_out_file==end_output_files){
 printf("%s","\n! No program text was specified.");mark_harmless();
@@ -691,12 +687,20 @@
 
 update_terminal();
 }
-if(text_info->text_link!=macro){
+if(text_info->text_link!=macro)
+/*51:*/
+#line 570 "ctangle.w"
+
+{
 while(stack_ptr> stack)get_output();
 flush_buffer();
 }
+
+/*:51*/
+#line 538 "ctangle.w"
+
 /*50:*/
-#line 547 "ctangle.w"
+#line 556 "ctangle.w"
 
 for(an_output_file= end_output_files;an_output_file> cur_out_file;){
 an_output_file--;
@@ -707,16 +711,31 @@
 
 if(show_progress){printf("\n(%s)",output_file_name);update_terminal();}
 cur_line= 1;
-stack_ptr= stack+1;
-cur_name= *an_output_file;
+/*34:*/
+#line 303 "ctangle.w"
+
+stack_ptr= stack+1;cur_name= *an_output_file;
 cur_repl= (text_pointer)cur_name->equiv;
 cur_byte= cur_repl->tok_start;
+
+/*:34*/
+#line 566 "ctangle.w"
+
+/*51:*/
+#line 570 "ctangle.w"
+
+{
 while(stack_ptr> stack)get_output();
 flush_buffer();
 }
 
+/*:51*/
+#line 567 "ctangle.w"
+
+}
+
 /*:50*/
-#line 533 "ctangle.w"
+#line 539 "ctangle.w"
 
 if(show_happiness){
 if(show_progress)new_line();
@@ -726,7 +745,7 @@
 }
 
 /*:48*//*54:*/
-#line 585 "ctangle.w"
+#line 592 "ctangle.w"
 
 static void
 output_defs(void)
@@ -766,7 +785,7 @@
 }
 
 /*:54*//*55:*/
-#line 628 "ctangle.w"
+#line 635 "ctangle.w"
 
 static void
 out_char(
@@ -779,7 +798,7 @@
 if(protect||out_state==verbatim)C_putc('\\');
 flush_buffer();if(out_state!=verbatim)out_state= normal;break;
 /*59:*/
-#line 696 "ctangle.w"
+#line 703 "ctangle.w"
 
 case identifier:
 if(out_state==num_or_id)C_putc(' ');
@@ -791,10 +810,10 @@
 out_state= num_or_id;break;
 
 /*:59*/
-#line 639 "ctangle.w"
+#line 646 "ctangle.w"
 
 /*60:*/
-#line 706 "ctangle.w"
+#line 713 "ctangle.w"
 
 case section_number:
 if(cur_val> 0)C_printf("/*%d:*/",cur_val);
@@ -821,10 +840,10 @@
 break;
 
 /*:60*/
-#line 640 "ctangle.w"
+#line 647 "ctangle.w"
 
 /*56:*/
-#line 658 "ctangle.w"
+#line 665 "ctangle.w"
 
 case plus_plus:C_putc('+');C_putc('+');out_state= normal;break;
 case minus_minus:C_putc('-');C_putc('-');out_state= normal;break;
@@ -845,7 +864,7 @@
 break;
 
 /*:56*/
-#line 641 "ctangle.w"
+#line 648 "ctangle.w"
 
 case'=':case'>':C_putc(cur_char);C_putc(' ');
 out_state= normal;break;
@@ -864,7 +883,7 @@
 }
 
 /*:55*//*64:*/
-#line 787 "ctangle.w"
+#line 794 "ctangle.w"
 
 static eight_bits
 skip_ahead(void)
@@ -882,7 +901,7 @@
 }
 
 /*:64*//*67:*/
-#line 826 "ctangle.w"
+#line 833 "ctangle.w"
 
 static boolean skip_comment(
 boolean is_long_comment)
@@ -916,7 +935,7 @@
 }
 
 /*:67*//*69:*/
-#line 867 "ctangle.w"
+#line 874 "ctangle.w"
 
 static eight_bits
 get_next(void)
@@ -930,7 +949,7 @@
 else if(print_where&&!no_where){
 print_where= false;
 /*85:*/
-#line 1213 "ctangle.w"
+#line 1220 "ctangle.w"
 
 {
 eight_bits a;
@@ -947,7 +966,7 @@
 }
 
 /*:85*/
-#line 879 "ctangle.w"
+#line 886 "ctangle.w"
 
 }
 else return(eight_bits)'\n';
@@ -960,7 +979,7 @@
 }
 loc++;
 if(xisdigit(c)||c=='.')/*73:*/
-#line 951 "ctangle.w"
+#line 958 "ctangle.w"
 {
 boolean hex_flag= false;
 id_first= loc-1;
@@ -994,13 +1013,13 @@
 }
 
 /*:73*/
-#line 890 "ctangle.w"
+#line 897 "ctangle.w"
 
 else if(c=='\''||c=='"'
 ||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"'))
 ||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"')))
 /*74:*/
-#line 988 "ctangle.w"
+#line 995 "ctangle.w"
 {
 char delim= (char)c;
 id_first= section_text+1;
@@ -1044,11 +1063,11 @@
 }
 
 /*:74*/
-#line 894 "ctangle.w"
+#line 901 "ctangle.w"
 
 else if(isalpha((int)c)||isxalpha(c)||ishigh(c))
 /*72:*/
-#line 942 "ctangle.w"
+#line 949 "ctangle.w"
 {
 id_first= --loc;
 do
@@ -1059,10 +1078,10 @@
 }
 
 /*:72*/
-#line 896 "ctangle.w"
+#line 903 "ctangle.w"
 
 else if(c=='@')/*75:*/
-#line 1033 "ctangle.w"
+#line 1040 "ctangle.w"
 
 switch(c= ccode[(eight_bits)*loc++]){
 case ignore:continue;
@@ -1077,11 +1096,11 @@
 case section_name:
 cur_section_name_char= *(loc-1);
 /*77:*/
-#line 1078 "ctangle.w"
+#line 1085 "ctangle.w"
 {
 char*k= section_text;
 /*79:*/
-#line 1100 "ctangle.w"
+#line 1107 "ctangle.w"
 
 while(true){
 if(loc> limit&&get_line()==false){
@@ -1091,7 +1110,7 @@
 }
 c= (eight_bits)*loc;
 /*80:*/
-#line 1123 "ctangle.w"
+#line 1130 "ctangle.w"
 
 if(c=='@'){
 c= (eight_bits)*(loc+1);
@@ -1110,7 +1129,7 @@
 }
 
 /*:80*/
-#line 1108 "ctangle.w"
+#line 1115 "ctangle.w"
 
 loc++;if(k<section_text_end)k++;
 if(xisspace(c)){
@@ -1127,7 +1146,7 @@
 if(*k==' '&&k> section_text)k--;
 
 /*:79*/
-#line 1080 "ctangle.w"
+#line 1087 "ctangle.w"
 
 if(k-section_text> 3&&strncmp(k-2,"...",3)==0)
 cur_section_name= section_lookup(section_text+1,k-3,true);
@@ -1136,7 +1155,7 @@
 
 if(cur_section_name_char=='(')
 /*47:*/
-#line 494 "ctangle.w"
+#line 502 "ctangle.w"
 
 {
 for(an_output_file= cur_out_file;
@@ -1150,16 +1169,16 @@
 }
 
 /*:47*/
-#line 1088 "ctangle.w"
+#line 1095 "ctangle.w"
 
 return section_name;
 }
 
 /*:77*/
-#line 1046 "ctangle.w"
+#line 1053 "ctangle.w"
 
 case string:/*81:*/
-#line 1145 "ctangle.w"
+#line 1152 "ctangle.w"
 
 id_first= loc++;*(limit+1)= '@';*(limit+2)= '>';
 while(*loc!='@'||*(loc+1)!='>')loc++;
@@ -1169,10 +1188,10 @@
 return string;
 
 /*:81*/
-#line 1047 "ctangle.w"
+#line 1054 "ctangle.w"
 
 case ord:/*76:*/
-#line 1058 "ctangle.w"
+#line 1065 "ctangle.w"
 
 id_first= loc;
 if(*loc=='\\')
@@ -1194,13 +1213,13 @@
 return ord;
 
 /*:76*/
-#line 1048 "ctangle.w"
+#line 1055 "ctangle.w"
 
 default:return c;
 }
 
 /*:75*/
-#line 897 "ctangle.w"
+#line 904 "ctangle.w"
 
 else if(xisspace(c)){
 if(!preprocessing||loc> limit)continue;
@@ -1210,7 +1229,7 @@
 }
 else if(c=='#'&&loc==buffer+1)preprocessing= true;
 mistake:/*71:*/
-#line 919 "ctangle.w"
+#line 926 "ctangle.w"
 
 switch(c){
 case'+':if(*loc=='+')compress(plus_plus);break;
@@ -1235,7 +1254,7 @@
 }
 
 /*:71*/
-#line 905 "ctangle.w"
+#line 912 "ctangle.w"
 
 return c;
 }
@@ -1242,7 +1261,7 @@
 }
 
 /*:69*//*83:*/
-#line 1181 "ctangle.w"
+#line 1188 "ctangle.w"
 
 static void
 scan_repl(
@@ -1250,7 +1269,7 @@
 {
 sixteen_bits a;
 if(t==section_name)/*85:*/
-#line 1213 "ctangle.w"
+#line 1220 "ctangle.w"
 
 {
 eight_bits a;
@@ -1267,11 +1286,11 @@
 }
 
 /*:85*/
-#line 1187 "ctangle.w"
+#line 1194 "ctangle.w"
 
 while(true)switch(a= get_next()){
 /*86:*/
-#line 1228 "ctangle.w"
+#line 1235 "ctangle.w"
 
 case identifier:store_id(a);
 if(*buffer=='#'&&(
@@ -1284,7 +1303,7 @@
 case section_name:if(t!=section_name)goto done;
 else{
 /*87:*/
-#line 1269 "ctangle.w"
+#line 1276 "ctangle.w"
 {
 char*try_loc= loc;
 while(*try_loc==' '&&try_loc<limit)try_loc++;
@@ -1297,13 +1316,13 @@
 }
 
 /*:87*/
-#line 1239 "ctangle.w"
+#line 1246 "ctangle.w"
 
 a= cur_section_name-name_dir;
 app_repl((a/0400)+0250);
 app_repl(a%0400);
 /*85:*/
-#line 1213 "ctangle.w"
+#line 1220 "ctangle.w"
 
 {
 eight_bits a;
@@ -1320,7 +1339,7 @@
 }
 
 /*:85*/
-#line 1243 "ctangle.w"
+#line 1250 "ctangle.w"
 
 }
 break;
@@ -1332,7 +1351,7 @@
 app_repl((a/0400)+0200);
 app_repl(a%0400);
 /*85:*/
-#line 1213 "ctangle.w"
+#line 1220 "ctangle.w"
 
 {
 eight_bits a;
@@ -1349,13 +1368,13 @@
 }
 
 /*:85*/
-#line 1253 "ctangle.w"
+#line 1260 "ctangle.w"
 
 }
 break;
 case constant:case string:
 /*88:*/
-#line 1286 "ctangle.w"
+#line 1293 "ctangle.w"
 
 app_repl(a);
 while(id_first<id_loc){
@@ -1371,12 +1390,12 @@
 app_repl(a);
 
 /*:88*/
-#line 1257 "ctangle.w"
+#line 1264 "ctangle.w"
 
 break;
 case ord:
 /*89:*/
-#line 1304 "ctangle.w"
+#line 1311 "ctangle.w"
 {
 int c= (int)((eight_bits)*id_first);
 if(c=='\\'){
@@ -1426,7 +1445,7 @@
 }
 
 /*:89*/
-#line 1260 "ctangle.w"
+#line 1267 "ctangle.w"
 
 break;
 case definition:case format_code:case begin_C:if(t!=section_name)goto done;
@@ -1437,7 +1456,7 @@
 case new_section:goto done;
 
 /*:86*/
-#line 1192 "ctangle.w"
+#line 1199 "ctangle.w"
 
 case')':app_repl(a);
 if(t==macro)app_repl(' ');
@@ -1450,7 +1469,7 @@
 }
 
 /*:83*//*90:*/
-#line 1362 "ctangle.w"
+#line 1369 "ctangle.w"
 
 static void
 scan_section(void)
@@ -1465,7 +1484,7 @@
 next_control= ignore;
 while(true){
 /*92:*/
-#line 1403 "ctangle.w"
+#line 1410 "ctangle.w"
 
 while(next_control<definition)
 
@@ -1474,11 +1493,11 @@
 }
 
 /*:92*/
-#line 1376 "ctangle.w"
+#line 1383 "ctangle.w"
 
 if(next_control==definition){
 /*93:*/
-#line 1410 "ctangle.w"
+#line 1417 "ctangle.w"
 
 while((next_control= get_next())=='\n');
 if(next_control!=identifier){
@@ -1494,7 +1513,7 @@
 cur_text->text_link= macro;
 
 /*:93*/
-#line 1378 "ctangle.w"
+#line 1385 "ctangle.w"
 
 continue;
 }
@@ -1504,7 +1523,7 @@
 if(next_control==section_name){
 p= cur_section_name;
 /*94:*/
-#line 1432 "ctangle.w"
+#line 1439 "ctangle.w"
 
 while((next_control= get_next())=='+');
 if(next_control!='='&&next_control!=eq_eq)
@@ -1511,7 +1530,7 @@
 continue;
 
 /*:94*/
-#line 1386 "ctangle.w"
+#line 1393 "ctangle.w"
 
 break;
 }
@@ -1519,20 +1538,20 @@
 }
 no_where= print_where= false;
 /*95:*/
-#line 1437 "ctangle.w"
+#line 1444 "ctangle.w"
 
 /*96:*/
-#line 1442 "ctangle.w"
+#line 1449 "ctangle.w"
 
 store_two_bytes((sixteen_bits)(0150000+section_count));
 
 
 /*:96*/
-#line 1438 "ctangle.w"
+#line 1445 "ctangle.w"
 
 scan_repl(section_name);
 /*97:*/
-#line 1446 "ctangle.w"
+#line 1453 "ctangle.w"
 
 if(p==name_dir||p==NULL){
 last_unnamed->text_link= cur_text-text_info;last_unnamed= cur_text;
@@ -1549,16 +1568,16 @@
 
 
 /*:97*/
-#line 1440 "ctangle.w"
+#line 1447 "ctangle.w"
 
 
 /*:95*/
-#line 1392 "ctangle.w"
+#line 1399 "ctangle.w"
 
 }
 
 /*:90*//*98:*/
-#line 1461 "ctangle.w"
+#line 1468 "ctangle.w"
 
 static void
 phase_one(void){
@@ -1571,7 +1590,7 @@
 }
 
 /*:98*//*100:*/
-#line 1477 "ctangle.w"
+#line 1484 "ctangle.w"
 
 static void
 skip_limbo(void)
@@ -1585,7 +1604,7 @@
 switch(ccode[(eight_bits)c]){
 case new_section:return;
 case translit_code:/*102:*/
-#line 1507 "ctangle.w"
+#line 1514 "ctangle.w"
 
 while(xisspace(*loc)&&loc<limit)loc++;
 loc+= 3;
@@ -1610,7 +1629,7 @@
 }
 
 /*:102*/
-#line 1489 "ctangle.w"
+#line 1496 "ctangle.w"
 break;
 case format_code:case'@':break;
 case control_text:if(c=='q'||c=='Q'){
@@ -1628,7 +1647,7 @@
 }
 
 /*:100*//*103:*/
-#line 1533 "ctangle.w"
+#line 1540 "ctangle.w"
 
 void
 print_stats(void){

Modified: trunk/Build/source/texk/web2c/cwebdir/ctangle.w
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctangle.w	2023-09-21 23:43:49 UTC (rev 68342)
+++ trunk/Build/source/texk/web2c/cwebdir/ctangle.w	2023-09-22 14:22:50 UTC (rev 68343)
@@ -294,9 +294,17 @@
 error message will have been generated before we do any of the initialization.
 
 @<Initialize the output stacks@>=
-stack_ptr=stack+1; cur_name=name_dir; cur_repl=text_info->text_link+text_info;
+stack_ptr=stack+1; cur_name=name_dir;
+cur_repl=text_info->text_link+text_info;
 cur_byte=cur_repl->tok_start; cur_section=0;
 
+@ Similar settings are used for secondary output files.
+
+@<Initialize the secondary output@>=
+stack_ptr=stack+1; cur_name=*an_output_file;
+cur_repl=(text_pointer)cur_name->equiv;
+cur_byte=cur_repl->tok_start;
+
 @ When the replacement text for name |p| is to be inserted into the output,
 the following subroutine is called to save the old level of output and get
 the new one going.
@@ -318,9 +326,6 @@
   }
 }
 
-@ @<Predecl...@>=
-static void push_level(name_pointer);@/
-static void pop_level(boolean);
 
 @ When we come to the end of a replacement text, the |pop_level| subroutine
 does the right thing: It either moves to the continuation of this replacement
@@ -339,6 +344,11 @@
   if (stack_ptr>stack) cur_state=*stack_ptr;@^system dependencies@>
 }
 
+@ @<Predecl...@>=
+static void push_level(name_pointer);@/
+static void pop_level(boolean);@/
+static void get_output(void);
+
 @ The heart of the output procedure is the function |get_output|,
 which produces the next token of output and sends it on to the lower-level
 function |out_char|. The main purpose of |get_output| is to handle the
@@ -391,8 +401,6 @@
   }
 }
 
-@ @<Predecl...@>=@+static void get_output(void);
-
 @ The user may have forgotten to give any \CEE/ text for a section name,
 or the \CEE/ text may have been associated with a different name by mistake.
 
@@ -526,10 +534,8 @@
 @.Writing the output...@>
       update_terminal();
     }
-    if (text_info->text_link!=macro) {
-      while (stack_ptr>stack) get_output();
-      flush_buffer();
-    }
+    if (text_info->text_link!=macro)
+      @<Output material...@>@;
     @<Write all the named output files@>@;
     if (show_happiness) {
       if (show_progress) new_line();
@@ -538,7 +544,10 @@
   }
 }
 
-@ @<Predecl...@>=@+static void phase_two(void);
+@ @<Predecl...@>=
+static void phase_two(void);@/
+static void output_defs(void);@/
+static void out_char(eight_bits);
 
 @ To write the named output files, we proceed as for the unnamed
 section.
@@ -554,14 +563,16 @@
 @.Cannot open output file@>
     if (show_progress) { printf("\n(%s)",output_file_name); update_terminal(); }
     cur_line=1;
-    stack_ptr=stack+1;
-    cur_name=*an_output_file;
-    cur_repl=(text_pointer)cur_name->equiv;
-    cur_byte=cur_repl->tok_start;
-    while (stack_ptr > stack) get_output();
-    flush_buffer();
+    @<Initialize the secondary output@>@;
+    @<Output material...@>@;
 }
 
+@ @<Output material from |stack|@>=
+{
+  while (stack_ptr>stack) get_output();
+  flush_buffer();
+}
+
 @ If a \.{@@h} was not encountered in the input,
 we go through the list of replacement texts and copy the ones
 that refer to macros, preceded by the \.{\#define} preprocessor command.
@@ -573,10 +584,6 @@
 @ @<Private...@>=
 static boolean output_defs_seen=false;
 
-@ @<Predecl...@>=
-static void output_defs(void);@/
-static void out_char(eight_bits);
-
 @ @d macro_end (cur_text+1)->tok_start /* end of |macro| replacement text */
 @#
 @d C_printf(c,a) fprintf(C_file,c,a)



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