From 561085282b65ae9085c18c56475fecc74af78a79 Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Sat, 29 Jul 2023 17:38:44 +0000 Subject: [PATCH] [CWEB] Syntactic sugar. See 'too_long()' macro in common.w. git-svn-id: svn://tug.org/texlive/trunk/Build/source@67762 c570f23f-e606-0410-a88d-b1316a301751 --- texk/web2c/ctangleboot.cin | 24 +++++----- texk/web2c/cwebboot.cin | 14 +++--- texk/web2c/cwebdir/ChangeLog | 16 +++++++ texk/web2c/cwebdir/comm-bs.ch | 4 +- texk/web2c/cwebdir/comm-w2c.h | 8 ++-- texk/web2c/cwebdir/common.c | 14 +++--- texk/web2c/cwebdir/common.h | 8 ++-- texk/web2c/cwebdir/common.w | 6 +-- texk/web2c/cwebdir/ctang-bs.ch | 8 ++-- texk/web2c/cwebdir/ctang-w2c.ch | 8 ++-- texk/web2c/cwebdir/ctangle.c | 24 +++++----- texk/web2c/cwebdir/ctangle.w | 16 +++---- texk/web2c/cwebdir/ctwill-w2c.ch | 16 +++---- texk/web2c/cwebdir/cweav-bs.ch | 8 ++-- texk/web2c/cwebdir/cweav-w2c.ch | 12 ++--- texk/web2c/cwebdir/cweave.w | 80 ++++++++++++++++---------------- 16 files changed, 141 insertions(+), 125 deletions(-) diff --git a/texk/web2c/ctangleboot.cin b/texk/web2c/ctangleboot.cin index ab90cc6a00..f6991bb3de 100644 --- a/texk/web2c/ctangleboot.cin +++ b/texk/web2c/ctangleboot.cin @@ -83,8 +83,8 @@ #define harmless_message 1 #define error_message 2 #define fatal_message 3 -#define mark_harmless if(history==spotless) history= harmless_message -#define mark_error history= error_message +#define mark_harmless() if(history==spotless) history= harmless_message +#define mark_error() history= error_message #define confusion(s) fatal(_("! This can't happen: ") ,s) \ \ @@ -95,8 +95,8 @@ #define make_xrefs flags['x'] #define check_for_change flags['c'] \ -#define update_terminal fflush(stdout) -#define new_line putchar('\n') +#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 @@ -693,7 +693,7 @@ C_putc('\n'); if(cur_line%100==0&&show_progress){ putchar('.'); if(cur_line%500==0)printf("%d",cur_line); -update_terminal; +update_terminal(); } cur_line++; } @@ -726,7 +726,7 @@ output_defs(); if(text_info->text_link==macro&&cur_out_file==end_output_files){ #line 97 "cwebdir/ctang-w2c.ch" -fputs(_("\n! No program text was specified."),stdout);mark_harmless; +fputs(_("\n! No program text was specified."),stdout);mark_harmless(); #line 519 "cwebdir/ctangle.w" } @@ -736,7 +736,7 @@ if(show_progress){ #line 103 "cwebdir/ctang-w2c.ch" printf(_("\nWriting the output file (%s):"),C_file_name); #line 525 "cwebdir/ctangle.w" -update_terminal; +update_terminal(); } } else{ @@ -746,7 +746,7 @@ fputs(_("\nWriting the output files:"),stdout); #line 531 "cwebdir/ctangle.w" printf(" (%s)",C_file_name); -update_terminal; +update_terminal(); } if(text_info->text_link==macro)goto writeloop; } @@ -833,7 +833,7 @@ if((C_file= fopen(output_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),output_file_name); } -if(show_progress){printf("\n(%s)",output_file_name);update_terminal;} +if(show_progress){printf("\n(%s)",output_file_name);update_terminal();} cur_line= 1; stack_ptr= stack+1; cur_name= *an_output_file; @@ -1012,7 +1012,7 @@ strcpy(check_file_name,""); #line 539 "cwebdir/ctangle.w" if(show_happiness){ -if(show_progress)new_line; +if(show_progress)new_line(); #line 115 "cwebdir/ctang-w2c.ch" fputs(_("Done."),stdout); #line 543 "cwebdir/ctangle.w" @@ -1451,7 +1451,7 @@ fputs(_("\n! Section name too long: "),stdout); #line 1123 "cwebdir/ctangle.w" term_write(section_text+1,25); -printf("...");mark_harmless; +printf("...");mark_harmless(); } if(*k==' '&&k> section_text)k--; @@ -1809,7 +1809,7 @@ text_pointer q; sixteen_bits a; section_count++;no_where= true; if(*(loc-1)=='*'&&show_progress){ -printf("*%d",(int)section_count);update_terminal; +printf("*%d",(int)section_count);update_terminal(); } next_control= ignore; while(true){ diff --git a/texk/web2c/cwebboot.cin b/texk/web2c/cwebboot.cin index af32f191bd..78f1c6c04c 100644 --- a/texk/web2c/cwebboot.cin +++ b/texk/web2c/cwebboot.cin @@ -107,8 +107,8 @@ #define harmless_message 1 #define error_message 2 #define fatal_message 3 -#define mark_harmless if(history==spotless) history= harmless_message -#define mark_error history= error_message +#define mark_harmless() if(history==spotless) history= harmless_message +#define mark_error() history= error_message #define confusion(s) fatal(_("! This can't happen: ") ,s) \ \ @@ -119,8 +119,8 @@ #define make_xrefs flags['x'] #define check_for_change flags['c'] \ -#define update_terminal fflush(stdout) -#define new_line putchar('\n') +#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 @@ -1326,7 +1326,7 @@ if(l> buffer){ for(k= buffer;k + + * comm-bs.ch, + * comm-w2c.h, + * common.c, + * common.h, + * common.w, + * ctang-bs.ch, + * ctang-w2c.ch, + * ctangle.c, + * ctangle.w, + * ctwill-w2c.ch, + * cweav-bs.ch, + * cweav-w2c.ch, + * cweave.w: Syntactic sugar. + 2023-07-28 Andreas Scherer * comm-w2c.h, diff --git a/texk/web2c/cwebdir/comm-bs.ch b/texk/web2c/cwebdir/comm-bs.ch index 5d62e60019..5af439b88a 100644 --- a/texk/web2c/cwebdir/comm-bs.ch +++ b/texk/web2c/cwebdir/comm-bs.ch @@ -25,7 +25,7 @@ typedef struct name_info { union { struct name_info *Rlink; /* right link in binary search tree for section names */ - char Ilk; /* used by identifiers in \.{CWEAVE} only */ + eight_bits Ilk; /* used by identifiers in \.{CWEAVE} only */ } dummy; void *equiv_or_xref; /* info corresponding to names */ } name_info; /* contains information about an identifier or section name */ @@ -45,7 +45,7 @@ typedef struct name_info { union { struct name_info *Rlink; /* right link in binary search tree for section names */ - char Ilk; /* used by identifiers in \.{CWEAVE} only */ + eight_bits Ilk; /* used by identifiers in \.{CWEAVE} only */ } dummy; union { void huge* equiv_member; diff --git a/texk/web2c/cwebdir/comm-w2c.h b/texk/web2c/cwebdir/comm-w2c.h index 076748cee6..c9fd567797 100644 --- a/texk/web2c/cwebdir/comm-w2c.h +++ b/texk/web2c/cwebdir/comm-w2c.h @@ -208,8 +208,8 @@ extern void init_node(name_pointer);@/ @d harmless_message 1 /* |history| value when non-serious info was printed */ @d error_message 2 /* |history| value when an error was noted */ @d fatal_message 3 /* |history| value when we had to stop prematurely */ -@d mark_harmless if (history==spotless) history=harmless_message -@d mark_error history=error_message +@d mark_harmless() if (history==spotless) history=harmless_message +@d mark_error() history=error_message @d confusion(s) fatal(_("! This can't happen: "),s) @.This can't happen@> @@ -242,8 +242,8 @@ extern boolean flags[]; /* an option for each 7-bit code */ extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */ @ Code related to output: -@d update_terminal fflush(stdout) /* empty the terminal output buffer */ -@d new_line putchar('\n') +@d update_terminal() fflush(stdout) /* empty the terminal output buffer */ +@d new_line() putchar('\n') @d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout) @= diff --git a/texk/web2c/cwebdir/common.c b/texk/web2c/cwebdir/common.c index 8636b902f0..cc1889ca28 100644 --- a/texk/web2c/cwebdir/common.c +++ b/texk/web2c/cwebdir/common.c @@ -68,8 +68,8 @@ #define harmless_message 1 #define error_message 2 #define fatal_message 3 -#define mark_harmless if(history==spotless) history= harmless_message -#define mark_error history= error_message +#define mark_harmless() if(history==spotless) history= harmless_message +#define mark_error() history= error_message #define confusion(s) fatal("! This can't happen: ",s) \ \ @@ -79,8 +79,8 @@ #define show_stats flags['s'] #define make_xrefs flags['x'] \ -#define update_terminal fflush(stdout) -#define new_line putchar('\n') +#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 @@ -1101,7 +1101,7 @@ if(l> buffer){ for(k= buffer;k @@ -217,8 +217,8 @@ extern char scn_file_name[]; /* name of |scn_file| */ extern boolean flags[]; /* an option for each 7-bit code */ @ Code related to output: -@d update_terminal fflush(stdout) /* empty the terminal output buffer */ -@d new_line putchar('\n') +@d update_terminal() fflush(stdout) /* empty the terminal output buffer */ +@d new_line() putchar('\n') @d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout) @= diff --git a/texk/web2c/cwebdir/common.w b/texk/web2c/cwebdir/common.w index c207aeea40..593a9efeb8 100644 --- a/texk/web2c/cwebdir/common.w +++ b/texk/web2c/cwebdir/common.w @@ -1017,7 +1017,7 @@ const char *s) { *s=='!'? printf("\n%s",s) : printf("%s",s); if (web_file_open) @@; - update_terminal; mark_error; + update_terminal(); mark_error(); } @ The error locations can be indicated by using the global variables @@ -1040,7 +1040,7 @@ if (l>buffer) { for (k=buffer; k@; diff --git a/texk/web2c/cwebdir/ctang-bs.ch b/texk/web2c/cwebdir/ctang-bs.ch index bf4a443f1d..b8de3d58d6 100644 --- a/texk/web2c/cwebdir/ctang-bs.ch +++ b/texk/web2c/cwebdir/ctang-bs.ch @@ -27,7 +27,7 @@ is modified. @x Section 10. - for section names */ +@d ilk dummy.Ilk /* used by \.{CWEAVE} only */ @= typedef struct name_info { @@ -36,7 +36,7 @@ typedef struct name_info { union { struct name_info *Rlink; /* right link in binary search tree for section names */ - char Ilk; /* used by identifiers in \.{CWEAVE} only */ + eight_bits Ilk; /* used by identifiers in \.{CWEAVE} only */ } dummy; void *equiv_or_xref; /* info corresponding to names */ } name_info; /* contains information about an identifier or section name */ @@ -52,7 +52,7 @@ extern name_pointer hash[]; /* heads of hash lists */ extern hash_pointer hash_end; /* end of |hash| */ extern hash_pointer h; /* index into hash-head array */ @y - for section names */ +@d ilk dummy.Ilk /* used by \.{CWEAVE} only */ @f huge extern @@ -63,7 +63,7 @@ typedef struct name_info { union { struct name_info *Rlink; /* right link in binary search tree for section names */ - char Ilk; /* used by identifiers in \.{CWEAVE} only */ + eight_bits Ilk; /* used by identifiers in \.{CWEAVE} only */ } dummy; union { char *equiv_member; diff --git a/texk/web2c/cwebdir/ctang-w2c.ch b/texk/web2c/cwebdir/ctang-w2c.ch index d4ccabf789..c8fd9a39d8 100644 --- a/texk/web2c/cwebdir/ctang-w2c.ch +++ b/texk/web2c/cwebdir/ctang-w2c.ch @@ -92,9 +92,9 @@ @z @x - fputs("\n! No program text was specified.",stdout); mark_harmless; + fputs("\n! No program text was specified.",stdout); mark_harmless(); @y - fputs(_("\n! No program text was specified."),stdout); mark_harmless; + fputs(_("\n! No program text was specified."),stdout); mark_harmless(); @z @x @@ -124,7 +124,7 @@ for (an_output_file=end_output_files; an_output_file>cur_out_file;) { if ((C_file=fopen(output_file_name,"wb"))==NULL) fatal("! Cannot open output file ",output_file_name); @.Cannot open output file@> - if (show_progress) { printf("\n(%s)",output_file_name); update_terminal; } + if (show_progress) { printf("\n(%s)",output_file_name); update_terminal(); } cur_line=1; stack_ptr=stack+1; cur_name=*an_output_file; @@ -149,7 +149,7 @@ for (an_output_file=end_output_files; an_output_file>cur_out_file;) { fatal(_("! Cannot open output file "),output_file_name); @.Cannot open output file@> } - if (show_progress) { printf("\n(%s)",output_file_name); update_terminal; } + if (show_progress) { printf("\n(%s)",output_file_name); update_terminal(); } cur_line=1; stack_ptr=stack+1; cur_name=*an_output_file; diff --git a/texk/web2c/cwebdir/ctangle.c b/texk/web2c/cwebdir/ctangle.c index 6683184d3f..a7ec5e28ab 100644 --- a/texk/web2c/cwebdir/ctangle.c +++ b/texk/web2c/cwebdir/ctangle.c @@ -70,8 +70,8 @@ #define harmless_message 1 #define error_message 2 #define fatal_message 3 -#define mark_harmless if(history==spotless) history= harmless_message -#define mark_error history= error_message +#define mark_harmless() if(history==spotless) history= harmless_message +#define mark_error() history= error_message #define confusion(s) fatal("! This can't happen: ",s) \ \ @@ -81,8 +81,8 @@ #define show_stats flags['s'] #define make_xrefs flags['x'] \ -#define update_terminal fflush(stdout) -#define new_line putchar('\n') +#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 @@ -647,7 +647,7 @@ C_putc('\n'); if(cur_line%100==0&&show_progress){ putchar('.'); if(cur_line%500==0)printf("%d",cur_line); -update_terminal; +update_terminal(); } cur_line++; } @@ -679,14 +679,14 @@ output_defs(); #line 516 "ctangle.w" if(text_info->text_link==macro&&cur_out_file==end_output_files){ -fputs("\n! No program text was specified.",stdout);mark_harmless; +fputs("\n! No program text was specified.",stdout);mark_harmless(); } else{ if(cur_out_file==end_output_files){ if(show_progress){ printf("\nWriting the output file (%s):",C_file_name); -update_terminal; +update_terminal(); } } else{ @@ -694,7 +694,7 @@ if(show_progress){ fputs("\nWriting the output files:",stdout); printf(" (%s)",C_file_name); -update_terminal; +update_terminal(); } if(text_info->text_link==macro)goto writeloop; } @@ -710,7 +710,7 @@ fclose(C_file); if((C_file= fopen(output_file_name,"wb"))==NULL) fatal("! Cannot open output file ",output_file_name); -if(show_progress){printf("\n(%s)",output_file_name);update_terminal;} +if(show_progress){printf("\n(%s)",output_file_name);update_terminal();} cur_line= 1; stack_ptr= stack+1; cur_name= *an_output_file; @@ -724,7 +724,7 @@ flush_buffer(); #line 539 "ctangle.w" if(show_happiness){ -if(show_progress)new_line; +if(show_progress)new_line(); fputs("Done.",stdout); } } @@ -1127,7 +1127,7 @@ if(k>=section_text_end){ fputs("\n! Section name too long: ",stdout); term_write(section_text+1,25); -printf("...");mark_harmless; +printf("...");mark_harmless(); } if(*k==' '&&k> section_text)k--; @@ -1465,7 +1465,7 @@ text_pointer q; sixteen_bits a; section_count++;no_where= true; if(*(loc-1)=='*'&&show_progress){ -printf("*%d",(int)section_count);update_terminal; +printf("*%d",(int)section_count);update_terminal(); } next_control= ignore; while(true){ diff --git a/texk/web2c/cwebdir/ctangle.w b/texk/web2c/cwebdir/ctangle.w index aa6217ac76..15d37c9d31 100644 --- a/texk/web2c/cwebdir/ctangle.w +++ b/texk/web2c/cwebdir/ctangle.w @@ -462,7 +462,7 @@ flush_buffer(void) /* writes one line to output file */ if (cur_line % 100 == 0 && show_progress) { putchar('.'); if (cur_line % 500 == 0) printf("%d",cur_line); - update_terminal; /* progress report */ + update_terminal(); /* progress report */ } cur_line++; } @@ -515,14 +515,14 @@ phase_two (void) { @@; @@; if (text_info->text_link==macro && cur_out_file==end_output_files) { - fputs("\n! No program text was specified.",stdout); mark_harmless; + fputs("\n! No program text was specified.",stdout); mark_harmless(); @.No program text...@> } else { if (cur_out_file==end_output_files) { if (show_progress) { printf("\nWriting the output file (%s):",C_file_name); - update_terminal; + update_terminal(); } } else { @@ -530,7 +530,7 @@ phase_two (void) { fputs("\nWriting the output files:",stdout); @.Writing the output...@> printf(" (%s)",C_file_name); - update_terminal; + update_terminal(); } if (text_info->text_link==macro) goto writeloop; } @@ -538,7 +538,7 @@ phase_two (void) { flush_buffer(); writeloop: @@; if (show_happiness) { - if (show_progress) new_line; + if (show_progress) new_line(); fputs("Done.",stdout); } } @@ -558,7 +558,7 @@ for (an_output_file=end_output_files; an_output_file>cur_out_file;) { if ((C_file=fopen(output_file_name,"wb"))==NULL) fatal("! Cannot open output file ",output_file_name); @.Cannot open output file@> - if (show_progress) { printf("\n(%s)",output_file_name); update_terminal; } + if (show_progress) { printf("\n(%s)",output_file_name); update_terminal(); } cur_line=1; stack_ptr=stack+1; cur_name=*an_output_file; @@ -1122,7 +1122,7 @@ if (k>=section_text_end) { fputs("\n! Section name too long: ",stdout); @.Section name too long@> term_write(section_text+1,25); - printf("..."); mark_harmless; + printf("..."); mark_harmless(); } if (*k==' ' && k>section_text) k--; @@ -1374,7 +1374,7 @@ scan_section(void) sixteen_bits a; /* token for left-hand side of definition */ section_count++; @+ no_where=true; if (*(loc-1)=='*' && show_progress) { /* starred section */ - printf("*%d",(int)section_count); update_terminal; + printf("*%d",(int)section_count); update_terminal(); } next_control=ignore; while (true) { diff --git a/texk/web2c/cwebdir/ctwill-w2c.ch b/texk/web2c/cwebdir/ctwill-w2c.ch index 874f1decae..c570b2a68a 100644 --- a/texk/web2c/cwebdir/ctwill-w2c.ch +++ b/texk/web2c/cwebdir/ctwill-w2c.ch @@ -446,18 +446,18 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); @x fputs("\n! Never defined: <",stdout); - print_section_name(p); putchar('>'); mark_harmless; + print_section_name(p); putchar('>'); mark_harmless(); @y fputs(_("\n! Never defined: <"),stdout); - print_section_name(p); putchar('>'); mark_harmless; + print_section_name(p); putchar('>'); mark_harmless(); @z @x fputs("\n! Never used: <",stdout); - print_section_name(p); putchar('>'); mark_harmless; + print_section_name(p); putchar('>'); mark_harmless(); @y fputs(_("\n! Never used: <"),stdout); - print_section_name(p); putchar('>'); mark_harmless; + print_section_name(p); putchar('>'); mark_harmless(); @z @x @@ -618,9 +618,9 @@ print_text( /* prints a token list for debugging; not used in |main| */ @z @x - update_terminal; + update_terminal(); @y - puts("|"); update_terminal; + puts("|"); update_terminal(); @z @x @@ -883,9 +883,9 @@ if (cat1==decl_head) { @z @x - printf("\nTracing after l. %d:\n",cur_line); mark_harmless; + printf("\nTracing after l. %d:\n",cur_line); mark_harmless(); @y - printf(_("\nTracing after l. %d:\n"),cur_line); mark_harmless; + printf(_("\nTracing after l. %d:\n"),cur_line); mark_harmless(); @z @x diff --git a/texk/web2c/cwebdir/cweav-bs.ch b/texk/web2c/cwebdir/cweav-bs.ch index 46c6f6c01c..5d432e0574 100644 --- a/texk/web2c/cwebdir/cweav-bs.ch +++ b/texk/web2c/cwebdir/cweav-bs.ch @@ -30,7 +30,7 @@ is modified. @x Section 10. - for section names */ +@d ilk dummy.Ilk /* used by \.{CWEAVE} only */ @= typedef struct name_info { @@ -39,7 +39,7 @@ typedef struct name_info { union { struct name_info *Rlink; /* right link in binary search tree for section names */ - char Ilk; /* used by identifiers in \.{CWEAVE} only */ + eight_bits Ilk; /* used by identifiers in \.{CWEAVE} only */ } dummy; void *equiv_or_xref; /* info corresponding to names */ } name_info; /* contains information about an identifier or section name */ @@ -55,7 +55,7 @@ extern name_pointer hash[]; /* heads of hash lists */ extern hash_pointer hash_end; /* end of |hash| */ extern hash_pointer h; /* index into hash-head array */ @y - for section names */ +@d ilk dummy.Ilk /* used by \.{CWEAVE} only */ @f huge extern @@ -66,7 +66,7 @@ typedef struct name_info { union { struct name_info *Rlink; /* right link in binary search tree for section names */ - char Ilk; /* used by identifiers in \.{CWEAVE} only */ + eight_bits Ilk; /* used by identifiers in \.{CWEAVE} only */ } dummy; union { char *equiv_member; diff --git a/texk/web2c/cwebdir/cweav-w2c.ch b/texk/web2c/cwebdir/cweav-w2c.ch index 4d8062bad6..48cf8dbde3 100644 --- a/texk/web2c/cwebdir/cweav-w2c.ch +++ b/texk/web2c/cwebdir/cweav-w2c.ch @@ -175,18 +175,18 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); @x fputs("\n! Never defined: <",stdout); - print_section_name(p); putchar('>'); mark_harmless; + print_section_name(p); putchar('>'); mark_harmless(); @y fputs(_("\n! Never defined: <"),stdout); - print_section_name(p); putchar('>'); mark_harmless; + print_section_name(p); putchar('>'); mark_harmless(); @z @x fputs("\n! Never used: <",stdout); - print_section_name(p); putchar('>'); mark_harmless; + print_section_name(p); putchar('>'); mark_harmless(); @y fputs(_("\n! Never used: <"),stdout); - print_section_name(p); putchar('>'); mark_harmless; + print_section_name(p); putchar('>'); mark_harmless(); @z @x @@ -443,9 +443,9 @@ else if (cat1==stmt) { @z @x - printf("\nTracing after l. %d:\n",cur_line); mark_harmless; + printf("\nTracing after l. %d:\n",cur_line); mark_harmless(); @y - printf(_("\nTracing after l. %d:\n"),cur_line); mark_harmless; + printf(_("\nTracing after l. %d:\n"),cur_line); mark_harmless(); @z @x diff --git a/texk/web2c/cwebdir/cweave.w b/texk/web2c/cwebdir/cweave.w index 20a2308b53..3419fc7e06 100644 --- a/texk/web2c/cwebdir/cweave.w +++ b/texk/web2c/cwebdir/cweave.w @@ -100,7 +100,7 @@ char **av) /* argument values */ phase_one(); /* read all the user's text and store the cross-references */ phase_two(); /* read all the text again and translate it to \TEX/ form */ phase_three(); /* output the cross-reference index */ - if (tracing==fully && !show_progress) new_line; + if (tracing==fully && !show_progress) new_line(); return wrap_up(); /* and exit gracefully */ } @@ -914,7 +914,7 @@ convention, but do not allow the string to be longer than |longest_name|. fputs("\n! String too long: ",stdout); @.String too long@> term_write(section_text+1,25); - printf("..."); mark_error; + printf("..."); mark_error(); } id_loc++; return string; @@ -984,7 +984,7 @@ if (k>=section_text_end) { fputs("\n! Section name too long: ",stdout); @.Section name too long@> term_write(section_text+1,25); - printf("..."); mark_harmless; + printf("..."); mark_harmless(); } if (*k==' ' && k>section_text) k--; @@ -1078,7 +1078,7 @@ phase_one(void) { /* it will become |true| if any line changes */ if (*(loc-1)=='*' && show_progress) { printf("*%d",(int)section_count); - update_terminal; /* print a progress report */ + update_terminal(); /* print a progress report */ } @@; @@; @@ -1303,13 +1303,13 @@ name_pointer p) /* print anomalies in subtree |p| */ if ((an_output=(cur_xref->num==file_flag))==true) cur_xref=cur_xref->xlink; if (cur_xref->num '); mark_harmless; + print_section_name(p); putchar('>'); mark_harmless(); @.Never defined:
@> } while (cur_xref->num >=cite_flag) cur_xref=cur_xref->xlink; if (cur_xref==xmem && !an_output) { fputs("\n! Never used: <",stdout); - print_section_name(p); putchar('>'); mark_harmless; + print_section_name(p); putchar('>'); mark_harmless(); @.Never used:
@> } section_check(p->rlink); @@ -1345,7 +1345,7 @@ of commented-out text). @d c_line_write(c) fflush(active_file),fwrite(out_buf+1,sizeof(char),c,active_file) @d tex_putc(c) putc(c,active_file) -@d tex_new_line putc('\n',active_file) +@d tex_new_line() putc('\n',active_file) @d tex_printf(c) fprintf(active_file,"%s",c) @d tex_puts(c) fputs(c,active_file) @@ -1364,7 +1364,7 @@ boolean per_cent,boolean carryover) while (j>out_buf && *j==' ') j--; c_line_write(j-out_buf); if (per_cent) tex_putc('%'); - tex_new_line; out_line++; + tex_new_line(); out_line++; if (carryover) while (j>out_buf) if (*j--=='%' && (j==out_buf || *j!='\\')) { @@ -1463,7 +1463,7 @@ line by putting a |'%'| just before the last character. printf("\n! Line had to be broken (output l. %d):\n",out_line); @.Line had to be broken@> term_write(out_buf+1, out_ptr-out_buf-1); - new_line; mark_harmless; + new_line(); mark_harmless(); flush_buffer(out_ptr-1,true,true); return; } @@ -2236,7 +2236,7 @@ text_pointer p) default: @@; } } - update_terminal; + update_terminal(); } @ @=@+static void print_text(text_pointer p); @@ -2352,9 +2352,9 @@ static int cur_mathness, init_mathness; understanding the format by comparing the code with the symbolic productions as they were listed earlier. -@d begin_math if (cur_mathness==maybe_math) init_mathness=yes_math; +@d begin_math() if (cur_mathness==maybe_math) init_mathness=yes_math; else if (cur_mathness==no_math) app_str("${}") -@d end_math if (cur_mathness==maybe_math) init_mathness=no_math; +@d end_math() if (cur_mathness==maybe_math) init_mathness=no_math; else if (cur_mathness==yes_math) app_str("{}$") @c @@ -2371,10 +2371,10 @@ token a) { if (a==' ' || (a>=big_cancel && a<=big_force) || a==dindent) /* non-math token */ { - end_math; + end_math(); cur_mathness=no_math; } else { - begin_math; + begin_math(); cur_mathness=yes_math; } app(a); @@ -2386,11 +2386,11 @@ scrap_pointer a) { switch (a->mathness % 4) { /* left boundary */ case (no_math): - end_math; + end_math(); cur_mathness=a->mathness / 4; /* right boundary */ break; case (yes_math): - begin_math; + begin_math(); cur_mathness=a->mathness / 4; /* right boundary */ break; case (maybe_math): /* no changes */ break; @@ -3176,7 +3176,7 @@ current token list is empty and ready to be appended~to. Note that |freeze_text| does not check to see that |text_ptr| hasn't gotten too large, since it is assumed that this test was done beforehand. -@d freeze_text *(++text_ptr)=tok_ptr +@d freeze_text() *(++text_ptr)=tok_ptr @= static void reduce(scrap_pointer,short,eight_bits,short,short);@/ @@ -3197,7 +3197,7 @@ short d, short n) if (k>0) { j->trans=text_ptr; j->mathness=4*cur_mathness+init_mathness; - freeze_text; + freeze_text(); } if (k>1) { for (i=j+k, i1=j+1; i<=lo_ptr; i++, i1++) { @@ -3340,13 +3340,13 @@ for (j=scrap_base; j<=lo_ptr; j++) { if (j->mathness / 4 == yes_math) app('$'); if (tok_ptr+6>tok_mem_end) overflow("token"); } -freeze_text; return text_ptr-1; +freeze_text(); return text_ptr-1; @ @= if (lo_ptr>scrap_base && tracing==partly) { printf("\nIrreducible scrap sequence in section %d:",(int)section_count); @.Irreducible scrap sequence...@> - mark_harmless; + mark_harmless(); for (j=scrap_base; j<=lo_ptr; j++) { putchar(' '); print_cat(j->cat); } @@ -3354,7 +3354,7 @@ if (lo_ptr>scrap_base && tracing==partly) { @ @= if (tracing==fully) { - printf("\nTracing after l. %d:\n",cur_line); mark_harmless; + printf("\nTracing after l. %d:\n",cur_line); mark_harmless(); @.Tracing after...@> if (loc>buffer+50) { printf("..."); @@ -3399,7 +3399,7 @@ been appended: @d app_scrap(c,b) { (++scrap_ptr)->cat=(c); scrap_ptr->trans=text_ptr; scrap_ptr->mathness=5*(b); /* no no, yes yes, or maybe maybe */ - freeze_text; + freeze_text(); } @ @= @@ -3697,7 +3697,7 @@ outer_parse(void) /* makes scraps from \CEE/ tokens and comments */ @.\\SHC@> bal=copy_comment(is_long_comment,1); next_control=ignore; while (bal>0) { - p=text_ptr; freeze_text; q=C_translate(); + p=text_ptr; freeze_text(); q=C_translate(); /* at this point we have |tok_ptr+6<=max_toks| */ app(tok_flag+(int)(p-tok_start)); if (make_pb) app_str("\\PB{"); @@ -3772,7 +3772,7 @@ typedef output_state *stack_pointer; @d cur_end cur_state.end_field /* current ending location in |tok_mem| */ @d cur_tok cur_state.tok_field /* location of next output token in |tok_mem| */ @d cur_mode cur_state.mode_field /* current mode of interpretation */ -@d init_stack stack_ptr=stack;cur_mode=outer /* initialize the stack */ +@d init_stack() stack_ptr=stack;cur_mode=outer /* initialize the stack */ @= static output_state stack[stack_size+1]; /* info for non-current levels */ @@ -3807,7 +3807,7 @@ text_pointer p) force when the current level was begun. This subroutine will never be called when |stack_ptr==1|. It is so simple, we declare it as a macro: -@d pop_level cur_state = *(--stack_ptr) +@d pop_level() cur_state = *(--stack_ptr) @ The |get_output| function returns the next byte of output that is not a reference to a token list. It returns the values |identifier| or |res_word| @@ -3833,7 +3833,7 @@ static eight_bits get_output(void) /* returns the next token of output */ { sixteen_bits a; /* current item read from |tok_mem| */ - restart: while (cur_tok==cur_end) pop_level; + restart: while (cur_tok==cur_end) pop_level(); a=*(cur_tok++); if (a>=0400) { cur_name=a % id_flag + name_dir; @@ -3904,7 +3904,7 @@ make_output(void) /* outputs the equivalents of tokens */ boolean save_mode; /* value of |cur_mode| before a sequence of breaks */ boolean dindent_pending=false; /* should a |dindent| be output? */ app(end_translation); /* append a sentinel */ - freeze_text; push_level(text_ptr-1); + freeze_text(); push_level(text_ptr-1); while (true) { a=get_output(); reswitch: switch(a) { @@ -4120,7 +4120,7 @@ while (k - print_section_name(cur_section_name); printf("> "); mark_error; + print_section_name(cur_section_name); printf("> "); mark_error(); } @ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters, @@ -4135,7 +4135,7 @@ while (true) { if (k>=k_limit) { fputs("\n! C text in section name didn't end: <",stdout); @.C text...didn't end@> - print_section_name(cur_section_name); printf("> "); mark_error; break; + print_section_name(cur_section_name); printf("> "); mark_error(); break; } b=*(k++); if (b=='@@' || (b=='\\' && delim!=0)) @@ -4186,8 +4186,8 @@ within a single section. The variables |out_line| or |out_ptr| will change if a section is non-null, so the following macros `|save_position|' and `|emit_space_if_needed|' are able to handle the situation: -@d save_position save_line=out_line; save_place=out_ptr -@d emit_space_if_needed if (save_line!=out_line || save_place!=out_ptr) +@d save_position() save_line=out_line; save_place=out_ptr +@d emit_space_if_needed() if (save_line!=out_line || save_place!=out_ptr) out_str("\\Y"); space_checked=true; @.\\Y@> @@ -4204,7 +4204,7 @@ static boolean group_found=false; /* has a starred section occurred? */ @ @= { section_count++; @@; - save_position; + save_position(); @@; @@; @@; @@ -4238,7 +4238,7 @@ else { @.\\N@> {@+ char s[32];@+sprintf(s,"{%d}",sec_depth+1);@+out_str(s);@+} if (show_progress) - printf("*%d",(int)section_count); update_terminal; /* print a progress report */ + printf("*%d",(int)section_count); update_terminal(); /* print a progress report */ } out('{'); out_section(section_count); out('}'); @@ -4247,7 +4247,7 @@ index entries are not copied and \CEE/ text within \pb\ is translated. @= do switch (next_control=copy_TeX()) { - case '|': init_stack; output_C(); break; + case '|': init_stack(); output_C(); break; case '@@': out('@@'); break; case TeX_string: case noop: case xref_roman: case xref_wildcard: case xref_typewriter: @@ -4270,7 +4270,7 @@ the token memory is in its initial empty state. @= space_checked=false; while (next_control<=definition) { /* |format_code| or |definition| */ - init_stack; + init_stack(); if (next_control==definition) @@; else @@; outer_parse(); finish_C(format_visible); format_visible=true; @@ -4327,7 +4327,7 @@ it starts after we scan the matching `\.)'. @= { if (save_line!=out_line || save_place!=out_ptr || space_checked) app(backup); - if(!space_checked){emit_space_if_needed;save_position;} + if(!space_checked){emit_space_if_needed();save_position();} app_str("\\D"); /* this will produce `\#\&{define }' */ @.\\D@> if ((next_control=get_next())!=identifier) @@ -4357,7 +4357,7 @@ it starts after we scan the matching `\.)'. @ @= { doing_format=true; if(*(loc-1)=='s' || *(loc-1)=='S') format_visible=false; - if(!space_checked){emit_space_if_needed;save_position;} + if(!space_checked){emit_space_if_needed();save_position();} app_str("\\F"); /* this will produce `\&{format }' */ @.\\F@> next_control=get_next(); @@ -4385,7 +4385,7 @@ static name_pointer this_section; /* the current section name, or zero */ @ @= this_section=name_dir; if (next_control<=section_name) { - emit_space_if_needed; init_stack; + emit_space_if_needed(); init_stack(); if (next_control==begin_C) next_control=get_next(); else { this_section=cur_section; @@ -4552,7 +4552,7 @@ else { fclose(active_file); } if (show_happiness) { - if (show_progress) new_line; + if (show_progress) new_line(); fputs("Done.",stdout); } check_complete(); /* was all of the change file used? */ @@ -4830,7 +4830,7 @@ name_pointer p) if (p) { section_print(p->llink); out_str("\\I"); @.\\I@> - tok_ptr=tok_mem+1; text_ptr=tok_start+1; scrap_ptr=scrap_info; init_stack; + tok_ptr=tok_mem+1; text_ptr=tok_start+1; scrap_ptr=scrap_info; init_stack(); app(section_flag+(int)(p-name_dir)); make_output(); footnote(cite_flag); footnote(0); /* |cur_xref| was set by |make_output| */