texlive[74799] Build/source/texk/web2c: [CWEB] Discard trailing

commits+ascherer at tug.org commits+ascherer at tug.org
Mon Mar 31 18:33:16 CEST 2025


Revision: 74799
          https://tug.org/svn/texlive?view=revision&revision=74799
Author:   ascherer
Date:     2025-03-31 18:33:16 +0200 (Mon, 31 Mar 2025)
Log Message:
-----------
[CWEB] Discard trailing whitespace in macros.

Note that we can't use 'isspace' here, because a trailing '++' (in the
CWEB code) is scanned as 'plus_plus' and takes the numeric value '013'
(see 'common.h') and collides with ASCII '\v' (vertical tab).

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

Modified: trunk/Build/source/texk/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ChangeLog	2025-03-30 23:42:09 UTC (rev 74798)
+++ trunk/Build/source/texk/web2c/ChangeLog	2025-03-31 16:33:16 UTC (rev 74799)
@@ -1,3 +1,8 @@
+2025-03-31  Andreas Scherer  <https://ascherer.github.io>
+
+	* ctangleboot.cin,
+	* cwebboot.cin: Discard trailing whitespace in macros.
+
 2025-03-12  Andreas Scherer  <https://ascherer.github.io>
 
 	* weave.ch: Prevent get_line() when parsing module name.

Modified: trunk/Build/source/texk/web2c/ctangleboot.cin
===================================================================
--- trunk/Build/source/texk/web2c/ctangleboot.cin	2025-03-30 23:42:09 UTC (rev 74798)
+++ trunk/Build/source/texk/web2c/ctangleboot.cin	2025-03-31 16:33:16 UTC (rev 74799)
@@ -28,11 +28,8 @@
 /*:5*/
 #line 67 "cwebdir/ctangle.w"
 
-#define banner "This is CTANGLE, Version 4.12.1" \
- \
-
-#define _(s) gettext(s)  \
-
+#define banner "This is CTANGLE, Version 4.12.1"
+#define _(s) gettext(s)
 #define and_and 04
 #define lt_lt 020
 #define gt_gt 021
@@ -47,38 +44,29 @@
 #define dot_dot_dot 016
 #define colon_colon 06
 #define period_ast 026
-#define minus_gt_ast 027 \
-
-#define compress(c) if(loc++<=limit) return c \
-
-#define xisalpha(c) (isalpha((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisdigit(c) (isdigit((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisspace(c) (isspace((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xislower(c) (islower((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisupper(c) (isupper((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisxdigit(c) (isxdigit((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define isxalpha(c) ((c) =='_'||(c) =='$')  \
-
-#define ishigh(c) ((eight_bits) (c) > 0177)  \
- \
-
-#define max_include_depth 10 \
-
+#define minus_gt_ast 027
+#define compress(c) if(loc++<=limit) return c
+#define xisalpha(c) (isalpha((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisdigit(c) (isdigit((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisspace(c) (isspace((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xislower(c) (islower((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisupper(c) (isupper((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisxdigit(c) (isxdigit((int) (c) ) &&((eight_bits) (c) <0200) )
+#define isxalpha(c) ((c) =='_'||(c) =='$')
+#define ishigh(c) ((eight_bits) (c) > 0177)
+#define max_include_depth 10
 #define max_file_name_length 1024
 #define cur_file file[include_depth]
 #define cur_file_name file_name[include_depth]
 #define cur_line line[include_depth]
 #define web_file file[0]
-#define web_file_name file_name[0] \
-
-#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) 
-#define print_id(c) term_write((c) ->byte_start,length(c) ) 
+#define web_file_name file_name[0]
+#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start)
+#define print_id(c) term_write((c) ->byte_start,length(c) )
 #define llink link
 #define rlink dummy.Rlink
-#define root name_dir->rlink \
-
-#define ilk dummy.Ilk \
-
+#define root name_dir->rlink
+#define ilk dummy.Ilk
 #define spotless 0
 #define harmless_message 1
 #define error_message 2
@@ -85,70 +73,51 @@
 #define fatal_message 3
 #define mark_harmless() if(history==spotless) history= harmless_message
 #define mark_error() history= error_message
-#define confusion(s) fatal(_("! This can't happen: ") ,s)  \
- \
-
+#define confusion(s) fatal(_("! This can't happen: ") ,s)
 #define show_banner flags['b']
 #define show_progress flags['p']
 #define show_happiness flags['h']
 #define show_stats flags['s']
 #define make_xrefs flags['x']
