Skip to content

Commit 5eb6d4e

Browse files
committed
ANSI-fication and Py_PROTO extermination.
1 parent ff7df9d commit 5eb6d4e

File tree

12 files changed

+176
-174
lines changed

12 files changed

+176
-174
lines changed

Include/bitset.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_BITSET_H
2-
#define Py_BITSET_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -14,18 +8,24 @@ See the file "Misc/COPYRIGHT" for information on usage and
148
redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
159
******************************************************************/
1610

11+
#ifndef Py_BITSET_H
12+
#define Py_BITSET_H
13+
#ifdef __cplusplus
14+
extern "C" {
15+
#endif
16+
1717
/* Bitset interface */
1818

1919
#define BYTE char
2020

2121
typedef BYTE *bitset;
2222

23-
bitset newbitset Py_PROTO((int nbits));
24-
void delbitset Py_PROTO((bitset bs));
23+
bitset newbitset(int nbits);
24+
void delbitset(bitset bs);
2525
#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
26-
int addbit Py_PROTO((bitset bs, int ibit)); /* Returns 0 if already set */
27-
int samebitset Py_PROTO((bitset bs1, bitset bs2, int nbits));
28-
void mergebitset Py_PROTO((bitset bs1, bitset bs2, int nbits));
26+
int addbit(bitset bs, int ibit); /* Returns 0 if already set */
27+
int samebitset(bitset bs1, bitset bs2, int nbits);
28+
void mergebitset(bitset bs1, bitset bs2, int nbits);
2929

3030
#define BITSPERBYTE (8*sizeof(BYTE))
3131
#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)

Include/ceval.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,37 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1717
/* Interface to random parts in ceval.c */
1818

1919
DL_IMPORT(PyObject *) PyEval_CallObjectWithKeywords
20-
Py_PROTO((PyObject *, PyObject *, PyObject *));
20+
(PyObject *, PyObject *, PyObject *);
2121

2222
/* DLL-level Backwards compatibility: */
2323
#undef PyEval_CallObject
24-
DL_IMPORT(PyObject *) PyEval_CallObject Py_PROTO((PyObject *, PyObject *));
24+
DL_IMPORT(PyObject *) PyEval_CallObject(PyObject *, PyObject *);
2525

2626
/* Inline this */
2727
#define PyEval_CallObject(func,arg) \
2828
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
2929

3030
#ifdef HAVE_STDARG_PROTOTYPES
31-
DL_IMPORT(PyObject *) PyEval_CallFunction Py_PROTO((PyObject *obj, char *format, ...));
32-
DL_IMPORT(PyObject *) PyEval_CallMethod Py_PROTO((PyObject *obj,
33-
char *methodname, char *format, ...));
31+
DL_IMPORT(PyObject *) PyEval_CallFunction(PyObject *obj, char *format, ...);
32+
DL_IMPORT(PyObject *) PyEval_CallMethod(PyObject *obj,
33+
char *methodname, char *format, ...);
3434
#else
3535
/* Better to have no prototypes at all for varargs functions in this case */
3636
DL_IMPORT(PyObject *) PyEval_CallFunction();
3737
DL_IMPORT(PyObject *) PyEval_CallMethod();
3838
#endif
3939

40-
DL_IMPORT(PyObject *) PyEval_GetBuiltins Py_PROTO((void));
41-
DL_IMPORT(PyObject *) PyEval_GetGlobals Py_PROTO((void));
42-
DL_IMPORT(PyObject *) PyEval_GetLocals Py_PROTO((void));
43-
DL_IMPORT(PyObject *) PyEval_GetOwner Py_PROTO((void));
44-
DL_IMPORT(PyObject *) PyEval_GetFrame Py_PROTO((void));
45-
DL_IMPORT(int) PyEval_GetRestricted Py_PROTO((void));
40+
DL_IMPORT(PyObject *) PyEval_GetBuiltins(void);
41+
DL_IMPORT(PyObject *) PyEval_GetGlobals(void);
42+
DL_IMPORT(PyObject *) PyEval_GetLocals(void);
43+
DL_IMPORT(PyObject *) PyEval_GetOwner(void);
44+
DL_IMPORT(PyObject *) PyEval_GetFrame(void);
45+
DL_IMPORT(int) PyEval_GetRestricted(void);
4646

47-
DL_IMPORT(int) Py_FlushLine Py_PROTO((void));
47+
DL_IMPORT(int) Py_FlushLine(void);
4848

49-
DL_IMPORT(int) Py_AddPendingCall Py_PROTO((int (*func) Py_PROTO((ANY *)), ANY *arg));
50-
DL_IMPORT(int) Py_MakePendingCalls Py_PROTO((void));
49+
DL_IMPORT(int) Py_AddPendingCall(int (*func)(ANY *), ANY *arg);
50+
DL_IMPORT(int) Py_MakePendingCalls(void);
5151

5252

5353
/* Interface for threads.
@@ -95,16 +95,16 @@ DL_IMPORT(int) Py_MakePendingCalls Py_PROTO((void));
9595
mechanism!
9696
*/
9797

98-
extern DL_IMPORT(PyThreadState *) PyEval_SaveThread Py_PROTO((void));
99-
extern DL_IMPORT(void) PyEval_RestoreThread Py_PROTO((PyThreadState *));
98+
extern DL_IMPORT(PyThreadState *) PyEval_SaveThread(void);
99+
extern DL_IMPORT(void) PyEval_RestoreThread(PyThreadState *);
100100

101101
#ifdef WITH_THREAD
102102

103-
extern DL_IMPORT(void) PyEval_InitThreads Py_PROTO((void));
104-
extern DL_IMPORT(void) PyEval_AcquireLock Py_PROTO((void));
105-
extern DL_IMPORT(void) PyEval_ReleaseLock Py_PROTO((void));
106-
extern DL_IMPORT(void) PyEval_AcquireThread Py_PROTO((PyThreadState *tstate));
107-
extern DL_IMPORT(void) PyEval_ReleaseThread Py_PROTO((PyThreadState *tstate));
103+
extern DL_IMPORT(void) PyEval_InitThreads(void);
104+
extern DL_IMPORT(void) PyEval_AcquireLock(void);
105+
extern DL_IMPORT(void) PyEval_ReleaseLock(void);
106+
extern DL_IMPORT(void) PyEval_AcquireThread(PyThreadState *tstate);
107+
extern DL_IMPORT(void) PyEval_ReleaseThread(PyThreadState *tstate);
108108

109109
#define Py_BEGIN_ALLOW_THREADS { \
110110
PyThreadState *_save; \
@@ -123,7 +123,7 @@ extern DL_IMPORT(void) PyEval_ReleaseThread Py_PROTO((PyThreadState *tstate));
123123

124124
#endif /* !WITH_THREAD */
125125

126-
extern DL_IMPORT(int) _PyEval_SliceIndex Py_PROTO((PyObject *, int *));
126+
extern DL_IMPORT(int) _PyEval_SliceIndex(PyObject *, int *);
127127

128128

129129
#ifdef __cplusplus

Include/eval.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_EVAL_H
2-
#define Py_EVAL_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -16,7 +10,13 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1610

1711
/* Interface to execute compiled code */
1812

19-
DL_IMPORT(PyObject *) PyEval_EvalCode Py_PROTO((PyCodeObject *, PyObject *, PyObject *));
13+
#ifndef Py_EVAL_H
14+
#define Py_EVAL_H
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
19+
DL_IMPORT(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *);
2020

2121
#ifdef __cplusplus
2222
}

