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.
This commit is contained in:
Thomas Wouters 2000-07-22 19:20:54 +00:00
parent f70ef4f860
commit 23c9e0024a
16 changed files with 123 additions and 330 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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];

View File

@ -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)
{
}

View File

@ -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;

View File

@ -156,7 +156,7 @@ static grammar _PyParser_Grammar = {
};
grammar *
meta_grammar()
meta_grammar(void)
{
return &_PyParser_Grammar;
}

View File

@ -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) {

View File

@ -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; )

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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)