-#define check_for_change flags['c'] \
-
-#define update_terminal() fflush(stdout) 
-#define new_line() putchar('\n') 
-#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)  \
-
+#define check_for_change flags['c']
+#define update_terminal() fflush(stdout)
+#define new_line() putchar('\n')
+#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)
 #define buf_size 1000
-#define longest_name 10000 \
-
-#define long_buf_size (buf_size+longest_name) 
-#define max_bytes 1000000 \
-
-#define max_names 10239 \
-
-#define max_sections 4000 \
-
+#define longest_name 10000
+#define long_buf_size (buf_size+longest_name)
+#define max_bytes 1000000
+#define max_names 10239
+#define max_sections 4000
 #define max_texts 10239
 #define max_toks 1000000
-#define equiv equiv_or_xref \
-
+#define equiv equiv_or_xref
 #define macro 0
-#define section_flag max_texts \
-
+#define section_flag max_texts
 #define string 02
 #define constant 03
 #define join 0177
-#define output_defs_flag (2*024000-1)  \
-
+#define output_defs_flag (2*024000-1)
 #define stack_size 50
-#define cur_state stack[stack_size+1] \
-
+#define cur_state stack[stack_size+1]
 #define cur_byte cur_state.byte_field
 #define cur_name cur_state.name_field
 #define cur_repl cur_state.repl_field
 #define cur_section cur_state.section_field
-#define cur_end (cur_repl+1) ->tok_start \
-
+#define cur_end (cur_repl+1) ->tok_start
 #define section_number 0201
-#define identifier 0202 \
-
+#define identifier 0202
 #define normal 0
 #define num_or_id 1
 #define post_slash 2
 #define unbreakable 3
-#define verbatim 4 \
-
+#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 \
-
-#define transliterate_utf_eight flags['u'] \
-
+#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
+#define transliterate_utf_eight flags['u']
 #define ignore 00
 #define ord 0302
 #define control_text 0303
@@ -158,22 +127,17 @@
 #define definition 0307
 #define begin_C 0310
 #define section_name 0311
-#define new_section 0312 \
-
+#define new_section 0312
 #define app_repl(c) { \
 if(tok_ptr==tok_mem_end) overflow(_("token") ) ; \
 else*(tok_ptr++) = (eight_bits) c; \
-} \
-
+}
 #define store_id(a) a= id_lookup(id_first,id_loc,'\0') -name_dir; \
 app_repl((a/0400) +0200) ; \
-app_repl(a%0400)  \
+app_repl(a%0400)
+#define keep_digit_separators flags['k']
+#define max_banner 50
 
-#define keep_digit_separators flags['k'] \
-
-#define max_banner 50 \
-
-
 #line 68 "cwebdir/ctangle.w"
 
 /*3:*/