Include/import.h

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_IMPORT_H
2-
#define Py_IMPORT_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -16,37 +10,43 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1610

1711
/* Module definition and import interface */
1812

19-
DL_IMPORT(long) PyImport_GetMagicNumber Py_PROTO((void));
20-
DL_IMPORT(PyObject *) PyImport_ExecCodeModule Py_PROTO((char *name, PyObject *co));
21-
DL_IMPORT(PyObject *) PyImport_ExecCodeModuleEx Py_PROTO((
22-
char *name, PyObject *co, char *pathname));
23-
DL_IMPORT(PyObject *) PyImport_GetModuleDict Py_PROTO((void));
24-
DL_IMPORT(PyObject *) PyImport_AddModule Py_PROTO((char *name));
25-
DL_IMPORT(PyObject *) PyImport_ImportModule Py_PROTO((char *name));
26-
DL_IMPORT(PyObject *) PyImport_ImportModuleEx Py_PROTO((
27-
char *name, PyObject *globals, PyObject *locals, PyObject *fromlist));
28-
DL_IMPORT(PyObject *) PyImport_Import Py_PROTO((PyObject *name));
29-
DL_IMPORT(PyObject *) PyImport_ReloadModule Py_PROTO((PyObject *m));
30-
DL_IMPORT(void) PyImport_Cleanup Py_PROTO((void));
31-
DL_IMPORT(int) PyImport_ImportFrozenModule Py_PROTO((char *));
32-
33-
extern DL_IMPORT(PyObject *)_PyImport_FindExtension Py_PROTO((char *, char *));
34-
extern DL_IMPORT(PyObject *)_PyImport_FixupExtension Py_PROTO((char *, char *));
13+
#ifndef Py_IMPORT_H
14+
#define Py_IMPORT_H
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
19+
DL_IMPORT(long) PyImport_GetMagicNumber(void);
20+
DL_IMPORT(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
21+
DL_IMPORT(PyObject *) PyImport_ExecCodeModuleEx(
22+
char *name, PyObject *co, char *pathname);
23+
DL_IMPORT(PyObject *) PyImport_GetModuleDict(void);
24+
DL_IMPORT(PyObject *) PyImport_AddModule(char *name);
25+
DL_IMPORT(PyObject *) PyImport_ImportModule(char *name);
26+
DL_IMPORT(PyObject *) PyImport_ImportModuleEx(
27+
char *name, PyObject *globals, PyObject *locals, PyObject *fromlist);
28+
DL_IMPORT(PyObject *) PyImport_Import(PyObject *name);
29+
DL_IMPORT(PyObject *) PyImport_ReloadModule(PyObject *m);
30+
DL_IMPORT(void) PyImport_Cleanup(void);
31+
DL_IMPORT(int) PyImport_ImportFrozenModule(char *);
32+
33+
extern DL_IMPORT(PyObject *)_PyImport_FindExtension(char *, char *);
34+
extern DL_IMPORT(PyObject *)_PyImport_FixupExtension(char *, char *);
3535

3636
struct _inittab {
37-
char *name;
38-
void (*initfunc)();
37+
char *name;
38+
void (*initfunc)();
3939
};
4040

4141
extern DL_IMPORT(struct _inittab *) PyImport_Inittab;
4242

43-
extern DL_IMPORT(int) PyImport_AppendInittab Py_PROTO((char *name, void (*initfunc)()));
44-
extern DL_IMPORT(int) PyImport_ExtendInittab Py_PROTO((struct _inittab *newtab));
43+
extern DL_IMPORT(int) PyImport_AppendInittab(char *name, void (*initfunc)());
44+
extern DL_IMPORT(int) PyImport_ExtendInittab(struct _inittab *newtab);
4545

4646
struct _frozen {
47-
char *name;
48-
unsigned char *code;
49-
int size;
47+
char *name;
48+
unsigned char *code;
49+
int size;
5050
};
5151

5252
/* Embedding apps may change this pointer to point to their favorite

Include/intrcheck.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_INTRCHECK_H
2-
#define Py_INTRCHECK_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -14,9 +8,15 @@ See the file "Misc/COPYRIGHT" for information on usage and
148
redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
159
******************************************************************/
1610

17-
extern DL_IMPORT(int) PyOS_InterruptOccurred Py_PROTO((void));
18-
extern DL_IMPORT(void) PyOS_InitInterrupts Py_PROTO((void));
19-
DL_IMPORT(void) PyOS_AfterFork Py_PROTO((void));
11+
#ifndef Py_INTRCHECK_H
12+
#define Py_INTRCHECK_H
13+
#ifdef __cplusplus
14+
extern "C" {
15+
#endif
16+
17+
extern DL_IMPORT(int) PyOS_InterruptOccurred(void);
18+
extern DL_IMPORT(void) PyOS_InitInterrupts(void);
19+
DL_IMPORT(void) PyOS_AfterFork(void);
2020

2121
#ifdef __cplusplus
2222
}

Include/marshal.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_MARSHAL_H
2-
#define Py_MARSHAL_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -16,15 +10,21 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1610

1711
/* Interface for marshal.c */
1812

19-
DL_IMPORT(void) PyMarshal_WriteLongToFile Py_PROTO((long, FILE *));
20-
DL_IMPORT(void) PyMarshal_WriteShortToFile Py_PROTO((int, FILE *));
21-
DL_IMPORT(void) PyMarshal_WriteObjectToFile Py_PROTO((PyObject *, FILE *));
22-
DL_IMPORT(PyObject *) PyMarshal_WriteObjectToString Py_PROTO((PyObject *));
13+
#ifndef Py_MARSHAL_H
14+
#define Py_MARSHAL_H
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
19+
DL_IMPORT(void) PyMarshal_WriteLongToFile(long, FILE *);
20+
DL_IMPORT(void) PyMarshal_WriteShortToFile(int, FILE *);
21+
DL_IMPORT(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *);
22+
DL_IMPORT(PyObject *) PyMarshal_WriteObjectToString(PyObject *);
2323

24-
DL_IMPORT(long) PyMarshal_ReadLongFromFile Py_PROTO((FILE *));
25-
DL_IMPORT(int) PyMarshal_ReadShortFromFile Py_PROTO((FILE *));
26-
DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromFile Py_PROTO((FILE *));
27-
DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromString Py_PROTO((char *, int));
24+
DL_IMPORT(long) PyMarshal_ReadLongFromFile(FILE *);
25+
DL_IMPORT(int) PyMarshal_ReadShortFromFile(FILE *);
26+
DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
27+
DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromString(char *, int);
2828

2929
#ifdef __cplusplus
3030
}

