summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-06-23 16:27:41 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-06-23 16:27:41 +0000
commit371b8e253250c7ed1fde51ca0f9b0a25bd997fda (patch)
treeb4e55333597396725c9801d8d5cd0c6a33d0b657 /Build
parent123c3f5ff16e3565a9445dcacc38b249c64e7744 (diff)
always use prototypes
stop using #ifdef HAVE_PROTOTYPES or P?C, P?H, and AA macros git-svn-id: svn://tug.org/texlive/trunk@13921 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/web2c/ChangeLog10
-rw-r--r--Build/source/texk/web2c/web2c/coerce.h14
-rw-r--r--Build/source/texk/web2c/web2c/fixwrites.c18
-rw-r--r--Build/source/texk/web2c/web2c/kps.c6
-rw-r--r--Build/source/texk/web2c/web2c/main.c24
-rw-r--r--Build/source/texk/web2c/web2c/splitup.c5
-rw-r--r--Build/source/texk/web2c/web2c/web2c-lexer.c10
-rw-r--r--Build/source/texk/web2c/web2c/web2c-lexer.l10
-rw-r--r--Build/source/texk/web2c/web2c/web2c-parser.c32
-rw-r--r--Build/source/texk/web2c/web2c/web2c-parser.y32
-rw-r--r--Build/source/texk/web2c/web2c/web2c.h30
11 files changed, 105 insertions, 86 deletions
diff --git a/Build/source/texk/web2c/web2c/ChangeLog b/Build/source/texk/web2c/web2c/ChangeLog
index ba2af1f1568..7da1884b236 100644
--- a/Build/source/texk/web2c/web2c/ChangeLog
+++ b/Build/source/texk/web2c/web2c/ChangeLog
@@ -2,6 +2,16 @@
* native/config.h: #include <stdarg.h>, not <kpathsea/c-vararg.h>.
+ * coerce.h, fixwrites.c, kps.c, main.c, splitup.c, web2c-lexer.l,
+ web2c-parser.y, web2c.h: use ANSI C function definitions and
+ prototypes instead of P[1-9][CH] macros.
+
+ * web2c-parser.y (do_proc_args): generate ANSI C function
+ definitions without AA macros.
+ (gen_function_head): replace '#ifdef HAVE_PROTOTYPES' by '#if 1',
+ but keep unused code, otherwise splitup might create less files.
+ * splitup.c (read_line): handle '#if 1".
+
2009-06-09 Peter Breitenlohner <peb@mppmu.mpg.de>
* Makefile.am (AM_CFLAGS): enable compiler warnings.
diff --git a/Build/source/texk/web2c/web2c/coerce.h b/Build/source/texk/web2c/web2c/coerce.h
index 047acdd3049..15ce3e0ad86 100644
--- a/Build/source/texk/web2c/web2c/coerce.h
+++ b/Build/source/texk/web2c/web2c/coerce.h
@@ -49,7 +49,7 @@
/* And we use the opportunity to declare a few functions that could not be
declared in texmfmp.h, because they need typedefs not yet known at that
point. */
-extern strnumber getjobname P1H(strnumber);
+extern strnumber getjobname (strnumber);
#ifdef MP
/* MP defined poolASCIIcode instead of packedASCIIcode, sigh. */
@@ -59,19 +59,19 @@ typedef poolASCIIcode packedASCIIcode;
/* XeTeX redefines "ASCII" types.... */
typedef packedUTF16code packedASCIIcode;
#endif
-extern void calledit P4H(packedASCIIcode *, poolpointer, integer, integer);
+extern void calledit (packedASCIIcode *, poolpointer, integer, integer);
#ifdef MF
-extern void blankrectangle P4H(screencol, screencol, screenrow, screenrow);
-extern void paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+extern void blankrectangle (screencol, screencol, screenrow, screenrow);
+extern void paintrow (screenrow, pixelcolor, transspec, screencol);
#endif
#ifdef TeX
/* Prototypes for source-specials functions... */
extern strnumber makefullnamestring();
-extern boolean isnewsource P2H(strnumber, int);
-extern poolpointer makesrcspecial P2H(strnumber, int);
-extern void remembersourceinfo P2H(strnumber, int);
+extern boolean isnewsource (strnumber, int);
+extern poolpointer makesrcspecial (strnumber, int);
+extern void remembersourceinfo (strnumber, int);
#endif
#ifdef luaTeX
diff --git a/Build/source/texk/web2c/web2c/fixwrites.c b/Build/source/texk/web2c/web2c/fixwrites.c
index 867c8de7110..66701aabdbf 100644
--- a/Build/source/texk/web2c/web2c/fixwrites.c
+++ b/Build/source/texk/web2c/web2c/fixwrites.c
@@ -15,7 +15,7 @@ int tex = false;
/* Replace the last (should be only) newline in S with a null. */
static void
-remove_newline P1C(string, s)
+remove_newline (string s)
{
char *temp = strrchr (s, '\n');
if (temp == NULL)
@@ -31,7 +31,7 @@ remove_newline P1C(string, s)
static char *
-insert_long P1C(string, cp)
+insert_long (string cp)
{
char tbuf[BUFSIZ];
register int i;
@@ -46,7 +46,7 @@ insert_long P1C(string, cp)
static void
-join P1C(string, cp)
+join (string cp)
{
char temp[BUFSIZ], *tp;
@@ -63,7 +63,7 @@ join P1C(string, cp)
static void
-do_blanks P1C(int, indent)
+do_blanks (int indent)
{
register int i;
@@ -78,7 +78,7 @@ do_blanks P1C(int, indent)
/* Return true if we have a whole write/writeln statement. We determine
this by matching parens, ignoring those within strings. */
static int
-whole P1C(string, cp)
+whole (string cp)
{
register int depth = 0;
@@ -112,7 +112,7 @@ whole P1C(string, cp)
/* Skips to the next , or ), skipping over balanced paren pairs. */
static char *
-skip_balanced P1C(string, cp)
+skip_balanced (string cp)
{
register int depth = 0;
@@ -136,7 +136,7 @@ skip_balanced P1C(string, cp)
/* Return true if c appears, except inside a quoted string */
static int
-bare P2C(string, cp, char, c)
+bare (string cp, char c)
{
for (; *cp && *cp != c; ++cp)
{
@@ -170,7 +170,7 @@ bare P2C(string, cp, char, c)
not the first one. */
static char *
-advance_cp P2C(char *, cp, int, lefts)
+advance_cp (char *cp, int lefts)
{
char *cp1;
char *cp2;
@@ -185,7 +185,7 @@ advance_cp P2C(char *, cp, int, lefts)
}
int
-main P2C(int, argc, string *, argv)
+main (int argc, string *argv)
{
register char *cp;
int blanks_done, indent, i;
diff --git a/Build/source/texk/web2c/web2c/kps.c b/Build/source/texk/web2c/web2c/kps.c
index 369c5ea9059..0363f7e7644 100644
--- a/Build/source/texk/web2c/web2c/kps.c
+++ b/Build/source/texk/web2c/web2c/kps.c
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#undef fclose
string
-uppercasify P1C(const_string, s)
+uppercasify (const_string s)
{
string target;
string ret = malloc (strlen(s) + 1);
@@ -50,7 +50,7 @@ uppercasify P1C(const_string, s)
routines and abort if an error happens. */
FILE *
-xfopen P2C(const_string, filename, const_string, mode)
+xfopen (const_string filename, const_string mode)
{
FILE *f;
@@ -67,7 +67,7 @@ xfopen P2C(const_string, filename, const_string, mode)
void
-xfclose P2C(FILE *, f, const_string, filename)
+xfclose (FILE *f, const_string filename)
{
assert (f);
diff --git a/Build/source/texk/web2c/web2c/main.c b/Build/source/texk/web2c/web2c/main.c
index cb763f2fc40..a90171ff655 100644
--- a/Build/source/texk/web2c/web2c/main.c
+++ b/Build/source/texk/web2c/web2c/main.c
@@ -68,7 +68,7 @@ char **gargv;
extern int yyleng;
void
-find_next_temp P1H(void)
+find_next_temp (void)
{
next_temp[4]++;
if (next_temp[4] > 'z')
@@ -79,13 +79,13 @@ find_next_temp P1H(void)
}
void
-normal P1H(void)
+normal (void)
{
out = stdout;
}
void
-new_line P1H(void)
+new_line (void)
{
if (!out)
return;
@@ -100,7 +100,7 @@ new_line P1H(void)
/* Output the string S to the file `out'. */
void
-my_output P1C(string, s)
+my_output (string s)
{
int len = strlen (s);
int less_indent = 0;
@@ -132,7 +132,7 @@ my_output P1C(string, s)
}
void
-semicolon P1H(void)
+semicolon (void)
{
if (!last_brace) {
my_output (";");
@@ -142,7 +142,7 @@ semicolon P1H(void)
}
static int
-hash P1C(const_string, id)
+hash (const_string id)
{
register int i = 0, j;
for (j = 0; id[j] != 0; j++)
@@ -151,7 +151,7 @@ hash P1C(const_string, id)
}
int
-search_table P1C(const_string, id)
+search_table (const_string id)
{
int ptr;
ptr = hash_list[hash (id)];
@@ -169,7 +169,7 @@ search_table P1C(const_string, id)
/* Add ID to the symbol table. Leave it up to the caller to assign to
the `typ' field. Return the index into the `sym_table' array. */
int
-add_to_table P1C(string, id)
+add_to_table (string id)
{
int h, ptr;
h = hash (id);
@@ -186,7 +186,7 @@ add_to_table P1C(string, id)
}
void
-remove_locals P1H(void)
+remove_locals (void)
{
int h, ptr;
for (h = 0; h < hash_prime; h++)
@@ -202,7 +202,7 @@ remove_locals P1H(void)
}
void
-mark P1H(void)
+mark (void)
{
mark_sym_free = next_sym_free;
mark_string_free = next_string_free;
@@ -211,7 +211,7 @@ mark P1H(void)
void
-initialize P1H(void)
+initialize (void)
{
register int i;
@@ -224,7 +224,7 @@ initialize P1H(void)
}
int
-main P2C(int, argc, string *, argv)
+main (int argc, string *argv)
{
int error, i;
diff --git a/Build/source/texk/web2c/web2c/splitup.c b/Build/source/texk/web2c/web2c/splitup.c
index 0d1a768dc6c..e2d7475f6b6 100644
--- a/Build/source/texk/web2c/web2c/splitup.c
+++ b/Build/source/texk/web2c/web2c/splitup.c
@@ -59,11 +59,12 @@ FILE *out, *ini, *temp;
* so we know when it's safe to finish writing the current file.
*/
static int
-read_line P1H(void)
+read_line (void)
{
if (fgets (buffer, sizeof (buffer), stdin) == NULL)
return false;
if (strncmp (buffer, "#ifdef", 6) == 0
+ || strncmp (buffer, "#if 1", 5) == 0
|| strncmp (buffer, "#ifndef", 7) == 0)
{
++ifdef_nesting;
@@ -76,7 +77,7 @@ read_line P1H(void)
}
int
-main P2C(int, argc, string *, argv)
+main (int argc, string *argv)
{
string coerce;
unsigned coerce_len;
diff --git a/Build/source/texk/web2c/web2c/web2c-lexer.c b/Build/source/texk/web2c/web2c/web2c-lexer.c
index 7b8641c2606..215d01c89f6 100644
--- a/Build/source/texk/web2c/web2c/web2c-lexer.c
+++ b/Build/source/texk/web2c/web2c/web2c-lexer.c
@@ -744,7 +744,7 @@ extern boolean doing_statements;
This is a good thing, since libfl.a is often installed somewhere that
the linker doesn't search by default. */
static int
-yywrap P1H(void)
+yywrap (void)
{
return 1;
}
@@ -2482,7 +2482,7 @@ void yyfree (void * ptr )
to yytext outside of this file. Which means we can omit one of the more
troublesome autoconf tests. */
void
-get_string_literal P1C(char *, s)
+get_string_literal (char *s)
{
int i, j;
j = 1;
@@ -2499,7 +2499,7 @@ get_string_literal P1C(char *, s)
}
void
-get_single_char P1C(char *, s)
+get_single_char (char *s)
{
s[0]='\'';
if (yytext[1] == '\\' || yytext[1] == '\'') {
@@ -2515,7 +2515,7 @@ get_single_char P1C(char *, s)
}
void
-get_result_type P1C(char *, s)
+get_result_type (char *s)
{
strcpy(s, yytext);
}
@@ -2525,7 +2525,7 @@ get_result_type P1C(char *, s)
bad status. */
int
-yyerror P1C(string, s)
+yyerror (string s)
{
/* This is so the convert script can delete the output file on error. */
puts ("@error@");
diff --git a/Build/source/texk/web2c/web2c/web2c-lexer.l b/Build/source/texk/web2c/web2c/web2c-lexer.l
index d4c55509f28..a7576ee96f5 100644
--- a/Build/source/texk/web2c/web2c/web2c-lexer.l
+++ b/Build/source/texk/web2c/web2c/web2c-lexer.l
@@ -25,7 +25,7 @@ extern boolean doing_statements;
This is a good thing, since libfl.a is often installed somewhere that
the linker doesn't search by default. */
static int
-yywrap P1H(void)
+yywrap (void)
{
return 1;
}
@@ -227,7 +227,7 @@ HHB1 ("hh"{WW}"."{WW}"b1")
to yytext outside of this file. Which means we can omit one of the more
troublesome autoconf tests. */
void
-get_string_literal P1C(char *, s)
+get_string_literal (char *s)
{
int i, j;
j = 1;
@@ -244,7 +244,7 @@ get_string_literal P1C(char *, s)
}
void
-get_single_char P1C(char *, s)
+get_single_char (char *s)
{
s[0]='\'';
if (yytext[1] == '\\' || yytext[1] == '\'') {
@@ -260,7 +260,7 @@ get_single_char P1C(char *, s)
}
void
-get_result_type P1C(char *, s)
+get_result_type (char *s)
{
strcpy(s, yytext);
}
@@ -270,7 +270,7 @@ get_result_type P1C(char *, s)
bad status. */
int
-yyerror P1C(string, s)
+yyerror (string s)
{
/* This is so the convert script can delete the output file on error. */
puts ("@error@");
diff --git a/Build/source/texk/web2c/web2c/web2c-parser.c b/Build/source/texk/web2c/web2c/web2c-parser.c
index aa8be84435b..ae842313872 100644
--- a/Build/source/texk/web2c/web2c/web2c-parser.c
+++ b/Build/source/texk/web2c/web2c/web2c-parser.c
@@ -96,12 +96,12 @@ extern char coerce_name[];
extern string program_name;
extern boolean debug;
-static long my_labs P1H(long);
-static void compute_array_bounds P1H(void);
-static void fixup_var_list P1H(void);
-static void do_proc_args P1H(void);
-static void gen_function_head P1H(void);
-static boolean doreturn P1H(string);
+static long my_labs (long);
+static void compute_array_bounds (void);
+static void fixup_var_list (void);
+static void do_proc_args (void);
+static void gen_function_head (void);
+static boolean doreturn (string);
/* Line 189 of yacc.c */
@@ -4096,7 +4096,7 @@ yyreturn:
static void
-compute_array_bounds P1H(void)
+compute_array_bounds (void)
{
long lb;
char tmp[200];
@@ -4182,7 +4182,7 @@ fixup_var_list ()
Otherwise, return 0. */
static boolean
-doreturn P1C(string, label)
+doreturn (string label)
{
return
tex
@@ -4196,7 +4196,7 @@ doreturn P1C(string, label)
/* Return the absolute value of a long. */
static long
-my_labs P1C(long, x)
+my_labs (long x)
{
if (x < 0L) return(-x);
return(x);
@@ -4206,7 +4206,7 @@ my_labs P1C(long, x)
/* Output current function declaration to coerce file. */
static void
-do_proc_args P1H(void)
+do_proc_args (void)
{
/* If we want ANSI code and one of the parameters is a var
parameter, then use the #define to add the &. We do this by
@@ -4224,18 +4224,18 @@ do_proc_args P1H(void)
/* We can't use our P?H macros here, since there might be an arbitrary
number of function arguments. */
- fprintf (coerce, "%s %s AA((", fn_return_type, z_id);
+ fprintf (coerce, "%s %s (", fn_return_type, z_id);
if (ids_paramed == 0) fprintf (coerce, "void");
for (i = 0; i < ids_paramed; i++) {
if (i > 0)
putc (',', coerce);
fprintf (coerce, "%s %s", arg_type[i], symbol (param_id_list[i]));
}
- fprintf (coerce, "));\n");
+ fprintf (coerce, ");\n");
}
static void
-gen_function_head P1H(void)
+gen_function_head (void)
{
int i;
@@ -4265,7 +4265,11 @@ gen_function_head P1H(void)
generated code, or we'd generate different code with and without
prototypes, which might cause splitup to create different numbers
of files in each case. */
- fputs ("#ifdef HAVE_PROTOTYPES\n", out);
+ /* We now always use ANSI C prototypes, but keep the '#if 1' in the
+ generated code, to avoid different numbers of files.
+ Once we stop splitting the TeX and Metafont output files all this
+ can go away. */
+ fputs ("#if 1\n", out);
my_output (z_id);
my_output ("(");
if (ids_paramed == 0) my_output ("void");
diff --git a/Build/source/texk/web2c/web2c/web2c-parser.y b/Build/source/texk/web2c/web2c/web2c-parser.y
index 1a1e04df7da..54693b9d753 100644
--- a/Build/source/texk/web2c/web2c/web2c-parser.y
+++ b/Build/source/texk/web2c/web2c/web2c-parser.y
@@ -48,12 +48,12 @@ extern char coerce_name[];
extern string program_name;
extern boolean debug;
-static long my_labs P1H(long);
-static void compute_array_bounds P1H(void);
-static void fixup_var_list P1H(void);
-static void do_proc_args P1H(void);
-static void gen_function_head P1H(void);
-static boolean doreturn P1H(string);
+static long my_labs (long);
+static void compute_array_bounds (void);
+static void fixup_var_list (void);
+static void do_proc_args (void);
+static void gen_function_head (void);
+static boolean doreturn (string);
%}
%start PROGRAM
@@ -1205,7 +1205,7 @@ FOR_LIST: EXPRESS
%%
static void
-compute_array_bounds P1H(void)
+compute_array_bounds (void)
{
long lb;
char tmp[200];
@@ -1291,7 +1291,7 @@ fixup_var_list ()
Otherwise, return 0. */
static boolean
-doreturn P1C(string, label)
+doreturn (string label)
{
return
tex
@@ -1305,7 +1305,7 @@ doreturn P1C(string, label)
/* Return the absolute value of a long. */
static long
-my_labs P1C(long, x)
+my_labs (long x)
{
if (x < 0L) return(-x);
return(x);
@@ -1315,7 +1315,7 @@ my_labs P1C(long, x)
/* Output current function declaration to coerce file. */
static void
-do_proc_args P1H(void)
+do_proc_args (void)
{
/* If we want ANSI code and one of the parameters is a var
parameter, then use the #define to add the &. We do this by
@@ -1333,18 +1333,18 @@ do_proc_args P1H(void)
/* We can't use our P?H macros here, since there might be an arbitrary
number of function arguments. */
- fprintf (coerce, "%s %s AA((", fn_return_type, z_id);
+ fprintf (coerce, "%s %s (", fn_return_type, z_id);
if (ids_paramed == 0) fprintf (coerce, "void");
for (i = 0; i < ids_paramed; i++) {
if (i > 0)
putc (',', coerce);
fprintf (coerce, "%s %s", arg_type[i], symbol (param_id_list[i]));
}
- fprintf (coerce, "));\n");
+ fprintf (coerce, ");\n");
}
static void
-gen_function_head P1H(void)
+gen_function_head (void)
{
int i;
@@ -1374,7 +1374,11 @@ gen_function_head P1H(void)
generated code, or we'd generate different code with and without
prototypes, which might cause splitup to create different numbers
of files in each case. */
- fputs ("#ifdef HAVE_PROTOTYPES\n", out);
+ /* We now always use ANSI C prototypes, but keep the '#if 1' in the
+ generated code, to avoid different numbers of files.
+ Once we stop splitting the TeX and Metafont output files all this
+ can go away. */
+ fputs ("#if 1\n", out);
my_output (z_id);
my_output ("(");
if (ids_paramed == 0) my_output ("void");
diff --git a/Build/source/texk/web2c/web2c/web2c.h b/Build/source/texk/web2c/web2c/web2c.h
index bccaf6f7541..ec225c0594a 100644
--- a/Build/source/texk/web2c/web2c/web2c.h
+++ b/Build/source/texk/web2c/web2c/web2c.h
@@ -52,22 +52,22 @@ extern struct sym_entry sym_table[];
extern int next_sym_free, next_string_free;
extern int mark_sym_free, mark_string_free;
-extern void find_next_temp P1H(void);
-extern void normal P1H(void);
-extern void new_line P1H(void);
-extern void my_output P1H(string);
-extern void semicolon P1H(void);
-extern void remove_locals P1H(void);
-extern void mark P1H(void);
-extern void initialize P1H(void);
-extern int add_to_table P1H(string);
-extern int search_table P1H(const_string);
-extern int yyerror P1H(string);
+extern void find_next_temp (void);
+extern void normal (void);
+extern void new_line (void);
+extern void my_output (string);
+extern void semicolon (void);
+extern void remove_locals (void);
+extern void mark (void);
+extern void initialize (void);
+extern int add_to_table (string);
+extern int search_table (const_string);
+extern int yyerror (string);
-extern void get_string_literal P1H(char*);
-extern void get_single_char P1H(char*);
-extern void get_result_type P1H(char*);
-extern void get_return_type P1H(char*);
+extern void get_string_literal (char*);
+extern void get_single_char (char*);
+extern void get_result_type (char*);
+extern void get_return_type (char*);
/* No prototypes for these two. As used, neither takes arguments. */
extern int yylex(), yyparse();