@@ -1035,17 +999,17 @@
 static void
 output_defs(void)
 {
-sixteen_bits a;
+sixteen_bits a;eight_bits*last_char;
 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;
+cur_byte= cur_text->tok_start;last_char= macro_end-1;
 C_printf("%s","#define ");
 out_state= normal;
 protect= true;
-while(cur_byte<macro_end){
+while('\n'==*last_char||' '==*last_char)last_char--;
+while(cur_byte<=last_char){
 a= *cur_byte++;
-if(cur_byte==macro_end&&a=='\n')break;
 if(out_state==verbatim&&a!=string&&a!=constant&&a!='\n')
 C_putc(a);
 

Modified: trunk/Build/source/texk/web2c/cwebboot.cin
===================================================================
--- trunk/Build/source/texk/web2c/cwebboot.cin	2025-03-30 23:42:09 UTC (rev 74798)
+++ trunk/Build/source/texk/web2c/cwebboot.cin	2025-03-31 16:33:16 UTC (rev 74799)
@@ -55,8 +55,7 @@
 /*:96*/
 #line 63 "cwebdir/common.w"
 
-#define _(s) gettext(s)  \
-
+#define _(s) gettext(s)
 #define and_and 04
 #define lt_lt 020
 #define gt_gt 021
@@ -71,38 +70,29 @@
 #define dot_dot_dot 016
 #define colon_colon 06
 #define period_ast 026
-#define minus_gt_ast 027 \
-
-#define compress(c) if(loc++<=limit) return c \
-
-#define xisalpha(c) (isalpha((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisdigit(c) (isdigit((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisspace(c) (isspace((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xislower(c) (islower((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisupper(c) (isupper((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisxdigit(c) (isxdigit((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define isxalpha(c) ((c) =='_'||(c) =='$')  \
-
-#define ishigh(c) ((eight_bits) (c) > 0177)  \
- \
-
-#define max_include_depth 10 \
-
+#define minus_gt_ast 027
+#define compress(c) if(loc++<=limit) return c
+#define xisalpha(c) (isalpha((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisdigit(c) (isdigit((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisspace(c) (isspace((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xislower(c) (islower((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisupper(c) (isupper((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisxdigit(c) (isxdigit((int) (c) ) &&((eight_bits) (c) <0200) )
+#define isxalpha(c) ((c) =='_'||(c) =='$')
+#define ishigh(c) ((eight_bits) (c) > 0177)
+#define max_include_depth 10
 #define max_file_name_length 1024
 #define cur_file file[include_depth]
 #define cur_file_name file_name[include_depth]
 #define cur_line line[include_depth]
 #define web_file file[0]
-#define web_file_name file_name[0] \
-
-#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) 
-#define print_id(c) term_write((c) ->byte_start,length(c) ) 
+#define web_file_name file_name[0]
+#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start)
+#define print_id(c) term_write((c) ->byte_start,length(c) )
 #define llink link
 #define rlink dummy.Rlink
-#define root name_dir->rlink \
-
-#define ilk dummy.Ilk \
-
+#define root name_dir->rlink
+#define ilk dummy.Ilk
 #define spotless 0
 #define harmless_message 1
 #define error_message 2
@@ -109,73 +99,54 @@
 #define fatal_message 3
 #define mark_harmless() if(history==spotless) history= harmless_message
 #define mark_error() history= error_message
-#define confusion(s) fatal(_("! This can't happen: ") ,s)  \
- \
-
+#define confusion(s) fatal(_("! This can't happen: ") ,s)
 #define show_banner flags['b']
 #define show_progress flags['p']
 #define show_happiness flags['h']
 #define show_stats flags['s']
 #define make_xrefs flags['x']
-#define check_for_change flags['c'] \
-
-#define update_terminal() fflush(stdout) 
-#define new_line() putchar('\n') 
-#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)  \
-
+#define check_for_change flags['c']
+#define update_terminal() fflush(stdout)
+#define new_line() putchar('\n')
+#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)
 #define buf_size 1000
-#define longest_name 10000 \
-
-#define long_buf_size (buf_size+longest_name) 
-#define max_bytes 1000000 \
-
-#define max_names 10239 \
-
-#define max_sections 4000 \
-
+#define longest_name 10000
+#define long_buf_size (buf_size+longest_name)
+#define max_bytes 1000000
+#define max_names 10239
+#define max_sections 4000
 #define lines_dont_match (change_limit-change_buffer!=limit-buffer|| \
-strncmp(buffer,change_buffer,(size_t) (limit-buffer) ) !=0)  \
-
+strncmp(buffer,change_buffer,(size_t) (limit-buffer) ) !=0)
 #define if_section_start_make_pending(b)  \
 *limit= '!'; \
 for(loc= buffer;xisspace(*loc) ;loc++) ; \
 *limit= ' '; \
-if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b \
-
+if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b
 #define too_long() {include_depth--; \
-err_print(_("! Include file name too long") ) ;goto restart;} \
-
-#define hash_size 8501 \
-
-#define first_chunk(p) ((p) ->byte_start+2) 
+err_print(_("! Include file name too long") ) ;goto restart;}
+#define hash_size 8501
+#define first_chunk(p) ((p) ->byte_start+2)
 #define prefix_length(p) (size_t) ((eight_bits) *((p) ->byte_start) *256+ \
-(eight_bits) *((p) ->byte_start+1) ) 
+(eight_bits) *((p) ->byte_start+1) )
 #define set_prefix_length(p,m) (*((p) ->byte_start) = (char) ((m) /256) , \
-*((p) ->byte_start+1) = (char) ((m) %256) )  \
-
+*((p) ->byte_start+1) = (char) ((m) %256) )
 #define less 0
 #define equal 1
 #define greater 2
 #define prefix 3
-#define extension 4 \
-
-#define bad_extension 5 \
-
+#define extension 4
+#define bad_extension 5
 #define RETURN_OK 0
 #define RETURN_WARN 5
 #define RETURN_ERROR 10
-#define RETURN_FAIL 20 \
-
-#define flag_change (**argv!='-') 
-#define max_banner 50 \
-
+#define RETURN_FAIL 20
+#define flag_change (**argv!='-')
+#define max_banner 50
 #define PATH_SEPARATOR separators[0]
 #define DIR_SEPARATOR separators[1]
-#define DEVICE_SEPARATOR separators[2] \
+#define DEVICE_SEPARATOR separators[2]
+#define kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true)
 
-#define kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true)  \
-
-
 #line 64 "cwebdir/common.w"
 
 /*2:*/

Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2025-03-30 23:42:09 UTC (rev 74798)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2025-03-31 16:33:16 UTC (rev 74799)
@@ -1,3 +1,9 @@
+2025-03-31  Andreas Scherer  <https://ascherer.github.io>
+
+	* common.c,
+	* ctangle.c,
+	* ctangle.w: Discard trailing whitespace in macros.
+
 2025-03-12  Andreas Scherer  <https://ascherer.github.io>
 
 	* ctwill-w2c.ch,

Modified: trunk/Build/source/texk/web2c/cwebdir/common.c
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/common.c	2025-03-30 23:42:09 UTC (rev 74798)
+++ trunk/Build/source/texk/web2c/cwebdir/common.c	2025-03-31 16:33:16 UTC (rev 74799)
@@ -16,8 +16,7 @@
 #line 63 "common.w"
 
 #define ctangle false
-#define cweave true \
-
+#define cweave true
 #define and_and 04
 #define lt_lt 020
 #define gt_gt 021
@@ -32,38 +31,29 @@
 #define dot_dot_dot 016
 #define colon_colon 06
 #define period_ast 026
-#define minus_gt_ast 027 \
-
-#define compress(c) if(loc++<=limit) return c \
-
-#define xisalpha(c) (isalpha((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisdigit(c) (isdigit((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisspace(c) (isspace((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xislower(c) (islower((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisupper(c) (isupper((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisxdigit(c) (isxdigit((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define isxalpha(c) ((c) =='_'||(c) =='$')  \
-
-#define ishigh(c) ((eight_bits) (c) > 0177)  \
- \
-
-#define max_include_depth 10 \
-
+#define minus_gt_ast 027
+#define compress(c) if(loc++<=limit) return c
+#define xisalpha(c) (isalpha((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisdigit(c) (isdigit((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisspace(c) (isspace((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xislower(c) (islower((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisupper(c) (isupper((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisxdigit(c) (isxdigit((int) (c) ) &&((eight_bits) (c) <0200) )
+#define isxalpha(c) ((c) =='_'||(c) =='$')
+#define ishigh(c) ((eight_bits) (c) > 0177)
+#define max_include_depth 10
 #define max_file_name_length 60
 #define cur_file file[include_depth]
 #define cur_file_name file_name[include_depth]
 #define cur_line line[include_depth]
 #define web_file file[0]
-#define web_file_name file_name[0] \
-
-#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) 
-#define print_id(c) term_write((c) ->byte_start,length(c) ) 
+#define web_file_name file_name[0]
+#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start)
+#define print_id(c) term_write((c) ->byte_start,length(c) )
 #define llink link
 #define rlink dummy.Rlink
-#define root name_dir->rlink \
-
-#define ilk dummy.Ilk \
-
+#define root name_dir->rlink
+#define ilk dummy.Ilk
 #define spotless 0
 #define harmless_message 1
 #define error_message 2
@@ -70,59 +60,44 @@
 #define fatal_message 3
 #define mark_harmless() if(history==spotless) history= harmless_message
 #define mark_error() history= error_message
-#define confusion(s) fatal("! This can't happen: ",s)  \
- \
-
+#define confusion(s) fatal("! This can't happen: ",s)
 #define show_banner flags['b']
 #define show_progress flags['p']
 #define show_happiness flags['h']
 #define show_stats flags['s']
-#define make_xrefs flags['x'] \
-
-#define update_terminal() fflush(stdout) 
-#define new_line() putchar('\n') 
-#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)  \
-
+#define make_xrefs flags['x']
+#define update_terminal() fflush(stdout)
+#define new_line() putchar('\n')
+#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)
 #define buf_size 200
-#define longest_name 10000 \
-
-#define long_buf_size (buf_size+longest_name) 
-#define max_bytes 100000 \
-
-#define max_names 5000 \
-
-#define max_sections 2000 \
-
+#define longest_name 10000
+#define long_buf_size (buf_size+longest_name)
+#define max_bytes 100000
+#define max_names 5000
+#define max_sections 2000
 #define lines_dont_match (change_limit-change_buffer!=limit-buffer|| \