Include/node.h

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_NODE_H
2-
#define Py_NODE_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -16,17 +10,24 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1610

1711
/* Parse tree node interface */
1812

13+
#ifndef Py_NODE_H
14+
#define Py_NODE_H
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
1919
typedef struct _node {
20-
short n_type;
21-
char *n_str;
22-
short n_lineno;
23-
short n_nchildren;
24-
struct _node *n_child;
20+
short n_type;
21+
char *n_str;
22+
short n_lineno;
23+
short n_nchildren;
24+
struct _node *n_child;
2525
} node;
2626

27-
extern DL_IMPORT(node *) PyNode_New Py_PROTO((int type));
28-
extern DL_IMPORT(int) PyNode_AddChild Py_PROTO((node *n, int type, char *str, int lineno));
29-
extern DL_IMPORT(void) PyNode_Free Py_PROTO((node *n));
27+
extern DL_IMPORT(node *) PyNode_New(int type);
28+
extern DL_IMPORT(int) PyNode_AddChild(node *n, int type,
29+
char *str, int lineno);
30+
extern DL_IMPORT(void) PyNode_Free(node *n);
3031

3132
/* Node access functions */
3233
#define NCH(n) ((n)->n_nchildren)
@@ -40,13 +41,13 @@ extern DL_IMPORT(void) PyNode_Free Py_PROTO((node *n));
4041
#else
4142
#define REQ(n, type) \
4243
{ if (TYPE(n) != (type)) { \
43-
fprintf(stderr, "FATAL: node type %d, required %d\n", \
44-
TYPE(n), type); \
45-
abort(); \
44+
fprintf(stderr, "FATAL: node type %d, required %d\n", \
45+
TYPE(n), type); \
46+
abort(); \
4647
} }
4748
#endif
4849

