Kaydet (Commit) 5eb6d4e3 authored tarafından Fred Drake's avatar Fred Drake

ANSI-fication and Py_PROTO extermination.

üst ff7df9d7
#ifndef Py_BITSET_H
#define Py_BITSET_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************
Copyright (c) 2000, BeOpen.com.
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
......@@ -14,18 +8,24 @@ See the file "Misc/COPYRIGHT" for information on usage and
redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
******************************************************************/
#ifndef Py_BITSET_H
#define Py_BITSET_H
#ifdef __cplusplus
extern "C" {
#endif
/* Bitset interface */
#define BYTE char
typedef BYTE *bitset;
bitset newbitset Py_PROTO((int nbits));
void delbitset Py_PROTO((bitset bs));
bitset newbitset(int nbits);
void delbitset(bitset bs);
#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
int addbit Py_PROTO((bitset bs, int ibit)); /* Returns 0 if already set */
int samebitset Py_PROTO((bitset bs1, bitset bs2, int nbits));
void mergebitset Py_PROTO((bitset bs1, bitset bs2, int nbits));
int addbit(bitset bs, int ibit); /* Returns 0 if already set */
int samebitset(bitset bs1, bitset bs2, int nbits);
void mergebitset(bitset bs1, bitset bs2, int nbits);
#define BITSPERBYTE (8*sizeof(BYTE))
#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
......
......@@ -17,37 +17,37 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* Interface to random parts in ceval.c */
DL_IMPORT(PyObject *) PyEval_CallObjectWithKeywords
Py_PROTO((PyObject *, PyObject *, PyObject *));
(PyObject *, PyObject *, PyObject *);
/* DLL-level Backwards compatibility: */
#undef PyEval_CallObject
DL_IMPORT(PyObject *) PyEval_CallObject Py_PROTO((PyObject *, PyObject *));
DL_IMPORT(PyObject *) PyEval_CallObject(PyObject *, PyObject *);
/* Inline this */
#define PyEval_CallObject(func,arg) \
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
#ifdef HAVE_STDARG_PROTOTYPES
DL_IMPORT(PyObject *) PyEval_CallFunction Py_PROTO((PyObject *obj, char *format, ...));
DL_IMPORT(PyObject *) PyEval_CallMethod Py_PROTO((PyObject *obj,
char *methodname, char *format, ...));
DL_IMPORT(PyObject *) PyEval_CallFunction(PyObject *obj, char *format, ...);
DL_IMPORT(PyObject *) PyEval_CallMethod(PyObject *obj,
char *methodname, char *format, ...);
#else
/* Better to have no prototypes at all for varargs functions in this case */
DL_IMPORT(PyObject *) PyEval_CallFunction();
DL_IMPORT(PyObject *) PyEval_CallMethod();
#endif
DL_IMPORT(PyObject *) PyEval_GetBuiltins Py_PROTO((void));
DL_IMPORT(PyObject *) PyEval_GetGlobals Py_PROTO((void));
DL_IMPORT(PyObject *) PyEval_GetLocals Py_PROTO((void));
DL_IMPORT(PyObject *) PyEval_GetOwner Py_PROTO((void));
DL_IMPORT(PyObject *) PyEval_GetFrame Py_PROTO((void));
DL_IMPORT(int) PyEval_GetRestricted Py_PROTO((void));
DL_IMPORT(PyObject *) PyEval_GetBuiltins(void);
DL_IMPORT(PyObject *) PyEval_GetGlobals(void);
DL_IMPORT(PyObject *) PyEval_GetLocals(void);
DL_IMPORT(PyObject *) PyEval_GetOwner(void);
DL_IMPORT(PyObject *) PyEval_GetFrame(void);
DL_IMPORT(int) PyEval_GetRestricted(void);
DL_IMPORT(int) Py_FlushLine Py_PROTO((void));
DL_IMPORT(int) Py_FlushLine(void);
DL_IMPORT(int) Py_AddPendingCall Py_PROTO((int (*func) Py_PROTO((ANY *)), ANY *arg));
DL_IMPORT(int) Py_MakePendingCalls Py_PROTO((void));
DL_IMPORT(int) Py_AddPendingCall(int (*func)(ANY *), ANY *arg);
DL_IMPORT(int) Py_MakePendingCalls(void);
/* Interface for threads.
......@@ -95,16 +95,16 @@ DL_IMPORT(int) Py_MakePendingCalls Py_PROTO((void));
mechanism!
*/
extern DL_IMPORT(PyThreadState *) PyEval_SaveThread Py_PROTO((void));
extern DL_IMPORT(void) PyEval_RestoreThread Py_PROTO((PyThreadState *));
extern DL_IMPORT(PyThreadState *) PyEval_SaveThread(void);
extern DL_IMPORT(void) PyEval_RestoreThread(PyThreadState *);
#ifdef WITH_THREAD
extern DL_IMPORT(void) PyEval_InitThreads Py_PROTO((void));
extern DL_IMPORT(void) PyEval_AcquireLock Py_PROTO((void));
extern DL_IMPORT(void) PyEval_ReleaseLock Py_PROTO((void));
extern DL_IMPORT(void) PyEval_AcquireThread Py_PROTO((PyThreadState *tstate));
extern DL_IMPORT(void) PyEval_ReleaseThread Py_PROTO((PyThreadState *tstate));
extern DL_IMPORT(void) PyEval_InitThreads(void);
extern DL_IMPORT(void) PyEval_AcquireLock(void);
extern DL_IMPORT(void) PyEval_ReleaseLock(void);
extern DL_IMPORT(void) PyEval_AcquireThread(PyThreadState *tstate);
extern DL_IMPORT(void) PyEval_ReleaseThread(PyThreadState *tstate);
#define Py_BEGIN_ALLOW_THREADS { \
PyThreadState *_save; \
......@@ -123,7 +123,7 @@ extern DL_IMPORT(void) PyEval_ReleaseThread Py_PROTO((PyThreadState *tstate));
#endif /* !WITH_THREAD */
extern DL_IMPORT(int) _PyEval_SliceIndex Py_PROTO((PyObject *, int *));
extern DL_IMPORT(int) _PyEval_SliceIndex(PyObject *, int *);
#ifdef __cplusplus
......
#ifndef Py_EVAL_H
#define Py_EVAL_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************
Copyright (c) 2000, BeOpen.com.
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
......@@ -16,7 +10,13 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* Interface to execute compiled code */
DL_IMPORT(PyObject *) PyEval_EvalCode Py_PROTO((PyCodeObject *, PyObject *, PyObject *));
#ifndef Py_EVAL_H
#define Py_EVAL_H
#ifdef __cplusplus
extern "C" {
#endif
DL_IMPORT(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *);
#ifdef __cplusplus
}
......
#ifndef Py_IMPORT_H
#define Py_IMPORT_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************
Copyright (c) 2000, BeOpen.com.
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
......@@ -16,22 +10,28 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* Module definition and import interface */
DL_IMPORT(long) PyImport_GetMagicNumber Py_PROTO((void));
DL_IMPORT(PyObject *) PyImport_ExecCodeModule Py_PROTO((char *name, PyObject *co));
DL_IMPORT(PyObject *) PyImport_ExecCodeModuleEx Py_PROTO((
char *name, PyObject *co, char *pathname));
DL_IMPORT(PyObject *) PyImport_GetModuleDict Py_PROTO((void));
DL_IMPORT(PyObject *) PyImport_AddModule Py_PROTO((char *name));
DL_IMPORT(PyObject *) PyImport_ImportModule Py_PROTO((char *name));
DL_IMPORT(PyObject *) PyImport_ImportModuleEx Py_PROTO((
char *name, PyObject *globals, PyObject *locals, PyObject *fromlist));
DL_IMPORT(PyObject *) PyImport_Import Py_PROTO((PyObject *name));
DL_IMPORT(PyObject *) PyImport_ReloadModule Py_PROTO((PyObject *m));
DL_IMPORT(void) PyImport_Cleanup Py_PROTO((void));
DL_IMPORT(int) PyImport_ImportFrozenModule Py_PROTO((char *));
extern DL_IMPORT(PyObject *)_PyImport_FindExtension Py_PROTO((char *, char *));
extern DL_IMPORT(PyObject *)_PyImport_FixupExtension Py_PROTO((char *, char *));
#ifndef Py_IMPORT_H
#define Py_IMPORT_H
#ifdef __cplusplus
extern "C" {
#endif
DL_IMPORT(long) PyImport_GetMagicNumber(void);
DL_IMPORT(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
DL_IMPORT(PyObject *) PyImport_ExecCodeModuleEx(
char *name, PyObject *co, char *pathname);
DL_IMPORT(PyObject *) PyImport_GetModuleDict(void);
DL_IMPORT(PyObject *) PyImport_AddModule(char *name);
DL_IMPORT(PyObject *) PyImport_ImportModule(char *name);
DL_IMPORT(PyObject *) PyImport_ImportModuleEx(
char *name, PyObject *globals, PyObject *locals, PyObject *fromlist);
DL_IMPORT(PyObject *) PyImport_Import(PyObject *name);
DL_IMPORT(PyObject *) PyImport_ReloadModule(PyObject *m);
DL_IMPORT(void) PyImport_Cleanup(void);
DL_IMPORT(int) PyImport_ImportFrozenModule(char *);
extern DL_IMPORT(PyObject *)_PyImport_FindExtension(char *, char *);
extern DL_IMPORT(PyObject *)_PyImport_FixupExtension(char *, char *);
struct _inittab {
char *name;
......@@ -40,8 +40,8 @@ struct _inittab {
extern DL_IMPORT(struct _inittab *) PyImport_Inittab;
extern DL_IMPORT(int) PyImport_AppendInittab Py_PROTO((char *name, void (*initfunc)()));
extern DL_IMPORT(int) PyImport_ExtendInittab Py_PROTO((struct _inittab *newtab));
extern DL_IMPORT(int) PyImport_AppendInittab(char *name, void (*initfunc)());
extern DL_IMPORT(int) PyImport_ExtendInittab(struct _inittab *newtab);
struct _frozen {
char *name;
......
#ifndef Py_INTRCHECK_H
#define Py_INTRCHECK_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************
Copyright (c) 2000, BeOpen.com.
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
......@@ -14,9 +8,15 @@ See the file "Misc/COPYRIGHT" for information on usage and
redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
******************************************************************/
extern DL_IMPORT(int) PyOS_InterruptOccurred Py_PROTO((void));
extern DL_IMPORT(void) PyOS_InitInterrupts Py_PROTO((void));
DL_IMPORT(void) PyOS_AfterFork Py_PROTO((void));
#ifndef Py_INTRCHECK_H
#define Py_INTRCHECK_H
#ifdef __cplusplus
extern "C" {
#endif
extern DL_IMPORT(int) PyOS_InterruptOccurred(void);
extern DL_IMPORT(void) PyOS_InitInterrupts(void);
DL_IMPORT(void) PyOS_AfterFork(void);
#ifdef __cplusplus
}
......
#ifndef Py_MARSHAL_H
#define Py_MARSHAL_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************
Copyright (c) 2000, BeOpen.com.
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
......@@ -16,15 +10,21 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* Interface for marshal.c */
DL_IMPORT(void) PyMarshal_WriteLongToFile Py_PROTO((long, FILE *));
DL_IMPORT(void) PyMarshal_WriteShortToFile Py_PROTO((int, FILE *));
DL_IMPORT(void) PyMarshal_WriteObjectToFile Py_PROTO((PyObject *, FILE *));
DL_IMPORT(PyObject *) PyMarshal_WriteObjectToString Py_PROTO((PyObject *));
#ifndef Py_MARSHAL_H
#define Py_MARSHAL_H
#ifdef __cplusplus
extern "C" {
#endif
DL_IMPORT(void) PyMarshal_WriteLongToFile(long, FILE *);
DL_IMPORT(void) PyMarshal_WriteShortToFile(int, FILE *);
DL_IMPORT(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *);
DL_IMPORT(PyObject *) PyMarshal_WriteObjectToString(PyObject *);
DL_IMPORT(long) PyMarshal_ReadLongFromFile Py_PROTO((FILE *));
DL_IMPORT(int) PyMarshal_ReadShortFromFile Py_PROTO((FILE *));
DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromFile Py_PROTO((FILE *));
DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromString Py_PROTO((char *, int));
DL_IMPORT(long) PyMarshal_ReadLongFromFile(FILE *);
DL_IMPORT(int) PyMarshal_ReadShortFromFile(FILE *);
DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromString(char *, int);
#ifdef __cplusplus
}
......
#ifndef Py_NODE_H
#define Py_NODE_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************
Copyright (c) 2000, BeOpen.com.
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
......@@ -16,6 +10,12 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* Parse tree node interface */
#ifndef Py_NODE_H
#define Py_NODE_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _node {
short n_type;
char *n_str;
......@@ -24,9 +24,10 @@ typedef struct _node {
struct _node *n_child;
} node;
extern DL_IMPORT(node *) PyNode_New Py_PROTO((int type));
extern DL_IMPORT(int) PyNode_AddChild Py_PROTO((node *n, int type, char *str, int lineno));
extern DL_IMPORT(void) PyNode_Free Py_PROTO((node *n));
extern DL_IMPORT(node *) PyNode_New(int type);
extern DL_IMPORT(int) PyNode_AddChild(node *n, int type,
char *str, int lineno);
extern DL_IMPORT(void) PyNode_Free(node *n);
/* Node access functions */
#define NCH(n) ((n)->n_nchildren)
......@@ -46,7 +47,7 @@ extern DL_IMPORT(void) PyNode_Free Py_PROTO((node *n));
} }
#endif
extern DL_IMPORT(void) PyNode_ListTree Py_PROTO((node *));
extern DL_IMPORT(void) PyNode_ListTree(node *);
#ifdef __cplusplus
}
......
#ifndef Py_PARSETOK_H
#define Py_PARSETOK_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************
Copyright (c) 2000, BeOpen.com.
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
......@@ -16,6 +10,12 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* Parser-tokenizer link interface */
#ifndef Py_PARSETOK_H
#define Py_PARSETOK_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int error;
char *filename;
......@@ -24,9 +24,10 @@ typedef struct {
char *text;
} perrdetail;
extern DL_IMPORT(node *) PyParser_ParseString Py_PROTO((char *, grammar *, int, perrdetail *));
extern DL_IMPORT(node *) PyParser_ParseFile Py_PROTO((FILE *, char *, grammar *, int,
char *, char *, perrdetail *));
extern DL_IMPORT(node *) PyParser_ParseString(char *, grammar *, int,
perrdetail *);
extern DL_IMPORT(node *) PyParser_ParseFile (FILE *, char *, grammar *, int,
char *, char *, perrdetail *);
#ifdef __cplusplus
}
......
......@@ -24,7 +24,7 @@ extern DL_IMPORT(int) Py_FrozenFlag;
extern DL_IMPORT(int) Py_TabcheckFlag;
extern DL_IMPORT(int) Py_UnicodeFlag;
DL_IMPORT(void) Py_FatalError Py_PROTO((char *));
DL_IMPORT(void) Py_FatalError(char *message);
#ifdef __cplusplus
}
......
#ifndef Py_PYSTATE_H
#define Py_PYSTATE_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************
Copyright (c) 2000, BeOpen.com.
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
......@@ -17,6 +11,12 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* Thread and interpreter state structures and their interfaces */
#ifndef Py_PYSTATE_H
#define Py_PYSTATE_H
#ifdef __cplusplus
extern "C" {
#endif
/* State shared between threads */
struct _ts; /* Forward */
......@@ -68,17 +68,17 @@ typedef struct _ts {
} PyThreadState;
DL_IMPORT(PyInterpreterState *) PyInterpreterState_New Py_PROTO((void));
DL_IMPORT(void) PyInterpreterState_Clear Py_PROTO((PyInterpreterState *));
DL_IMPORT(void) PyInterpreterState_Delete Py_PROTO((PyInterpreterState *));
DL_IMPORT(PyInterpreterState *) PyInterpreterState_New(void);
DL_IMPORT(void) PyInterpreterState_Clear(PyInterpreterState *);
DL_IMPORT(void) PyInterpreterState_Delete(PyInterpreterState *);
DL_IMPORT(PyThreadState *) PyThreadState_New Py_PROTO((PyInterpreterState *));
DL_IMPORT(void) PyThreadState_Clear Py_PROTO((PyThreadState *));
DL_IMPORT(void) PyThreadState_Delete Py_PROTO((PyThreadState *));
DL_IMPORT(PyThreadState *) PyThreadState_New(PyInterpreterState *);
DL_IMPORT(void) PyThreadState_Clear(PyThreadState *);
DL_IMPORT(void) PyThreadState_Delete(PyThreadState *);
DL_IMPORT(PyThreadState *) PyThreadState_Get Py_PROTO((void));
DL_IMPORT(PyThreadState *) PyThreadState_Swap Py_PROTO((PyThreadState *));
DL_IMPORT(PyObject *) PyThreadState_GetDict Py_PROTO((void));
DL_IMPORT(PyThreadState *) PyThreadState_Get(void);
DL_IMPORT(PyThreadState *) PyThreadState_Swap(PyThreadState *);
DL_IMPORT(PyObject *) PyThreadState_GetDict(void);
/* Variable and macro for in-line access to current thread state */
......
......@@ -71,8 +71,8 @@ struct memberlist {
#define READONLY 1
#define RO READONLY /* Shorthand */
DL_IMPORT(PyObject *) PyMember_Get Py_PROTO((char *, struct memberlist *, char *));
DL_IMPORT(int) PyMember_Set Py_PROTO((char *, struct memberlist *, char *, PyObject *));
DL_IMPORT(PyObject *) PyMember_Get(char *, struct memberlist *, char *);
DL_IMPORT(int) PyMember_Set(char *, struct memberlist *, char *, PyObject *);
#ifdef __cplusplus
}
......
#ifndef Py_TRACEBACK_H
#define Py_TRACEBACK_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************
Copyright (c) 2000, BeOpen.com.
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
......@@ -14,14 +8,20 @@ See the file "Misc/COPYRIGHT" for information on usage and
redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
******************************************************************/
#ifndef Py_TRACEBACK_H
#define Py_TRACEBACK_H
#ifdef __cplusplus
extern "C" {
#endif
/* Traceback interface */
struct _frame;
DL_IMPORT(int) PyTraceBack_Here Py_PROTO((struct _frame *));
DL_IMPORT(PyObject *) PyTraceBack_Fetch Py_PROTO((void));
DL_IMPORT(int) PyTraceBack_Store Py_PROTO((PyObject *));
DL_IMPORT(int) PyTraceBack_Print Py_PROTO((PyObject *, PyObject *));
DL_IMPORT(int) PyTraceBack_Here(struct _frame *);
DL_IMPORT(PyObject *) PyTraceBack_Fetch(void);
DL_IMPORT(int) PyTraceBack_Store(PyObject *);
DL_IMPORT(int) PyTraceBack_Print(PyObject *, PyObject *);
/* Reveale traceback type so we can typecheck traceback objects */
extern DL_IMPORT(PyTypeObject) PyTraceBack_Type;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment