diff options
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/cweave.w')
-rw-r--r-- | Build/source/texk/web2c/cwebdir/cweave.w | 174 |
1 files changed, 87 insertions, 87 deletions
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@>= |