texlive[74802] Build/source/texk/web2c: [CWEB] Refactor last_char and

commits+ascherer at tug.org commits+ascherer at tug.org
Mon Mar 31 21:51:31 CEST 2025


Revision: 74802
          https://tug.org/svn/texlive?view=revision&revision=74802
Author:   ascherer
Date:     2025-03-31 21:51:31 +0200 (Mon, 31 Mar 2025)
Log Message:
-----------
[CWEB] Refactor last_char and macro_end.

Both are exclusively used in section 54.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/ctangleboot.cin
    trunk/Build/source/texk/web2c/cwebdir/ctangle.c
    trunk/Build/source/texk/web2c/cwebdir/ctangle.w

Modified: trunk/Build/source/texk/web2c/ctangleboot.cin
===================================================================
--- trunk/Build/source/texk/web2c/ctangleboot.cin	2025-03-31 19:48:37 UTC (rev 74801)
+++ trunk/Build/source/texk/web2c/ctangleboot.cin	2025-03-31 19:51:31 UTC (rev 74802)
@@ -113,7 +113,6 @@
 #define unbreakable 3
 #define verbatim 4
 #define max_files 256
-#define macro_end (cur_text+1) ->tok_start
 #define C_printf(c,a) fprintf(C_file,c,a)
 #define C_putc(c) fputc((int) (c) ,C_file)
 #define translit_length 10
@@ -994,21 +993,23 @@
 }
 
 /*:48*//*54:*/
-#line 592 "cwebdir/ctangle.w"
+#line 590 "cwebdir/ctangle.w"
 
 static void
 output_defs(void)
 {
-sixteen_bits a;eight_bits*last_char;
+sixteen_bits a;eight_bits*macro_end;
 push_level(NULL);
 for(cur_text= text_info+1;cur_text<text_ptr;cur_text++)
 if(cur_text->text_link==macro){
-cur_byte= cur_text->tok_start;last_char= macro_end-1;
+cur_byte= cur_text->tok_start;
+macro_end= (cur_text+1)->tok_start;
 C_printf("%s","#define ");
 out_state= normal;
 protect= true;
-while('\n'==*last_char||' '==*last_char)last_char--;
-while(cur_byte<=last_char){
+do macro_end--;while('\n'==*macro_end||' '==*macro_end);
+
+while(cur_byte<=macro_end){
 a= *cur_byte++;
 if(out_state==verbatim&&a!=string&&a!=constant&&a!='\n')
 C_putc(a);

Modified: trunk/Build/source/texk/web2c/cwebdir/ctangle.c
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctangle.c	2025-03-31 19:48:37 UTC (rev 74801)
+++ trunk/Build/source/texk/web2c/cwebdir/ctangle.c	2025-03-31 19:51:31 UTC (rev 74802)
@@ -100,7 +100,6 @@
 #define unbreakable 3
 #define verbatim 4
 #define max_files 256
-#define macro_end (cur_text+1) ->tok_start
 #define C_printf(c,a) fprintf(C_file,c,a)
 #define C_putc(c) fputc((int) (c) ,C_file)
 #define translit_length 10
@@ -709,21 +708,23 @@
 }
 
 /*:48*//*54:*/
-#line 592 "ctangle.w"
+#line 590 "ctangle.w"
 
 static void
 output_defs(void)
 {
-sixteen_bits a;eight_bits*last_char;
+sixteen_bits a;eight_bits*macro_end;
 push_level(NULL);
 for(cur_text= text_info+1;cur_text<text_ptr;cur_text++)
 if(cur_text->text_link==macro){
-cur_byte= cur_text->tok_start;last_char= macro_end-1;
+cur_byte= cur_text->tok_start;
+macro_end= (cur_text+1)->tok_start;
 C_printf("%s","#define ");
 out_state= normal;
 protect= true;
-while('\n'==*last_char||' '==*last_char)last_char--;
-while(cur_byte<=last_char){
+do macro_end--;while('\n'==*macro_end||' '==*macro_end);
+
+while(cur_byte<=macro_end){
 a= *cur_byte++;
 if(out_state==verbatim&&a!=string&&a!=constant&&a!='\n')
 C_putc(a);

Modified: trunk/Build/source/texk/web2c/cwebdir/ctangle.w
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctangle.w	2025-03-31 19:48:37 UTC (rev 74801)
+++ trunk/Build/source/texk/web2c/cwebdir/ctangle.w	2025-03-31 19:51:31 UTC (rev 74802)
@@ -584,9 +584,7 @@
 @ @<Private...@>=
 static boolean output_defs_seen=false;
 
-@ @d macro_end (cur_text+1)->tok_start /* end of |macro| replacement text */
-@#
- at d C_printf(c,a) fprintf(C_file,c,a)
+@ @d C_printf(c,a) fprintf(C_file,c,a)
 @d C_putc(c) fputc((int)(c),C_file) /* isn't \CEE/ wonderfully consistent? */
 
 @c
@@ -593,16 +591,18 @@
 static void
 output_defs(void)
 {
-  sixteen_bits a; eight_bits *last_char;
+  sixteen_bits a; eight_bits *macro_end;
   push_level(NULL);
   for (cur_text=text_info+1; cur_text<text_ptr; cur_text++)
     if (cur_text->text_link==macro) { /* |cur_text| is the text for a |macro| */
-      cur_byte=cur_text->tok_start; last_char=macro_end-1;
+      cur_byte=cur_text->tok_start;
+      macro_end=(cur_text+1)->tok_start; /* end of |macro| replacement text */
       C_printf("%s","#define ");
       out_state=normal;
       protect=true; /* newlines should be preceded by |'\\'| */
-      while ('\n'==*last_char||' '==*last_char) last_char--; /* discard trailing whitespace */
-      while (cur_byte<=last_char) {
+      do macro_end--; while ('\n'==*macro_end||' '==*macro_end);
+        /* discard trailing whitespace */
+      while (cur_byte<=macro_end) {
         a=*cur_byte++;
         if (out_state==verbatim && a!=string && a!=constant && a!='\n')
           C_putc(a); /* a high-bit character can occur in a string */



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