49-
extern DL_IMPORT(void) PyNode_ListTree Py_PROTO((node *));
50+
extern DL_IMPORT(void) PyNode_ListTree(node *);
5051

5152
#ifdef __cplusplus
5253
}

Include/parsetok.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef Py_PARSETOK_H
2-
#define Py_PARSETOK_H
3-
#ifdef __cplusplus
4-
extern "C" {
5-
#endif
6-
71
/***********************************************************
82
Copyright (c) 2000, BeOpen.com.
93
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
@@ -16,17 +10,24 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1610

1711
/* Parser-tokenizer link interface */
1812

13+
#ifndef Py_PARSETOK_H
14+
#define Py_PARSETOK_H
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
1919
typedef struct {
20-
int error;
21-
char *filename;
22-
int lineno;
23-
int offset;
24-
char *text;
20+
int error;
21+
char *filename;
22+
int lineno;
23+
int offset;
24+
char *text;
2525
} perrdetail;
2626

27-
extern DL_IMPORT(node *) PyParser_ParseString Py_PROTO((char *, grammar *, int, perrdetail *));
28-
extern DL_IMPORT(node *) PyParser_ParseFile Py_PROTO((FILE *, char *, grammar *, int,
29-
char *, char *, perrdetail *));
27+
extern DL_IMPORT(node *) PyParser_ParseString(char *, grammar *, int,
28+
perrdetail *);
29+
extern DL_IMPORT(node *) PyParser_ParseFile (FILE *, char *, grammar *, int,
30+
char *, char *, perrdetail *);
3031

3132
#ifdef __cplusplus
3233
}

0 commit comments

Comments
 (0)