summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2021-02-22 14:22:20 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2021-02-22 14:22:20 +0000
commitd9e54ef03db8d244f5386fc89efffccb3d483a5e (patch)
treec0adb02e7b8fd39fc9335d04d8dcd020fb37b570 /Build/source
parent074fd0605dea00c6025fe0ac4d6ec8da21a59c28 (diff)
[CWEB] Code review.
* Decouple CTANGLE and CWEAVE from COMMON by using 'static' variables. * Reshuffle variable declarations in 'common.h' to match the definitions in 'common.w'. * Eliminate some unused stuff in CTWILL. git-svn-id: svn://tug.org/texlive/trunk@57841 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/web2c/ChangeLog5
-rw-r--r--Build/source/texk/web2c/ctangleboot.cin156
-rw-r--r--Build/source/texk/web2c/cwebboot.cin112
-rw-r--r--Build/source/texk/web2c/cwebdir/ChangeLog17
-rw-r--r--Build/source/texk/web2c/cwebdir/Makefile3
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-w2c.ch2
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-w2c.h86
-rw-r--r--Build/source/texk/web2c/cwebdir/common.c112
-rw-r--r--Build/source/texk/web2c/cwebdir/common.h84
-rw-r--r--Build/source/texk/web2c/cwebdir/common.w10
-rw-r--r--Build/source/texk/web2c/cwebdir/ctang-bs.ch12
-rw-r--r--Build/source/texk/web2c/cwebdir/ctangle.c154
-rw-r--r--Build/source/texk/web2c/cwebdir/ctangle.w78
-rw-r--r--Build/source/texk/web2c/cwebdir/ctwill-mini.ch42
-rw-r--r--Build/source/texk/web2c/cwebdir/ctwill-w2c.ch63
-rw-r--r--Build/source/texk/web2c/cwebdir/cweav-bs.ch42
-rw-r--r--Build/source/texk/web2c/cwebdir/cweav-man.ch2
-rw-r--r--Build/source/texk/web2c/cwebdir/cweave.w174
18 files changed, 582 insertions, 572 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 03e20277436..2f64551f44c 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,8 @@
+2021-02-22 Andreas Scherer <https://ascherer.github.io>
+
+ * ctangleboot.cin,
+ * cwebboot.cin: Code review.
+
2021-02-20 Andreas Scherer <https://ascherer.github.io>
* ctangleboot.cin,
diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin
index bb7a8621820..b117786bc79 100644
--- a/Build/source/texk/web2c/ctangleboot.cin
+++ b/Build/source/texk/web2c/ctangleboot.cin
@@ -53,6 +53,15 @@
#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) )
#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \
+#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 llink link
@@ -69,15 +78,6 @@
#define confusion(s) fatal(_("! This can't happen: ") ,s) \
\
-#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 show_banner flags['b']
#define show_progress flags['p']
#define show_stats flags['s']
@@ -187,7 +187,32 @@ extern char*loc;
extern char*limit;
/*:6*//*7:*/
-#line 119 "cwebdir/comm-w2c.h"
+#line 122 "cwebdir/comm-w2c.h"
+
+extern int include_depth;
+extern FILE*file[];
+extern FILE*change_file;
+extern char file_name[][max_file_name_length];
+
+extern char change_file_name[];
+extern char check_file_name[];
+extern int line[];
+extern int change_line;
+extern int change_depth;
+extern boolean input_has_ended;
+extern boolean changing;
+extern boolean web_file_open;
+
+/*:7*//*9:*/
+#line 143 "cwebdir/comm-w2c.h"
+
+extern sixteen_bits section_count;
+extern boolean changed_section[];
+extern boolean change_pending;
+extern boolean print_where;
+
+/*:9*//*10:*/
+#line 157 "cwebdir/comm-w2c.h"
typedef struct name_info{
char*byte_start;
@@ -211,45 +236,20 @@ extern name_pointer hash[];
extern hash_pointer hash_end;
extern hash_pointer h;
-/*:7*//*9:*/
-#line 163 "cwebdir/comm-w2c.h"
+/*:10*//*12:*/
+#line 201 "cwebdir/comm-w2c.h"
extern int history;
-/*:9*//*11:*/
-#line 183 "cwebdir/comm-w2c.h"
+/*:12*//*14:*/
+#line 218 "cwebdir/comm-w2c.h"
-extern int include_depth;
-extern FILE*file[];
-extern FILE*change_file;
+extern int argc;
+extern char**argv;
extern char C_file_name[];
extern char tex_file_name[];
extern char idx_file_name[];
extern char scn_file_name[];
-extern char file_name[][max_file_name_length];
-
-extern char change_file_name[];
-extern char check_file_name[];
-extern int line[];
-extern int change_line;
-extern int change_depth;
-extern boolean input_has_ended;
-extern boolean changing;
-extern boolean web_file_open;
-
-/*:11*//*13:*/
-#line 208 "cwebdir/comm-w2c.h"
-
-extern sixteen_bits section_count;
-extern boolean changed_section[];
-extern boolean change_pending;
-extern boolean print_where;
-
-/*:13*//*14:*/
-#line 222 "cwebdir/comm-w2c.h"
-
-extern int argc;
-extern char**argv;
extern boolean flags[];
extern const char*use_language;
@@ -298,83 +298,90 @@ typedef output_state*stack_pointer;
/*20:*/
#line 129 "cwebdir/ctangle.w"
-text text_info[max_texts];
-text_pointer text_info_end= text_info+max_texts-1;
-text_pointer text_ptr;
-eight_bits tok_mem[max_toks];
-eight_bits*tok_mem_end= tok_mem+max_toks-1;
-eight_bits*tok_ptr;
+static text text_info[max_texts];
+static text_pointer text_info_end= text_info+max_texts-1;
+static text_pointer text_ptr;
+static eight_bits tok_mem[max_toks];
+static eight_bits*tok_mem_end= tok_mem+max_toks-1;
+static eight_bits*tok_ptr;
/*:20*//*26:*/
#line 198 "cwebdir/ctangle.w"
-text_pointer last_unnamed;
+static text_pointer last_unnamed;
/*:26*//*32:*/
#line 286 "cwebdir/ctangle.w"
-output_state cur_state;
+static output_state cur_state;
-output_state stack[stack_size+1];
-stack_pointer stack_end= stack+stack_size;
-stack_pointer stack_ptr;
+static output_state stack[stack_size+1];
+static stack_pointer stack_end= stack+stack_size;
+static stack_pointer stack_ptr;
/*:32*//*37:*/
#line 362 "cwebdir/ctangle.w"
-int cur_val;
+static int cur_val;
/*:37*//*42:*/
#line 454 "cwebdir/ctangle.w"
-eight_bits out_state;
-boolean protect;
+static eight_bits out_state;
+static boolean protect;
/*:42*//*45:*/
#line 486 "cwebdir/ctangle.w"
-name_pointer output_files[max_files];
-name_pointer*cur_out_file,*end_output_files,*an_output_file;
-char cur_section_name_char;
-char output_file_name[longest_name+1];
+static name_pointer output_files[max_files];
+static name_pointer*cur_out_file,*end_output_files,*an_output_file;
+static char cur_section_name_char;
+static char output_file_name[longest_name+1];
/*:45*//*52:*/
#line 586 "cwebdir/ctangle.w"
-boolean output_defs_seen= false;
+static boolean output_defs_seen= false;
/*:52*//*57:*/
#line 695 "cwebdir/ctangle.w"
-char translit[128][translit_length];
+static char translit[128][translit_length];
/*:57*//*62:*/
#line 774 "cwebdir/ctangle.w"
-eight_bits ccode[256];
+static eight_bits ccode[256];
/*:62*//*66:*/
#line 834 "cwebdir/ctangle.w"
-boolean comment_continues= false;
+static boolean comment_continues= false;
/*:66*//*68:*/
#line 873 "cwebdir/ctangle.w"
-name_pointer cur_section_name;
-boolean no_where;
+static name_pointer cur_section_name;
+static boolean no_where;
/*:68*//*82:*/
#line 1187 "cwebdir/ctangle.w"
-text_pointer cur_text;
-eight_bits next_control;
+static text_pointer cur_text;
+static eight_bits next_control;
/*:82*/
#line 71 "cwebdir/ctangle.w"
/*8:*/
-#line 142 "cwebdir/comm-w2c.h"
+#line 137 "cwebdir/comm-w2c.h"
+
+extern boolean get_line(void);
+extern void check_complete(void);
+extern void reset_input(void);
+
+/*:8*//*11:*/
+#line 180 "cwebdir/comm-w2c.h"
extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
extern name_pointer id_lookup(const char*,const char*,char);
@@ -386,22 +393,15 @@ extern void print_prefix_name(name_pointer);
extern void print_section_name(name_pointer);
extern void sprint_section_name(char*,name_pointer);
-/*:8*//*10:*/
-#line 166 "cwebdir/comm-w2c.h"
+/*:11*//*13:*/
+#line 204 "cwebdir/comm-w2c.h"
extern int wrap_up(void);
extern void err_print(const char*);
extern void fatal(const char*,const char*);
extern void overflow(const char*);
-/*:10*//*12:*/
-#line 202 "cwebdir/comm-w2c.h"
-
-extern boolean get_line(void);
-extern void check_complete(void);
-extern void reset_input(void);
-
-/*:12*//*16:*/
+/*:13*//*16:*/
#line 244 "cwebdir/comm-w2c.h"
extern void common_init(void);
diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin
index ad331384198..4e1eda44868 100644
--- a/Build/source/texk/web2c/cwebboot.cin
+++ b/Build/source/texk/web2c/cwebboot.cin
@@ -77,6 +77,15 @@ typedef bool boolean;
#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) )
#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \
+#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 llink link
@@ -93,15 +102,6 @@ typedef bool boolean;
#define confusion(s) fatal(_("! This can't happen: ") ,s) \
\
-#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 show_banner flags['b']
#define show_progress flags['p']
#define show_stats flags['s']
@@ -202,7 +202,32 @@ extern char*loc;
extern char*limit;
/*:5*//*6:*/
-#line 119 "cwebdir/comm-w2c.h"
+#line 122 "cwebdir/comm-w2c.h"
+
+extern int include_depth;
+extern FILE*file[];
+extern FILE*change_file;
+extern char file_name[][max_file_name_length];
+
+extern char change_file_name[];
+extern char check_file_name[];
+extern int line[];
+extern int change_line;
+extern int change_depth;
+extern boolean input_has_ended;
+extern boolean changing;
+extern boolean web_file_open;
+
+/*:6*//*8:*/
+#line 143 "cwebdir/comm-w2c.h"
+
+extern sixteen_bits section_count;
+extern boolean changed_section[];
+extern boolean change_pending;
+extern boolean print_where;
+
+/*:8*//*9:*/
+#line 157 "cwebdir/comm-w2c.h"
typedef struct name_info{
char*byte_start;
@@ -226,45 +251,20 @@ extern name_pointer hash[];
extern hash_pointer hash_end;
extern hash_pointer h;
-/*:6*//*8:*/
-#line 163 "cwebdir/comm-w2c.h"
+/*:9*//*11:*/
+#line 201 "cwebdir/comm-w2c.h"
extern int history;
-/*:8*//*10:*/
-#line 183 "cwebdir/comm-w2c.h"
+/*:11*//*13:*/
+#line 218 "cwebdir/comm-w2c.h"
-extern int include_depth;
-extern FILE*file[];
-extern FILE*change_file;
+extern int argc;
+extern char**argv;
extern char C_file_name[];
extern char tex_file_name[];
extern char idx_file_name[];
extern char scn_file_name[];
-extern char file_name[][max_file_name_length];
-
-extern char change_file_name[];
-extern char check_file_name[];
-extern int line[];
-extern int change_line;
-extern int change_depth;
-extern boolean input_has_ended;
-extern boolean changing;
-extern boolean web_file_open;
-
-/*:10*//*12:*/
-#line 208 "cwebdir/comm-w2c.h"
-
-extern sixteen_bits section_count;
-extern boolean changed_section[];
-extern boolean change_pending;
-extern boolean print_where;
-
-/*:12*//*13:*/
-#line 222 "cwebdir/comm-w2c.h"
-
-extern int argc;
-extern char**argv;
extern boolean flags[];
extern const char*use_language;
@@ -305,8 +305,8 @@ char*id_loc;
char buffer[long_buf_size];
char*buffer_end= buffer+buf_size-2;
-char*limit= buffer;
char*loc= buffer;
+char*limit= buffer;
/*:22*//*25:*/
#line 194 "cwebdir/common.w"
@@ -328,8 +328,8 @@ boolean web_file_open= false;
/*:25*//*26:*/
#line 220 "cwebdir/common.w"
-char change_buffer[buf_size];
-char*change_limit;
+static char change_buffer[buf_size];
+static char*change_limit;
/*:26*//*37:*/
#line 401 "cwebdir/common.w"
@@ -351,8 +351,8 @@ name_pointer name_dir_end= name_dir+max_names-1;
/*:43*//*44:*/
#line 609 "cwebdir/common.w"
-name_pointer name_ptr;
char*byte_ptr;
+name_pointer name_ptr;
/*:44*//*46:*/
#line 629 "cwebdir/common.w"
@@ -415,7 +415,14 @@ char separators[]= SEPARATORS;
#line 70 "cwebdir/common.w"
/*7:*/
-#line 142 "cwebdir/comm-w2c.h"
+#line 137 "cwebdir/comm-w2c.h"
+
+extern boolean get_line(void);
+extern void check_complete(void);
+extern void reset_input(void);
+
+/*:7*//*10:*/
+#line 180 "cwebdir/comm-w2c.h"
extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
extern name_pointer id_lookup(const char*,const char*,char);
@@ -427,22 +434,15 @@ extern void print_prefix_name(name_pointer);
extern void print_section_name(name_pointer);
extern void sprint_section_name(char*,name_pointer);
-/*:7*//*9:*/
-#line 166 "cwebdir/comm-w2c.h"
+/*:10*//*12:*/
+#line 204 "cwebdir/comm-w2c.h"
extern int wrap_up(void);
extern void err_print(const char*);
extern void fatal(const char*,const char*);
extern void overflow(const char*);
-/*:9*//*11:*/
-#line 202 "cwebdir/comm-w2c.h"
-
-extern boolean get_line(void);
-extern void check_complete(void);
-extern void reset_input(void);
-
-/*:11*//*15:*/
+/*:12*//*15:*/
#line 244 "cwebdir/comm-w2c.h"
extern void common_init(void);
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog
index 62332f87863..31dbee73e62 100644
--- a/Build/source/texk/web2c/cwebdir/ChangeLog
+++ b/Build/source/texk/web2c/cwebdir/ChangeLog
@@ -1,3 +1,20 @@
+2021-02-22 Andreas Scherer <https://ascherer.github.io>
+
+ * Makefile,
+ * comm-w2c.ch
+ * comm-w2c.h
+ * common.c
+ * common.h
+ * common.w
+ * ctang-bs.ch,
+ * ctangle.c,
+ * ctangle.w,
+ * ctwill-mini.ch,
+ * ctwill-w2c.ch,
+ * cweav-bs.ch,
+ * cweav-man.ch,
+ * cweave.w: Decouple CTANGLE and CWEAVE from COMMON.
+
2021-02-20 Andreas Scherer <https://ascherer.github.io>
* Makefile,
diff --git a/Build/source/texk/web2c/cwebdir/Makefile b/Build/source/texk/web2c/cwebdir/Makefile
index 63dbd3db343..fa9d83c14fc 100644
--- a/Build/source/texk/web2c/cwebdir/Makefile
+++ b/Build/source/texk/web2c/cwebdir/Makefile
@@ -63,8 +63,10 @@ RM= /bin/rm
CP= /bin/cp
# uncomment the second line if you use pdftex to bypass .dvi files
+# uncomment the third line if you use xetex to bypass .dvi files
PDFTEX = dvipdfm
#PDFTEX = pdftex
+#PDFTEX = xetex
########## You shouldn't have to change anything after this point #######
@@ -105,6 +107,7 @@ ALL = common.w ctangle.w cweave.w prod.w \
case "$(PDFTEX)" in \
dvipdfm ) tex "\let\pdf+ \input $*"; dvipdfm $* ;; \
pdftex ) pdftex $* ;; \
+ xetex ) xetex $* ;; \
esac
all: ctangle cweave
diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch
index 34856c03e86..9b73bffa108 100644
--- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch
@@ -99,7 +99,7 @@ cweb program; /* \.{CTANGLE} or \.{CWEAVE} or \.{CTWILL}? */
@z
@x
-char alt_web_file_name[max_file_name_length]; /* alternate name to try */
+static char alt_web_file_name[max_file_name_length]; /* alternate name to try */
@y
@z
diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.h b/Build/source/texk/web2c/cwebdir/comm-w2c.h
index 0adfa44977f..2a8e3e861a5 100644
--- a/Build/source/texk/web2c/cwebdir/comm-w2c.h
+++ b/Build/source/texk/web2c/cwebdir/comm-w2c.h
@@ -108,6 +108,44 @@ extern char *buffer_end; /* end of |buffer| */
extern char *loc; /* points to the next character to be read from the buffer */
extern char *limit; /* points to the last character in the buffer */
+@ Code related to file handling:
+@f line x /* make |line| an unreserved word */
+@d max_include_depth 10 /* maximum number of source files open
+ simultaneously, not counting the change file */
+@d max_file_name_length 1024
+@d cur_file file[include_depth] /* current file */
+@d cur_file_name file_name[include_depth] /* current file name */
+@d cur_line line[include_depth] /* number of current line in current file */
+@d web_file file[0] /* main source file */
+@d web_file_name file_name[0] /* main source file name */
+
+@<Common code...@>=
+extern int include_depth; /* current level of nesting */
+extern FILE *file[]; /* stack of non-change files */
+extern FILE *change_file; /* change file */
+extern char file_name[][max_file_name_length];
+ /* stack of non-change file names */
+extern char change_file_name[]; /* name of change file */
+extern char check_file_name[]; /* name of |check_file| */
+extern int line[]; /* number of current line in the stacked files */
+extern int change_line; /* number of current line in change file */
+extern int change_depth; /* where \.{@@y} originated during a change */
+extern boolean input_has_ended; /* if there is no more input */
+extern boolean changing; /* if the current line is from |change_file| */
+extern boolean web_file_open; /* if the web file is being read */
+
+@ @<Predecl...@>=
+extern boolean get_line(void); /* inputs the next line */
+extern void check_complete(void); /* checks that all changes were picked up */
+extern void reset_input(void); /* initialize to read the web file and change file */
+
+@ Code related to section numbers:
+@<Common code...@>=
+extern sixteen_bits section_count; /* the current section number */
+extern boolean changed_section[]; /* is the section changed? */
+extern boolean change_pending; /* is a decision about change still unclear? */
+extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */
+
@ Code related to identifier and section name storage:
@d length(c) (size_t)((c+1)->byte_start-(c)->byte_start) /* the length of a name */
@d print_id(c) term_write((c)->byte_start,length((c))) /* print identifier */
@@ -169,48 +207,6 @@ extern void err_print(const char *); /* print error message and context */
extern void fatal(const char *,const char *); /* issue error message and die */
extern void overflow(const char *); /* succumb because a table has overflowed */
-@ Code related to file handling:
-@f line x /* make |line| an unreserved word */
-@d max_include_depth 10 /* maximum number of source files open
- simultaneously, not counting the change file */
-@d max_file_name_length 1024
-@d cur_file file[include_depth] /* current file */
-@d cur_file_name file_name[include_depth] /* current file name */
-@d cur_line line[include_depth] /* number of current line in current file */
-@d web_file file[0] /* main source file */
-@d web_file_name file_name[0] /* main source file name */
-
-@<Common code...@>=
-extern int include_depth; /* current level of nesting */
-extern FILE *file[]; /* stack of non-change files */
-extern FILE *change_file; /* change file */
-extern char C_file_name[]; /* name of |C_file| */
-extern char tex_file_name[]; /* name of |tex_file| */
-extern char idx_file_name[]; /* name of |idx_file| */
-extern char scn_file_name[]; /* name of |scn_file| */
-extern char file_name[][max_file_name_length];
- /* stack of non-change file names */
-extern char change_file_name[]; /* name of change file */
-extern char check_file_name[]; /* name of |check_file| */
-extern int line[]; /* number of current line in the stacked files */
-extern int change_line; /* number of current line in change file */
-extern int change_depth; /* where \.{@@y} originated during a change */
-extern boolean input_has_ended; /* if there is no more input */
-extern boolean changing; /* if the current line is from |change_file| */
-extern boolean web_file_open; /* if the web file is being read */
-
-@ @<Predecl...@>=
-extern boolean get_line(void); /* inputs the next line */
-extern void check_complete(void); /* checks that all changes were picked up */
-extern void reset_input(void); /* initialize to read the web file and change file */
-
-@ Code related to section numbers:
-@<Common code...@>=
-extern sixteen_bits section_count; /* the current section number */
-extern boolean changed_section[]; /* is the section changed? */
-extern boolean change_pending; /* is a decision about change still unclear? */
-extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */
-
@ Code related to command line arguments:
@d show_banner flags['b'] /* should the banner line be printed? */
@d show_progress flags['p'] /* should progress reports be printed? */
@@ -222,10 +218,14 @@ extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */
@<Common code...@>=
extern int argc; /* copy of |ac| parameter to |main| */
extern char **argv; /* copy of |av| parameter to |main| */
+extern char C_file_name[]; /* name of |C_file| */
+extern char tex_file_name[]; /* name of |tex_file| */
+extern char idx_file_name[]; /* name of |idx_file| */
+extern char scn_file_name[]; /* name of |scn_file| */
extern boolean flags[]; /* an option for each 7-bit code */
extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */
-@ Code relating to output:
+@ Code related to output:
@d update_terminal fflush(stdout) /* empty the terminal output buffer */
@d new_line putchar('\n') @d putxchar putchar
@d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout)
diff --git a/Build/source/texk/web2c/cwebdir/common.c b/Build/source/texk/web2c/cwebdir/common.c
index 49b40d04664..7462a25d9d6 100644
--- a/Build/source/texk/web2c/cwebdir/common.c
+++ b/Build/source/texk/web2c/cwebdir/common.c
@@ -41,6 +41,15 @@
#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) )
#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \
+#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 llink link
@@ -57,15 +66,6 @@
#define confusion(s) fatal("! This can't happen: ",s) \
\
-#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 show_banner flags['b']
#define show_progress flags['p']
#define show_stats flags['s']
@@ -149,7 +149,31 @@ extern char*loc;
extern char*limit;
/*:5*//*6:*/
-#line 102 "common.h"
+#line 105 "common.h"
+
+extern int include_depth;
+extern FILE*file[];
+extern FILE*change_file;
+extern char file_name[][max_file_name_length];
+
+extern char change_file_name[];
+extern int line[];
+extern int change_line;
+extern int change_depth;
+extern boolean input_has_ended;
+extern boolean changing;
+extern boolean web_file_open;
+
+/*:6*//*8:*/
+#line 125 "common.h"
+
+extern sixteen_bits section_count;
+extern boolean changed_section[];
+extern boolean change_pending;
+extern boolean print_where;
+
+/*:8*//*9:*/
+#line 139 "common.h"
typedef struct name_info{
char*byte_start;
@@ -173,44 +197,20 @@ extern name_pointer hash[];
extern hash_pointer hash_end;
extern hash_pointer h;
-/*:6*//*8:*/
-#line 146 "common.h"
+/*:9*//*11:*/
+#line 183 "common.h"
extern int history;
-/*:8*//*10:*/
-#line 166 "common.h"
+/*:11*//*13:*/
+#line 199 "common.h"
-extern int include_depth;
-extern FILE*file[];
-extern FILE*change_file;
+extern int argc;
+extern char**argv;
extern char C_file_name[];
extern char tex_file_name[];
extern char idx_file_name[];
extern char scn_file_name[];
-extern char file_name[][max_file_name_length];
-
-extern char change_file_name[];
-extern int line[];
-extern int change_line;
-extern int change_depth;
-extern boolean input_has_ended;
-extern boolean changing;
-extern boolean web_file_open;
-
-/*:10*//*12:*/
-#line 190 "common.h"
-
-extern sixteen_bits section_count;
-extern boolean changed_section[];
-extern boolean change_pending;
-extern boolean print_where;
-
-/*:12*//*13:*/
-#line 203 "common.h"
-
-extern int argc;
-extern char**argv;
extern boolean flags[];
/*:13*//*14:*/
@@ -247,8 +247,8 @@ char*id_loc;
char buffer[long_buf_size];
char*buffer_end= buffer+buf_size-2;
-char*limit= buffer;
char*loc= buffer;
+char*limit= buffer;
/*:22*//*25:*/
#line 194 "common.w"
@@ -259,7 +259,7 @@ FILE*change_file;
char file_name[max_include_depth][max_file_name_length];
char change_file_name[max_file_name_length];
-char alt_web_file_name[max_file_name_length];
+static char alt_web_file_name[max_file_name_length];
int line[max_include_depth];
int change_line;
int change_depth;
@@ -270,8 +270,8 @@ boolean web_file_open= false;
/*:25*//*26:*/
#line 220 "common.w"
-char change_buffer[buf_size];
-char*change_limit;
+static char change_buffer[buf_size];
+static char*change_limit;
/*:26*//*37:*/
#line 401 "common.w"
@@ -293,8 +293,8 @@ name_pointer name_dir_end= name_dir+max_names-1;
/*:43*//*44:*/
#line 609 "common.w"
-name_pointer name_ptr;
char*byte_ptr;
+name_pointer name_ptr;
/*:44*//*46:*/
#line 629 "common.w"
@@ -332,7 +332,14 @@ FILE*active_file;
#line 70 "common.w"
/*7:*/
-#line 125 "common.h"
+#line 119 "common.h"
+
+extern boolean get_line(void);
+extern void check_complete(void);
+extern void reset_input(void);
+
+/*:7*//*10:*/
+#line 162 "common.h"
extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
extern name_pointer id_lookup(const char*,const char*,char);
@@ -344,22 +351,15 @@ extern void print_prefix_name(name_pointer);
extern void print_section_name(name_pointer);
extern void sprint_section_name(char*,name_pointer);
-/*:7*//*9:*/
-#line 149 "common.h"
+/*:10*//*12:*/
+#line 186 "common.h"
extern int wrap_up(void);
extern void err_print(const char*);
extern void fatal(const char*,const char*);
extern void overflow(const char*);
-/*:9*//*11:*/
-#line 184 "common.h"
-
-extern boolean get_line(void);
-extern void check_complete(void);
-extern void reset_input(void);
-
-/*:11*//*15:*/
+/*:12*//*15:*/
#line 223 "common.h"
extern void common_init(void);
diff --git a/Build/source/texk/web2c/cwebdir/common.h b/Build/source/texk/web2c/cwebdir/common.h
index 40896f808aa..d79059621b7 100644
--- a/Build/source/texk/web2c/cwebdir/common.h
+++ b/Build/source/texk/web2c/cwebdir/common.h
@@ -91,6 +91,43 @@ extern char *buffer_end; /* end of |buffer| */
extern char *loc; /* points to the next character to be read from the buffer */
extern char *limit; /* points to the last character in the buffer */
+@ Code related to file handling:
+@f line x /* make |line| an unreserved word */
+@d max_include_depth 10 /* maximum number of source files open
+ simultaneously, not counting the change file */
+@d max_file_name_length 1024
+@d cur_file file[include_depth] /* current file */
+@d cur_file_name file_name[include_depth] /* current file name */
+@d cur_line line[include_depth] /* number of current line in current file */
+@d web_file file[0] /* main source file */
+@d web_file_name file_name[0] /* main source file name */
+
+@<Common code...@>=
+extern int include_depth; /* current level of nesting */
+extern FILE *file[]; /* stack of non-change files */
+extern FILE *change_file; /* change file */
+extern char file_name[][max_file_name_length];
+ /* stack of non-change file names */
+extern char change_file_name[]; /* name of change file */
+extern int line[]; /* number of current line in the stacked files */
+extern int change_line; /* number of current line in change file */
+extern int change_depth; /* where \.{@@y} originated during a change */
+extern boolean input_has_ended; /* if there is no more input */
+extern boolean changing; /* if the current line is from |change_file| */
+extern boolean web_file_open; /* if the web file is being read */
+
+@ @<Predecl...@>=
+extern boolean get_line(void); /* inputs the next line */
+extern void check_complete(void); /* checks that all changes were picked up */
+extern void reset_input(void); /* initialize to read the web file and change file */
+
+@ Code related to section numbers:
+@<Common code...@>=
+extern sixteen_bits section_count; /* the current section number */
+extern boolean changed_section[]; /* is the section changed? */
+extern boolean change_pending; /* is a decision about change still unclear? */
+extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */
+
@ Code related to identifier and section name storage:
@d length(c) (size_t)((c+1)->byte_start-(c)->byte_start) /* the length of a name */
@d print_id(c) term_write((c)->byte_start,length((c))) /* print identifier */
@@ -152,47 +189,6 @@ extern void err_print(const char *); /* print error message and context */
extern void fatal(const char *,const char *); /* issue error message and die */
extern void overflow(const char *); /* succumb because a table has overflowed */
-@ Code related to file handling:
-@f line x /* make |line| an unreserved word */
-@d max_include_depth 10 /* maximum number of source files open
- simultaneously, not counting the change file */
-@d max_file_name_length 1024
-@d cur_file file[include_depth] /* current file */
-@d cur_file_name file_name[include_depth] /* current file name */
-@d cur_line line[include_depth] /* number of current line in current file */
-@d web_file file[0] /* main source file */
-@d web_file_name file_name[0] /* main source file name */
-
-@<Common code...@>=
-extern int include_depth; /* current level of nesting */
-extern FILE *file[]; /* stack of non-change files */
-extern FILE *change_file; /* change file */
-extern char C_file_name[]; /* name of |C_file| */
-extern char tex_file_name[]; /* name of |tex_file| */
-extern char idx_file_name[]; /* name of |idx_file| */
-extern char scn_file_name[]; /* name of |scn_file| */
-extern char file_name[][max_file_name_length];
- /* stack of non-change file names */
-extern char change_file_name[]; /* name of change file */
-extern int line[]; /* number of current line in the stacked files */
-extern int change_line; /* number of current line in change file */
-extern int change_depth; /* where \.{@@y} originated during a change */
-extern boolean input_has_ended; /* if there is no more input */
-extern boolean changing; /* if the current line is from |change_file| */
-extern boolean web_file_open; /* if the web file is being read */
-
-@ @<Predecl...@>=
-extern boolean get_line(void); /* inputs the next line */
-extern void check_complete(void); /* checks that all changes were picked up */
-extern void reset_input(void); /* initialize to read the web file and change file */
-
-@ Code related to section numbers:
-@<Common code...@>=
-extern sixteen_bits section_count; /* the current section number */
-extern boolean changed_section[]; /* is the section changed? */
-extern boolean change_pending; /* is a decision about change still unclear? */
-extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */
-
@ Code related to command line arguments:
@d show_banner flags['b'] /* should the banner line be printed? */
@d show_progress flags['p'] /* should progress reports be printed? */
@@ -203,9 +199,13 @@ extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */
@<Common code...@>=
extern int argc; /* copy of |ac| parameter to |main| */
extern char **argv; /* copy of |av| parameter to |main| */
+extern char C_file_name[]; /* name of |C_file| */
+extern char tex_file_name[]; /* name of |tex_file| */
+extern char idx_file_name[]; /* name of |idx_file| */
+extern char scn_file_name[]; /* name of |scn_file| */
extern boolean flags[]; /* an option for each 7-bit code */
-@ Code relating to output:
+@ Code related to output:
@d update_terminal fflush(stdout) /* empty the terminal output buffer */
@d new_line putchar('\n') @d putxchar putchar
@d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout)
diff --git a/Build/source/texk/web2c/cwebdir/common.w b/Build/source/texk/web2c/cwebdir/common.w
index 377a796126e..85188f4e405 100644
--- a/Build/source/texk/web2c/cwebdir/common.w
+++ b/Build/source/texk/web2c/cwebdir/common.w
@@ -149,8 +149,8 @@ some of \.{CWEB}'s routines use the fact that it is safe to refer to
@<Global var...@>=
char buffer[long_buf_size]; /* where each line of input goes */
char *buffer_end=buffer+buf_size-2; /* end of |buffer| */
-char *limit=buffer; /* points to the last character in the buffer */
char *loc=buffer; /* points to the next character to be read from the buffer */
+char *limit=buffer; /* points to the last character in the buffer */
@ In the unlikely event that your standard I/O library does not
support |feof|, |getc|, and |ungetc| you may have to change things here.
@@ -198,7 +198,7 @@ FILE *change_file; /* change file */
char file_name[max_include_depth][max_file_name_length];
/* stack of non-change file names */
char change_file_name[max_file_name_length]; /* name of change file */
-char alt_web_file_name[max_file_name_length]; /* alternate name to try */
+static char alt_web_file_name[max_file_name_length]; /* alternate name to try */
int line[max_include_depth]; /* number of current line in the stacked files */
int change_line; /* number of current line in change file */
int change_depth; /* where \.{@@y} originated during a change */
@@ -218,8 +218,8 @@ Here's a shorthand expression for inequality between the two lines:
strncmp(buffer, change_buffer, (size_t)(limit-buffer)))
@<Global var...@>=
-char change_buffer[buf_size]; /* next line of |change_file| */
-char *change_limit; /* points to the last character in |change_buffer| */
+static char change_buffer[buf_size]; /* next line of |change_file| */
+static char *change_limit; /* points to the last character in |change_buffer| */
@ Procedure |prime_the_change_buffer|
sets |change_buffer| in preparation for the next matching operation.
@@ -607,8 +607,8 @@ usually have |name_ptr->byte_start==byte_ptr|, and certainly
we want to keep |name_ptr<=name_dir_end| and |byte_ptr<=byte_mem_end|.
@<Global var...@>=
-name_pointer name_ptr; /* first unused position in |name_dir| */
char *byte_ptr; /* first unused position in |byte_mem| */
+name_pointer name_ptr; /* first unused position in |name_dir| */
@ @<Init...@>=
name_dir->byte_start=byte_ptr=byte_mem; /* position zero in both arrays */
diff --git a/Build/source/texk/web2c/cwebdir/ctang-bs.ch b/Build/source/texk/web2c/cwebdir/ctang-bs.ch
index 22310b8e70c..bebfc4435d1 100644
--- a/Build/source/texk/web2c/cwebdir/ctang-bs.ch
+++ b/Build/source/texk/web2c/cwebdir/ctang-bs.ch
@@ -141,13 +141,13 @@ typedef text *text_pointer;
@x Section 17.
-eight_bits tok_mem[max_toks];
-eight_bits *tok_mem_end=tok_mem+max_toks-1;
-eight_bits *tok_ptr; /* first unused position in |tok_mem| */
+static eight_bits tok_mem[max_toks];
+static eight_bits *tok_mem_end=tok_mem+max_toks-1;
+static eight_bits *tok_ptr; /* first unused position in |tok_mem| */
@y
-eight_bits huge tok_mem[max_toks];
-eight_bits huge* tok_mem_end;
-eight_bits huge* tok_ptr; /* first unused position in |tok_mem| */
+static eight_bits huge tok_mem[max_toks];
+static eight_bits huge* tok_mem_end;
+static eight_bits huge* tok_ptr; /* first unused position in |tok_mem| */
@z
diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c
index 200d61a92b7..769dc071f7c 100644
--- a/Build/source/texk/web2c/cwebdir/ctangle.c
+++ b/Build/source/texk/web2c/cwebdir/ctangle.c
@@ -43,6 +43,15 @@
#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) )
#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \
+#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 llink link
@@ -59,15 +68,6 @@
#define confusion(s) fatal("! This can't happen: ",s) \
\
-#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 show_banner flags['b']
#define show_progress flags['p']
#define show_stats flags['s']
@@ -171,7 +171,31 @@ extern char*loc;
extern char*limit;
/*:6*//*7:*/
-#line 102 "common.h"
+#line 105 "common.h"
+
+extern int include_depth;
+extern FILE*file[];
+extern FILE*change_file;
+extern char file_name[][max_file_name_length];
+
+extern char change_file_name[];
+extern int line[];
+extern int change_line;
+extern int change_depth;
+extern boolean input_has_ended;
+extern boolean changing;
+extern boolean web_file_open;
+
+/*:7*//*9:*/
+#line 125 "common.h"
+
+extern sixteen_bits section_count;
+extern boolean changed_section[];
+extern boolean change_pending;
+extern boolean print_where;
+
+/*:9*//*10:*/
+#line 139 "common.h"
typedef struct name_info{
char*byte_start;
@@ -195,44 +219,20 @@ extern name_pointer hash[];
extern hash_pointer hash_end;
extern hash_pointer h;
-/*:7*//*9:*/
-#line 146 "common.h"
+/*:10*//*12:*/
+#line 183 "common.h"
extern int history;
-/*:9*//*11:*/
-#line 166 "common.h"
+/*:12*//*14:*/
+#line 199 "common.h"
-extern int include_depth;
-extern FILE*file[];
-extern FILE*change_file;
+extern int argc;
+extern char**argv;
extern char C_file_name[];
extern char tex_file_name[];
extern char idx_file_name[];
extern char scn_file_name[];
-extern char file_name[][max_file_name_length];
-
-extern char change_file_name[];
-extern int line[];
-extern int change_line;
-extern int change_depth;
-extern boolean input_has_ended;
-extern boolean changing;
-extern boolean web_file_open;
-
-/*:11*//*13:*/
-#line 190 "common.h"
-
-extern sixteen_bits section_count;
-extern boolean changed_section[];
-extern boolean change_pending;
-extern boolean print_where;
-
-/*:13*//*14:*/
-#line 203 "common.h"
-
-extern int argc;
-extern char**argv;
extern boolean flags[];
/*:14*//*15:*/
@@ -274,83 +274,90 @@ typedef output_state*stack_pointer;
/*20:*/
#line 129 "ctangle.w"
-text text_info[max_texts];
-text_pointer text_info_end= text_info+max_texts-1;
-text_pointer text_ptr;
-eight_bits tok_mem[max_toks];
-eight_bits*tok_mem_end= tok_mem+max_toks-1;
-eight_bits*tok_ptr;
+static text text_info[max_texts];
+static text_pointer text_info_end= text_info+max_texts-1;
+static text_pointer text_ptr;
+static eight_bits tok_mem[max_toks];
+static eight_bits*tok_mem_end= tok_mem+max_toks-1;
+static eight_bits*tok_ptr;
/*:20*//*26:*/
#line 198 "ctangle.w"
-text_pointer last_unnamed;
+static text_pointer last_unnamed;
/*:26*//*32:*/
#line 286 "ctangle.w"
-output_state cur_state;
+static output_state cur_state;
-output_state stack[stack_size+1];
-stack_pointer stack_end= stack+stack_size;
-stack_pointer stack_ptr;
+static output_state stack[stack_size+1];
+static stack_pointer stack_end= stack+stack_size;
+static stack_pointer stack_ptr;
/*:32*//*37:*/
#line 362 "ctangle.w"
-int cur_val;
+static int cur_val;
/*:37*//*42:*/
#line 454 "ctangle.w"
-eight_bits out_state;
-boolean protect;
+static eight_bits out_state;
+static boolean protect;
/*:42*//*45:*/
#line 486 "ctangle.w"
-name_pointer output_files[max_files];
-name_pointer*cur_out_file,*end_output_files,*an_output_file;
-char cur_section_name_char;
-char output_file_name[longest_name+1];
+static name_pointer output_files[max_files];
+static name_pointer*cur_out_file,*end_output_files,*an_output_file;
+static char cur_section_name_char;
+static char output_file_name[longest_name+1];
/*:45*//*52:*/
#line 586 "ctangle.w"
-boolean output_defs_seen= false;
+static boolean output_defs_seen= false;
/*:52*//*57:*/
#line 695 "ctangle.w"
-char translit[128][translit_length];
+static char translit[128][translit_length];
/*:57*//*62:*/
#line 774 "ctangle.w"
-eight_bits ccode[256];
+static eight_bits ccode[256];
/*:62*//*66:*/
#line 834 "ctangle.w"
-boolean comment_continues= false;
+static boolean comment_continues= false;
/*:66*//*68:*/
#line 873 "ctangle.w"
-name_pointer cur_section_name;
-boolean no_where;
+static name_pointer cur_section_name;
+static boolean no_where;
/*:68*//*82:*/
#line 1187 "ctangle.w"
-text_pointer cur_text;
-eight_bits next_control;
+static text_pointer cur_text;
+static eight_bits next_control;
/*:82*/
#line 71 "ctangle.w"
/*8:*/
-#line 125 "common.h"
+#line 119 "common.h"
+
+extern boolean get_line(void);
+extern void check_complete(void);
+extern void reset_input(void);
+
+/*:8*//*11:*/
+#line 162 "common.h"
extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
extern name_pointer id_lookup(const char*,const char*,char);
@@ -362,22 +369,15 @@ extern void print_prefix_name(name_pointer);
extern void print_section_name(name_pointer);
extern void sprint_section_name(char*,name_pointer);
-/*:8*//*10:*/
-#line 149 "common.h"
+/*:11*//*13:*/
+#line 186 "common.h"
extern int wrap_up(void);
extern void err_print(const char*);
extern void fatal(const char*,const char*);
extern void overflow(const char*);
-/*:10*//*12:*/
-#line 184 "common.h"
-
-extern boolean get_line(void);
-extern void check_complete(void);
-extern void reset_input(void);
-
-/*:12*//*16:*/
+/*:13*//*16:*/
#line 223 "common.h"
extern void common_init(void);
diff --git a/Build/source/texk/web2c/cwebdir/ctangle.w b/Build/source/texk/web2c/cwebdir/ctangle.w
index 3e717fbda2f..590e90ef1da 100644
--- a/Build/source/texk/web2c/cwebdir/ctangle.w
+++ b/Build/source/texk/web2c/cwebdir/ctangle.w
@@ -68,7 +68,7 @@ is modified.
@h
@<Common code for \.{CWEAVE} and \.{CTANGLE}@>@/
@<Typedef declarations@>@/
-@<Global variables@>@/
+@<Private variables@>@/
@<Predeclaration of procedures@>@/
@ \.{CTANGLE} has a fairly straightforward outline. It operates in
@@ -126,13 +126,13 @@ typedef struct {
} text;
typedef text *text_pointer;
-@ @<Glob...@>=
-text text_info[max_texts];
-text_pointer text_info_end=text_info+max_texts-1;
-text_pointer text_ptr; /* first unused position in |text_info| */
-eight_bits tok_mem[max_toks];
-eight_bits *tok_mem_end=tok_mem+max_toks-1;
-eight_bits *tok_ptr; /* first unused position in |tok_mem| */
+@ @<Private...@>=
+static text text_info[max_texts];
+static text_pointer text_info_end=text_info+max_texts-1;
+static text_pointer text_ptr; /* first unused position in |text_info| */
+static eight_bits tok_mem[max_toks];
+static eight_bits *tok_mem_end=tok_mem+max_toks-1;
+static eight_bits *tok_ptr; /* first unused position in |tok_mem| */
@ @<Set init...@>=
text_info->tok_start=tok_ptr=tok_mem;
@@ -195,8 +195,8 @@ The replacement text pointer for the first unnamed section appears in
@d section_flag max_texts /* final |text_link| in section replacement texts */
-@<Glob...@>=
-text_pointer last_unnamed; /* most recent replacement text of unnamed section */
+@<Private...@>=
+static text_pointer last_unnamed; /* most recent replacement text of unnamed section */
@ @<Set init...@>= last_unnamed=text_info; text_info->text_link=0;
@@ -283,12 +283,12 @@ typedef output_state *stack_pointer;
@d cur_repl cur_state.repl_field /* pointer to current replacement text */
@d cur_section cur_state.section_field /* current section number being expanded */
-@<Global...@>=
-output_state cur_state; /* |cur_end|, |cur_byte|, |cur_name|, |cur_repl|,
+@<Private...@>=
+static output_state cur_state; /* |cur_end|, |cur_byte|, |cur_name|, |cur_repl|,
and |cur_section| */
-output_state stack[stack_size+1]; /* info for non-current levels */
-stack_pointer stack_end=stack+stack_size; /* end of |stack| */
-stack_pointer stack_ptr; /* first unused location in the output state stack */
+static output_state stack[stack_size+1]; /* info for non-current levels */
+static stack_pointer stack_end=stack+stack_size; /* end of |stack| */
+static stack_pointer stack_ptr; /* first unused location in the output state stack */
@ To get the output process started, we will perform the following
initialization steps. We may assume that |text_info->text_link| is nonzero,
@@ -359,8 +359,8 @@ if the next output is an identifier, in which case
@d section_number 0201 /* code returned by |get_output| for section numbers */
@d identifier 0202 /* code returned by |get_output| for identifiers */
-@<Global...@>=
-int cur_val; /* additional information corresponding to output token */
+@<Private...@>=
+static int cur_val; /* additional information corresponding to output token */
@ If |get_output| finds that no more output remains, it returns with
|stack_ptr==stack|.
@@ -451,9 +451,9 @@ are preceded by a `\.\\'.
@d unbreakable 3 /* state associated with \.{@@\&} */
@d verbatim 4 /* state in the middle of a string */
-@<Global...@>=
-eight_bits out_state; /* current status of partial output */
-boolean protect; /* should newline characters be quoted? */
+@<Private...@>=
+static eight_bits out_state; /* current status of partial output */
+static boolean protect; /* should newline characters be quoted? */
@ Here is a routine that is invoked when we want to output the current line.
During the output process, |cur_line| equals the number of the next line
@@ -483,11 +483,11 @@ All these special sections are saved on a stack, |output_files|.
We write them out after we've done the unnamed section.
@d max_files 256
-@<Glob...@>=
-name_pointer output_files[max_files];
-name_pointer *cur_out_file, *end_output_files, *an_output_file;
-char cur_section_name_char; /* is it |'<'| or |'('| */
-char output_file_name[longest_name+1]; /* name of the file */
+@<Private...@>=
+static name_pointer output_files[max_files];
+static name_pointer *cur_out_file, *end_output_files, *an_output_file;
+static char cur_section_name_char; /* is it |'<'| or |'('| */
+static char output_file_name[longest_name+1]; /* name of the file */
@ We make |end_output_files| point just beyond the end of
|output_files|. The stack pointer
@@ -583,8 +583,8 @@ that refer to macros, preceded by the \.{\#define} preprocessor command.
if (!output_defs_seen)
output_defs();
-@ @<Glob...@>=
-boolean output_defs_seen=false;
+@ @<Private...@>=
+static boolean output_defs_seen=false;
@ @<Predecl...@>=
static void output_defs(void);@/
@@ -692,8 +692,8 @@ This makes debugging a lot less confusing.
@d translit_length 10
-@<Glo...@>=
-char translit[128][translit_length];
+@<Private...@>=
+static char translit[128][translit_length];
@ @<Set init...@>=
{
@@ -771,8 +771,8 @@ milestones.
@d section_name 0311 /* control code for `\.{@@<}' */
@d new_section 0312 /* control code for `\.{@@\ }' and `\.{@@*}' */
-@<Global...@>=
-eight_bits ccode[256]; /* meaning of a char following \.{@@} */
+@<Private...@>=
+static eight_bits ccode[256]; /* meaning of a char following \.{@@} */
@ @<Set ini...@>= {
int c; /* must be |int| so the |for| loop will end */
@@ -831,8 +831,8 @@ the two types of comments.
If |skip_comment| comes to the end of the section, it prints an error message.
No comment, long or short, is allowed to contain `\.{@@\ }' or `\.{@@*}'.
-@<Global...@>=
-boolean comment_continues=false; /* are we scanning a comment? */
+@<Private...@>=
+static boolean comment_continues=false; /* are we scanning a comment? */
@ @c
static boolean skip_comment(@t\1\1@> /* skips over comments */
@@ -870,9 +870,9 @@ boolean is_long_comment@t\2\2@>)
@d constant 03
-@<Global...@>=
-name_pointer cur_section_name; /* name of section just scanned */
-boolean no_where; /* suppress |print_where|? */
+@<Private...@>=
+static name_pointer cur_section_name; /* name of section just scanned */
+static boolean no_where; /* suppress |print_where|? */
@ As one might expect, |get_next| consists mostly of a big switch
that branches to the various special cases that can arise.
@@ -1184,9 +1184,9 @@ acted, |cur_text| will point to the replacement text just generated, and
@d macro 0
@d app_repl(c) {if (tok_ptr==tok_mem_end) overflow("token"); *tok_ptr++=c;}
-@<Global...@>=
-text_pointer cur_text; /* replacement text formed by |scan_repl| */
-eight_bits next_control;
+@<Private...@>=
+static text_pointer cur_text; /* replacement text formed by |scan_repl| */
+static eight_bits next_control;
@ @<Predecl...@>=
static void scan_repl(eight_bits);@/
diff --git a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
index 5f6788aa9f9..4e3a5585594 100644
--- a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
+++ b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
@@ -109,7 +109,15 @@ Section 9.
@-c@>
@z
-Section 10.
+Section 12.
+
+@x
+@ Code related to section numbers:
+@y
+@ Code related to section numbers:
+@z
+
+Section 13.
@x
@ Code related to identifier and section name storage:
@@ -118,7 +126,7 @@ Section 10.
@-c@>
@z
-Section 12.
+Section 15.
@x
@ Code related to error handling:
@@ -127,14 +135,6 @@ Section 12.
@-s@>
@z
-Section 16.
-
-@x
-@ Code related to section numbers:
-@y
-@ Code related to section numbers:
-@z
-
Section 17.
@x
@@ -146,9 +146,9 @@ extern const char *use_language; /* prefix to \.{ctwimac.tex} in \TEX/ output */
Section 18.
@x
-@ Code relating to output:
+@ Code related to output:
@y
-@ Code relating to output:
+@ Code related to output:
@-a@>
@-b@>
@-c@>
@@ -1079,17 +1079,6 @@ Section 277.
@r @ @<Output information about usage of id's defined in other sections@>=
@z
-Section 283.
-
-@x
-the index section itself---NOT!
-
-@<Global...@>=
-sixteen_bits k_section; /* runs through the sections */
-@y
-the index section itself---NOT!
-@z
-
Section 284.
@x
@@ -1099,13 +1088,6 @@ Section 284.
@-c@>
@z
-@x
-name_pointer blink[max_names]; /* links in the buckets */
-@y
-name_pointer blink[max_names]; /* links in the buckets */
-sixteen_bits k_section; /* runs through the sections */
-@z
-
Section 286.
@x
diff --git a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch
index 4008555140e..e87b31170a1 100644
--- a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch
@@ -285,16 +285,16 @@ outbursts of new code.)
@x
turned on during the first phase.
-@<Global...@>=
-boolean change_exists; /* has any section changed? */
+@<Private...@>=
+static boolean change_exists; /* has any section changed? */
@y
turned on during the first phase---NOT!
@z
@x
-sixteen_bits xref_switch,section_xref_switch; /* either zero or |def_flag| */
+static sixteen_bits xref_switch,section_xref_switch; /* either zero or |def_flag| */
@y
-sixteen_bits xref_switch,section_xref_switch; /* either zero or |def_flag| */
+static sixteen_bits xref_switch,section_xref_switch; /* either zero or |def_flag| */
@ \.{CTWILL} also has special data structures to keep track of current
and temporary meanings. These structures were not designed for maximum
@@ -312,21 +312,21 @@ typedef struct {
char tex_part[max_tex_chars]; /* \TeX\ part of meaning */
} meaning_struct;
-@ @<Glob...@>=
+@ @<Private...@>=
struct perm_meaning {
meaning_struct perm; /* current meaning of an identifier */
int stamp; /* last section number in which further output suppressed */
struct perm_meaning *link; /* another meaning to output in this section */
} cur_meaning[max_names]; /* the current ``permanent'' meanings */
-struct perm_meaning *top_usage; /* first meaning to output in this section */
-meaning_struct temp_meaning_stack[max_meanings]; /* the current ``temporary'' meanings */
-meaning_struct *temp_meaning_ptr; /* first available slot in |temp_meaning_stack| */
-meaning_struct *max_temp_meaning_ptr; /* its maximum value so far */
-name_pointer title_code[max_titles]; /* program names seen so far */
-name_pointer *title_code_ptr; /* first available slot in |title_code| */
-char ministring_buf[max_tex_chars]; /* \TeX\ code being generated */
-char *ministring_ptr; /* first available slot in |ministring_buf| */
-boolean ms_mode; /* are we outputting to |ministring_buf|? */
+static struct perm_meaning *top_usage; /* first meaning to output in this section */
+static meaning_struct temp_meaning_stack[max_meanings]; /* the current ``temporary'' meanings */
+static meaning_struct *temp_meaning_ptr; /* first available slot in |temp_meaning_stack| */
+static meaning_struct *max_temp_meaning_ptr; /* its maximum value so far */
+static name_pointer title_code[max_titles]; /* program names seen so far */
+static name_pointer *title_code_ptr; /* first available slot in |title_code| */
+static char ministring_buf[max_tex_chars]; /* \TeX\ code being generated */
+static char *ministring_ptr; /* first available slot in |ministring_buf| */
+static boolean ms_mode; /* are we outputting to |ministring_buf|? */
@ @<Set init...@>=
max_temp_meaning_ptr=temp_meaning_stack;
@@ -443,8 +443,8 @@ id_lookup("make_pair",NULL,func_template);
@y
id_lookup("make_pair",NULL,func_template);
-@ @<Glob...@>=
-sixteen_bits int_loc, ext_loc; /* locations of special reserved words */
+@ @<Private...@>=
+static sixteen_bits int_loc, ext_loc; /* locations of special reserved words */
@z
@x
@@ -885,10 +885,10 @@ the section is changed, we output `\.{\\*}' just after the number.
@z
@x
-scrap scrap_info[max_scraps]; /* memory array for scraps */
+static scrap scrap_info[max_scraps]; /* memory array for scraps */
@y
-scrap scrap_info[max_scraps]; /* memory array for scraps */
-scrap null_scrap; /* a scrap with empty translation */
+static scrap scrap_info[max_scraps]; /* memory array for scraps */
+static scrap null_scrap; /* a scrap with empty translation */
@z
@x
@@ -1412,9 +1412,9 @@ while (!input_has_ended) @<Translate the current section@>@;
while (!input_has_ended) @<Translate the current section@>@;
}
-@ @<Glob...@>=
-FILE *aux_file;
-char aux_file_name[max_file_name_length]; /* name of \.{.aux} file */
+@ @<Private...@>=
+static FILE *aux_file;
+static char aux_file_name[max_file_name_length]; /* name of \.{.aux} file */
@ @<Read the \.{.aux} file, if present; then open it for output@>=
memcpy(aux_file_name,tex_file_name,strlen(tex_file_name)-4);
@@ -1439,14 +1439,14 @@ if ((aux_file=fopen(aux_file_name,"wb"))==NULL)
@z
@x
-boolean group_found=false; /* has a starred section occurred? */
+static boolean group_found=false; /* has a starred section occurred? */
@ @<Translate the current section@>= {
section_count++;
@y
-boolean group_found=false; /* has a starred section occurred? */
-boolean right_start_switch; /* has `\.{@@r}' occurred recently? */
-boolean temp_switch; /* has `\.{@@\%}' occurred recently? */
+static boolean group_found=false; /* has a starred section occurred? */
+static boolean right_start_switch; /* has `\.{@@r}' occurred recently? */
+static boolean temp_switch; /* has `\.{@@\%}' occurred recently? */
@ @d usage_sentinel (struct perm_meaning *)1
@<Translate the current section@>= {
@@ -1522,10 +1522,10 @@ flush_buffer(out_ptr,false,false);
doing_format=false;
}
-@ @<Glob...@>=
-boolean is_macro; /* it's a macro def, not a format def */
-int def_diff; /* 0 iff the current macro has parameters */
-name_pointer id_being_defined; /* the definee */
+@ @<Private...@>=
+static boolean is_macro; /* it's a macro def, not a format def */
+static int def_diff; /* 0 iff the current macro has parameters */
+static name_pointer id_being_defined; /* the definee */
@z
@x
@@ -1762,6 +1762,9 @@ finish_line(); fclose(active_file); active_file=NULL;
@x
the index section itself.
+
+@<Private...@>=
+static sixteen_bits k_section; /* runs through the sections */
@y
the index section itself---NOT!
@z
diff --git a/Build/source/texk/web2c/cwebdir/cweav-bs.ch b/Build/source/texk/web2c/cwebdir/cweav-bs.ch
index 723208d6c7f..f7c1af6df6e 100644
--- a/Build/source/texk/web2c/cwebdir/cweav-bs.ch
+++ b/Build/source/texk/web2c/cwebdir/cweav-bs.ch
@@ -103,11 +103,11 @@ typedef xref_info huge* xref_pointer;
@x Section 23.
-xref_info xmem[max_refs]; /* contains cross-reference information */
-xref_pointer xmem_end = xmem+max_refs-1;
+static xref_info xmem[max_refs]; /* contains cross-reference information */
+static xref_pointer xmem_end = xmem+max_refs-1;
@y
-xref_info huge xmem[max_refs]; /* contains cross-reference information */
-xref_pointer xmem_end;
+static xref_info huge xmem[max_refs]; /* contains cross-reference information */
+static xref_pointer xmem_end;
@z
@@ -129,21 +129,21 @@ xmem->num=0; /* sentinel value */
@x Section 30. (to please Borland's C++, version 4.02)
-token tok_mem[max_toks]; /* tokens */
-token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */
-token_pointer tok_ptr; /* first unused position in |tok_mem| */
-token_pointer max_tok_ptr; /* largest value of |tok_ptr| */
-token_pointer tok_start[max_texts]; /* directory into |tok_mem| */
-text_pointer tok_start_end = tok_start+max_texts-1; /* end of |tok_start| */
-text_pointer text_ptr; /* first unused position in |tok_start| */
-@y
-token tok_mem[max_toks]; /* tokens */
-token_pointer tok_mem_end; /* end of |tok_mem| */
-token_pointer tok_ptr; /* first unused position in |tok_mem| */
-token_pointer max_tok_ptr; /* largest value of |tok_ptr| */
-token_pointer tok_start[max_texts]; /* directory into |tok_mem| */
-text_pointer tok_start_end; /* end of |tok_start| */
-text_pointer text_ptr; /* first unused position in |tok_start| */
+static token tok_mem[max_toks]; /* tokens */
+static token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */
+static token_pointer tok_ptr; /* first unused position in |tok_mem| */
+static token_pointer max_tok_ptr; /* largest value of |tok_ptr| */
+static token_pointer tok_start[max_texts]; /* directory into |tok_mem| */
+static text_pointer tok_start_end = tok_start+max_texts-1; /* end of |tok_start| */
+static text_pointer text_ptr; /* first unused position in |tok_start| */
+@y
+static token tok_mem[max_toks]; /* tokens */
+static token_pointer tok_mem_end; /* end of |tok_mem| */
+static token_pointer tok_ptr; /* first unused position in |tok_mem| */
+static token_pointer max_tok_ptr; /* largest value of |tok_ptr| */
+static token_pointer tok_start[max_texts]; /* directory into |tok_mem| */
+static text_pointer tok_start_end; /* end of |tok_start| */
+static text_pointer text_ptr; /* first unused position in |tok_start| */
@z
@x Section 31. (goes with the previous change)
@@ -212,9 +212,9 @@ max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1;
@x Section 246.
-char *cur_byte; /* index into |byte_mem| */
+static char *cur_byte; /* index into |byte_mem| */
@y
-char huge* cur_byte; /* index into |byte_mem| */
+static char huge* cur_byte; /* index into |byte_mem| */
@z
diff --git a/Build/source/texk/web2c/cwebdir/cweav-man.ch b/Build/source/texk/web2c/cwebdir/cweav-man.ch
index 83b14c9007e..b72360944a2 100644
--- a/Build/source/texk/web2c/cwebdir/cweav-man.ch
+++ b/Build/source/texk/web2c/cwebdir/cweav-man.ch
@@ -16,7 +16,7 @@ under the terms of a permission notice identical to this one.
}
@y
\def\botofcontents{\vfill\titlefalse}
-\def\contentspagenumber{110}
+\def\contentspagenumber{111}
\def\title{APPENDIX F: CWEAVE}
\let\K=\leftarrow
@z
diff --git a/Build/source/texk/web2c/cwebdir/cweave.w b/Build/source/texk/web2c/cwebdir/cweave.w
index 8be353088c0..1a74e7e9fff 100644
--- a/Build/source/texk/web2c/cwebdir/cweave.w
+++ b/Build/source/texk/web2c/cwebdir/cweave.w
@@ -73,7 +73,7 @@ is modified.
@h
@<Common code for \.{CWEAVE} and \.{CTANGLE}@>@/
@<Typedef declarations@>@/
-@<Global variables@>@/
+@<Private variables@>@/
@<Predeclaration of procedures@>
@ \.{CWEAVE} has a fairly straightforward outline. It operates in
@@ -181,8 +181,8 @@ is the total number of sections that have started. Sections which have
been altered by a change file entry have their |changed_section| flag
turned on during the first phase.
-@<Global...@>=
-boolean change_exists; /* has any section changed? */
+@<Private...@>=
+static boolean change_exists; /* has any section changed? */
@ The other large memory area in \.{CWEAVE} keeps the cross-reference data.
All uses of the name |p| are recorded in a linked list beginning at
@@ -213,11 +213,11 @@ typedef struct xref_info {
} xref_info;
typedef xref_info *xref_pointer;
-@ @<Global...@>=
-xref_info xmem[max_refs]; /* contains cross-reference information */
-xref_pointer xmem_end = xmem+max_refs-1;
-xref_pointer xref_ptr; /* the largest occupied position in |xmem| */
-sixteen_bits xref_switch,section_xref_switch; /* either zero or |def_flag| */
+@ @<Private...@>=
+static xref_info xmem[max_refs]; /* contains cross-reference information */
+static xref_pointer xmem_end = xmem+max_refs-1;
+static xref_pointer xref_ptr; /* the largest occupied position in |xmem| */
+static sixteen_bits xref_switch,section_xref_switch; /* either zero or |def_flag| */
@ A section that is used for multi-file output (with the \.{@@(} feature)
has a special first cross-reference whose |num| field is |file_flag|.
@@ -332,15 +332,15 @@ that is unoccupied by replacement text is called |tok_ptr|, and the first
unused location of |tok_start| is called |text_ptr|.
Thus, we usually have |*text_ptr==tok_ptr|.
-@<Global...@>=
-token tok_mem[max_toks]; /* tokens */
-token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */
-token_pointer tok_ptr; /* first unused position in |tok_mem| */
-token_pointer max_tok_ptr; /* largest value of |tok_ptr| */
-token_pointer tok_start[max_texts]; /* directory into |tok_mem| */
-text_pointer tok_start_end = tok_start+max_texts-1; /* end of |tok_start| */
-text_pointer text_ptr; /* first unused position in |tok_start| */
-text_pointer max_text_ptr; /* largest value of |text_ptr| */
+@<Private...@>=
+static token tok_mem[max_toks]; /* tokens */
+static token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */
+static token_pointer tok_ptr; /* first unused position in |tok_mem| */
+static token_pointer max_tok_ptr; /* largest value of |tok_ptr| */
+static token_pointer tok_start[max_texts]; /* directory into |tok_mem| */
+static text_pointer tok_start_end = tok_start+max_texts-1; /* end of |tok_start| */
+static text_pointer text_ptr; /* first unused position in |tok_start| */
+static text_pointer max_text_ptr; /* largest value of |text_ptr| */
@ @<Set init...@>=
tok_ptr=max_tok_ptr=tok_mem+1;@/
@@ -546,8 +546,8 @@ scanning routines.
@ Control codes are converted to \.{CWEAVE}'s internal
representation by means of the table |ccode|.
-@<Global...@>=
-eight_bits ccode[256]; /* meaning of a char following \.{@@} */
+@<Private...@>=
+static eight_bits ccode[256]; /* meaning of a char following \.{@@} */
@ @<Set ini...@>=
{int c; for (c=0; c<256; c++) ccode[c]=0;}
@@ -666,9 +666,9 @@ it sets |xref_switch| to |def_flag| and goes on to the next token.
@d string 0201 /* \CEE/ string */
@d identifier 0202 /* \CEE/ identifier or reserved word */
-@<Global...@>=
-name_pointer cur_section; /* name of section just scanned */
-char cur_section_char; /* the character just before that name */
+@<Private...@>=
+static name_pointer cur_section; /* name of section just scanned */
+static char cur_section_char; /* the character just before that name */
@ As one might expect, |get_next| consists mostly of a big switch
that branches to the various special cases that can arise.
@@ -721,8 +721,8 @@ for |ord|, since |get_next| changes |ord| into a string.
@d left_preproc ord /* begins a preprocessor command */
@d right_preproc 0217 /* ends a preprocessor command */
-@<Glob...@>=
-boolean preprocessing=false; /* are we scanning a preprocessor command? */
+@<Private...@>=
+static boolean preprocessing=false; /* are we scanning a preprocessor command? */
@ @<Raise prep...@>= {
preprocessing=true;
@@ -734,8 +734,8 @@ boolean preprocessing=false; /* are we scanning a preprocessor command? */
a file name in lines that start with \.{\#include}. We must treat this file
name as a string.
-@<Glob...@>=
-boolean sharp_include_line=false; /* are we scanning a |#include| line? */
+@<Private...@>=
+static boolean sharp_include_line=false; /* are we scanning a |#include| line? */
@ @<Check if next token is |include|@>=
while (loc<=buffer_end-7 && xisspace(*loc)) loc++;
@@ -1007,8 +1007,8 @@ The global variable |next_control| often contains the most recent output of
|get_next|; in interesting cases, this will be the control code that
ended a section or part of a section.
-@<Global...@>=
-eight_bits next_control; /* control code waiting to be acting upon */
+@<Private...@>=
+static eight_bits next_control; /* control code waiting to be acting upon */
@ The overall processing strategy in phase one has the following
straightforward outline.
@@ -1161,9 +1161,9 @@ entirely, even if it contains \pb\ constructions.
The variables |lhs| and |rhs| point to the respective identifiers involved
in a format definition.
-@<Global...@>=
-name_pointer lhs, rhs; /* pointers to |byte_start| for format identifiers */
-name_pointer res_wd_end; /* pointer to the first nonreserved identifier */
+@<Private...@>=
+static name_pointer lhs, rhs; /* pointers to |byte_start| for format identifiers */
+static name_pointer res_wd_end; /* pointer to the first nonreserved identifier */
@ When we get to the following code we have |next_control>=format_code|.
@@ -1245,9 +1245,9 @@ if (next_control<=section_name) { /* |begin_C| or |section_name| */
section name was both defined and used. The variable |cur_xref| will point
to cross-references for the current section name of interest.
-@<Global...@>=
-xref_pointer cur_xref; /* temporary cross-reference pointer */
-boolean an_output; /* did |file_flag| precede |cur_xref|? */
+@<Private...@>=
+static xref_pointer cur_xref; /* temporary cross-reference pointer */
+static boolean an_output; /* did |file_flag| precede |cur_xref|? */
@ The following recursive procedure
walks through the tree of section names and prints out anomalies.
@@ -1289,11 +1289,11 @@ characters long, so we place it into an output buffer. During the output
process, |out_line| will hold the current line number of the line about to
be output.
-@<Global...@>=
-char out_buf[line_length+1]; /* assembled characters */
-char *out_buf_end = out_buf+line_length; /* end of |out_buf| */
-char *out_ptr; /* last character in |out_buf| */
-int out_line; /* number of next line to be output */
+@<Private...@>=
+static char out_buf[line_length+1]; /* assembled characters */
+static char *out_buf_end = out_buf+line_length; /* end of |out_buf| */
+static char *out_ptr; /* last character in |out_buf| */
+static int out_line; /* number of next line to be output */
@ The |flush_buffer| routine empties the buffer up to a given breakpoint,
and moves any remaining characters to the beginning of the next line.
@@ -1716,8 +1716,8 @@ same initial letter; these subscripts are assigned from left to right.
@d begin_arg 61 /* \.{@@[} */
@d end_arg 62 /* \.{@@]} */
-@<Glo...@>=
-char cat_name[256][12];
+@<Private...@>=
+static char cat_name[256][12];
@ @<Set in...@>=
{int c; for (c=0;c<256;c++) strcpy(cat_name[c],"UNKNOWN");}
@@ -2104,15 +2104,15 @@ typedef scrap *scrap_pointer;
@ @d trans trans_plus.Trans /* translation texts of scraps */
-@<Global...@>=
-scrap scrap_info[max_scraps]; /* memory array for scraps */
-scrap_pointer scrap_info_end=scrap_info+max_scraps-1; /* end of |scrap_info| */
-scrap_pointer scrap_base; /* beginning of the current scrap sequence */
-scrap_pointer scrap_ptr; /* ending of the current scrap sequence */
-scrap_pointer max_scr_ptr; /* largest value assumed by |scrap_ptr| */
-scrap_pointer pp; /* current position for reducing productions */
-scrap_pointer lo_ptr; /* last scrap that has been examined */
-scrap_pointer hi_ptr; /* first scrap that has not been examined */
+@<Private...@>=
+static scrap scrap_info[max_scraps]; /* memory array for scraps */
+static scrap_pointer scrap_info_end=scrap_info+max_scraps-1; /* end of |scrap_info| */
+static scrap_pointer scrap_base; /* beginning of the current scrap sequence */
+static scrap_pointer scrap_ptr; /* ending of the current scrap sequence */
+static scrap_pointer max_scr_ptr; /* largest value assumed by |scrap_ptr| */
+static scrap_pointer pp; /* current position for reducing productions */
+static scrap_pointer lo_ptr; /* last scrap that has been examined */
+static scrap_pointer hi_ptr; /* first scrap that has not been examined */
@ @<Set init...@>=
scrap_base=scrap_info+1;
@@ -2265,8 +2265,8 @@ productions as they were listed earlier.
@d app(a) *(tok_ptr++)=(token)(a)
@d app1(a) *(tok_ptr++)=(token)(tok_flag+(int)((a)->trans-tok_start))
-@<Global...@>=
-int cur_mathness, init_mathness;
+@<Private...@>=
+static int cur_mathness, init_mathness;
@ @<Predecl...@>=
static void app_str(const char *);@/
@@ -3114,8 +3114,8 @@ current stack categories will be printed out when |tracing| is set to 2;
a sequence of two or more irreducible scraps will be printed out when
|tracing| is set to 1.
-@<Global...@>=
-int tracing; /* can be used to show parsing details */
+@<Private...@>=
+static int tracing; /* can be used to show parsing details */
@ @<Print a snapsh...@>=
{ scrap_pointer k_l; /* pointer into |scrap_info| */
@@ -3604,12 +3604,12 @@ typedef output_state *stack_pointer;
@d cur_mode cur_state.mode_field /* current mode of interpretation */
@d init_stack stack_ptr=stack;cur_mode=outer /* initialize the stack */
-@<Global...@>=
-output_state cur_state; /* |cur_end|, |cur_tok|, |cur_mode| */
-output_state stack[stack_size]; /* info for non-current levels */
-stack_pointer stack_end=stack+stack_size-1; /* end of |stack| */
-stack_pointer stack_ptr; /* first unused location in the output state stack */
-stack_pointer max_stack_ptr; /* largest value assumed by |stack_ptr| */
+@<Private...@>=
+static output_state cur_state; /* |cur_end|, |cur_tok|, |cur_mode| */
+static output_state stack[stack_size]; /* info for non-current levels */
+static stack_pointer stack_end=stack+stack_size-1; /* end of |stack| */
+static stack_pointer stack_ptr; /* first unused location in the output state stack */
+static stack_pointer max_stack_ptr; /* largest value assumed by |stack_ptr| */
@ @<Set init...@>=
max_stack_ptr=stack;
@@ -3658,8 +3658,8 @@ by a complex routine that might generate additional levels of output).
In these cases |cur_name| points to the identifier or section name in
question.
-@<Global...@>=
-name_pointer cur_name;
+@<Private...@>=
+static name_pointer cur_name;
@ @d res_word 0201 /* returned by |get_output| for reserved words */
@d section_code 0200 /* returned by |get_output| for section names */
@@ -4017,14 +4017,14 @@ and `|emit_space_if_needed|' are able to handle the situation:
space_checked=true;
@.\\Y@>
-@<Global...@>=
-int save_line; /* former value of |out_line| */
-char *save_place; /* former value of |out_ptr| */
-int sec_depth; /* the integer, if any, following \.{@@*} */
-boolean space_checked; /* have we done |emit_space_if_needed|? */
-boolean format_visible; /* should the next format declaration be output? */
-boolean doing_format=false; /* are we outputting a format declaration? */
-boolean group_found=false; /* has a starred section occurred? */
+@<Private...@>=
+static int save_line; /* former value of |out_line| */
+static char *save_place; /* former value of |out_ptr| */
+static int sec_depth; /* the integer, if any, following \.{@@*} */
+static boolean space_checked; /* have we done |emit_space_if_needed|? */
+static boolean format_visible; /* should the next format declaration be output? */
+static boolean doing_format=false; /* are we outputting a format declaration? */
+static boolean group_found=false; /* has a starred section occurred? */
@ @<Translate the current section@>= {
section_count++;
@@ -4202,8 +4202,8 @@ it starts after we scan the matching `\.)'.
|next_control>=begin_C|. We will make the global variable |this_section|
point to the current section name, if it has a name.
-@<Global...@>=
-name_pointer this_section; /* the current section name, or zero */
+@<Private...@>=
+static name_pointer this_section; /* the current section name, or zero */
@ @<Translate the \CEE/...@>=
this_section=name_dir;
@@ -4389,8 +4389,8 @@ check_complete(); /* was all of the change file used? */
@ Just before the index comes a list of all the changed sections, including
the index section itself.
-@<Global...@>=
-sixteen_bits k_section; /* runs through the sections */
+@<Private...@>=
+static sixteen_bits k_section; /* runs through the sections */
@ @<Tell about changed sections@>= {
/* remember that the index is already marked as changed */
@@ -4415,10 +4415,10 @@ letters, since we want to have `$t<\\{TeX}<\&{to}$'.) The
list for character |c| begins at location |bucket[c]| and continues through
the |blink| array.
-@<Global...@>=
-name_pointer bucket[256];
-name_pointer next_name; /* successor of |cur_name| when sorting */
-name_pointer blink[max_names]; /* links in the buckets */
+@<Private...@>=
+static name_pointer bucket[256];
+static name_pointer next_name; /* successor of |cur_name| when sorting */
+static name_pointer blink[max_names]; /* links in the buckets */
@ To begin the sorting, we go through all the hash lists and put each entry
having a nonempty cross-reference list into the proper bucket.
@@ -4458,11 +4458,11 @@ name_pointer Head;
@d sort_ptr scrap_ptr /* ditto */
@d max_sorts max_scraps /* ditto */
-@<Global...@>=
-eight_bits cur_depth; /* depth of current buckets */
-char *cur_byte; /* index into |byte_mem| */
-sixteen_bits cur_val; /* current cross-reference number */
-sort_pointer max_sort_ptr; /* largest value of |sort_ptr| */
+@<Private...@>=
+static eight_bits cur_depth; /* depth of current buckets */
+static char *cur_byte; /* index into |byte_mem| */
+static sixteen_bits cur_val; /* current cross-reference number */
+static sort_pointer max_sort_ptr; /* largest value of |sort_ptr| */
@ @<Set init...@>=
max_sort_ptr=scrap_info;
@@ -4470,8 +4470,8 @@ max_sort_ptr=scrap_info;
@ The desired alphabetic order is specified by the |collate| array; namely,
$|collate|[0]<|collate|[1]<\cdots<|collate|[100]$.
-@<Global...@>=
-eight_bits collate[101+128]; /* collation order */
+@<Private...@>=
+static eight_bits collate[101+128]; /* collation order */
@^high-bit character handling@>
@ We use the order $\hbox{null}<\.\ <\hbox{other characters}<{}$\.\_${}<
@@ -4635,8 +4635,8 @@ out('.'); finish_line();
@ List inversion is best thought of as popping elements off one stack and
pushing them onto another. In this case |cur_xref| will be the head of
the stack that we push things onto.
-@<Global...@>=
-xref_pointer next_xref, this_xref;
+@<Private...@>=
+static xref_pointer next_xref, this_xref;
/* pointer variables for rearranging a list */
@ @<Invert the cross-reference list at |cur_name|, making |cur_xref| the head@>=