-strncmp(buffer,change_buffer,(size_t) (limit-buffer) ) !=0)  \
-
+strncmp(buffer,change_buffer,(size_t) (limit-buffer) ) !=0)
 #define if_section_start_make_pending(b)  \
 *limit= '!'; \
 for(loc= buffer;xisspace(*loc) ;loc++) ; \
 *limit= ' '; \
-if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b \
-
+if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b
 #define too_long() {include_depth--; \
-err_print("! Include file name too long") ;goto restart;} \
-
-#define hash_size 353 \
-
-#define first_chunk(p) ((p) ->byte_start+2) 
+err_print("! Include file name too long") ;goto restart;}
+#define hash_size 353
+#define first_chunk(p) ((p) ->byte_start+2)
 #define prefix_length(p) (size_t) ((eight_bits) *((p) ->byte_start) *256+ \
-(eight_bits) *((p) ->byte_start+1) ) 
+(eight_bits) *((p) ->byte_start+1) )
 #define set_prefix_length(p,m) (*((p) ->byte_start) = (char) ((m) /256) , \
-*((p) ->byte_start+1) = (char) ((m) %256) )  \
-
+*((p) ->byte_start+1) = (char) ((m) %256) )
 #define less 0
 #define equal 1
 #define greater 2
 #define prefix 3
-#define extension 4 \
+#define extension 4
+#define bad_extension 5
+#define flag_change (**argv!='-')
 
-#define bad_extension 5 \
-
-#define flag_change (**argv!='-') 
-
 #line 64 "common.w"
 
 /*2:*/

Modified: trunk/Build/source/texk/web2c/cwebdir/ctangle.c
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctangle.c	2025-03-30 23:42:09 UTC (rev 74798)
+++ trunk/Build/source/texk/web2c/cwebdir/ctangle.c	2025-03-31 16:33:16 UTC (rev 74799)
@@ -15,11 +15,9 @@
 /*:5*/
 #line 67 "ctangle.w"
 
-#define banner "This is CTANGLE (Version 4.12.1)" \
-
+#define banner "This is CTANGLE (Version 4.12.1)"
 #define ctangle false
-#define cweave true \
-
+#define cweave true
 #define and_and 04
 #define lt_lt 020
 #define gt_gt 021
@@ -34,38 +32,29 @@
 #define dot_dot_dot 016
 #define colon_colon 06
 #define period_ast 026
-#define minus_gt_ast 027 \
-
-#define compress(c) if(loc++<=limit) return c \
-
-#define xisalpha(c) (isalpha((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisdigit(c) (isdigit((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisspace(c) (isspace((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xislower(c) (islower((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisupper(c) (isupper((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define xisxdigit(c) (isxdigit((int) (c) ) &&((eight_bits) (c) <0200) ) 
-#define isxalpha(c) ((c) =='_'||(c) =='$')  \
-
-#define ishigh(c) ((eight_bits) (c) > 0177)  \
- \
-
-#define max_include_depth 10 \
-
+#define minus_gt_ast 027
+#define compress(c) if(loc++<=limit) return c
+#define xisalpha(c) (isalpha((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisdigit(c) (isdigit((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisspace(c) (isspace((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xislower(c) (islower((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisupper(c) (isupper((int) (c) ) &&((eight_bits) (c) <0200) )
+#define xisxdigit(c) (isxdigit((int) (c) ) &&((eight_bits) (c) <0200) )
+#define isxalpha(c) ((c) =='_'||(c) =='$')
+#define ishigh(c) ((eight_bits) (c) > 0177)
+#define max_include_depth 10
 #define max_file_name_length 60
 #define cur_file file[include_depth]
 #define cur_file_name file_name[include_depth]
 #define cur_line line[include_depth]
 #define web_file file[0]
-#define web_file_name file_name[0] \
-
-#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) 
-#define print_id(c) term_write((c) ->byte_start,length(c) ) 
+#define web_file_name file_name[0]
+#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start)
+#define print_id(c) term_write((c) ->byte_start,length(c) )
 #define llink link
 #define rlink dummy.Rlink
-#define root name_dir->rlink \
-
-#define ilk dummy.Ilk \
-
+#define root name_dir->rlink
+#define ilk dummy.Ilk
 #define spotless 0
 #define harmless_message 1
 #define error_message 2
@@ -72,67 +61,49 @@
 #define fatal_message 3
 #define mark_harmless() if(history==spotless) history= harmless_message
 #define mark_error() history= error_message
