diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2009-11-10 10:27:09 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2009-11-10 10:27:09 +0000 |
commit | 5e8e9500102800e68c9e7fcac9e85c1668b71a36 (patch) | |
tree | 81d79ac70ffbb127e8063f18c8f55475ca169ee1 /Build/source/texk/web2c/cwebdir | |
parent | e6a9c88ada2f11dd61e4c4e39dff84944bed5787 (diff) |
towards TL2010: texk/web2c
git-svn-id: svn://tug.org/texlive/trunk@15964 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/cwebdir')
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 25 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/comm-w2c.ch | 162 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctang-w2c.ch | 110 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/cweav-w2c.ch | 353 |
4 files changed, 499 insertions, 151 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index 4e03484a507..09eeb4cfc95 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,28 @@ +2009-08-29 Peter Breitenlohner <peb@mppmu.mpg.de> + + * {comm,ctang,cweav}-w2c.ch: Create a header file cweb.h with + prototypes for all functions declared in common.w and used in + ctangle.w and cweave.w or vice versa, and #include "cweb.h" in + cweb.c, ctangle.c, and cweave.c. + + Avoid maximal compiler warnings. + * {comm,ctang,cweav}-w2c.ch (names_match, id_lookup, err_print, + fatal, overflow): Constify string params and local vars. + * ctang-w2c.ch (Insert the line): Rename inner local var a=>a_l, + not to shadow previous local. + * cweav-w2c.ch (out_str, app_str): Constify string params. + (Print a snapsh...): Rename local var k=>k_l, not to shadow + a param. + In main(), 'use' print_text() not used somewhere else. + +2009-08-28 Peter Breitenlohner <peb@mppmu.mpg.de> + + * ../am/cweb.am (ctie_CFLAGS, cweave_CFLAGS, tie_CFLAGS), + ../am/bootstrap.am (ctangle_CFLAGS): Enable compiler warnings. + * {comm,ctang,cweav}-w2c.ch: Declare most functions as static. + * ctang-w2c.ch, cweav-w2c.ch: Put explicit braces around + ambiguous else. + 2009-06-23 Peter Breitenlohner <peb@mppmu.mpg.de> * comm-w2c.ch, ctang-w2c.ch, cweav-w2c.ch: drop P?C, P?H macros, diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch index 88695e29a2e..22b70066f42 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch @@ -30,6 +30,14 @@ This change can not be applied when `tie' is used %\let\maybe=\iffalse % print only changed modules %@z +Section 1. + +@x l.63 +@<Predeclaration of procedures@>@/ +@y +#include "cweb.h" +@<Predeclaration of procedures@>@/ +@z Section 2. We use the definition from `kpathsea/types.h': @@ -82,17 +90,21 @@ char alt_web_file_name[max_file_name_length]; /* alternate name to try */ Section 12. -@x l.254 +@x l.252 +void prime_the_change_buffer() @y +static void prime_the_change_buffer (void) @z Section 16. -@x l.322 +@x l.321 +void check_change() /* switches to |change_file| if the buffers match */ @y +static void check_change (void) /* switches to |change_file| if the buffers match */ @z @@ -254,10 +266,12 @@ check_complete (void) { Section 33. -@x l.651 +@x l.650 +@ @<Predec...@>= extern int names_match(); @y -extern int names_match (name_pointer, char*, int, char); +@ @<External functions@>= +extern int names_match (name_pointer, const char*, int, char); @z Section 35. @@ -269,14 +283,52 @@ char *last; /* last character of string plus one */ char t; /* the |ilk|; used by \.{CWEAVE} only */ @y /* looks up a string in the identifier table */ -id_lookup (char *first, char *last, char t) +id_lookup (const char *first, const char *last, char t) +@z + +@x l.667 + char *i=first; /* position in |buffer| */ +@y + const char *i=first; /* position in |buffer| */ +@z + +@x l.668 - rename local var, not to shadow global + int h; /* hash code */ +@y + int h; /* hash code */ +@z + +Section 36. + +@x l.684 - use renamed local var +h=(unsigned char)*i; +while (++i<last) h=(h+h+(int)((unsigned char)*i)) % hash_size; +@y +h=(unsigned char)*i; +while (++i<last) h=(h+h+(int)((unsigned char)*i)) % hash_size; +@z + +Section 37. + +@x l.692 - use renamed local var +p=hash[h]; +@y +p=hash[h]; +@z + +@x l.696 - use renamed local var + p->link=hash[h]; hash[h]=p; /* insert |p| at beginning of hash list */ +@y + p->link=hash[h]; hash[h]=p; /* insert |p| at beginning of hash list */ @z Section 38. -@x l.704 +@x l.703 +@<Pred...@>= void init_p(); @y +@<External functions@>= extern void init_p (name_pointer p, char t); @z @@ -301,10 +353,12 @@ sprint_section_name (char *dest, name_pointer p) Section 44. -@x l.806 +@x l.805 +void print_prefix_name(p) name_pointer p; @y +static void print_prefix_name (name_pointer p) @z @@ -316,20 +370,38 @@ int web_strcmp(j,j_len,k,k_len) /* fuller comparison than |strcmp| */ int j_len, k_len; /* length of strings */ @y /* fuller comparison than |strcmp| */ -int web_strcmp (char *j, int j_len, char *k, int k_len) +static int +web_strcmp (char *j, int j_len, char *k, int k_len) +@z + +@x l.830 -- rename local vars, not to shadow math function + char *j1=j+j_len, *k1=k+k_len; + while (k<k1 && j<j1 && *j==*k) k++, j++; + if (k==k1) if (j==j1) return equal; + else return extension; + else if (j==j1) return prefix; +@y + char *j1=j+j_len, *k1=k+k_len; + while (k<k1 && j<j1 && *j==*k) k++, j++; + if (k==k1) if (j==j1) return equal; + else return extension; + else if (j==j1) return prefix; @z Section 46. -@x l.853 +@x l.852 +@<Prede...@>= extern void init_node(); @y +@<External functions@>= extern void init_node (name_pointer node); @z Section 47. -@x l.857 +@x l.856 +name_pointer add_section_name(par,c,first,last,ispref) /* install a new node in the tree */ name_pointer par; /* parent of new node */ int c; /* right or left? */ @@ -337,20 +409,22 @@ char *first; /* first character of section name */ char *last; /* last character of section name, plus one */ int ispref; /* are we adding a prefix or a full name? */ @y -/* install a new node in the tree */ +static name_pointer add_section_name (name_pointer par, int c, char *first, char *last, - int ispref) + int ispref) /* install a new node in the tree */ @z Section 48. -@x l.886 +@x l.885 +void extend_section_name(p,first,last,ispref) name_pointer p; /* name to be extended */ char *first; /* beginning of extension text */ char *last; /* one beyond end of extension text */ int ispref; /* are we adding a prefix or a full name? */ @y +static void extend_section_name (name_pointer p, char *first, char *last, int ispref) @z @@ -370,7 +444,7 @@ Section 53. @x l.1018 int section_name_cmp(); @y -int section_name_cmp (char**, int, name_pointer); +static int section_name_cmp (char**, int, name_pointer); @z Section 54. @@ -381,15 +455,18 @@ char **pfirst; /* pointer to beginning of comparison string */ int len; /* length of string */ name_pointer r; /* section name being compared */ @y -int section_name_cmp (char **pfirst, int len, name_pointer r) +static int +section_name_cmp (char **pfirst, int len, name_pointer r) @z Section 57. -@x l.1093 +@x l.1092 +@<Predecl...@>= void err_print(); @y -void err_print (char*); +@<External functions@>= +extern void err_print (const char*); @z Section 58. @@ -398,16 +475,18 @@ Section 58. err_print(s) /* prints `\..' and location of error message */ char *s; @y -err_print (char *s) /* prints `\..' and location of error message */ +err_print (const char *s) /* prints `\..' and location of error message */ @z Section 60. -@x l.1141 +@x l.1140 +@<Prede...@>= int wrap_up(); extern void print_stats(); @y -int wrap_up (void); +@<External functions@>= +extern int wrap_up (void); extern void print_stats (void); @z @@ -421,11 +500,13 @@ int wrap_up (void) { Section 63. -@x l.1174 +@x l.1173 +@<Predec...@>= void fatal(), overflow(); @y -void fatal (char*, char*); -void overflow (char*); +@<External functions@>= +extern void fatal (const char*, const char*); +extern void overflow (const char*); @z Section 64. @@ -434,7 +515,7 @@ Section 64. fatal(s,t) char *s,*t; @y -fatal (char *s, char *t) +fatal (const char *s, const char *t) @z Section 65. @@ -443,7 +524,7 @@ Section 65. overflow(t) char *t; @y -overflow (char *t) +overflow (const char *t) @z Section 67. @@ -492,15 +573,17 @@ Section 69. @x l.1252 void scan_args(); @y -void scan_args (void); +static void scan_args (void); @z Section 70. -@x l.1257 +@x l.1255 +void scan_args() @y +static void scan_args (void) @z @@ -578,7 +661,7 @@ char *found_filename; /* filename found by |kpse_find_file| */ @z -Section 81. (removed) +Section 81. (reused) @x l.1403 @ We predeclare several standard system functions here instead of including @@ -593,11 +676,34 @@ extern char* strcpy(); /* copy one string to another */ extern int strncmp(); /* compare up to $n$ string characters */ extern char* strncpy(); /* copy up to $n$ string characters */ @y +@ We declare some more prototypes for exported function in cases where this +could not be done easily without changing section numbers. + +@<External functions@>= +extern void common_init (void); +extern int input_ln (FILE *fp); +extern void reset_input (void); +extern int get_line (void); +extern void check_complete (void); +extern name_pointer id_lookup (const char *first, const char *last, char t); +extern void print_section_name (name_pointer p); +extern void sprint_section_name (char *dest, name_pointer p); +extern name_pointer section_lookup (char *first, char *last, int ispref); @z @x @** Index. @y +@** External functions. In order to allow for type checking we create a +header file \.{cweb.h} containing the declaration of all functions defined +in \.{common.w} and used in \.{ctangle.w} and \.{cweave.w} or vice versa. + +@(cweb.h@>= +@=/* Prototypes for functions, either@> +@= * declared in common.w and used in ctangle.w and cweave.w, or@> +@= * used in common.w and declared in ctangle.w and cweave.w. */@> +@<External functions@>@; + @** System dependent changes. @ Modules for dealing with help messages and version info. diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch index 9e9bbe3b927..38d60422f6d 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch @@ -87,7 +87,7 @@ typedef short boolean; Section 6. -@x l.36 +@x common.h l.36 #include <stdio.h> @y #include <stdio.h> @@ -98,22 +98,17 @@ extern char *versionstring; Section 9. -@x common.h l.109 +@x common.h l.109 - protos now all in cweb.h. extern name_pointer id_lookup(); /* looks up a string in the identifier table */ extern name_pointer section_lookup(); /* finds section name */ extern void print_section_name(), sprint_section_name(); @y -/* looks up a string in the identifier table */ -extern name_pointer id_lookup (char*, char*, char); -/* finds section name */ -extern name_pointer section_lookup (char*, char*, char); -extern void print_section_name (name_pointer); -extern void sprint_section_name (char*, name_pointer); +#include "cweb.h" @z Section 10. -@x common.h l.123 - explicit types. +@x common.h l.123 - explicit types, protos now all in cweb.h. extern history; /* indicates how bad this run was */ extern err_print(); /* print error message and context */ extern wrap_up(); /* indicate |history| and exit */ @@ -121,10 +116,6 @@ extern void fatal(); /* issue error message and die */ extern void overflow(); /* succumb because a table has overflowed */ @y extern int history; /* indicates how bad this run was */ -extern void err_print (char*); /* print error message and context */ -extern int wrap_up (void); /* indicate |history| and exit */ -extern void fatal (char*, char*); /* issue error message and die */ -extern void overflow (char*); /* succumb because a table has overflowed */ @z Section 11. @@ -149,22 +140,18 @@ extern int line[]; /* number of current line in the stacked files */ extern int change_line; /* number of current line in change file */ @z -@x common.h l.153 - explicit types. +@x common.h l.153 - protos now all in cweb.h. extern reset_input(); /* initialize to read the web file and change file */ extern get_line(); /* inputs the next line */ extern check_complete(); /* checks that all changes were picked up */ @y -extern void reset_input (void); /* initialize to read the web file and change file */ -extern int get_line (void); /* inputs the next line */ -extern void check_complete (void); /* checks that all changes were picked up */ @z Section 15. -@x common.h l.192 +@x common.h l.192 - protos now all in cweb.h. extern void common_init(); @y -extern void common_init (void); @z Section 21. @@ -175,7 +162,7 @@ name_pointer p; /* points to the proposed match */ char *first; /* position of first character of string */ int l; /* length of identifier */ @y -int names_match (name_pointer p, char *first, int l, char t) +int names_match (name_pointer p, const char *first, int l, char t) @z Section 22. @@ -195,44 +182,54 @@ init_p (name_pointer p, char t) {} Section 26. -@x l.262 +@x l.261 +void store_two_bytes(x) sixteen_bits x; @y +static void store_two_bytes (sixteen_bits x) @z Section 30. -@x l.338 +@x l.337 +void push_level(p) /* suspends the current level */ name_pointer p; @y +static void push_level (name_pointer p) /* suspends the current level */ @z Section 31. -@x l.357 +@x l.356 +void pop_level(flag) /* do this when |cur_byte| reaches |cur_end| */ int flag; /* |flag==0| means we are in |output_defs| */ @y +static void pop_level (int flag) /* do this when |cur_byte| reaches |cur_end| */ @z Section 33. -@x l.393 +@x l.392 +void get_output() /* sends next token to |out_char| */ @y +static void get_output (void) /* sends next token to |out_char| */ @z Section 37. -@x l.483 +@x l.482 +void flush_buffer() /* writes one line to output file */ @y +static void flush_buffer (void) /* writes one line to output file */ @z @@ -241,14 +238,16 @@ Section 41. @x l.534 void phase_two(); @y -void phase_two (void); +static void phase_two (void); @z Section 42. -@x l.538 +@x l.537 +void phase_two () { @y +static void phase_two (void) { @z @@ -257,14 +256,16 @@ Section 46. @x l.603 void output_defs(); @y -void output_defs (void); +static void output_defs (void); @z Section 47. -@x l.607 +@x l.606 +void output_defs() @y +static void output_defs (void) @z @@ -287,9 +288,11 @@ out_char (eight_bits cur_char) Section 58. -@x l.815 +@x l.814 +eight_bits skip_ahead() /* skip to next control code */ @y +static eight_bits skip_ahead (void) /* skip to next control code */ @z @@ -299,7 +302,8 @@ Section 60. int skip_comment(is_long_comment) /* skips over comments */ boolean is_long_comment; @y -int skip_comment (boolean is_long_comment) /* skips over comments */ +static int +skip_comment (boolean is_long_comment) /* skips over comments */ @z Section 62 @@ -311,26 +315,52 @@ Section 62 Section 63. -@x l.902 +@x l.901 +eight_bits get_next() /* produces the next input token */ @y +static eight_bits get_next (void) /* produces the next input token */ @z +Section 63. + +@x l.954 + else if (*loc=='>') if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);} + else compress(minus_gt); break; +@y + else if (*loc=='>') {if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);} + else compress(minus_gt);} break; +@z + Section 76. -@x l.1201 +@x l.1200 +void scan_repl(t) /* creates a replacement text */ eight_bits t; @y +static void scan_repl (eight_bits t) /* creates a replacement text */ @z +Section 77. + +@x l.1232 -- rename local var, not to shadow previous local +{int a=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a / 0400)+0200); + app_repl(a % 0400);} +@y +{int a_l=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a_l / 0400)+0200); + app_repl(a_l % 0400);} +@z + Section 83. -@x l.1359 +@x l.1358 +void scan_section() @y +static void scan_section (void) @z @@ -339,14 +369,16 @@ Section 90. @x l.1458 void phase_one(); @y -void phase_one (void); +static void phase_one (void); @z Section 91. -@x l.1462 +@x l.1461 +void phase_one() { @y +static void phase_one (void) { @z @@ -355,14 +387,16 @@ Section 92. @x l.1476 void skip_limbo(); @y -void skip_limbo (void); +static void skip_limbo (void); @z Section 93. -@x l.1480 +@x l.1479 +void skip_limbo() @y +static void skip_limbo (void) @z diff --git a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch index 4d74596a0a1..11058fb5172 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch @@ -83,6 +83,12 @@ int main (int ac, char **av) } @z +@x l.112 - 'use' print_text(), used nowhere else + return wrap_up(); /* and exit gracefully */ +@y + if (0) print_text(text_ptr); + return wrap_up(); /* and exit gracefully */ +@z Section 5. @@ -93,7 +99,7 @@ typedef short boolean; Section 6. -@x l.36 +@x common.h l.36 #include <stdio.h> @y #include <stdio.h> @@ -104,22 +110,17 @@ extern char *versionstring; Section 9. -@x common.h l.109 +@x common.h l.109 - protos now all in cweb.h. extern name_pointer id_lookup(); /* looks up a string in the identifier table */ extern name_pointer section_lookup(); /* finds section name */ extern void print_section_name(), sprint_section_name(); @y -/* looks up a string in the identifier table */ -extern name_pointer id_lookup (char*, char*, char); -/* finds section name */ -extern name_pointer section_lookup (char*, char*, char); -extern void print_section_name (name_pointer); -extern void sprint_section_name (char*, name_pointer); +#include "cweb.h" @z Section 10. -@x common.h l.123 - explicit types. +@x common.h l.123 - explicit types, protos now all in cweb.h. extern history; /* indicates how bad this run was */ extern err_print(); /* print error message and context */ extern wrap_up(); /* indicate |history| and exit */ @@ -127,10 +128,6 @@ extern void fatal(); /* issue error message and die */ extern void overflow(); /* succumb because a table has overflowed */ @y extern int history; /* indicates how bad this run was */ -extern void err_print (char*); /* print error message and context */ -extern int wrap_up (void); /* indicate |history| and exit */ -extern void fatal (char*, char*); /* issue error message and die */ -extern void overflow (char*); /* succumb because a table has overflowed */ @z Section 11. @@ -155,48 +152,50 @@ extern int line[]; /* number of current line in the stacked files */ extern int change_line; /* number of current line in change file */ @z -@x common.h l.153 - explicit types. +@x common.h l.153 - protos now all in cweb.h. extern reset_input(); /* initialize to read the web file and change file */ extern get_line(); /* inputs the next line */ extern check_complete(); /* checks that all changes were picked up */ @y -extern void reset_input (void); /* initialize to read the web file and change file */ -extern int get_line (void); /* inputs the next line */ -extern void check_complete (void); /* checks that all changes were picked up */ @z Section 15. -@x common.h l.192 +@x common.h l.192 - protos now all in cweb.h. extern void common_init(); @y -extern void common_init (void); @z Section 21. -@x l.276 +@x l.275 +void new_xref(p) name_pointer p; @y +static void new_xref (name_pointer p) @z Section 22. -@x l.307 +@x l.306 +void new_section_xref(p) name_pointer p; @y +static void new_section_xref (name_pointer p) @z Section 23. -@x l.327 +@x l.326 +void set_file_flag(p) name_pointer p; @y +static void set_file_flag (name_pointer p) @z @@ -209,7 +208,8 @@ char *first; /* position of first character of string */ int l; /* length of identifier */ eight_bits t; /* desired ilk */ @y -int names_match (name_pointer p, char *first, int l, char t) +int +names_match (name_pointer p, const char *first, int l, char t) @z @x l.383 @@ -232,22 +232,26 @@ Section 34. @x l.600 void skip_limbo(); @y -void skip_limbo (void); +static void skip_limbo (void); @z Section 35. -@x l.604 +@x l.603 +void skip_limbo() { @y +static void skip_limbo (void) { @z Section 36. -@x l.626 +@x l.625 +unsigned skip_TeX() /* skip past pure \TEX/ code */ @y +static unsigned skip_TeX (void) /* skip past pure \TEX/ code */ @z @@ -263,30 +267,60 @@ Section 39. @x l.696 eight_bits get_next(); @y -eight_bits get_next (void); +static eight_bits get_next (void); @z Section 40. -@x l.700 +@x l.699 +eight_bits get_next() /* produces the next input token */ @y +static eight_bits get_next (void) /* produces the next input token */ @z +Section 45. + +@x l.780 + else if (*loc=='>') if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);} + else compress(minus_gt); break; +@y + else if (*loc=='>') {if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);} + else compress(minus_gt);} break; +@z + +Section 48. + +@x l.870 + if (c=='\\') if (loc>=limit) continue; + else if (++id_loc<=section_text_end) { + *id_loc = '\\'; c=*loc++; + } +@y + if (c=='\\') { + if (loc>=limit) continue; + else if (++id_loc<=section_text_end) { + *id_loc = '\\'; c=*loc++; + } + } +@z + Section 55. @x l.971 void skip_restricted(); @y -void skip_restricted (void); +static void skip_restricted (void); @z Section 56. -@x l.975 +@x l.974 +void skip_restricted() @y +static void skip_restricted (void) @z @@ -295,14 +329,16 @@ Section 59. @x l.1024 void phase_one(); @y -void phase_one (void); +static void phase_one (void); @z Section 60. -@x l.1028 +@x l.1027 +void phase_one() { @y +static void phase_one (void) { @z @@ -311,15 +347,17 @@ Section 62. @x l.1076 void C_xref(); @y -void C_xref (eight_bits); +static void C_xref (eight_bits); @z Section 63. @x l.1080 +void C_xref( spec_ctrl ) /* makes cross-references for \CEE/ identifiers */ eight_bits spec_ctrl; @y +static void C_xref (eight_bits spec_ctrl) /* makes cross-references for \CEE/ identifiers */ @z @@ -328,14 +366,16 @@ Section 64. @x l.1104 void outer_xref(); @y -void outer_xref (void); +static void outer_xref (void); @z Section 65. -@x l.1108 +@x l.1107 +void outer_xref() /* extension of |C_xref| */ @y +static void outer_xref (void) /* extension of |C_xref| */ @z @@ -344,43 +384,51 @@ Section 74. @x l.1266 void section_check(); @y -void section_check (name_pointer); +static void section_check (name_pointer); @z Section 75. -@x l.1270 +@x l.1269 +void section_check(p) name_pointer p; /* print anomalies in subtree |p| */ @y +static void section_check (name_pointer p) /* print anomalies in subtree |p| */ @z Section 78. -@x l.1323 +@x l.1322 +void flush_buffer(b,per_cent,carryover) char *b; /* outputs from |out_buf+1| to |b|,where |b<=out_ptr| */ boolean per_cent,carryover; @y +static void flush_buffer (char *b, boolean per_cent, boolean carryover) @z Section 79. -@x l.1352 +@x l.1351 +void finish_line() /* do this at the end of a line */ @y +static void finish_line (void) /* do this at the end of a line */ @z Section 81. -@x l.1384 +@x l.1383 +void out_str(s) /* output characters from |s| to end of string */ char *s; @y -out_str (char *s) /* output characters from |s| to end of string */ +static void +out_str (const char *s) /* output characters from |s| to end of string */ @z Section 83. @@ -388,49 +436,59 @@ Section 83. @x l.1402 void break_out(); @y -void break_out (void); +static void break_out (void); @z Section 84. -@x l.1406 +@x l.1405 +void break_out() /* finds a way to break the output line */ @y +static void break_out (void) /* finds a way to break the output line */ @z Section 86. -@x l.1441 +@x l.1440 +void out_section(n) sixteen_bits n; @y +static void out_section (sixteen_bits n) @z Section 87. -@x l.1455 +@x l.1454 +void out_name(p,quote_xalpha) name_pointer p; boolean quote_xalpha; @y +static void out_name (name_pointer p, boolean quote_xalpha) @z Section 88. -@x l.1485 +@x l.1484 +void copy_limbo() @y +static void copy_limbo (void) @z Section 90. -@x l.1520 +@x l.1519 +eight_bits copy_TeX() @y +static eight_bits copy_TeX (void) @z @@ -439,7 +497,7 @@ Section 91. @x l.1449 int copy_comment(); @y -int copy_comment (boolean, int); +static int copy_comment (boolean, int); @z Section 92. @@ -449,75 +507,100 @@ int copy_comment(is_long_comment,bal) /* copies \TEX/ code in comments */ boolean is_long_comment; /* is this a traditional \CEE/ comment? */ int bal; /* brace balance */ @y -int copy_comment (boolean is_long_comment, int bal) +static int +copy_comment (boolean is_long_comment, int bal) +@z + +Section 93. + +@x l.1608 + if (phase==2) app_tok(*(loc++)) else loc++; +@y + {if (phase==2) app_tok(*(loc++)) else loc++;} @z Section 99. -@x l.1784 +@x l.1783 +void print_cat(c) /* symbolic printout of a category */ eight_bits c; @y +static void print_cat (eight_bits c) @z Section 106. -@x l.2139 +@x l.2138 +void print_text(p) /* prints a token list for debugging; not used in |main| */ text_pointer p; @y +static void print_text (text_pointer p) @z Section 109. -@x l.2264 +@x l.2263 +void app_str(s) char *s; @y -app_str (char *s) +static void +app_str (const char *s) @z -@x l.2271 +@x l.2270 +void big_app(a) token a; @y +static void big_app (token a) @z -@x l.2288 +@x l.2287 +void big_app1(a) scrap_pointer a; @y +static void big_app1 (scrap_pointer a) @z Section 111. -@x l.2415 +@x l.2414 +token_pointer find_first_ident(p) text_pointer p; @y +static token_pointer find_first_ident (text_pointer p) @z Section 112. -@x l.2447 +@x l.2446 +void make_reserved(p) /* make the first identifier in |p->trans| like |int| */ scrap_pointer p; @y +static void make_reserved (scrap_pointer p) @z Section 113. -@x l.2478 +@x l.2477 +void make_underlined(p) /* underline the entry for the first identifier in |p->trans| */ scrap_pointer p; @y +static void make_underlined (scrap_pointer p) @z @@ -526,54 +609,90 @@ Section 114. @x l.2495 void underline_xref(); @y -void underline_xref (name_pointer); +static void underline_xref (name_pointer); @z Section 115. -@x l.2499 +@x l.2498 +void underline_xref(p) name_pointer p; @y +static void underline_xref (name_pointer p) @z Section 164. -@x l.3004 +@x l.3003 +void reduce(j,k,c,d,n) scrap_pointer j; eight_bits c; short k, d, n; @y +static void reduce (scrap_pointer j, short k, eight_bits c, short d, short n) @z Section 165. -@x l.3030 +@x l.3029 +void squash(j,k,c,d,n) scrap_pointer j; eight_bits c; short k, d, n; @y +static void squash (scrap_pointer j, short k, eight_bits c, short d, short n) @z +Section 169. + +@x l.3096 -- rename local var, not to shadow param +{ scrap_pointer k; /* pointer into |scrap_info| */ + if (tracing==2) { + printf("\n%d:",n); + for (k=scrap_base; k<=lo_ptr; k++) { + if (k==pp) putxchar('*'); else putxchar(' '); + if (k->mathness %4 == yes_math) putchar('+'); + else if (k->mathness %4 == no_math) putchar('-'); + print_cat(k->cat); + if (k->mathness /4 == yes_math) putchar('+'); + else if (k->mathness /4 == no_math) putchar('-'); +@y +{ scrap_pointer k_l; /* pointer into |scrap_info| */ + if (tracing==2) { + printf("\n%d:",n); + for (k_l=scrap_base; k_l<=lo_ptr; k_l++) { + if (k_l==pp) putxchar('*'); else putxchar(' '); + if (k_l->mathness %4 == yes_math) putchar('+'); + else if (k_l->mathness %4 == no_math) putchar('-'); + print_cat(k_l->cat); + if (k_l->mathness /4 == yes_math) putchar('+'); + else if (k_l->mathness /4 == no_math) putchar('-'); +@z + Section 170. -@x l.3126 +@x l.3125 +text_pointer translate() /* converts a sequence of scraps */ @y +static text_pointer translate (void) /* converts a sequence of scraps */ @z Section 174. -@x l.3191 +@x l.3190 +void C_parse(spec_ctrl) /* creates scraps from \CEE/ tokens */ eight_bits spec_ctrl; @y +static void C_parse (eight_bits spec_ctrl) /* creates scraps from \CEE/ tokens */ @z @@ -582,64 +701,78 @@ Section 181. @x l.3421 void app_cur_id(); @y -void app_cur_id (boolean); +static void app_cur_id (boolean); @z Section 182. -@x l.3425 +@x l.3424 +void app_cur_id(scrapping) boolean scrapping; /* are we making this into a scrap? */ @y +static void app_cur_id (boolean scrapping) @z Section 183. -@x l.3451 +@x l.3449 +text_pointer C_translate() @y +static text_pointer C_translate (void) @z Section 184. -@x l.3480 +@x l.3479 +void outer_parse() /* makes scraps from \CEE/ tokens and comments */ @y +static void outer_parse (void) /* makes scraps from \CEE/ tokens and comments */ @z Section 189. -@x l.3586 +@x l.3585 +void push_level(p) /* suspends the current level */ text_pointer p; @y +static void push_level (text_pointer p) /* suspends the current level */ @z Section 190. -@x l.3606 +@x l.3605 +void pop_level() @y +static void pop_level (void) @z Section 192. -@x l.3628 +@x l.3627 +eight_bits get_output() /* returns the next token of output */ @y +static eight_bits get_output (void) /* returns the next token of output */ @z Section 193. -@x l.3665 +@x l.3664 +void output_C() /* outputs the current token list */ @y +static void output_C (void) /* outputs the current token list */ @z @@ -648,30 +781,47 @@ Section 194. @x l.3687 void make_output(); @y -void make_output (void); +static void make_output (void); @z Section 195. -@x l.3691 +@x l.3690 +void make_output() /* outputs the equivalents of tokens */ @y +static void make_output (void) /* outputs the equivalents of tokens */ @z +Section 202. + +@x l.3927 + if (b=='\'' || b=='"') + if (delim==0) delim=b; + else if (delim==b) delim=0; +@y + if (b=='\'' || b=='"') { + if (delim==0) delim=b; + else if (delim==b) delim=0; + } +@z + Section 205. @x l.3951 void phase_two(); @y -void phase_two (void); +static void phase_two (void); @z Section 206. @x l.3955 +void phase_two() { @y +static void phase_two (void) { @z @@ -680,32 +830,48 @@ Section 212. @x l.4074 void finish_C(); @y -void finish_C (boolean); +static void finish_C (boolean); @z Section 213. -@x l.4078 +@x l.4077 +void finish_C(visible) /* finishes a definition or a \CEE/ part */ boolean visible; /* nonzero if we should produce \TEX/ output */ @y +static void finish_C (boolean visible) /* finishes a definition or a \CEE/ part */ @z +Section 212. + +@x l.4092 + if (*out_ptr=='6') out_ptr-=2; + else if (*out_ptr=='7') *out_ptr='Y'; +@y + { + if (*out_ptr=='6') out_ptr-=2; + else if (*out_ptr=='7') *out_ptr='Y'; + } +@z + Section 221. @x l.4245 void footnote(); @y -void footnote (sixteen_bits); +static void footnote (sixteen_bits); @z Section 222. -@x l.4249 +@x l.4248 +void footnote(flag) /* outputs section cross-references */ sixteen_bits flag; @y +static void footnote (sixteen_bits flag) /* outputs section cross-references */ @z @@ -714,14 +880,16 @@ Section 225. @x l.4294 void phase_three(); @y -void phase_three (void); +static void phase_three (void); @z Section 226. -@x l.4298 +@x l.4297 +void phase_three() { @y +static void phase_three (void) { @z @@ -730,15 +898,17 @@ Section 237. @x l.4474 void unbucket(); @y -void unbucket (eight_bits); +static void unbucket (eight_bits); @z Section 238. -@x l.4478 +@x l.4477 +void unbucket(d) /* empties buckets having depth |d| */ eight_bits d; @y +static void unbucket (eight_bits d) /* empties buckets having depth |d| */ @z @@ -747,15 +917,17 @@ Section 246. @x l.4594 void section_print(); @y -void section_print (name_pointer); +static void section_print (name_pointer); @z Section 247. -@x l.4598 +@x l.4597 +void section_print(p) /* print all section names in subtree |p| */ name_pointer p; @y +static void section_print (name_pointer p) /* print all section names in subtree |p| */ @z @@ -766,3 +938,14 @@ print_stats() { @y print_stats (void) { @z + +Section 250. (added) + +@x l.4643 - declare print_text(), so it can be 'used' in main. +@** Index. +@y +@ @<Predecl...@>= +static void print_text (text_pointer p); + +@** Index. +@z |