summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-07-22 19:20:54 (GMT)
committerThomas Wouters <thomas@python.org>2000-07-22 19:20:54 (GMT)
commit23c9e0024af99379ae517b016b874d57127e9a97 (patch)
tree8b9550548b9af667e20b8aaaae03ac54d38d6f70
parentf70ef4f8606f99744252a804229d53a4d97601c1 (diff)
downloadcpython-23c9e0024af99379ae517b016b874d57127e9a97.zip
cpython-23c9e0024af99379ae517b016b874d57127e9a97.tar.gz
cpython-23c9e0024af99379ae517b016b874d57127e9a97.tar.bz2
Mass ANSIfication.
Work around intrcheck.c's desire to pass 'PyErr_CheckSignals' to 'Py_AddPendingCall' by providing a (static) wrapper function that has the right number of arguments.
-rw-r--r--Parser/acceler.c14
-rw-r--r--Parser/bitset.c22
-rw-r--r--Parser/firstsets.c7
-rw-r--r--Parser/grammar.c32
-rw-r--r--Parser/grammar1.c7
-rw-r--r--Parser/intrcheck.c48
-rw-r--r--Parser/listnode.c11
-rw-r--r--Parser/metagrammar.c2
-rw-r--r--Parser/myreadline.c13
-rw-r--r--Parser/node.c15
-rw-r--r--Parser/parser.c66
-rw-r--r--Parser/parsetok.c21
-rw-r--r--Parser/pgen.c97
-rw-r--r--Parser/pgenmain.c36
-rw-r--r--Parser/printgrammar.c25
-rw-r--r--Parser/tokenizer.c37
16 files changed, 123 insertions, 330 deletions
diff --git a/Parser/acceler.c b/Parser/acceler.c
index 177bb49..cd8e444 100644
--- a/Parser/acceler.c
+++ b/Parser/acceler.c
@@ -30,8 +30,7 @@ static void fixdfa(grammar *, dfa *);
static void fixstate(grammar *, state *);
void
-PyGrammar_AddAccelerators(g)
- grammar *g;
+PyGrammar_AddAccelerators(grammar *g)
{
dfa *d;
int i;
@@ -48,8 +47,7 @@ PyGrammar_AddAccelerators(g)
}
void
-PyGrammar_RemoveAccelerators(g)
- grammar *g;
+PyGrammar_RemoveAccelerators(grammar *g)
{
dfa *d;
int i;
@@ -68,9 +66,7 @@ PyGrammar_RemoveAccelerators(g)
}
static void
-fixdfa(g, d)
- grammar *g;
- dfa *d;
+fixdfa(grammar *g, dfa *d)
{
state *s;
int j;
@@ -80,9 +76,7 @@ fixdfa(g, d)
}
static void
-fixstate(g, s)
- grammar *g;
- state *s;
+fixstate(grammar *g, state *s)
{
arc *a;
int k;
diff --git a/Parser/bitset.c b/Parser/bitset.c
index fba9331..a69cc36 100644
--- a/Parser/bitset.c
+++ b/Parser/bitset.c
@@ -14,8 +14,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include "bitset.h"
bitset
-newbitset(nbits)
- int nbits;
+newbitset(int nbits)
{
int nbytes = NBYTES(nbits);
bitset ss = PyMem_NEW(BYTE, nbytes);
@@ -30,16 +29,13 @@ newbitset(nbits)
}
void
-delbitset(ss)
- bitset ss;
+delbitset(bitset ss)
{
PyMem_DEL(ss);
}
int
-addbit(ss, ibit)
- bitset ss;
- int ibit;
+addbit(bitset ss, int ibit)
{
int ibyte = BIT2BYTE(ibit);
BYTE mask = BIT2MASK(ibit);
@@ -52,18 +48,14 @@ addbit(ss, ibit)
#if 0 /* Now a macro */
int
-testbit(ss, ibit)
- bitset ss;
- int ibit;
+testbit(bitset ss, int ibit)
{
return (ss[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0;
}
#endif
int
-samebitset(ss1, ss2, nbits)
- bitset ss1, ss2;
- int nbits;
+samebitset(bitset ss1, bitset ss2, int nbits)
{
int i;
@@ -74,9 +66,7 @@ samebitset(ss1, ss2, nbits)
}
void
-mergebitset(ss1, ss2, nbits)
- bitset ss1, ss2;
- int nbits;
+mergebitset(bitset ss1, bitset ss2, int nbits)
{
int i;
diff --git a/Parser/firstsets.c b/Parser/firstsets.c
index b27ed2e..295f67d 100644
--- a/Parser/firstsets.c
+++ b/Parser/firstsets.c
@@ -20,8 +20,7 @@ extern int Py_DebugFlag;
static void calcfirstset(grammar *, dfa *);
void
-addfirstsets(g)
- grammar *g;
+addfirstsets(grammar *g)
{
int i;
dfa *d;
@@ -35,9 +34,7 @@ addfirstsets(g)
}
static void
-calcfirstset(g, d)
- grammar *g;
- dfa *d;
+calcfirstset(grammar *g, dfa *d)
{
int i, j;
state *s;
diff --git a/Parser/grammar.c b/Parser/grammar.c
index 1a50786..07e59ff 100644
--- a/Parser/grammar.c
+++ b/Parser/grammar.c
@@ -21,8 +21,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
extern int Py_DebugFlag;
grammar *
-newgrammar(start)
- int start;
+newgrammar(int start)
{
grammar *g;
@@ -39,10 +38,7 @@ newgrammar(start)
}
dfa *
-adddfa(g, type, name)
- grammar *g;
- int type;
- char *name;
+adddfa(grammar *g, int type, char *name)
{
dfa *d;
@@ -60,8 +56,7 @@ adddfa(g, type, name)
}
int
-addstate(d)
- dfa *d;
+addstate(dfa *d)
{
state *s;
@@ -79,9 +74,7 @@ addstate(d)
}
void
-addarc(d, from, to, lbl)
- dfa *d;
- int lbl;
+addarc(dfa *d, int from, int to, int lbl)
{
state *s;
arc *a;
@@ -99,10 +92,7 @@ addarc(d, from, to, lbl)
}
int
-addlabel(ll, type, str)
- labellist *ll;
- int type;
- char *str;
+addlabel(labellist *ll, int type, char *str)
{
int i;
label *lb;
@@ -124,10 +114,7 @@ addlabel(ll, type, str)
/* Same, but rather dies than adds */
int
-findlabel(ll, type, str)
- labellist *ll;
- int type;
- char *str;
+findlabel(labellist *ll, int type, char *str)
{
int i;
@@ -145,8 +132,7 @@ findlabel(ll, type, str)
static void translabel(grammar *, label *);
void
-translatelabels(g)
- grammar *g;
+translatelabels(grammar *g)
{
int i;
@@ -159,9 +145,7 @@ translatelabels(g)
}
static void
-translabel(g, lb)
- grammar *g;
- label *lb;
+translabel(grammar *g, label *lb)
{
int i;
diff --git a/Parser/grammar1.c b/Parser/grammar1.c
index f9a24c0..16821f4 100644
--- a/Parser/grammar1.c
+++ b/Parser/grammar1.c
@@ -18,9 +18,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* Return the DFA for the given type */
dfa *
-PyGrammar_FindDFA(g, type)
- grammar *g;
- register int type;
+PyGrammar_FindDFA(grammar *g, register int type)
{
register dfa *d;
#if 1
@@ -42,8 +40,7 @@ PyGrammar_FindDFA(g, type)
}
char *
-PyGrammar_LabelRepr(lb)
- label *lb;
+PyGrammar_LabelRepr(label *lb)
{
static char buf[100];
diff --git a/Parser/intrcheck.c b/Parser/intrcheck.c
index 5278d76..34a3425 100644
--- a/Parser/intrcheck.c
+++ b/Parser/intrcheck.c
@@ -30,17 +30,17 @@ int Py_AddPendingCall(int (*func)(ANY *), ANY *arg);
#include <io.h>
void
-PyOS_InitInterrupts()
+PyOS_InitInterrupts(void)
{
}
void
-PyOS_FiniInterrupts()
+PyOS_FiniInterrupts(void)
{
}
int
-PyOS_InterruptOccurred()
+PyOS_InterruptOccurred(void)
{
_wyield();
}
@@ -66,18 +66,18 @@ PyOS_InterruptOccurred()
#include <go32.h>
void
-PyOS_InitInterrupts()
+PyOS_InitInterrupts(void)
{
_go32_want_ctrl_break(1 /* TRUE */);
}
void
-PyOS_FiniInterrupts()
+PyOS_FiniInterrupts(void)
{
}
int
-PyOS_InterruptOccurred()
+PyOS_InterruptOccurred(void)
{
return _go32_was_ctrl_break_hit();
}
@@ -87,17 +87,17 @@ PyOS_InterruptOccurred()
/* This might work for MS-DOS (untested though): */
void
-PyOS_InitInterrupts()
+PyOS_InitInterrupts(void)
{
}
void
-PyOS_FiniInterrupts()
+PyOS_FiniInterrupts(void)
{
}
int
-PyOS_InterruptOccurred()
+PyOS_InterruptOccurred(void)
{
int interrupted = 0;
while (kbhit()) {
@@ -136,21 +136,21 @@ PyOS_InterruptOccurred()
static int interrupted;
void
-PyErr_SetInterrupt()
+PyErr_SetInterrupt(void)
{
interrupted = 1;
}
-extern int PyErr_CheckSignals();
+extern int PyErr_CheckSignals(void);
+
+static int
+checksignals_witharg(void * arg)
+{
+ return PyErr_CheckSignals();
+}
-/* ARGSUSED */
static RETSIGTYPE
-#if defined(_M_IX86) && !defined(__QNX__)
-intcatcher(int sig) /* So the C compiler shuts up */
-#else /* _M_IX86 */
-intcatcher(sig)
- int sig; /* Not used by required by interface */
-#endif /* _M_IX86 */
+intcatcher(int sig)
{
extern void Py_Exit(int);
static char message[] =
@@ -167,13 +167,13 @@ intcatcher(sig)
break;
}
signal(SIGINT, intcatcher);
- Py_AddPendingCall(PyErr_CheckSignals, NULL);
+ Py_AddPendingCall(checksignals_witharg, NULL);
}
-static RETSIGTYPE (*old_siginthandler)() = SIG_DFL;
+static RETSIGTYPE (*old_siginthandler)(int) = SIG_DFL;
void
-PyOS_InitInterrupts()
+PyOS_InitInterrupts(void)
{
if ((old_siginthandler = signal(SIGINT, SIG_IGN)) != SIG_IGN)
signal(SIGINT, intcatcher);
@@ -189,13 +189,13 @@ PyOS_InitInterrupts()
}
void
-PyOS_FiniInterrupts()
+PyOS_FiniInterrupts(void)
{
signal(SIGINT, old_siginthandler);
}
int
-PyOS_InterruptOccurred()
+PyOS_InterruptOccurred(void)
{
if (!interrupted)
return 0;
@@ -206,6 +206,6 @@ PyOS_InterruptOccurred()
#endif /* !OK */
void
-PyOS_AfterFork()
+PyOS_AfterFork(void)
{
}
diff --git a/Parser/listnode.c b/Parser/listnode.c
index c7d5cfa..68f28bf 100644
--- a/Parser/listnode.c
+++ b/Parser/listnode.c
@@ -19,8 +19,7 @@ static void list1node(FILE *, node *);
static void listnode(FILE *, node *);
void
-PyNode_ListTree(n)
- node *n;
+PyNode_ListTree(node *n)
{
listnode(stdout, n);
}
@@ -28,9 +27,7 @@ PyNode_ListTree(n)
static int level, atbol;
static void
-listnode(fp, n)
- FILE *fp;
- node *n;
+listnode(FILE *fp, node *n)
{
level = 0;
atbol = 1;
@@ -38,9 +35,7 @@ listnode(fp, n)
}
static void
-list1node(fp, n)
- FILE *fp;
- node *n;
+list1node(FILE *fp, node *n)
{
if (n == 0)
return;
diff --git a/Parser/metagrammar.c b/Parser/metagrammar.c
index 589d7ac..16b7626 100644
--- a/Parser/metagrammar.c
+++ b/Parser/metagrammar.c
@@ -156,7 +156,7 @@ static grammar _PyParser_Grammar = {
};
grammar *
-meta_grammar()
+meta_grammar(void)
{
return &_PyParser_Grammar;
}
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index bb35000..a996a6e 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -23,16 +23,13 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include <limits.h>
#endif
-int (*PyOS_InputHook)() = NULL;
+int (*PyOS_InputHook)(void) = NULL;
/* This function restarts a fgets() after an EINTR error occurred
except if PyOS_InterruptOccurred() returns true. */
static int
-my_fgets(buf, len, fp)
- char *buf;
- int len;
- FILE *fp;
+my_fgets(char *buf, int len, FILE *fp)
{
char *p;
for (;;) {
@@ -65,8 +62,7 @@ my_fgets(buf, len, fp)
/* Readline implementation using fgets() */
char *
-PyOS_StdioReadline(prompt)
- char *prompt;
+PyOS_StdioReadline(char *prompt)
{
size_t n;
char *p;
@@ -124,8 +120,7 @@ char *(*PyOS_ReadlineFunctionPointer)(char *);
/* Interface used by tokenizer.c and bltinmodule.c */
char *
-PyOS_Readline(prompt)
- char *prompt;
+PyOS_Readline(char *prompt)
{
char *rv;
if (PyOS_ReadlineFunctionPointer == NULL) {
diff --git a/Parser/node.c b/Parser/node.c
index 3a710ef..910192d 100644
--- a/Parser/node.c
+++ b/Parser/node.c
@@ -17,8 +17,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include "errcode.h"
node *
-PyNode_New(type)
- int type;
+PyNode_New(int type)
{
node *n = PyMem_NEW(node, 1);
if (n == NULL)
@@ -35,11 +34,7 @@ PyNode_New(type)
#define XXXROUNDUP(n) ((n) == 1 ? 1 : ((n) + XXX - 1) / XXX * XXX)
int
-PyNode_AddChild(n1, type, str, lineno)
- register node *n1;
- int type;
- char *str;
- int lineno;
+PyNode_AddChild(register node *n1, int type, char *str, int lineno)
{
register int nch = n1->n_nchildren;
register int nch1 = nch+1;
@@ -68,8 +63,7 @@ static void freechildren(node *);
void
-PyNode_Free(n)
- node *n;
+PyNode_Free(node *n)
{
if (n != NULL) {
freechildren(n);
@@ -78,8 +72,7 @@ PyNode_Free(n)
}
static void
-freechildren(n)
- node *n;
+freechildren(node *n)
{
int i;
for (i = NCH(n); --i >= 0; )
diff --git a/Parser/parser.c b/Parser/parser.c
index b74de7f..5017a50 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -36,21 +36,15 @@ extern int Py_DebugFlag;
static void s_reset(stack *);
static void
-s_reset(s)
- stack *s;
+s_reset(stack *s)
{
s->s_top = &s->s_base[MAXSTACK];
}
#define s_empty(s) ((s)->s_top == &(s)->s_base[MAXSTACK])
-static int s_push(stack *, dfa *, node *);
-
static int
-s_push(s, d, parent)
- register stack *s;
- dfa *d;
- node *parent;
+s_push(register stack *s, dfa *d, node *parent)
{
register stackentry *top;
if (s->s_top == s->s_base) {
@@ -66,11 +60,8 @@ s_push(s, d, parent)
#ifdef Py_DEBUG
-static void s_pop(stack *);
-
static void
-s_pop(s)
- register stack *s;
+s_pop(register stack *s)
{
if (s_empty(s))
Py_FatalError("s_pop: parser stack underflow -- FATAL");
@@ -87,9 +78,7 @@ s_pop(s)
/* PARSER CREATION */
parser_state *
-PyParser_New(g, start)
- grammar *g;
- int start;
+PyParser_New(grammar *g, int start)
{
parser_state *ps;
@@ -110,8 +99,7 @@ PyParser_New(g, start)
}
void
-PyParser_Delete(ps)
- parser_state *ps;
+PyParser_Delete(parser_state *ps)
{
/* NB If you want to save the parse tree,
you must set p_tree to NULL before calling delparser! */
@@ -122,15 +110,8 @@ PyParser_Delete(ps)
/* PARSER STACK OPERATIONS */
-static int shift(stack *, int, char *, int, int);
-
static int
-shift(s, type, str, newstate, lineno)
- register stack *s;
- int type;
- char *str;
- int newstate;
- int lineno;
+shift(register stack *s, int type, char *str, int newstate, int lineno)
{
int err;
assert(!s_empty(s));
@@ -141,15 +122,8 @@ shift(s, type, str, newstate, lineno)
return 0;
}
-static int push(stack *, int, dfa *, int, int);
-
static int
-push(s, type, d, newstate, lineno)
- register stack *s;
- int type;
- dfa *d;
- int newstate;
- int lineno;
+push(register stack *s, int type, dfa *d, int newstate, int lineno)
{
int err;
register node *n;
@@ -165,13 +139,8 @@ push(s, type, d, newstate, lineno)
/* PARSER PROPER */
-static int classify(grammar *, int, char *);
-
static int
-classify(g, type, str)
- grammar *g;
- register int type;
- char *str;
+classify(grammar *g, int type, char *str)
{
register int n = g->g_ll.ll_nlabels;
@@ -205,12 +174,8 @@ classify(g, type, str)
}
int
-PyParser_AddToken(ps, type, str, lineno, expected_ret)
- register parser_state *ps;
- register int type;
- char *str;
- int lineno;
- int *expected_ret;
+PyParser_AddToken(register parser_state *ps, register int type, char *str,
+ int lineno, int *expected_ret)
{
register int ilabel;
int err;
@@ -305,9 +270,7 @@ PyParser_AddToken(ps, type, str, lineno, expected_ret)
/* DEBUG OUTPUT */
void
-dumptree(g, n)
- grammar *g;
- node *n;
+dumptree(grammar *g, node *n)
{
int i;
@@ -331,9 +294,7 @@ dumptree(g, n)
}
void
-showtree(g, n)
- grammar *g;
- node *n;
+showtree(grammar *g, node *n)
{
int i;
@@ -354,8 +315,7 @@ showtree(g, n)
}
void
-printtree(ps)
- parser_state *ps;
+printtree(parser_state *ps)
{
if (Py_DebugFlag) {
printf("Parse tree:\n");
diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index 9d090f1..24bda83 100644
--- a/Parser/parsetok.c
+++ b/Parser/parsetok.c
@@ -27,11 +27,7 @@ static node *parsetok(struct tok_state *, grammar *, int, perrdetail *);
/* Parse input coming from a string. Return error code, print some errors. */
node *
-PyParser_ParseString(s, g, start, err_ret)
- char *s;
- grammar *g;
- int start;
- perrdetail *err_ret;
+PyParser_ParseString(char *s, grammar *g, int start, perrdetail *err_ret)
{
struct tok_state *tok;
@@ -60,13 +56,8 @@ PyParser_ParseString(s, g, start, err_ret)
/* Parse input coming from a file. Return error code, print some errors. */
node *
-PyParser_ParseFile(fp, filename, g, start, ps1, ps2, err_ret)
- FILE *fp;
- char *filename;
- grammar *g;
- int start;
- char *ps1, *ps2;
- perrdetail *err_ret;
+PyParser_ParseFile(FILE *fp, char *filename, grammar *g, int start,
+ char *ps1, char *ps2, perrdetail *err_ret)
{
struct tok_state *tok;
@@ -95,11 +86,7 @@ PyParser_ParseFile(fp, filename, g, start, ps1, ps2, err_ret)
Return error code. */
static node *
-parsetok(tok, g, start, err_ret)
- struct tok_state *tok;
- grammar *g;
- int start;
- perrdetail *err_ret;
+parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret)
{
parser_state *ps;
node *n;
diff --git a/Parser/pgen.c b/Parser/pgen.c
index dbaadbd..0bc38dc 100644
--- a/Parser/pgen.c
+++ b/Parser/pgen.c
@@ -55,8 +55,7 @@ static void compile_atom(labellist *ll,
nfa *nf, node *n, int *pa, int *pb);
static int
-addnfastate(nf)
- nfa *nf;
+addnfastate(nfa *nf)
{
nfastate *st;
@@ -70,9 +69,7 @@ addnfastate(nf)
}
static void
-addnfaarc(nf, from, to, lbl)
- nfa *nf;
- int from, to, lbl;
+addnfaarc(nfa *nf, int from, int to, int lbl)
{
nfastate *st;
nfaarc *ar;
@@ -87,8 +84,7 @@ addnfaarc(nf, from, to, lbl)
}
static nfa *
-newnfa(name)
- char *name;
+newnfa(char *name)
{
nfa *nf;
static int type = NT_OFFSET; /* All types will be disjunct */
@@ -114,7 +110,7 @@ typedef struct _nfagrammar {
static void compile_rule(nfagrammar *gr, node *n);
static nfagrammar *
-newnfagrammar()
+newnfagrammar(void)
{
nfagrammar *gr;
@@ -130,9 +126,7 @@ newnfagrammar()
}
static nfa *
-addnfa(gr, name)
- nfagrammar *gr;
- char *name;
+addnfa(nfagrammar *gr, char *name)
{
nfa *nf;
@@ -160,8 +154,7 @@ static char REQNFMT[] = "metacompile: less than %d children\n";
#endif
static nfagrammar *
-metacompile(n)
- node *n;
+metacompile(node *n)
{
nfagrammar *gr;
int i;
@@ -179,9 +172,7 @@ metacompile(n)
}
static void
-compile_rule(gr, n)
- nfagrammar *gr;
- node *n;
+compile_rule(nfagrammar *gr, node *n)
{
nfa *nf;
@@ -200,11 +191,7 @@ compile_rule(gr, n)
}
static void
-compile_rhs(ll, nf, n, pa, pb)
- labellist *ll;
- nfa *nf;
- node *n;
- int *pa, *pb;
+compile_rhs(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
int i;
int a, b;
@@ -237,11 +224,7 @@ compile_rhs(ll, nf, n, pa, pb)
}
static void
-compile_alt(ll, nf, n, pa, pb)
- labellist *ll;
- nfa *nf;
- node *n;
- int *pa, *pb;
+compile_alt(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
int i;
int a, b;
@@ -268,11 +251,7 @@ compile_alt(ll, nf, n, pa, pb)
}
static void
-compile_item(ll, nf, n, pa, pb)
- labellist *ll;
- nfa *nf;
- node *n;
- int *pa, *pb;
+compile_item(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
int i;
int a, b;
@@ -309,11 +288,7 @@ compile_item(ll, nf, n, pa, pb)
}
static void
-compile_atom(ll, nf, n, pa, pb)
- labellist *ll;
- nfa *nf;
- node *n;
- int *pa, *pb;
+compile_atom(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
int i;
@@ -339,10 +314,7 @@ compile_atom(ll, nf, n, pa, pb)
}
static void
-dumpstate(ll, nf, istate)
- labellist *ll;
- nfa *nf;
- int istate;
+dumpstate(labellist *ll, nfa *nf, int istate)
{
nfastate *st;
int i;
@@ -365,9 +337,7 @@ dumpstate(ll, nf, istate)
}
static void
-dumpnfa(ll, nf)
- labellist *ll;
- nfa *nf;
+dumpnfa(labellist *ll, nfa *nf)
{
int i;
@@ -381,10 +351,7 @@ dumpnfa(ll, nf)
/* PART TWO -- CONSTRUCT DFA -- Algorithm 3.1 from [Aho&Ullman 77] */
static void
-addclosure(ss, nf, istate)
- bitset ss;
- nfa *nf;
- int istate;
+addclosure(bitset ss, nfa *nf, int istate)
{
if (addbit(ss, istate)) {
nfastate *st = &nf->nf_state[istate];
@@ -426,10 +393,7 @@ static void simplify(int xx_nstates, ss_state *xx_state);
static void convert(dfa *d, int xx_nstates, ss_state *xx_state);
static void
-makedfa(gr, nf, d)
- nfagrammar *gr;
- nfa *nf;
- dfa *d;
+makedfa(nfagrammar *gr, nfa *nf, dfa *d)
{
int nbits = nf->nf_nstates;
bitset ss;
@@ -533,12 +497,8 @@ makedfa(gr, nf, d)
}
static void
-printssdfa(xx_nstates, xx_state, nbits, ll, msg)
- int xx_nstates;
- ss_state *xx_state;
- int nbits;
- labellist *ll;
- char *msg;
+printssdfa(int xx_nstates, ss_state *xx_state, int nbits,
+ labellist *ll, char *msg)
{
int i, ibit, iarc;
ss_state *yy;
@@ -579,8 +539,7 @@ printssdfa(xx_nstates, xx_state, nbits, ll, msg)
*/
static int
-samestate(s1, s2)
- ss_state *s1, *s2;
+samestate(ss_state *s1, ss_state *s2)
{
int i;
@@ -595,10 +554,7 @@ samestate(s1, s2)
}
static void
-renamestates(xx_nstates, xx_state, from, to)
- int xx_nstates;
- ss_state *xx_state;
- int from, to;
+renamestates(int xx_nstates, ss_state *xx_state, int from, int to)
{
int i, j;
@@ -615,9 +571,7 @@ renamestates(xx_nstates, xx_state, from, to)
}
static void
-simplify(xx_nstates, xx_state)
- int xx_nstates;
- ss_state *xx_state;
+simplify(int xx_nstates, ss_state *xx_state)
{
int changes;
int i, j;
@@ -648,10 +602,7 @@ simplify(xx_nstates, xx_state)
/* Convert the DFA into a grammar that can be used by our parser */
static void
-convert(d, xx_nstates, xx_state)
- dfa *d;
- int xx_nstates;
- ss_state *xx_state;
+convert(dfa *d, int xx_nstates, ss_state *xx_state)
{
int i, j;
ss_state *yy;
@@ -685,8 +636,7 @@ convert(d, xx_nstates, xx_state)
/* PART FIVE -- GLUE IT ALL TOGETHER */
static grammar *
-maketables(gr)
- nfagrammar *gr;
+maketables(nfagrammar *gr)
{
int i;
nfa *nf;
@@ -714,8 +664,7 @@ maketables(gr)
}
grammar *
-pgen(n)
- node *n;
+pgen(node *n)
{
nfagrammar *gr;
grammar *g;
diff --git a/Parser/pgenmain.c b/Parser/pgenmain.c
index 0562e39..a366981 100644
--- a/Parser/pgenmain.c
+++ b/Parser/pgenmain.c
@@ -39,16 +39,13 @@ char *askfile(void);
#endif
void
-Py_Exit(sts)
- int sts;
+Py_Exit(int sts)
{
exit(sts);
}
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
grammar *g;
FILE *fp;
@@ -85,8 +82,7 @@ main(argc, argv)
}
grammar *
-getgrammar(filename)
- char *filename;
+getgrammar(char *filename)
{
FILE *fp;
node *n;
@@ -132,7 +128,7 @@ getgrammar(filename)
#ifdef THINK_C
char *
-askfile()
+askfile(void)
{
char buf[256];
static char name[256];
@@ -151,8 +147,7 @@ askfile()
#endif
void
-Py_FatalError(msg)
- char *msg;
+Py_FatalError(char *msg)
{
fprintf(stderr, "pgen: FATAL ERROR: %s\n", msg);
Py_Exit(1);
@@ -161,8 +156,7 @@ Py_FatalError(msg)
#ifdef macintosh
/* ARGSUSED */
int
-guesstabsize(path)
- char *path;
+guesstabsize(char *path)
{
return 4;
}
@@ -171,8 +165,7 @@ guesstabsize(path)
/* No-nonsense my_readline() for tokenizer.c */
char *
-PyOS_Readline(prompt)
- char *prompt;
+PyOS_Readline(char *prompt)
{
size_t n = 1000;
char *p = PyMem_MALLOC(n);
@@ -191,29 +184,14 @@ PyOS_Readline(prompt)
return PyMem_REALLOC(p, n+1);
}
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
void
-#ifdef HAVE_STDARG_PROTOTYPES
PySys_WriteStderr(const char *format, ...)
-#else
-PySys_WriteStderr(va_alist)
- va_dcl
-#endif
{
va_list va;
-#ifdef HAVE_STDARG_PROTOTYPES
va_start(va, format);
-#else
- char *format;
- va_start(va);
- format = va_arg(va, char *);
-#endif
vfprintf(stderr, format, va);
va_end(va);
}
diff --git a/Parser/printgrammar.c b/Parser/printgrammar.c
index 5d1d9e0..1cd45ee 100644
--- a/Parser/printgrammar.c
+++ b/Parser/printgrammar.c
@@ -20,9 +20,7 @@ static void printdfas(grammar *, FILE *);
static void printlabels(grammar *, FILE *);
void
-printgrammar(g, fp)
- grammar *g;
- FILE *fp;
+printgrammar(grammar *g, FILE *fp)
{
fprintf(fp, "#include \"pgenheaders.h\"\n");
fprintf(fp, "#include \"grammar.h\"\n");
@@ -37,9 +35,7 @@ printgrammar(g, fp)
}
void
-printnonterminals(g, fp)
- grammar *g;
- FILE *fp;
+printnonterminals(grammar *g, FILE *fp)
{
dfa *d;
int i;
@@ -50,10 +46,7 @@ printnonterminals(g, fp)
}
static void
-printarcs(i, d, fp)
- int i;
- dfa *d;
- FILE *fp;
+printarcs(int i, dfa *d, FILE *fp)
{
arc *a;
state *s;
@@ -71,9 +64,7 @@ printarcs(i, d, fp)
}
static void
-printstates(g, fp)
- grammar *g;
- FILE *fp;
+printstates(grammar *g, FILE *fp)
{
state *s;
dfa *d;
@@ -93,9 +84,7 @@ printstates(g, fp)
}
static void
-printdfas(g, fp)
- grammar *g;
- FILE *fp;
+printdfas(grammar *g, FILE *fp)
{
dfa *d;
int i, j;
@@ -115,9 +104,7 @@ printdfas(g, fp)
}
static void
-printlabels(g, fp)
- grammar *g;
- FILE *fp;
+printlabels(grammar *g, FILE *fp)
{
label *l;
int i;
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index d4ec345..160f6ba 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -88,7 +88,7 @@ char *_PyParser_TokenNames[] = {
/* Create and initialize a new tok_state structure */
static struct tok_state *
-tok_new()
+tok_new(void)
{
struct tok_state *tok = PyMem_NEW(struct tok_state, 1);
if (tok == NULL)
@@ -116,8 +116,7 @@ tok_new()
/* Set up tokenizer for string */
struct tok_state *
-PyTokenizer_FromString(str)
- char *str;
+PyTokenizer_FromString(char *str)
{
struct tok_state *tok = tok_new();
if (tok == NULL)
@@ -130,9 +129,7 @@ PyTokenizer_FromString(str)
/* Set up tokenizer for file */
struct tok_state *
-PyTokenizer_FromFile(fp, ps1, ps2)
- FILE *fp;
- char *ps1, *ps2;
+PyTokenizer_FromFile(FILE *fp, char *ps1, char *ps2)
{
struct tok_state *tok = tok_new();
if (tok == NULL)
@@ -153,8 +150,7 @@ PyTokenizer_FromFile(fp, ps1, ps2)
/* Free a tok_state structure */
void
-PyTokenizer_Free(tok)
- struct tok_state *tok;
+PyTokenizer_Free(struct tok_state *tok)
{
if (tok->fp != NULL && tok->buf != NULL)
PyMem_DEL(tok->buf);
@@ -165,8 +161,7 @@ PyTokenizer_Free(tok)
/* Get next char, updating state; error code goes into tok->done */
static int
-tok_nextc(tok)
- register struct tok_state *tok;
+tok_nextc(register struct tok_state *tok)
{
for (;;) {
if (tok->cur != tok->inp) {
@@ -321,9 +316,7 @@ tok_nextc(tok)
/* Back-up one character */
static void
-tok_backup(tok, c)
- register struct tok_state *tok;
- register int c;
+tok_backup(register struct tok_state *tok, register int c)
{
if (c != EOF) {
if (--tok->cur < tok->buf)
@@ -337,8 +330,7 @@ tok_backup(tok, c)
/* Return the token corresponding to a single character */
int
-PyToken_OneChar(c)
- int c;
+PyToken_OneChar(int c)
{
switch (c) {
case '(': return LPAR;
@@ -370,8 +362,7 @@ PyToken_OneChar(c)
int
-PyToken_TwoChars(c1, c2)
- int c1, c2;
+PyToken_TwoChars(int c1, int c2)
{
switch (c1) {
case '=':
@@ -408,8 +399,7 @@ PyToken_TwoChars(c1, c2)
static int
-indenterror(tok)
- struct tok_state *tok;
+indenterror(struct tok_state *tok)
{
if (tok->alterror) {
tok->done = E_TABSPACE;
@@ -428,9 +418,8 @@ indenterror(tok)
/* Get next token, after space stripping etc. */
int
-PyTokenizer_Get(tok, p_start, p_end)
- register struct tok_state *tok; /* In/out: tokenizer state */
- char **p_start, **p_end; /* Out: point to start/end of token */
+PyTokenizer_Get(register struct tok_state *tok, char **p_start,
+ char **p_end)
{
register int c;
int blankline;
@@ -812,9 +801,7 @@ PyTokenizer_Get(tok, p_start, p_end)
#ifdef Py_DEBUG
void
-tok_dump(type, start, end)
- int type;
- char *start, *end;
+tok_dump(int type, char *start, char *end)
{
printf("%s", _PyParser_TokenNames[type]);
if (type == NAME || type == NUMBER || type == STRING || type == OP)