-#define confusion(s) fatal("! This can't happen: ",s)  \
- \
-
+#define confusion(s) fatal("! This can't happen: ",s)
 #define show_banner flags['b']
 #define show_progress flags['p']
 #define show_happiness flags['h']
 #define show_stats flags['s']
-#define make_xrefs flags['x'] \
-
-#define update_terminal() fflush(stdout) 
-#define new_line() putchar('\n') 
-#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)  \
-
+#define make_xrefs flags['x']
+#define update_terminal() fflush(stdout)
+#define new_line() putchar('\n')
+#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)
 #define buf_size 200
-#define longest_name 10000 \
-
-#define long_buf_size (buf_size+longest_name) 
-#define max_bytes 100000 \
-
-#define max_names 5000 \
-
-#define max_sections 2000 \
-
+#define longest_name 10000
+#define long_buf_size (buf_size+longest_name)
+#define max_bytes 100000
+#define max_names 5000
+#define max_sections 2000
 #define max_texts 4000
 #define max_toks 270000
-#define equiv equiv_or_xref \
-
+#define equiv equiv_or_xref
 #define macro 0
-#define section_flag max_texts \
-
+#define section_flag max_texts
 #define string 02
 #define constant 03
 #define join 0177
-#define output_defs_flag (2*024000-1)  \
-
+#define output_defs_flag (2*024000-1)
 #define stack_size 50
-#define cur_state stack[stack_size+1] \
-
+#define cur_state stack[stack_size+1]
 #define cur_byte cur_state.byte_field
 #define cur_name cur_state.name_field
 #define cur_repl cur_state.repl_field
 #define cur_section cur_state.section_field
-#define cur_end (cur_repl+1) ->tok_start \
-
+#define cur_end (cur_repl+1) ->tok_start
 #define section_number 0201
-#define identifier 0202 \
-
+#define identifier 0202
 #define normal 0
 #define num_or_id 1
 #define post_slash 2
 #define unbreakable 3
-#define verbatim 4 \
-
+#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 \
-
+#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
 #define ignore 00
 #define ord 0302
 #define control_text 0303
@@ -142,20 +113,16 @@
 #define definition 0307
 #define begin_C 0310
 #define section_name 0311
-#define new_section 0312 \
-
+#define new_section 0312
 #define app_repl(c) { \
 if(tok_ptr==tok_mem_end) overflow("token") ; \
 else*(tok_ptr++) = (eight_bits) c; \
-} \
-
+}
 #define store_id(a) a= id_lookup(id_first,id_loc,'\0') -name_dir; \
 app_repl((a/0400) +0200) ; \
-app_repl(a%0400)  \
+app_repl(a%0400)
+#define keep_digit_separators flags['k']
 
-#define keep_digit_separators flags['k'] \
-
-
 #line 68 "ctangle.w"
 
 /*3:*/
@@ -747,17 +714,17 @@
 static void
 output_defs(void)
 {
-sixteen_bits a;
+sixteen_bits a;eight_bits*last_char;
 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;
+cur_byte= cur_text->tok_start;last_char= macro_end-1;
 C_printf("%s","#define ");
 out_state= normal;
 protect= true;
-while(cur_byte<macro_end){
+while('\n'==*last_char||' '==*last_char)last_char--;
+while(cur_byte<=last_char){
 a= *cur_byte++;
-if(cur_byte==macro_end&&a=='\n')break;
 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-30 23:42:09 UTC (rev 74798)
+++ trunk/Build/source/texk/web2c/cwebdir/ctangle.w	2025-03-31 16:33:16 UTC (rev 74799)
@@ -593,17 +593,17 @@
 static void
 output_defs(void)
 {
-  sixteen_bits a;
+  sixteen_bits a; eight_bits *last_char;
   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;
+      cur_byte=cur_text->tok_start; last_char=macro_end-1;
       C_printf("%s","#define ");
       out_state=normal;
       protect=true; /* newlines should be preceded by |'\\'| */
-      while (cur_byte<macro_end) {
+      while ('\n'==*last_char||' '==*last_char) last_char--; /* discard trailing whitespace */
+      while (cur_byte<=last_char) {
         a=*cur_byte++;
-        if (cur_byte==macro_end && a=='\n') break; /* disregard a final newline */
         if (out_state==verbatim && a!=string && a!=constant && a!='\n')
           C_putc(a); /* a high-bit character can occur in a string */
 @^high-bit character handling@>



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