summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-01-12 11:45:45 (GMT)
committerGuido van Rossum <guido@python.org>1995-01-12 11:45:45 (GMT)
commitcaa63808861d4e92d4dc1005fc01de0f2e4a8fd0 (patch)
tree3771531169ab510aca9b69cdc4d9de2b5c8810c4 /Include
parent94390ec2a6ea5acbea9dead528ce067c396a0301 (diff)
downloadcpython-caa63808861d4e92d4dc1005fc01de0f2e4a8fd0.zip
cpython-caa63808861d4e92d4dc1005fc01de0f2e4a8fd0.tar.gz
cpython-caa63808861d4e92d4dc1005fc01de0f2e4a8fd0.tar.bz2
The great renaming, phase two: all header files have been updated to
use the new names exclusively, and the linker will see the new names. Files that import "Python.h" also only see the new names. Files that import "allobjects.h" will continue to be able to use the old names, due to the inclusion (in allobjects.h) of "rename2.h".
Diffstat (limited to 'Include')
-rw-r--r--Include/Python.h2
-rw-r--r--Include/accessobject.h18
-rw-r--r--Include/allobjects.h11
-rw-r--r--Include/bitset.h10
-rw-r--r--Include/bltinmodule.h2
-rw-r--r--Include/ceval.h70
-rw-r--r--Include/cgensupport.h20
-rw-r--r--Include/classobject.h52
-rw-r--r--Include/compile.h24
-rw-r--r--Include/dictobject.h18
-rwxr-xr-xInclude/errors.h64
-rw-r--r--Include/eval.h4
-rw-r--r--Include/fileobject.h18
-rw-r--r--Include/floatobject.h16
-rw-r--r--Include/frameobject.h59
-rw-r--r--Include/funcobject.h28
-rw-r--r--Include/grammar.h28
-rw-r--r--Include/import.h10
-rw-r--r--Include/intobject.h30
-rw-r--r--Include/intrcheck.h4
-rw-r--r--Include/listobject.h36
-rw-r--r--Include/longintrepr.h4
-rw-r--r--Include/longobject.h18
-rw-r--r--Include/mappingobject.h24
-rw-r--r--Include/marshal.h16
-rw-r--r--Include/methodobject.h29
-rw-r--r--Include/modsupport.h35
-rw-r--r--Include/moduleobject.h10
-rw-r--r--Include/mymalloc.h20
-rw-r--r--Include/myproto.h13
-rw-r--r--Include/node.h8
-rw-r--r--Include/object.h185
-rw-r--r--Include/objimpl.h14
-rw-r--r--Include/parsetok.h4
-rw-r--r--Include/pgenheaders.h2
-rw-r--r--Include/pyerrors.h64
-rw-r--r--Include/pythonrun.h32
-rw-r--r--Include/pythread.h36
-rw-r--r--Include/rangeobject.h4
-rw-r--r--Include/rename2.h379
-rw-r--r--Include/stringobject.h28
-rw-r--r--Include/structmember.h6
-rw-r--r--Include/sysmodule.h12
-rw-r--r--Include/thread.h36
-rw-r--r--Include/token.h8
-rw-r--r--Include/traceback.h8
-rw-r--r--Include/tupleobject.h28
47 files changed, 975 insertions, 572 deletions
diff --git a/Include/Python.h b/Include/Python.h
index 88ea8c0..490848d 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -1,3 +1,3 @@
/* Header file to be included by modules using new naming conventions */
+#define Py_USE_NEW_NAMES
#include "allobjects.h"
-#include "rename1.h"
diff --git a/Include/accessobject.h b/Include/accessobject.h
index 975b0f0..8cf4120 100644
--- a/Include/accessobject.h
+++ b/Include/accessobject.h
@@ -46,19 +46,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define AC_R_PUBLIC 0004
#define AC_W_PUBLIC 0002
-extern DL_IMPORT typeobject Accesstype;
+extern DL_IMPORT PyTypeObject Accesstype;
-#define is_accessobject(v) ((v)->ob_type == &Accesstype)
+#define PyAccess_Check(v) ((v)->ob_type == &Accesstype)
-object *newaccessobject PROTO((object *, object *, typeobject *, int));
-object *getaccessvalue PROTO((object *, object *));
-int setaccessvalue PROTO((object *, object *, object *));
+PyObject *newaccessobject Py_PROTO((PyObject *, PyObject *, PyTypeObject *, int));
+PyObject *getaccessvalue Py_PROTO((PyObject *, PyObject *));
+int setaccessvalue Py_PROTO((PyObject *, PyObject *, PyObject *));
-void setaccessowner PROTO((object *, object *));
-object *cloneaccessobject PROTO((object *));
-int hasaccessvalue PROTO((object *));
+void setaccessowner Py_PROTO((PyObject *, PyObject *));
+PyObject *cloneaccessobject Py_PROTO((PyObject *));
+int hasaccessvalue Py_PROTO((PyObject *));
-extern DL_IMPORT typeobject Anynumbertype, Anysequencetype, Anymappingtype;
+extern DL_IMPORT PyTypeObject Anynumbertype, Anysequencetype, Anymappingtype;
#ifdef __cplusplus
}
diff --git a/Include/allobjects.h b/Include/allobjects.h
index 363d9a1..3995a2e 100644
--- a/Include/allobjects.h
+++ b/Include/allobjects.h
@@ -49,6 +49,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdio.h>
#include <string.h>
+#include <errno.h>
#include "myproto.h"
@@ -76,9 +77,17 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "modsupport.h"
#include "ceval.h"
-extern void fatal PROTO((char *));
+extern void Py_FatalError Py_PROTO((char *));
+
+#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a))
+#define PyArg_NoArgs(v) PyArg_Parse(v, "")
#ifdef __cplusplus
}
#endif
+
+#ifndef Py_USE_NEW_NAMES
+#include "rename2.h"
+#endif
+
#endif /* !Py_ALLOBJECTS_H */
diff --git a/Include/bitset.h b/Include/bitset.h
index f1a1ead..673abb1 100644
--- a/Include/bitset.h
+++ b/Include/bitset.h
@@ -34,12 +34,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
typedef BYTE *bitset;
-bitset newbitset PROTO((int nbits));
-void delbitset PROTO((bitset bs));
+bitset newbitset Py_PROTO((int nbits));
+void delbitset Py_PROTO((bitset bs));
#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
-int addbit PROTO((bitset bs, int ibit)); /* Returns 0 if already set */
-int samebitset PROTO((bitset bs1, bitset bs2, int nbits));
-void mergebitset PROTO((bitset bs1, bitset bs2, int nbits));
+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));
#define BITSPERBYTE (8*sizeof(BYTE))
#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
diff --git a/Include/bltinmodule.h b/Include/bltinmodule.h
index 2f4c120..7f09f7c 100644
--- a/Include/bltinmodule.h
+++ b/Include/bltinmodule.h
@@ -30,7 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Built-in module interface */
-extern object *getbuiltindict PROTO(());
+extern PyObject *getbuiltindict Py_PROTO(());
#ifdef __cplusplus
}
diff --git a/Include/ceval.h b/Include/ceval.h
index d1020aa..474e386 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -30,19 +30,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Interface to random parts in ceval.c */
-object *call_object PROTO((object *, object *));
+PyObject *PyEval_CallObject Py_PROTO((PyObject *, PyObject *));
-object *getbuiltins PROTO((void));
-object *getglobals PROTO((void));
-object *getlocals PROTO((void));
-object *getowner PROTO((void));
-object *getframe PROTO((void));
-int getrestricted PROTO((void));
+PyObject *PyEval_GetBuiltins Py_PROTO((void));
+PyObject *PyEval_GetGlobals Py_PROTO((void));
+PyObject *PyEval_GetLocals Py_PROTO((void));
+PyObject *PyEval_GetOwner Py_PROTO((void));
+PyObject *PyEval_GetFrame Py_PROTO((void));
+int PyEval_GetRestricted Py_PROTO((void));
-void flushline PROTO((void));
+void Py_FlushLine Py_PROTO((void));
-int Py_AddPendingCall PROTO((int (*func) PROTO((ANY *)), ANY *arg));
-int Py_MakePendingCalls PROTO((void));
+int Py_AddPendingCall Py_PROTO((int (*func) Py_PROTO((ANY *)), ANY *arg));
+int Py_MakePendingCalls Py_PROTO((void));
/* Interface for threads.
@@ -52,62 +52,64 @@ int Py_MakePendingCalls PROTO((void));
threads to run as follows:
...preparations here...
- BGN_SAVE
+ Py_BEGIN_ALLOW_THREADS
...blocking system call here...
- END_SAVE
+ Py_END_ALLOW_THREADS
...interpret result here...
- The BGN_SAVE/END_SAVE pair expands to a {}-surrounded block.
+ The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a
+ {}-surrounded block.
To leave the block in the middle (e.g., with return), you must insert
a line containing RET_SAVE before the return, e.g.
if (...premature_exit...) {
- RET_SAVE
- err_errno(IOError);
+ Py_BLOCK_THREADS
+ PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}
An alternative is:
- RET_SAVE
+ Py_BLOCK_THREADS
if (...premature_exit...) {
- err_errno(IOError);
+ PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}
- RES_SAVE
+ Py_UNBLOCK_THREADS
For convenience, that the value of 'errno' is restored across
- END_SAVE and RET_SAVE.
+ Py_END_ALLOW_THREADS and RET_SAVE.
- WARNING: NEVER NEST CALLS TO BGN_SAVE AND END_SAVE!!!
+ WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND
+ Py_END_ALLOW_THREADS!!!
- The function init_save_thread() should be called only from
+ The function PyEval_InitThreads() should be called only from
initthread() in "threadmodule.c".
Note that not yet all candidates have been converted to use this
mechanism!
*/
-extern void init_save_thread PROTO((void));
-extern object *save_thread PROTO((void));
-extern void restore_thread PROTO((object *));
+extern void PyEval_InitThreads Py_PROTO((void));
+extern PyObject *PyEval_SaveThread Py_PROTO((void));
+extern void PyEval_RestoreThread Py_PROTO((PyObject *));
#ifdef WITH_THREAD
-#define BGN_SAVE { \
- object *_save; \
- _save = save_thread();
-#define RET_SAVE restore_thread(_save);
-#define RES_SAVE _save = save_thread();
-#define END_SAVE restore_thread(_save); \
+#define Py_BEGIN_ALLOW_THREADS { \
+ PyObject *_save; \
+ _save = PyEval_SaveThread();
+#define Py_BLOCK_THREADS PyEval_RestoreThread(_save);
+#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
+#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
}
#else /* !WITH_THREAD */
-#define BGN_SAVE {
-#define RET_SAVE
-#define RES_SAVE
-#define END_SAVE }
+#define Py_BEGIN_ALLOW_THREADS {
+#define Py_BLOCK_THREADS
+#define Py_UNBLOCK_THREADS
+#define Py_END_ALLOW_THREADS }
#endif /* !WITH_THREAD */
diff --git a/Include/cgensupport.h b/Include/cgensupport.h
index fe02da2..bb7cbbc 100644
--- a/Include/cgensupport.h
+++ b/Include/cgensupport.h
@@ -32,16 +32,16 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
typedef char *string;
-#define mknewlongobject(x) newintobject(x)
-#define mknewshortobject(x) newintobject((long)x)
-#define mknewfloatobject(x) newfloatobject(x)
-#define mknewcharobject(ch) mkvalue("c", ch)
-
-extern int getiobjectarg PROTO((object *args, int nargs, int i, object **p_a));
-extern int getilongarg PROTO((object *args, int nargs, int i, long *p_a));
-extern int getishortarg PROTO((object *args, int nargs, int i, short *p_a));
-extern int getifloatarg PROTO((object *args, int nargs, int i, float *p_a));
-extern int getistringarg PROTO((object *args, int nargs, int i, string *p_a));
+#define mknewlongobject(x) PyInt_FromLong(x)
+#define mknewshortobject(x) PyInt_FromLong((long)x)
+#define mknewfloatobject(x) PyFloat_FromDouble(x)
+#define mknewcharobject(ch) Py_BuildValue("c", ch)
+
+extern int PyArg_GetObject Py_PROTO((PyObject *args, int nargs, int i, PyObject **p_a));
+extern int PyArg_GetLong Py_PROTO((PyObject *args, int nargs, int i, long *p_a));
+extern int PyArg_GetShort Py_PROTO((PyObject *args, int nargs, int i, short *p_a));
+extern int PyArg_GetFloat Py_PROTO((PyObject *args, int nargs, int i, float *p_a));
+extern int PyArg_GetString Py_PROTO((PyObject *args, int nargs, int i, string *p_a));
#ifdef __cplusplus
}
diff --git a/Include/classobject.h b/Include/classobject.h
index e0e46c5..9c4bc51 100644
--- a/Include/classobject.h
+++ b/Include/classobject.h
@@ -39,40 +39,42 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Revealing some structures (not for general use) */
typedef struct {
- OB_HEAD
- object *cl_bases; /* A tuple of class objects */
- object *cl_dict; /* A dictionary */
- object *cl_name; /* A string */
+ PyObject_HEAD
+ PyObject *cl_bases; /* A tuple of class objects */
+ PyObject *cl_dict; /* A dictionary */
+ PyObject *cl_name; /* A string */
/* The following three are functions or NULL */
- object *cl_getattr;
- object *cl_setattr;
- object *cl_delattr;
-} classobject;
+ PyObject *cl_getattr;
+ PyObject *cl_setattr;
+ PyObject *cl_delattr;
+} PyClassObject;
typedef struct {
- OB_HEAD
- classobject *in_class; /* The class object */
- object *in_dict; /* A dictionary */
-} instanceobject;
+ PyObject_HEAD
+ PyClassObject *in_class; /* The class object */
+ PyObject *in_dict; /* A dictionary */
+} PyInstanceObject;
-extern DL_IMPORT typeobject Classtype, Instancetype, Instancemethodtype;
+extern DL_IMPORT PyTypeObject PyClass_Type, PyInstance_Type, PyMethod_Type;
-#define is_classobject(op) ((op)->ob_type == &Classtype)
-#define is_instanceobject(op) ((op)->ob_type == &Instancetype)
-#define is_instancemethodobject(op) ((op)->ob_type == &Instancemethodtype)
+#define PyClass_Check(op) ((op)->ob_type == &PyClass_Type)
+#define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)
+#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
-extern object *newclassobject PROTO((object *, object *, object *));
-extern object *newinstanceobject PROTO((object *, object *));
-extern object *newinstancemethodobject PROTO((object *, object *, object *));
+extern PyObject *PyClass_New Py_PROTO((PyObject *, PyObject *, PyObject *));
+extern PyObject *PyInstance_New Py_PROTO((PyObject *, PyObject *));
+extern PyObject *PyMethod_New Py_PROTO((PyObject *, PyObject *, PyObject *));
-extern object *instancemethodgetfunc PROTO((object *));
-extern object *instancemethodgetself PROTO((object *));
-extern object *instancemethodgetclass PROTO((object *));
+extern PyObject *PyMethod_Function Py_PROTO((PyObject *));
+extern PyObject *PyMethod_Self Py_PROTO((PyObject *));
+extern PyObject *PyMethod_Class Py_PROTO((PyObject *));
-extern int issubclass PROTO((object *, object *));
+extern int PyClass_IsSubclass Py_PROTO((PyObject *, PyObject *));
-extern object *instancebinop PROTO((object *, object *, char *, char *,
- object * (*) PROTO((object *, object *)) ));
+extern PyObject *instancebinop
+ Py_PROTO((PyObject *, PyObject *,
+ char *, char *,
+ PyObject * (*) Py_PROTO((PyObject *, PyObject *)) ));
#ifdef __cplusplus
}
diff --git a/Include/compile.h b/Include/compile.h
index d2b6ed5..4513d28 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -39,24 +39,24 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- the name of the object for which it was compiled. */
typedef struct {
- OB_HEAD
- stringobject *co_code; /* instruction opcodes */
- object *co_consts; /* list of immutable constant objects */
- object *co_names; /* list of stringobjects */
- object *co_filename; /* string */
- object *co_name; /* string */
-} codeobject;
+ PyObject_HEAD
+ PyStringObject *co_code; /* instruction opcodes */
+ PyObject *co_consts; /* list of immutable constant objects */
+ PyObject *co_names; /* list of stringobjects */
+ PyObject *co_filename; /* string */
+ PyObject *co_name; /* string */
+} PyCodeObject;
-extern DL_IMPORT typeobject Codetype;
+extern DL_IMPORT PyTypeObject PyCode_Type;
-#define is_codeobject(op) ((op)->ob_type == &Codetype)
+#define PyCode_Check(op) ((op)->ob_type == &PyCode_Type)
/* Public interface */
struct _node; /* Declare the existence of this type */
-codeobject *compile PROTO((struct _node *, char *));
-codeobject *newcodeobject
- PROTO((object *, object *, object *, object *, object *));
+PyCodeObject *PyNode_Compile Py_PROTO((struct _node *, char *));
+PyCodeObject *PyCode_New
+ Py_PROTO((PyObject *, PyObject *, PyObject *, PyObject *, PyObject *));
#ifdef __cplusplus
}
diff --git a/Include/dictobject.h b/Include/dictobject.h
index e03435b..a14661e 100644
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -32,19 +32,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "mappingobject.h"
-#define is_dictobject(op) is_mappingobject(op)
+#define PyDict_Check(op) is_mappingobject(op)
-#define newdictobject newmappingobject
+#define newdictobject PyDict_New
-extern object *dictlookup PROTO((object *dp, char *key));
-extern int dictinsert PROTO((object *dp, char *key, object *item));
-extern int dictremove PROTO((object *dp, char *key));
+extern PyObject *PyDict_GetItemString Py_PROTO((PyObject *dp, char *key));
+extern int PyDict_SetItemString Py_PROTO((PyObject *dp, char *key, PyObject *item));
+extern int PyDict_DelItemString Py_PROTO((PyObject *dp, char *key));
-#define getdictkeys getmappingkeys
+#define getdictkeys PyDict_Keys
-#define dict2lookup mappinglookup
-#define dict2insert mappinginsert
-#define dict2remove mappingremove
+#define dict2lookup PyDict_GetItem
+#define dict2insert PyDict_SetItem
+#define dict2remove PyDict_DelItem
#ifdef __cplusplus
}
diff --git a/Include/errors.h b/Include/errors.h
index 69d2772..2fa551a 100755
--- a/Include/errors.h
+++ b/Include/errors.h
@@ -30,47 +30,45 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Error handling definitions */
-void err_set PROTO((object *));
-void err_setval PROTO((object *, object *));
-void err_restore PROTO((object *, object *, object *));
-void err_setstr PROTO((object *, char *));
-object *err_occurred PROTO((void));
-void err_fetch PROTO((object **, object **, object **));
-void err_clear PROTO((void));
+void PyErr_SetNone Py_PROTO((PyObject *));
+void PyErr_SetObject Py_PROTO((PyObject *, PyObject *));
+void PyErr_SetString Py_PROTO((PyObject *, char *));
+PyObject *PyErr_Occurred Py_PROTO((void));
+void PyErr_Clear Py_PROTO((void));
+void PyErr_Fetch Py_PROTO((PyObject **, PyObject **, PyObject **));
+void PyErr_Restore Py_PROTO((PyObject *, PyObject *, PyObject *));
/* Predefined exceptions */
-extern DL_IMPORT object *AccessError;
-extern DL_IMPORT object *AttributeError;
-extern DL_IMPORT object *ConflictError;
-extern DL_IMPORT object *EOFError;
-extern DL_IMPORT object *IOError;
-extern DL_IMPORT object *ImportError;
-extern DL_IMPORT object *IndexError;
-extern DL_IMPORT object *KeyError;
-extern DL_IMPORT object *KeyboardInterrupt;
-extern DL_IMPORT object *MemoryError;
-extern DL_IMPORT object *NameError;
-extern DL_IMPORT object *OverflowError;
-extern DL_IMPORT object *RuntimeError;
-extern DL_IMPORT object *SyntaxError;
-extern DL_IMPORT object *SystemError;
-extern DL_IMPORT object *SystemExit;
-extern DL_IMPORT object *TypeError;
-extern DL_IMPORT object *ValueError;
-extern DL_IMPORT object *ZeroDivisionError;
+extern DL_IMPORT PyObject *PyExc_AccessError;
+extern DL_IMPORT PyObject *PyExc_AttributeError;
+extern DL_IMPORT PyObject *PyExc_ConflictError;
+extern DL_IMPORT PyObject *PyExc_EOFError;
+extern DL_IMPORT PyObject *PyExc_IOError;
+extern DL_IMPORT PyObject *PyExc_ImportError;
+extern DL_IMPORT PyObject *PyExc_IndexError;
+extern DL_IMPORT PyObject *PyExc_KeyError;
+extern DL_IMPORT PyObject *PyExc_KeyboardInterrupt;
+extern DL_IMPORT PyObject *PyExc_MemoryError;
+extern DL_IMPORT PyObject *PyExc_NameError;
+extern DL_IMPORT PyObject *PyExc_OverflowError;
+extern DL_IMPORT PyObject *PyExc_RuntimeError;
+extern DL_IMPORT PyObject *PyExc_SyntaxError;
+extern DL_IMPORT PyObject *PyExc_SystemError;
+extern DL_IMPORT PyObject *PyExc_SystemExit;
+extern DL_IMPORT PyObject *PyExc_TypeError;
+extern DL_IMPORT PyObject *PyExc_ValueError;
+extern DL_IMPORT PyObject *PyExc_ZeroDivisionError;
/* Convenience functions */
-extern int err_badarg PROTO((void));
-extern object *err_nomem PROTO((void));
-extern object *err_errno PROTO((object *));
+extern int PyErr_BadArgument Py_PROTO((void));
+extern PyObject *PyErr_NoMemory Py_PROTO((void));
+extern PyObject *PyErr_SetFromErrno Py_PROTO((PyObject *));
-extern void err_badcall PROTO((void));
+extern void PyErr_BadInternalCall Py_PROTO((void));
-extern object *err_getexc PROTO((void));
-
-extern int sigcheck PROTO((void)); /* In sigcheck.c or signalmodule.c */
+extern int sigcheck Py_PROTO((void)); /* In sigcheck.c or signalmodule.c */
#ifdef __cplusplus
}
diff --git a/Include/eval.h b/Include/eval.h
index 3fd9c46..f374826 100644
--- a/Include/eval.h
+++ b/Include/eval.h
@@ -30,8 +30,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Interface to execute compiled code */
-object *eval_code
- PROTO((codeobject *, object *, object *, object *, object *));
+PyObject *PyEval_EvalCode
+ Py_PROTO((PyCodeObject *, PyObject *, PyObject *, PyObject *, PyObject *));
#ifdef __cplusplus
}
diff --git a/Include/fileobject.h b/Include/fileobject.h
index f3dad7b..b39d947 100644
--- a/Include/fileobject.h
+++ b/Include/fileobject.h
@@ -30,17 +30,17 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* File object interface */
-extern DL_IMPORT typeobject Filetype;
+extern DL_IMPORT PyTypeObject PyFile_Type;
-#define is_fileobject(op) ((op)->ob_type == &Filetype)
+#define PyFile_Check(op) ((op)->ob_type == &PyFile_Type)
-extern object *newfileobject PROTO((char *, char *));
-extern void setfilebufsize PROTO((object *, int));
-extern object *newopenfileobject
- PROTO((FILE *, char *, char *, int (*)FPROTO((FILE *))));
-extern FILE *getfilefile PROTO((object *));
-extern object *getfilename PROTO((object *));
-extern object *filegetline PROTO((object *, int));
+extern PyObject *PyFile_FromString Py_PROTO((char *, char *));
+extern void setfilebufsize Py_PROTO((PyObject *, int));
+extern PyObject *PyFile_FromFile
+ Py_PROTO((FILE *, char *, char *, int (*)Py_FPROTO((FILE *))));
+extern FILE *PyFile_AsFile Py_PROTO((PyObject *));
+extern PyObject *getfilename Py_PROTO((PyObject *));
+extern PyObject *PyFile_GetLine Py_PROTO((PyObject *, int));
#ifdef __cplusplus
}
diff --git a/Include/floatobject.h b/Include/floatobject.h
index 5e5a2f0..2feb0bc 100644
--- a/Include/floatobject.h
+++ b/Include/floatobject.h
@@ -31,23 +31,23 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Float object interface */
/*
-floatobject represents a (double precision) floating point number.
+PyFloatObject represents a (double precision) floating point number.
*/
typedef struct {
- OB_HEAD
+ PyObject_HEAD
double ob_fval;
-} floatobject;
+} PyFloatObject;
-extern DL_IMPORT typeobject Floattype;
+extern DL_IMPORT PyTypeObject PyFloat_Type;
-#define is_floatobject(op) ((op)->ob_type == &Floattype)
+#define PyFloat_Check(op) ((op)->ob_type == &PyFloat_Type)
-extern object *newfloatobject PROTO((double));
-extern double getfloatvalue PROTO((object *));
+extern PyObject *PyFloat_FromDouble Py_PROTO((double));
+extern double PyFloat_AsDouble Py_PROTO((PyObject *));
/* Macro, trading safety for speed */
-#define GETFLOATVALUE(op) ((op)->ob_fval)
+#define PyFloat_AS_DOUBLE(op) ((op)->ob_fval)
#ifdef __cplusplus
}
diff --git a/Include/frameobject.h b/Include/frameobject.h
index 2179de8..19534d5 100644
--- a/Include/frameobject.h
+++ b/Include/frameobject.h
@@ -34,38 +34,40 @@ typedef struct {
int b_type; /* what kind of block this is */
int b_handler; /* where to jump to find handler */
int b_level; /* value stack level to pop to */
-} block;
+} PyTryBlock;
typedef struct _frame {
- OB_HEAD
+ PyObject_HEAD
struct _frame *f_back; /* previous frame, or NULL */
- codeobject *f_code; /* code segment */
- object *f_builtins; /* builtin symbol table (dictobject) */
- object *f_globals; /* global symbol table (dictobject) */
- object *f_locals; /* local symbol table (dictobject) */
- object *f_owner; /* owner (e.g. class or module) or NULL */
- object *f_fastlocals; /* fast local variables (listobject) */
- object *f_localmap; /* local variable names (dictobject) */
- object **f_valuestack; /* malloc'ed array */
- block *f_blockstack; /* malloc'ed array */
+ PyCodeObject *f_code; /* code segment */
+ PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
+ PyObject *f_globals; /* global symbol table (PyDictObject) */
+ PyObject *f_locals; /* local symbol table (PyDictObject) */
+ PyObject *f_owner; /* owner (e.g. class or module) or NULL */
+ PyObject *f_fastlocals; /* fast local variables (PyListObject) */
+ PyObject *f_localmap; /* local variable names (PyDictObject) */
+ PyObject **f_valuestack; /* malloc'ed array */
+ PyTryBlock *f_blockstack; /* malloc'ed array */
int f_nvalues; /* size of f_valuestack */
int f_nblocks; /* size of f_blockstack */
int f_iblock; /* index in f_blockstack */
int f_lasti; /* Last instruction if called */
int f_lineno; /* Current line number */
- int f_restricted; /* Flag set if restricted operations in this scope */
- object *f_trace; /* Trace function */
-} frameobject;
+ int f_restricted; /* Flag set if restricted operations
+ in this scope */
+ PyObject *f_trace; /* Trace function */
+} PyFrameObject;
/* Standard object interface */
-extern DL_IMPORT typeobject Frametype;
+extern DL_IMPORT PyTypeObject PyFrame_Type;
-#define is_frameobject(op) ((op)->ob_type == &Frametype)
+#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)
-frameobject * newframeobject PROTO(
- (frameobject *, codeobject *, object *, object *, object *, int, int));
+PyFrameObject * PyFrame_New
+ Py_PROTO((PyFrameObject *, PyCodeObject *,
+ PyObject *, PyObject *, PyObject *, int, int));
/* The rest of the interface is specific for frame objects */
@@ -73,14 +75,15 @@ frameobject * newframeobject PROTO(
/* List access macros */
#ifdef NDEBUG
-#define GETITEM(v, i) GETTUPLEITEM((tupleobject *)(v), (i))
-#define GETITEMNAME(v, i) GETSTRINGVALUE((stringobject *)GETITEM((v), (i)))
+#define GETITEM(v, i) PyTuple_GET_ITEM((PyTupleObject *)(v), (i))
+#define GETITEMNAME(v, i) \
+ PyString_AS_STRING((PyStringObject *)GETITEM((v), (i)))
#else
-#define GETITEM(v, i) gettupleitem((v), (i))
-#define GETITEMNAME(v, i) getstringvalue(GETITEM(v, i))
+#define GETITEM(v, i) PyTuple_GetItem((v), (i))
+#define GETITEMNAME(v, i) PyString_AsString(GETITEM(v, i))
#endif
-#define GETUSTRINGVALUE(s) ((unsigned char *)GETSTRINGVALUE(s))
+#define GETUSTRINGVALUE(s) ((unsigned char *)PyString_AS_STRING(s))
/* Code access macros */
@@ -91,17 +94,17 @@ frameobject * newframeobject PROTO(
/* Block management functions */
-void setup_block PROTO((frameobject *, int, int, int));
-block *pop_block PROTO((frameobject *));
+void PyFrame_BlockSetup Py_PROTO((PyFrameObject *, int, int, int));
+PyTryBlock *PyFrame_BlockPop Py_PROTO((PyFrameObject *));
/* Extend the value stack */
-object **extend_stack PROTO((frameobject *, int, int));
+PyObject **PyFrame_ExtendStack Py_PROTO((PyFrameObject *, int, int));
/* Conversions between "fast locals" and locals in dictionary */
-void locals_2_fast PROTO((frameobject *, int));
-void fast_2_locals PROTO((frameobject *));
+void locals_2_fast Py_PROTO((PyFrameObject *, int));
+void fast_2_locals Py_PROTO((PyFrameObject *));
#ifdef __cplusplus
}
diff --git a/Include/funcobject.h b/Include/funcobject.h
index a6e30ca..877faff 100644
--- a/Include/funcobject.h
+++ b/Include/funcobject.h
@@ -31,24 +31,24 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Function object interface */
typedef struct {
- OB_HEAD
- object *func_code;
- object *func_globals;
- object *func_name;
+ PyObject_HEAD
+ PyObject *func_code;
+ PyObject *func_globals;
+ PyObject *func_name;
int func_argcount;
- object *func_argdefs;
- object *func_doc;
-} funcobject;
+ PyObject *func_argdefs;
+ PyObject *func_doc;
+} PyFunctionObject;
-extern DL_IMPORT typeobject Functype;
+extern DL_IMPORT PyTypeObject PyFunction_Type;
-#define is_funcobject(op) ((op)->ob_type == &Functype)
+#define PyFunction_Check(op) ((op)->ob_type == &PyFunction_Type)
-extern object *newfuncobject PROTO((object *, object *));
-extern object *getfunccode PROTO((object *));
-extern object *getfuncglobals PROTO((object *));
-extern object *getfuncargstuff PROTO((object *, int *));
-extern int setfuncargstuff PROTO((object *, int, object *));
+extern PyObject *PyFunction_New Py_PROTO((PyObject *, PyObject *));
+extern PyObject *PyFunction_GetCode Py_PROTO((PyObject *));
+extern PyObject *PyFunction_GetGlobals Py_PROTO((PyObject *));
+extern PyObject *getfuncargstuff Py_PROTO((PyObject *, int *));
+extern int setfuncargstuff Py_PROTO((PyObject *, int, PyObject *));
#ifdef __cplusplus
}
diff --git a/Include/grammar.h b/Include/grammar.h
index 2d3f88d..9c4dd45 100644
--- a/Include/grammar.h
+++ b/Include/grammar.h
@@ -91,24 +91,24 @@ typedef struct {
/* FUNCTIONS */
-grammar *newgrammar PROTO((int start));
-dfa *adddfa PROTO((grammar *g, int type, char *name));
-int addstate PROTO((dfa *d));
-void addarc PROTO((dfa *d, int from, int to, int lbl));
-dfa *finddfa PROTO((grammar *g, int type));
-char *typename PROTO((grammar *g, int lbl));
+grammar *newgrammar Py_PROTO((int start));
+dfa *adddfa Py_PROTO((grammar *g, int type, char *name));
+int addstate Py_PROTO((dfa *d));
+void addarc Py_PROTO((dfa *d, int from, int to, int lbl));
+dfa *PyGrammar_FindDFA Py_PROTO((grammar *g, int type));
+char *typename Py_PROTO((grammar *g, int lbl));
-int addlabel PROTO((labellist *ll, int type, char *str));
-int findlabel PROTO((labellist *ll, int type, char *str));
-char *labelrepr PROTO((label *lb));
-void translatelabels PROTO((grammar *g));
+int addlabel Py_PROTO((labellist *ll, int type, char *str));
+int findlabel Py_PROTO((labellist *ll, int type, char *str));
+char *PyGrammar_LabelRepr Py_PROTO((label *lb));
+void translatelabels Py_PROTO((grammar *g));
-void addfirstsets PROTO((grammar *g));
+void addfirstsets Py_PROTO((grammar *g));
-void addaccelerators PROTO((grammar *g));
+void PyGrammar_AddAccelerators Py_PROTO((grammar *g));
-void printgrammar PROTO((grammar *g, FILE *fp));
-void printnonterminals PROTO((grammar *g, FILE *fp));
+void printgrammar Py_PROTO((grammar *g, FILE *fp));
+void printnonterminals Py_PROTO((grammar *g, FILE *fp));
#ifdef __cplusplus
}
diff --git a/Include/import.h b/Include/import.h
index 7699bc6..3a973a5 100644
--- a/Include/import.h
+++ b/Include/import.h
@@ -31,11 +31,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Module definition and import interface */
long get_pyc_magic PROTO((void));
-object *get_modules PROTO((void));
-object *add_module PROTO((char *name));
-object *import_module PROTO((char *name));
-object *reload_module PROTO((object *m));
-void doneimport PROTO((void));
+PyObject *PyImport_GetModuleDict Py_PROTO((void));
+PyObject *PyImport_AddModule Py_PROTO((char *name));
+PyObject *PyImport_ImportModule Py_PROTO((char *name));
+PyObject *PyImport_ReloadModule Py_PROTO((PyObject *m));
+void PyImport_Cleanup Py_PROTO((void));
extern struct {
char *name;
diff --git a/Include/intobject.h b/Include/intobject.h
index 91d4c09..6e2344a 100644
--- a/Include/intobject.h
+++ b/Include/intobject.h
@@ -33,29 +33,29 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/*
123456789-123456789-123456789-123456789-123456789-123456789-123456789-12
-intobject represents a (long) integer. This is an immutable object;
+PyIntObject represents a (long) integer. This is an immutable object;
an integer cannot change its value after creation.
There are functions to create new integer objects, to test an object
for integer-ness, and to get the integer value. The latter functions
-returns -1 and sets errno to EBADF if the object is not an intobject.
+returns -1 and sets errno to EBADF if the object is not an PyIntObject.
None of the functions should be applied to nil objects.
-The type intobject is (unfortunately) exposed bere so we can declare
-TrueObject and FalseObject below; don't use this.
+The type PyIntObject is (unfortunately) exposed here so we can declare
+_Py_TrueStruct and _Py_ZeroStruct below; don't use this.
*/
typedef struct {
- OB_HEAD
+ PyObject_HEAD
long ob_ival;
-} intobject;
+} PyIntObject;
-extern DL_IMPORT typeobject Inttype;
+extern DL_IMPORT PyTypeObject PyInt_Type;
-#define is_intobject(op) ((op)->ob_type == &Inttype)
+#define PyInt_Check(op) ((op)->ob_type == &PyInt_Type)
-extern object *newintobject PROTO((long));
-extern long getintvalue PROTO((object *));
+extern PyObject *PyInt_FromLong Py_PROTO((long));
+extern long PyInt_AsLong Py_PROTO((PyObject *));
/*
@@ -66,16 +66,16 @@ All values of type Boolean must point to either of these; but in
contexts where integers are required they are integers (valued 0 and 1).
Hope these macros don't conflict with other people's.
-Don't forget to apply INCREF() when returning True or False!!!
+Don't forget to apply Py_INCREF() when returning True or False!!!
*/
-extern DL_IMPORT intobject FalseObject, TrueObject; /* Don't use these directly */
+extern DL_IMPORT PyIntObject _Py_ZeroStruct, _Py_TrueStruct; /* Don't use these directly */
-#define False ((object *) &FalseObject)
-#define True ((object *) &TrueObject)
+#define Py_False ((PyObject *) &_Py_ZeroStruct)
+#define Py_True ((PyObject *) &_Py_TrueStruct)
/* Macro, trading safety for speed */
-#define GETINTVALUE(op) ((op)->ob_ival)
+#define PyInt_AS_LONG(op) ((op)->ob_ival)
#ifdef __cplusplus
}
diff --git a/Include/intrcheck.h b/Include/intrcheck.h
index 8f22700..e91a927 100644
--- a/Include/intrcheck.h
+++ b/Include/intrcheck.h
@@ -28,8 +28,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
-extern int intrcheck PROTO((void));
-extern void initintr PROTO((void));
+extern int PyOS_InterruptOccurred Py_PROTO((void));
+extern void PyOS_InitInterrupts Py_PROTO((void));
#ifdef __cplusplus
}
diff --git a/Include/listobject.h b/Include/listobject.h
index f14286e..083a44b 100644
--- a/Include/listobject.h
+++ b/Include/listobject.h
@@ -37,35 +37,35 @@ Another generally useful object type is an list of object pointers.
This is a mutable type: the list items can be changed, and items can be
added or removed. Out-of-range indices or non-list objects are ignored.
-*** WARNING *** setlistitem does not increment the new item's reference
+*** WARNING *** PyList_SetItem does not increment the new item's reference
count, but does decrement the reference count of the item it replaces,
if not nil. It does *decrement* the reference count if it is *not*
-inserted in the list. Similarly, getlistitem does not increment the
+inserted in the list. Similarly, PyList_GetItem does not increment the
returned item's reference count.
*/
typedef struct {
- OB_VARHEAD
- object **ob_item;
-} listobject;
+ PyObject_VAR_HEAD
+ PyObject **ob_item;
+} PyListObject;
-extern DL_IMPORT typeobject Listtype;
+extern DL_IMPORT PyTypeObject PyList_Type;
-#define is_listobject(op) ((op)->ob_type == &Listtype)
+#define PyList_Check(op) ((op)->ob_type == &PyList_Type)
-extern object *newlistobject PROTO((int size));
-extern int getlistsize PROTO((object *));
-extern object *getlistitem PROTO((object *, int));
-extern int setlistitem PROTO((object *, int, object *));
-extern int inslistitem PROTO((object *, int, object *));
-extern int addlistitem PROTO((object *, object *));
-extern object *getlistslice PROTO((object *, int, int));
-extern int setlistslice PROTO((object *, int, int, object *));
-extern int sortlist PROTO((object *));
-extern object *listtuple PROTO((object *));
+extern PyObject *PyList_New Py_PROTO((int size));
+extern int PyList_Size Py_PROTO((PyObject *));
+extern PyObject *PyList_GetItem Py_PROTO((PyObject *, int));
+extern int PyList_SetItem Py_PROTO((PyObject *, int, PyObject *));
+extern int PyList_Insert Py_PROTO((PyObject *, int, PyObject *));
+extern int PyList_Append Py_PROTO((PyObject *, PyObject *));
+extern PyObject *PyList_GetSlice Py_PROTO((PyObject *, int, int));
+extern int PyList_SetSlice Py_PROTO((PyObject *, int, int, PyObject *));
+extern int PyList_Sort Py_PROTO((PyObject *));
+extern PyObject *listtuple Py_PROTO((PyObject *));
/* Macro, trading safety for speed */
-#define GETLISTITEM(op, i) ((op)->ob_item[i])
+#define PyList_GET_ITEM(op, i) ((op)->ob_item[i])
#ifdef __cplusplus
}
diff --git a/Include/longintrepr.h b/Include/longintrepr.h
index 7ed12d2..a5b1b36 100644
--- a/Include/longintrepr.h
+++ b/Include/longintrepr.h
@@ -61,12 +61,12 @@ typedef long stwodigits; /* signed variant of twodigits */
so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. */
struct _longobject {
- OB_HEAD
+ PyObject_HEAD
int ob_size; /* XXX Hack! newvarobj() stores it as unsigned! */
digit ob_digit[1];
};
-longobject *alloclongobject PROTO((int));
+PyLongObject *_PyLong_New Py_PROTO((int));
#ifdef __cplusplus
}
diff --git a/Include/longobject.h b/Include/longobject.h
index 83daa34..bc6a7fe 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -30,19 +30,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Long (arbitrary precision) integer object interface */
-typedef struct _longobject longobject; /* Revealed in longintrepr.h */
+typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */
-extern DL_IMPORT typeobject Longtype;
+extern DL_IMPORT PyTypeObject PyLong_Type;
-#define is_longobject(op) ((op)->ob_type == &Longtype)
+#define PyLong_Check(op) ((op)->ob_type == &PyLong_Type)
-extern object *newlongobject PROTO((long));
-extern object *dnewlongobject PROTO((double));
-extern long getlongvalue PROTO((object *));
-extern double dgetlongvalue PROTO((object *));
+extern PyObject *PyLong_FromLong Py_PROTO((long));
+extern PyObject *PyLong_FromDouble Py_PROTO((double));
+extern long PyLong_AsLong Py_PROTO((PyObject *));
+extern double PyLong_AsDouble Py_PROTO((PyObject *));
-object *long_scan PROTO((char *, int));
-object *long_escan PROTO((char *, char **, int));
+PyObject *PyLong_FromString Py_PROTO((char *, int));
+PyObject *long_escan Py_PROTO((char *, char **, int));
#ifdef __cplusplus
}
diff --git a/Include/mappingobject.h b/Include/mappingobject.h
index 5422e98..dbbe1ab 100644
--- a/Include/mappingobject.h
+++ b/Include/mappingobject.h
@@ -30,21 +30,21 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Mapping object type -- mapping from hashable object to object */
-extern DL_IMPORT typeobject Mappingtype;
+extern DL_IMPORT PyTypeObject Mappingtype;
#define is_mappingobject(op) ((op)->ob_type == &Mappingtype)
-extern object *newmappingobject PROTO((void));
-extern object *mappinglookup PROTO((object *mp, object *key));
-extern int mappinginsert PROTO((object *mp, object *key, object *item));
-extern int mappingremove PROTO((object *mp, object *key));
-extern void mappingclear PROTO((object *mp));
-extern int mappinggetnext
- PROTO((object *mp, int *pos, object **key, object **value));
-extern object *getmappingkeys PROTO((object *mp));
-extern object *getmappingvalues PROTO((object *mp));
-extern object *getmappingitems PROTO((object *mp));
-extern int getmappingsize PROTO((object *mp));
+extern PyObject *PyDict_New Py_PROTO((void));
+extern PyObject *PyDict_GetItem Py_PROTO((PyObject *mp, PyObject *key));
+extern int PyDict_SetItem Py_PROTO((PyObject *mp, PyObject *key, PyObject *item));
+extern int PyDict_DelItem Py_PROTO((PyObject *mp, PyObject *key));
+extern void PyDict_Clear Py_PROTO((PyObject *mp));
+extern int PyDict_Next
+ Py_PROTO((PyObject *mp, int *pos, PyObject **key, PyObject **value));
+extern PyObject *PyDict_Keys Py_PROTO((PyObject *mp));
+extern PyObject *PyDict_Values Py_PROTO((PyObject *mp));
+extern PyObject *PyDict_Items Py_PROTO((PyObject *mp));
+extern int getmappingsize Py_PROTO((PyObject *mp));
#ifdef __cplusplus
}
diff --git a/Include/marshal.h b/Include/marshal.h
index ff829c3..e5ee545 100644
--- a/Include/marshal.h
+++ b/Include/marshal.h
@@ -30,14 +30,14 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Interface for marshal.c */
-void wr_long PROTO((long, FILE *));
-void wr_short PROTO((int, FILE *));
-void wr_object PROTO((object *, FILE *));
-
-long rd_long PROTO((FILE *));
-int rd_short PROTO((FILE *));
-object *rd_object PROTO((FILE *));
-object *rds_object PROTO((char *, int));
+void PyMarshal_WriteLongToFile Py_PROTO((long, FILE *));
+void wr_short Py_PROTO((int, FILE *));
+void PyMarshal_WriteObjectToFile Py_PROTO((PyObject *, FILE *));
+
+long PyMarshal_ReadLongFromFile Py_PROTO((FILE *));
+int rd_short Py_PROTO((FILE *));
+PyObject *PyMarshal_ReadObjectFromFile Py_PROTO((FILE *));
+PyObject *PyMarshal_ReadObjectFromString Py_PROTO((char *, int));
#ifdef __cplusplus
}
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 44664e0..1b2dd87 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -30,26 +30,29 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Method object interface */
-extern DL_IMPORT typeobject Methodtype;
+extern DL_IMPORT PyTypeObject PyCFunction_Type;
-#define is_methodobject(op) ((op)->ob_type == &Methodtype)
+#define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type)
-typedef object *(*method) FPROTO((object *, object *));
+typedef PyObject *(*PyCFunction) Py_FPROTO((PyObject *, PyObject *));
-extern method getmethod PROTO((object *));
-extern object *getself PROTO((object *));
-extern int getvarargs PROTO((object *));
+extern PyCFunction PyCFunction_GetFunction Py_PROTO((PyObject *));
+extern PyObject *PyCFunction_GetSelf Py_PROTO((PyObject *));
+extern int PyCFunction_IsVarArgs Py_PROTO((PyObject *));
-struct methodlist {
- char *ml_name;
- method ml_meth;
- int ml_flags;
- char *ml_doc;
+struct PyMethodDef {
+ char *ml_name;
+ PyCFunction ml_meth;
+ int ml_flags;
+ char *ml_doc;
};
+typedef struct PyMethodDef PyMethodDef;
-extern object *newmethodobject PROTO((struct methodlist *, object *));
+extern PyObject *Py_FindMethod
+ Py_PROTO((PyMethodDef[], PyObject *, char *));
-extern object *findmethod PROTO((struct methodlist[], object *, char *));
+extern PyObject *PyCFunction_New
+ Py_PROTO((PyMethodDef *, PyObject *));
/* Flag passed to newmethodobject */
#define METH_VARARGS 0x0001
diff --git a/Include/modsupport.h b/Include/modsupport.h
index f81248c..7a38541 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -34,24 +34,25 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdarg.h>
-extern int getargs PROTO((object *, char *, ...));
-extern int newgetargs PROTO((object *, char *, ...));
-extern object *mkvalue PROTO((char *, ...));
+extern int PyArg_Parse Py_PROTO((PyObject *, char *, ...));
+extern int PyArg_ParseTuple Py_PROTO((PyObject *, char *, ...));
+extern PyObject *Py_BuildValue Py_PROTO((char *, ...));
#else
#include <varargs.h>
/* Better to have no prototypes at all for varargs functions in this case */
-extern int getargs();
-extern object *mkvalue();
+extern int PyArg_Parse();
+extern int PyArg_ParseTuple();
+extern PyObject *Py_BuildValue();
#endif
-extern int vgetargs PROTO((object *, char *, va_list));
-extern object *vmkvalue PROTO((char *, va_list));
+extern int PyArg_VaParse Py_PROTO((PyObject *, char *, va_list));
+extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list));
-#define PYTHON_API_VERSION 1001
+#define PYTHON_API_VERSION 1002
/* The API version is maintained (independently from the Python version)
so we can detect mismatches between the interpreter and dynamically
loaded modules.
@@ -59,20 +60,16 @@ extern object *vmkvalue PROTO((char *, va_list));
Please add a line or two to the top of this log for each API
version change:
+ 10-Jan-1995 GvR Renamed globals to new naming scheme
+
9-Jan-1995 GvR Initial version (incompatible with older API)
*/
-extern object *initmodule4 PROTO((char *, struct methodlist *,
- char *, object *, int));
-#define initmodule(name, methods) \
- initmodule4(name, methods, (char *)NULL, (object *)NULL, \
- PYTHON_API_VERSION)
-
-/* The following are obsolete -- use getargs directly! */
-#define getnoarg(v) getargs(v, "")
-#define getintarg(v, a) getargs(v, "i", a)
-#define getlongarg(v, a) getargs(v, "l", a)
-#define getstrarg(v, a) getargs(v, "s", a)
+extern PyObject *Py_InitModule4 Py_PROTO((char *, PyMethodDef *,
+ char *, PyObject *, int));
+#define Py_InitModule(name, methods) \
+ Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
+ PYTHON_API_VERSION)
#ifdef __cplusplus
}
diff --git a/Include/moduleobject.h b/Include/moduleobject.h
index c9dc96d..277f95d 100644
--- a/Include/moduleobject.h
+++ b/Include/moduleobject.h
@@ -30,13 +30,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Module object interface */
-extern DL_IMPORT typeobject Moduletype;
+extern DL_IMPORT PyTypeObject PyModule_Type;
-#define is_moduleobject(op) ((op)->ob_type == &Moduletype)
+#define PyModule_Check(op) ((op)->ob_type == &PyModule_Type)
-extern object *newmoduleobject PROTO((char *));
-extern object *getmoduledict PROTO((object *));
-extern char *getmodulename PROTO((object *));
+extern PyObject *PyModule_New Py_PROTO((char *));
+extern PyObject *PyModule_GetDict Py_PROTO((PyObject *));
+extern char *PyModule_GetName Py_PROTO((PyObject *));
#ifdef __cplusplus
}
diff --git a/Include/mymalloc.h b/Include/mymalloc.h
index 3c80db1..f7c0ae8 100644
--- a/Include/mymalloc.h
+++ b/Include/mymalloc.h
@@ -57,10 +57,10 @@ extern "C" {
#endif
#ifndef HAVE_STDLIB_H
-extern ANY *malloc PROTO((size_t));
-extern ANY *calloc PROTO((size_t, size_t));
-extern ANY *realloc PROTO((ANY *, size_t));
-extern void free PROTO((ANY *)); /* XXX sometimes int on Unix old systems */
+extern ANY *malloc Py_PROTO((size_t));
+extern ANY *calloc Py_PROTO((size_t, size_t));
+extern ANY *realloc Py_PROTO((ANY *, size_t));
+extern void free Py_PROTO((ANY *)); /* XXX sometimes int on Unix old systems */
#endif /* !HAVE_STDLIB */
#ifndef NULL
@@ -69,16 +69,20 @@ extern void free PROTO((ANY *)); /* XXX sometimes int on Unix old systems */
/* XXX Always allocate one extra byte, since some malloc's return NULL
XXX for malloc(0) or realloc(p, 0). */
-#define NEW(type, n) ( (type *) malloc(1 + (n) * sizeof(type)) )
-#define RESIZE(p, type, n) \
+#define PyMem_NEW(type, n) ( (type *) malloc(1 + (n) * sizeof(type)) )
+#define PyMem_RESIZE(p, type, n) \
if ((p) == NULL) \
(p) = (type *) malloc(1 + (n) * sizeof(type)); \
else \
(p) = (type *) realloc((ANY *)(p), 1 + (n) * sizeof(type))
-#define DEL(p) free((ANY *)p)
-#define XDEL(p) if ((p) == NULL) ; else DEL(p)
+#define PyMem_DEL(p) free((ANY *)p)
+#define PyMem_XDEL(p) if ((p) == NULL) ; else PyMem_DEL(p)
#ifdef __cplusplus
}
#endif
+
+#ifndef Py_USE_NEW_NAMES
+#include "rename2.h"
+#endif
#endif /* !Py_MYMALLOC_H */
diff --git a/Include/myproto.h b/Include/myproto.h
index e60d2cc..6e91339 100644
--- a/Include/myproto.h
+++ b/Include/myproto.h
@@ -29,16 +29,21 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#ifdef HAVE_PROTOTYPES
-#define PROTO(x) x
+#define Py_PROTO(x) x
#else
-#define PROTO(x) ()
+#define Py_PROTO(x) ()
#endif
-#ifndef FPROTO
-#define FPROTO(x) PROTO(x)
+#ifndef Py_FPROTO
+#define Py_FPROTO(x) Py_PROTO(x)
#endif
#ifdef __cplusplus
}
#endif
+
+#ifndef Py_USE_NEW_NAMES
+#include "rename2.h"
+#endif
+
#endif /* !Py_PROTO_H */
diff --git a/Include/node.h b/Include/node.h
index f98d7fc..fbeb851 100644
--- a/Include/node.h
+++ b/Include/node.h
@@ -38,9 +38,9 @@ typedef struct _node {
struct _node *n_child;
} node;
-extern node *newtree PROTO((int type));
-extern node *addchild PROTO((node *n, int type, char *str, int lineno));
-extern void freetree PROTO((node *n));
+extern node *PyNode_New Py_PROTO((int type));
+extern node *PyNode_AddChild Py_PROTO((node *n, int type, char *str, int lineno));
+extern void PyNode_Free Py_PROTO((node *n));
/* Node access functions */
#define NCH(n) ((n)->n_nchildren)
@@ -60,7 +60,7 @@ extern void freetree PROTO((node *n));
} }
#endif
-extern void listtree PROTO((node *));
+extern void PyNode_ListTree Py_PROTO((node *));
#ifdef __cplusplus
}
diff --git a/Include/object.h b/Include/object.h
index 58e2d15..e2d0329 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -65,12 +65,12 @@ object can be simply a pointer -- moving an object would require
updating all the pointers, and changing an object's size would require
moving it if there was another object right next to it.)
-Objects are always accessed through pointers of the type 'object *'.
-The type 'object' is a structure that only contains the reference count
+Objects are always accessed through pointers of the type 'PyObject *'.
+The type 'PyObject' is a structure that only contains the reference count
and the type pointer. The actual memory allocated for an object
contains other data that can only be accessed after casting the pointer
to a pointer to a longer structure type. This longer type must start
-with the reference count and type fields; the macro OB_HEAD should be
+with the reference count and type fields; the macro PyObject_HEAD should be
used for this (to accomodate for future changes). The implementation
of a particular object type can cast the object pointer to the proper
type and back.
@@ -84,36 +84,36 @@ whose size is determined when the object is allocated.
#ifndef NDEBUG
/* Turn on heavy reference debugging */
-#define TRACE_REFS
+#define Py_TRACE_REFS
/* Turn on reference counting */
-#define REF_DEBUG
+#define Py_REF_DEBUG
#endif /* NDEBUG */
-#ifdef TRACE_REFS
-#define OB_HEAD \
+#ifdef Py_TRACE_REFS
+#define PyObject_HEAD \
struct _object *_ob_next, *_ob_prev; \
int ob_refcnt; \
struct _typeobject *ob_type;
-#define OB_HEAD_INIT(type) 0, 0, 1, type,
+#define PyObject_HEAD_INIT(type) 0, 0, 1, type,
#else
-#define OB_HEAD \
+#define PyObject_HEAD \
int ob_refcnt; \
struct _typeobject *ob_type;
-#define OB_HEAD_INIT(type) 1, type,
+#define PyObject_HEAD_INIT(type) 1, type,
#endif
-#define OB_VARHEAD \
- OB_HEAD \
+#define PyObject_VAR_HEAD \
+ PyObject_HEAD \
int ob_size; /* Number of items in variable part */
typedef struct _object {
- OB_HEAD
-} object;
+ PyObject_HEAD
+} PyObject;
typedef struct {
- OB_VARHEAD
+ PyObject_VAR_HEAD
} varobject;
@@ -124,7 +124,7 @@ Type objects contain a string containing the type name (to help somewhat
in debugging), the allocation parameters (see newobj() and newvarobj()),
and methods for accessing objects of the type. Methods are optional,a
nil pointer meaning that particular kind of access is not available for
-this type. The DECREF() macro uses the tp_dealloc method without
+this type. The Py_DECREF() macro uses the tp_dealloc method without
checking for a nil pointer; it should always be implemented except if
the implementation can guarantee that the reference count will never
reach zero (e.g., for type objects).
@@ -133,16 +133,16 @@ NB: the methods for certain type groups are now contained in separate
method blocks.
*/
-typedef object * (*unaryfunc) PROTO((object *));
-typedef object * (*binaryfunc) PROTO((object *, object *));
-typedef object * (*ternaryfunc) PROTO((object *, object *, object *));
-typedef int (*inquiry) PROTO((object *));
-typedef int (*coercion) PROTO((object **, object **));
-typedef object *(*intargfunc) PROTO((object *, int));
-typedef object *(*intintargfunc) PROTO((object *, int, int));
-typedef int(*intobjargproc) PROTO((object *, int, object *));
-typedef int(*intintobjargproc) PROTO((object *, int, int, object *));
-typedef int(*objobjargproc) PROTO((object *, object *, object *));
+typedef PyObject * (*unaryfunc) Py_PROTO((PyObject *));
+typedef PyObject * (*binaryfunc) Py_PROTO((PyObject *, PyObject *));
+typedef PyObject * (*ternaryfunc) Py_PROTO((PyObject *, PyObject *, PyObject *));
+typedef int (*inquiry) Py_PROTO((PyObject *));
+typedef int (*coercion) Py_PROTO((PyObject **, PyObject **));
+typedef PyObject *(*intargfunc) Py_PROTO((PyObject *, int));
+typedef PyObject *(*intintargfunc) Py_PROTO((PyObject *, int, int));
+typedef int(*intobjargproc) Py_PROTO((PyObject *, int, PyObject *));
+typedef int(*intintobjargproc) Py_PROTO((PyObject *, int, int, PyObject *));
+typedef int(*objobjargproc) Py_PROTO((PyObject *, PyObject *, PyObject *));
typedef struct {
binaryfunc nb_add;
@@ -168,7 +168,7 @@ typedef struct {
unaryfunc nb_float;
unaryfunc nb_oct;
unaryfunc nb_hex;
-} number_methods;
+} PyNumberMethods;
typedef struct {
inquiry sq_length;
@@ -178,24 +178,24 @@ typedef struct {
intintargfunc sq_slice;
intobjargproc sq_ass_item;
intintobjargproc sq_ass_slice;
-} sequence_methods;
+} PySequenceMethods;
typedef struct {
inquiry mp_length;
binaryfunc mp_subscript;
objobjargproc mp_ass_subscript;
-} mapping_methods;
+} PyMappingMethods;
-typedef void (*destructor) PROTO((object *));
-typedef int (*printfunc) PROTO((object *, FILE *, int));
-typedef object *(*getattrfunc) PROTO((object *, char *));
-typedef int (*setattrfunc) PROTO((object *, char *, object *));
-typedef int (*cmpfunc) PROTO((object *, object *));
-typedef object *(*reprfunc) PROTO((object *));
-typedef long (*hashfunc) PROTO((object *));
+typedef void (*destructor) Py_PROTO((PyObject *));
+typedef int (*printfunc) Py_PROTO((PyObject *, FILE *, int));
+typedef PyObject *(*getattrfunc) Py_PROTO((PyObject *, char *));
+typedef int (*setattrfunc) Py_PROTO((PyObject *, char *, PyObject *));
+typedef int (*cmpfunc) Py_PROTO((PyObject *, PyObject *));
+typedef PyObject *(*reprfunc) Py_PROTO((PyObject *));
+typedef long (*hashfunc) Py_PROTO((PyObject *));
typedef struct _typeobject {
- OB_VARHEAD
+ PyObject_VAR_HEAD
char *tp_name; /* For printing */
int tp_basicsize, tp_itemsize; /* For allocation */
@@ -210,9 +210,9 @@ typedef struct _typeobject {
/* Method suites for standard classes */
- number_methods *tp_as_number;
- sequence_methods *tp_as_sequence;
- mapping_methods *tp_as_mapping;
+ PyNumberMethods *tp_as_number;
+ PySequenceMethods *tp_as_sequence;
+ PyMappingMethods *tp_as_mapping;
/* More standard operations (at end for binary compatibility) */
@@ -235,36 +235,36 @@ typedef struct _typeobject {
int tp_maxalloc;
struct _typeobject *tp_next;
#endif
-} typeobject;
+} PyTypeObject;
-extern DL_IMPORT typeobject Typetype; /* The type of type objects */
+extern DL_IMPORT PyTypeObject PyType_Type; /* The type of type objects */
-#define is_typeobject(op) ((op)->ob_type == &Typetype)
+#define PyType_Check(op) ((op)->ob_type == &PyType_Type)
/* Generic operations on objects */
-extern int printobject PROTO((object *, FILE *, int));
-extern object * reprobject PROTO((object *));
-extern object * strobject PROTO((object *));
-extern int cmpobject PROTO((object *, object *));
-extern object *getattr PROTO((object *, char *));
-extern int hasattr PROTO((object *, char *));
-extern object *getattro PROTO((object *, object *));
-extern int setattro PROTO((object *, object *, object *));
-extern long hashobject PROTO((object *));
+extern int PyObject_Print Py_PROTO((PyObject *, FILE *, int));
+extern PyObject * PyObject_Repr Py_PROTO((PyObject *));
+extern PyObject * strobject Py_PROTO((PyObject *));
+extern int PyObject_Compare Py_PROTO((PyObject *, PyObject *));
+extern PyObject *PyObject_GetAttrString Py_PROTO((PyObject *, char *));
+extern int hasattr Py_PROTO((PyObject *, char *));
+extern PyObject *PyObject_GetAttr Py_PROTO((PyObject *, PyObject *));
+extern int PyObject_SetAttr Py_PROTO((PyObject *, PyObject *, PyObject *));
+extern long PyObject_Hash Py_PROTO((PyObject *));
/* Flag bits for printing: */
-#define PRINT_RAW 1 /* No string quotes etc. */
+#define Py_PRINT_RAW 1 /* No string quotes etc. */
/*
123456789-123456789-123456789-123456789-123456789-123456789-123456789-12
-The macros INCREF(op) and DECREF(op) are used to increment or decrement
-reference counts. DECREF calls the object's deallocator function; for
+The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement
+reference counts. Py_DECREF calls the object's deallocator function; for
objects that don't contain references to other objects or heap memory
this can be the standard function free(). Both macros can be used
whereever a void expression is allowed. The argument shouldn't be a
-NIL pointer. The macro NEWREF(op) is used only to initialize reference
-counts to 1; it is defined here for convenience.
+NIL pointer. The macro _Py_NewReference(op) is used only to initialize
+reference counts to 1; it is defined here for convenience.
We assume that the reference count field can never overflow; this can
be proven when the size of the field is the same as the pointer size
@@ -277,65 +277,65 @@ complications in the deallocation function. (This is actually a
decision that's up to the implementer of each new type so if you want,
you can count such references to the type object.)
-*** WARNING*** The DECREF macro must have a side-effect-free argument
+*** WARNING*** The Py_DECREF macro must have a side-effect-free argument
since it may evaluate its argument multiple times. (The alternative
would be to mace it a proper function or assign it to a global temporary
variable first, both of which are slower; and in a multi-threaded
environment the global variable trick is not safe.)
*/
-#ifdef TRACE_REFS
-#ifndef REF_DEBUG
-#define REF_DEBUG
+#ifdef Py_TRACE_REFS
+#ifndef Py_REF_DEBUG
+#define Py_REF_DEBUG
#endif
#endif
-#ifndef TRACE_REFS
+#ifndef Py_TRACE_REFS
#ifdef COUNT_ALLOCS
-#define DELREF(op) ((op)->ob_type->tp_free++, (*(op)->ob_type->tp_dealloc)((object *)(op)))
+#define _Py_Dealloc(op) ((op)->ob_type->tp_free++, (*(op)->ob_type->tp_dealloc)((PyObject *)(op)))
#else
-#define DELREF(op) (*(op)->ob_type->tp_dealloc)((object *)(op))
+#define _Py_Dealloc(op) (*(op)->ob_type->tp_dealloc)((PyObject *)(op))
#endif
-#define UNREF(op) /*empty*/
+#define _Py_ForgetReference(op) /*empty*/
#endif
#ifdef COUNT_ALLOCS
-extern void inc_count PROTO((typeobject *));
+extern void inc_count Py_PROTO((PyTypeObject *));
#endif
-#ifdef REF_DEBUG
+#ifdef Py_REF_DEBUG
extern long ref_total;
-#ifndef TRACE_REFS
+#ifndef Py_TRACE_REFS
#ifdef COUNT_ALLOCS
-#define NEWREF(op) (inc_count((op)->ob_type), ref_total++, (op)->ob_refcnt = 1)
+#define _Py_NewReference(op) (inc_count((op)->ob_type), ref_total++, (op)->ob_refcnt = 1)
#else
-#define NEWREF(op) (ref_total++, (op)->ob_refcnt = 1)
+#define _Py_NewReference(op) (ref_total++, (op)->ob_refcnt = 1)
#endif
#endif
-#define INCREF(op) (ref_total++, (op)->ob_refcnt++)
-#define DECREF(op) \
+#define Py_INCREF(op) (ref_total++, (op)->ob_refcnt++)
+#define Py_DECREF(op) \
if (--ref_total, --(op)->ob_refcnt != 0) \
; \
else \
- DELREF(op)
+ _Py_Dealloc(op)
#else
#ifdef COUNT_ALLOCS
-#define NEWREF(op) (inc_count((op)->ob_type), (op)->ob_refcnt = 1)
+#define _Py_NewReference(op) (inc_count((op)->ob_type), (op)->ob_refcnt = 1)
#else
-#define NEWREF(op) ((op)->ob_refcnt = 1)
+#define _Py_NewReference(op) ((op)->ob_refcnt = 1)
#endif
-#define INCREF(op) ((op)->ob_refcnt++)
-#define DECREF(op) \
+#define Py_INCREF(op) ((op)->ob_refcnt++)
+#define Py_DECREF(op) \
if (--(op)->ob_refcnt != 0) \
; \
else \
- DELREF(op)
+ _Py_Dealloc(op)
#endif
/* Macros to use in case the object pointer may be NULL: */
-#define XINCREF(op) if ((op) == NULL) ; else INCREF(op)
-#define XDECREF(op) if ((op) == NULL) ; else DECREF(op)
+#define Py_XINCREF(op) if ((op) == NULL) ; else Py_INCREF(op)
+#define Py_XDECREF(op) if ((op) == NULL) ; else Py_DECREF(op)
/* Definition of NULL, so you don't have to include <stdio.h> */
@@ -345,20 +345,20 @@ extern long ref_total;
/*
-NoObject is an object of undefined type which can be used in contexts
+_Py_NoneStruct is an object of undefined type which can be used in contexts
where NULL (nil) is not suitable (since NULL often means 'error').
-Don't forget to apply INCREF() when returning this value!!!
+Don't forget to apply Py_INCREF() when returning this value!!!
*/
-extern DL_IMPORT object NoObject; /* Don't use this directly */
+extern DL_IMPORT PyObject _Py_NoneStruct; /* Don't use this directly */
-#define None (&NoObject)
+#define Py_None (&_Py_NoneStruct)
/*
A common programming style in Python requires the forward declaration
-of static, initialized structures, e.g. for a typeobject that is used
+of static, initialized structures, e.g. for a type object that is used
by the functions whose address must be used in the initializer.
Some compilers (notably SCO ODT 3.0, I seem to remember early AIX as
well) botch this if you use the static keyword for both declarations
@@ -409,23 +409,26 @@ Reference Counts
It takes a while to get used to the proper usage of reference counts.
Functions that create an object set the reference count to 1; such new
-objects must be stored somewhere or destroyed again with DECREF().
-Functions that 'store' objects such as settupleitem() and dictinsert()
+objects must be stored somewhere or destroyed again with Py_DECREF().
+Functions that 'store' objects such as PyTuple_SetItem() and
+PyDict_SetItemString()
don't increment the reference count of the object, since the most
frequent use is to store a fresh object. Functions that 'retrieve'
-objects such as gettupleitem() and dictlookup() also don't increment
+objects such as PyTuple_GetItem() and PyDict_GetItemString() also
+don't increment
the reference count, since most frequently the object is only looked at
quickly. Thus, to retrieve an object and store it again, the caller
-must call INCREF() explicitly.
+must call Py_INCREF() explicitly.
-NOTE: functions that 'consume' a reference count like dictinsert() even
+NOTE: functions that 'consume' a reference count like
+PyDict_SetItemString() even
consume the reference if the object wasn't stored, to simplify error
handling.
It seems attractive to make other functions that take an object as
argument consume a reference count; however this may quickly get
confusing (even the current practice is already confusing). Consider
-it carefully, it may safe lots of calls to INCREF() and DECREF() at
+it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at
times.
123456789-123456789-123456789-123456789-123456789-123456789-123456789-12
diff --git a/Include/objimpl.h b/Include/objimpl.h
index a8ce3cb..cb27c7c 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -34,7 +34,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Additional macros for modules that implement new object types.
You must first include "object.h".
-NEWOBJ(type, typeobj) allocates memory for a new object of the given
+PyObject_NEW(type, typeobj) allocates memory for a new object of the given
type; here 'type' must be the C structure type used to represent the
object and 'typeobj' the address of the corresponding type object.
Reference count and type pointer are filled in; the rest of the bytes of
@@ -42,16 +42,16 @@ the object are *undefined*! The resulting expression type is 'type *'.
The size of the object is actually determined by the tp_basicsize field
of the type object.
-NEWVAROBJ(type, typeobj, n) is similar but allocates a variable-size
-object with n extra items. The size is computer as tp_basicsize plus
+PyObject_NEW_VAR(type, typeobj, n) is similar but allocates a variable-size
+object with n extra items. The size is computed as tp_basicsize plus
n * tp_itemsize. This fills in the ob_size field as well.
*/
-extern object *newobject PROTO((typeobject *));
-extern varobject *newvarobject PROTO((typeobject *, unsigned int));
+extern PyObject *_PyObject_New Py_PROTO((PyTypeObject *));
+extern varobject *_PyObject_NewVar Py_PROTO((PyTypeObject *, unsigned int));
-#define NEWOBJ(type, typeobj) ((type *) newobject(typeobj))
-#define NEWVAROBJ(type, typeobj, n) ((type *) newvarobject(typeobj, n))
+#define PyObject_NEW(type, typeobj) ((type *) _PyObject_New(typeobj))
+#define PyObject_NEW_VAR(type, typeobj, n) ((type *) _PyObject_NewVar(typeobj, n))
#ifdef __cplusplus
}
diff --git a/Include/parsetok.h b/Include/parsetok.h
index a568f46..7ef64cf 100644
--- a/Include/parsetok.h
+++ b/Include/parsetok.h
@@ -38,8 +38,8 @@ typedef struct {
char *text;
} perrdetail;
-extern node *parsestring PROTO((char *, grammar *, int, perrdetail *));
-extern node *parsefile PROTO((FILE *, char *, grammar *, int,
+extern node *PyParser_ParseString Py_PROTO((char *, grammar *, int, perrdetail *));
+extern node *PyParser_ParseFile Py_PROTO((FILE *, char *, grammar *, int,
char *, char *, perrdetail *));
#ifdef __cplusplus
diff --git a/Include/pgenheaders.h b/Include/pgenheaders.h
index 2f1bf50..8c6764b 100644
--- a/Include/pgenheaders.h
+++ b/Include/pgenheaders.h
@@ -49,7 +49,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "myproto.h"
#include "mymalloc.h"
-extern void fatal PROTO((char *));
+extern void Py_FatalError Py_PROTO((char *));
#ifdef __cplusplus
}
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index 69d2772..2fa551a 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -30,47 +30,45 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Error handling definitions */
-void err_set PROTO((object *));
-void err_setval PROTO((object *, object *));
-void err_restore PROTO((object *, object *, object *));
-void err_setstr PROTO((object *, char *));
-object *err_occurred PROTO((void));
-void err_fetch PROTO((object **, object **, object **));
-void err_clear PROTO((void));
+void PyErr_SetNone Py_PROTO((PyObject *));
+void PyErr_SetObject Py_PROTO((PyObject *, PyObject *));
+void PyErr_SetString Py_PROTO((PyObject *, char *));
+PyObject *PyErr_Occurred Py_PROTO((void));
+void PyErr_Clear Py_PROTO((void));
+void PyErr_Fetch Py_PROTO((PyObject **, PyObject **, PyObject **));
+void PyErr_Restore Py_PROTO((PyObject *, PyObject *, PyObject *));
/* Predefined exceptions */
-extern DL_IMPORT object *AccessError;
-extern DL_IMPORT object *AttributeError;
-extern DL_IMPORT object *ConflictError;
-extern DL_IMPORT object *EOFError;
-extern DL_IMPORT object *IOError;
-extern DL_IMPORT object *ImportError;
-extern DL_IMPORT object *IndexError;
-extern DL_IMPORT object *KeyError;
-extern DL_IMPORT object *KeyboardInterrupt;
-extern DL_IMPORT object *MemoryError;
-extern DL_IMPORT object *NameError;
-extern DL_IMPORT object *OverflowError;
-extern DL_IMPORT object *RuntimeError;
-extern DL_IMPORT object *SyntaxError;
-extern DL_IMPORT object *SystemError;
-extern DL_IMPORT object *SystemExit;
-extern DL_IMPORT object *TypeError;
-extern DL_IMPORT object *ValueError;
-extern DL_IMPORT object *ZeroDivisionError;
+extern DL_IMPORT PyObject *PyExc_AccessError;
+extern DL_IMPORT PyObject *PyExc_AttributeError;
+extern DL_IMPORT PyObject *PyExc_ConflictError;
+extern DL_IMPORT PyObject *PyExc_EOFError;
+extern DL_IMPORT PyObject *PyExc_IOError;
+extern DL_IMPORT PyObject *PyExc_ImportError;
+extern DL_IMPORT PyObject *PyExc_IndexError;
+extern DL_IMPORT PyObject *PyExc_KeyError;
+extern DL_IMPORT PyObject *PyExc_KeyboardInterrupt;
+extern DL_IMPORT PyObject *PyExc_MemoryError;
+extern DL_IMPORT PyObject *PyExc_NameError;
+extern DL_IMPORT PyObject *PyExc_OverflowError;
+extern DL_IMPORT PyObject *PyExc_RuntimeError;
+extern DL_IMPORT PyObject *PyExc_SyntaxError;
+extern DL_IMPORT PyObject *PyExc_SystemError;
+extern DL_IMPORT PyObject *PyExc_SystemExit;
+extern DL_IMPORT PyObject *PyExc_TypeError;
+extern DL_IMPORT PyObject *PyExc_ValueError;
+extern DL_IMPORT PyObject *PyExc_ZeroDivisionError;
/* Convenience functions */
-extern int err_badarg PROTO((void));
-extern object *err_nomem PROTO((void));
-extern object *err_errno PROTO((object *));
+extern int PyErr_BadArgument Py_PROTO((void));
+extern PyObject *PyErr_NoMemory Py_PROTO((void));
+extern PyObject *PyErr_SetFromErrno Py_PROTO((PyObject *));
-extern void err_badcall PROTO((void));
+extern void PyErr_BadInternalCall Py_PROTO((void));
-extern object *err_getexc PROTO((void));
-
-extern int sigcheck PROTO((void)); /* In sigcheck.c or signalmodule.c */
+extern int sigcheck Py_PROTO((void)); /* In sigcheck.c or signalmodule.c */
#ifdef __cplusplus
}
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index f59e54e..cecb0cc 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -30,31 +30,31 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Interfaces to parse and execute pieces of python code */
-void initall PROTO((void));
+void Py_Initialize Py_PROTO((void));
-int run PROTO((FILE *, char *));
+int PyRun_AnyFile Py_PROTO((FILE *, char *));
-int run_command PROTO((char *));
-int run_script PROTO((FILE *, char *));
-int run_tty_1 PROTO((FILE *, char *));
-int run_tty_loop PROTO((FILE *, char *));
+int PyRun_SimpleString Py_PROTO((char *));
+int PyRun_SimpleFile Py_PROTO((FILE *, char *));
+int PyRun_InteractiveOne Py_PROTO((FILE *, char *));
+int PyRun_InteractiveLoop Py_PROTO((FILE *, char *));
-struct _node *parse_string PROTO((char *, int));
-struct _node *parse_file PROTO((FILE *, char *, int));
+struct _node *PyParser_SimpleParseString Py_PROTO((char *, int));
+struct _node *PyParser_SimpleParseFile Py_PROTO((FILE *, char *, int));
-object *run_string PROTO((char *, int, object *, object *));
-object *run_file PROTO((FILE *, char *, int, object *, object *));
-object *run_pyc_file PROTO((FILE *, char *, object *, object *));
+PyObject *PyRun_String Py_PROTO((char *, int, PyObject *, PyObject *));
+PyObject *PyRun_File Py_PROTO((FILE *, char *, int, PyObject *, PyObject *));
+PyObject *run_pyc_file Py_PROTO((FILE *, char *, PyObject *, PyObject *));
-object *compile_string PROTO((char *, char *, int));
+PyObject *Py_CompileString Py_PROTO((char *, char *, int));
-void print_error PROTO((void));
+void PyErr_Print Py_PROTO((void));
-int Py_AtExit PROTO((void (*func) PROTO((void))));
+int Py_AtExit Py_PROTO((void (*func) Py_PROTO((void))));
-void goaway PROTO((int));
+void Py_Exit Py_PROTO((int));
-void cleanup PROTO((void));
+void cleanup Py_PROTO((void));
#ifdef __cplusplus
}
diff --git a/Include/pythread.h b/Include/pythread.h
index 680b7fb..3a04a8b 100644
--- a/Include/pythread.h
+++ b/Include/pythread.h
@@ -4,11 +4,11 @@
#define NO_EXIT_PROG /* don't define exit_prog() */
/* (the result is no use of signals on SGI) */
-#ifndef PROTO
+#ifndef Py_PROTO
#if defined(__STDC__) || defined(__cplusplus)
-#define PROTO(args) args
+#define Py_PROTO(args) args
#else
-#define PROTO(args) ()
+#define Py_PROTO(args) ()
#endif
#endif
@@ -19,27 +19,27 @@ typedef void *type_sema;
extern "C" {
#endif
-void init_thread PROTO((void));
-int start_new_thread PROTO((void (*)(void *), void *));
-void exit_thread PROTO((void));
-void _exit_thread PROTO((void));
-long get_thread_ident PROTO((void));
+void init_thread Py_PROTO((void));
+int start_new_thread Py_PROTO((void (*)(void *), void *));
+void exit_thread Py_PROTO((void));
+void _exit_thread Py_PROTO((void));
+long get_thread_ident Py_PROTO((void));
-type_lock allocate_lock PROTO((void));
-void free_lock PROTO((type_lock));
-int acquire_lock PROTO((type_lock, int));
+type_lock allocate_lock Py_PROTO((void));
+void free_lock Py_PROTO((type_lock));
+int acquire_lock Py_PROTO((type_lock, int));
#define WAIT_LOCK 1
#define NOWAIT_LOCK 0
-void release_lock PROTO((type_lock));
+void release_lock Py_PROTO((type_lock));
-type_sema allocate_sema PROTO((int));
-void free_sema PROTO((type_sema));
-void down_sema PROTO((type_sema));
-void up_sema PROTO((type_sema));
+type_sema allocate_sema Py_PROTO((int));
+void free_sema Py_PROTO((type_sema));
+void down_sema Py_PROTO((type_sema));
+void up_sema Py_PROTO((type_sema));
#ifndef NO_EXIT_PROG
-void exit_prog PROTO((int));
-void _exit_prog PROTO((int));
+void exit_prog Py_PROTO((int));
+void _exit_prog Py_PROTO((int));
#endif
#ifdef __cplusplus
diff --git a/Include/rangeobject.h b/Include/rangeobject.h
index d35f1fd..f7ed0f1 100644
--- a/Include/rangeobject.h
+++ b/Include/rangeobject.h
@@ -34,8 +34,8 @@ Range objects behave like the corresponding tuple objects except that
they are represented by a start, stop, and step datamembers.
*/
-extern DL_IMPORT typeobject Rangetype;
+extern DL_IMPORT PyTypeObject Rangetype;
#define is_rangeobject(op) ((op)->ob_type == &Rangetype)
-extern object *newrangeobject PROTO((long, long, long, int));
+extern PyObject *newrangeobject Py_PROTO((long, long, long, int));
diff --git a/Include/rename2.h b/Include/rename2.h
new file mode 100644
index 0000000..5031b83
--- /dev/null
+++ b/Include/rename2.h
@@ -0,0 +1,379 @@
+#ifndef Py_OLDNAMES_H
+#define Py_OLDNAMES_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***********************************************************
+Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
+The Netherlands.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Stichting Mathematisch
+Centrum or CWI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+/* This file contains a bunch of #defines that make it possible to use
+ "old style" names (e.g. object) with the new style Python source
+ distribution. */
+
+#define True Py_True
+#define False Py_False
+#define None Py_None
+
+/* typedef ANY *PyUnivPtr; */
+#define methodlist PyMethodDef
+
+#define None Py_None
+#define False Py_False
+#define True Py_True
+
+#define Accesstype PyAccess_Type
+#define is_accessobject PyAccess_Check
+#define newaccessobject PyAccess_FromValue
+#define getaccessvalue PyAccess_AsValue
+#define setaccessvalue PyAccess_SetValue
+
+#ifdef Py_TRACE_REFS
+#define TRACE_REFS
+#endif
+
+#ifdef Py_REF_DEBUG
+#define REF_DEBUG
+#endif
+
+#define FalseObject _Py_ZeroStruct
+#define NoObject _Py_NoneStruct
+#define TrueObject _Py_TrueStruct
+#define debugging Py_DebugFlag
+#define gram _PyParser_Grammar
+#define sys_profile _PySys_ProfileFunc
+#define sys_trace _PySys_TraceFunc
+#define sys_checkinterval _PySys_CheckInterval
+#define threads_started _PyThread_Started
+#define tok_name _PyParser_TokenNames
+#define verbose Py_VerboseFlag
+#define AccessError PyExc_AccessError
+#define AttributeError PyExc_AttributeError
+#define ConflictError PyExc_ConflictError
+#define EOFError PyExc_EOFError
+#define IOError PyExc_IOError
+#define ImportError PyExc_ImportError
+#define IndexError PyExc_IndexError
+#define KeyError PyExc_KeyError
+#define MemoryError PyExc_MemoryError
+#define NameError PyExc_NameError
+#define OverflowError PyExc_OverflowError
+#define RuntimeError PyExc_RuntimeError
+#define SyntaxError PyExc_SyntaxError
+#define SystemError PyExc_SystemError
+#define TypeError PyExc_TypeError
+#define ValueError PyExc_ValueError
+#define ZeroDivisionError PyExc_ZeroDivisionError
+#define KeyboardInterrupt PyExc_KeyboardInterrupt
+#define SystemExit PyExc_SystemExit
+#define Floattype PyFloat_Type
+#define Inttype PyInt_Type
+#define Longtype PyLong_Type
+#define Notype PyNothing_Type
+#define Stringtype PyString_Type
+#define Typetype PyType_Type
+#define Listtype PyList_Type
+#define Dicttype PyDict_Type
+#define Tupletype PyTuple_Type
+#define Filetype PyFile_Type
+#define Classtype PyClass_Type
+#define Functype PyFunction_Type
+#define Instancemethodtype PyMethod_Type
+#define Instancetype PyInstance_Type
+#define Methodtype PyCFunction_Type
+#define Moduletype PyModule_Type
+#define Codetype PyCode_Type
+#define Frametype PyFrame_Type
+#define floatobject PyFloatObject
+#define intobject PyIntObject
+#define longobject PyLongObject
+#define noobject PyNothingObject
+#define object PyObject
+#define stringobject PyStringObject
+#define typeobject PyTypeObject
+#define listobject PyListObject
+#define dictobject PyDictObject
+#define tupleobject PyTupleObject
+#define fileobject PyFileObject
+#define classobject PyClassObject
+#define codeobject PyCodeObject
+#define frameobject PyFrameObject
+#define funcobject PyFunctionObject
+#define instancemethodobject PyMethodObject
+#define instanceobject PyInstanceObject
+#define methodobject PyCFunctionObject
+#define moduleobject PyModuleObject
+#define number_methods PyNumberMethods
+#define sequence_methods PySequenceMethods
+#define mapping_methods PyMappingMethods
+#define OB_HEAD PyObject_HEAD
+#define OB_VARHEAD PyObject_VAR_HEAD
+#define OB_HEAD_INIT PyObject_HEAD_INIT
+#define NEWOBJ PyObject_NEW
+#define NEWVAROBJ PyObject_NEW_VAR
+#define PROTO Py_PROTO
+#define FPROTO Py_FPROTO
+#define NEW PyMem_NEW
+#define RESIZE PyMem_RESIZE
+#define DEL PyMem_DEL
+#define XDEL PyMem_XDEL
+#define BGN_SAVE Py_BEGIN_ALLOW_THREADS
+#define RET_SAVE Py_BLOCK_THREADS
+#define RES_SAVE Py_UNBLOCK_THREADS
+#define END_SAVE Py_END_ALLOW_THREADS
+#define is_floatobject PyFloat_Check
+#define is_intobject PyInt_Check
+#define is_longobject PyLong_Check
+#define is_noobject PyNothing_Check
+#define is_stringobject PyString_Check
+#define is_typeobject PyType_Check
+#define is_listobject PyList_Check
+#define is_dictobject PyDict_Check
+#define is_tupleobject PyTuple_Check
+#define is_fileobject PyFile_Check
+#define is_classobject PyClass_Check
+#define is_codeobject PyCode_Check
+#define is_frameobject PyFrame_Check
+#define is_funcobject PyFunction_Check
+#define is_instancemethodobject PyMethod_Check
+#define is_instanceobject PyInstance_Check
+#define is_methodobject PyCFunction_Check
+#define is_moduleobject PyModule_Check
+#define INCREF Py_INCREF
+#define DECREF Py_DECREF
+#define XINCREF Py_XINCREF
+#define XDECREF Py_XDECREF
+#define NEWREF _Py_NewReference
+#define DELREF _Py_Dealloc
+#define UNREF _Py_ForgetReference
+#define cmpobject PyObject_Compare
+#define getattr PyObject_GetAttrString
+#define getattro PyObject_GetAttr
+#define hashobject PyObject_Hash
+#define newobject _PyObject_New
+#define newvarobject _PyObject_NewVar
+#define printobject PyObject_Print
+#define reprobject PyObject_Repr
+#define setattr PyObject_SetAttrString
+#define setattro PyObject_SetAttr
+#define testbool PyObject_IsTrue
+#define PRINT_RAW Py_PRINT_RAW
+#define float_buf_repr PyFloat_AsString
+#define getfloatvalue PyFloat_AsDouble
+#define GETFLOATVALUE PyFloat_AS_DOUBLE
+#define newfloatobject PyFloat_FromDouble
+#define getintvalue PyInt_AsLong
+#define GETINTVALUE PyInt_AS_LONG
+#define newintobject PyInt_FromLong
+#define alloclongobject _PyLong_New
+#define dgetlongvalue PyLong_AsDouble
+#define dnewlongobject PyLong_FromDouble
+#define getlongvalue PyLong_AsLong
+#define long_scan PyLong_FromString
+#define newlongobject PyLong_FromLong
+#define formatstring PyString_Format
+#define getstringsize PyString_Size
+#define getstringvalue PyString_AsString
+#define GETSTRINGVALUE PyString_AS_STRING
+#define joinstring PyString_Concat
+#define newsizedstringobject PyString_FromStringAndSize
+#define newstringobject PyString_FromString
+#define resizestring _PyString_Resize
+#define addlistitem PyList_Append
+#define getlistitem PyList_GetItem
+#define GETLISTITEM PyList_GET_ITEM
+#define getlistsize PyList_Size
+#define getlistslice PyList_GetSlice
+#define inslistitem PyList_Insert
+#define newlistobject PyList_New
+#define setlistitem PyList_SetItem
+#define setlistslice PyList_SetSlice
+#define sortlist PyList_Sort
+#define dictinsert PyDict_SetItemString
+#define dictlookup PyDict_GetItemString
+#define dictremove PyDict_DelItemString
+#define getmappingitems PyDict_Items
+#define getmappingkeys PyDict_Keys
+#define getmappingvalues PyDict_Values
+#define mappingclear PyDict_Clear
+#define mappinggetnext PyDict_Next
+#define mappinginsert PyDict_SetItem
+#define mappinglookup PyDict_GetItem
+#define mappingremove PyDict_DelItem
+#define newmappingobject PyDict_New
+#define gettupleitem PyTuple_GetItem
+#define GETTUPLEITEM PyTuple_GET_ITEM
+#define gettuplesize PyTuple_Size
+#define gettupleslice PyTuple_GetSlice
+#define newtupleobject PyTuple_New
+#define settupleitem PyTuple_SetItem
+#define filegetline PyFile_GetLine
+#define getfilefile PyFile_AsFile
+#define newfileobject PyFile_FromString
+#define newopenfileobject PyFile_FromFile
+#define softspace PyFile_SoftSpace
+#define writeobject PyFile_WriteObject
+#define writestring PyFile_WriteString
+#define instancemethodgetclass PyMethod_Class
+#define instancemethodgetfunc PyMethod_Function
+#define instancemethodgetself PyMethod_Self
+#define issubclass PyClass_IsSubclass
+#define newclassobject PyClass_New
+#define newinstancemethodobject PyMethod_New
+#define newinstanceobject PyInstance_New
+#define block PyTryBlock
+#define extend_stack PyFrame_ExtendStack
+#define newframeobject PyFrame_New
+#define pop_block PyFrame_BlockPop
+#define setup_block PyFrame_BlockSetup
+#define getfunccode PyFunction_GetCode
+#define getfuncglobals PyFunction_GetGlobals
+#define newfuncobject PyFunction_New
+#define method PyCFunction
+#define findmethod Py_FindMethod
+#define getmethod PyCFunction_GetFunction
+#define getself PyCFunction_GetSelf
+#define getvarargs PyCFunction_IsVarArgs
+#define newmethodobject PyCFunction_New
+#define getmoduledict PyModule_GetDict
+#define getmodulename PyModule_GetName
+#define newmoduleobject PyModule_New
+#define addaccelerators PyGrammar_AddAccelerators
+#define finddfa PyGrammar_FindDFA
+#define labelrepr PyGrammar_LabelRepr
+#define listtree PyNode_ListTree
+#define addchild PyNode_AddChild
+#define freetree PyNode_Free
+#define newtree PyNode_New
+#define addtoken PyParser_AddToken
+#define delparser PyParser_Delete
+#define newparser PyParser_New
+#define parsefile PyParser_ParseFile
+#define parsestring PyParser_ParseString
+#define tok_1char PyToken_OneChar
+#define tok_2char PyToken_TwoChars
+#define tok_free PyTokenizer_Free
+#define tok_get PyTokenizer_Get
+#define tok_setupf PyTokenizer_FromFile
+#define tok_setups PyTokenizer_FromString
+#define compile PyNode_Compile
+#define newcodeobject PyCode_New
+#define call_object PyEval_CallObject
+#define eval_code PyEval_EvalCode
+#define flushline Py_FlushLine
+#define getbuiltins PyEval_GetBuiltins
+#define getglobals PyEval_GetGlobals
+#define getlocals PyEval_GetLocals
+#define getowner PyEval_GetOwner
+#define getframe PyEval_GetFrame
+#define getrestricted PyEval_GetRestricted
+#define init_save_thread PyEval_InitThreads
+#define printtraceback PyErr_PrintTraceBack
+#define restore_thread PyEval_RestoreThread
+#define save_thread PyEval_SaveThread
+#define tb_fetch PyTraceBack_Fetch
+#define tb_here PyTraceBack_Here
+#define tb_print PyTraceBack_Print
+#define tb_store PyTraceBack_Store
+#define add_module PyImport_AddModule
+#define doneimport PyImport_Cleanup
+#define get_modules PyImport_GetModuleDict
+#define import_module PyImport_ImportModule
+#define init_frozen PyImport_ImportFrozenModule
+#define initimport PyImport_Init
+#define reload_module PyImport_ReloadModule
+#define coerce PyNumber_Coerce
+#define getbuiltin PyBuiltin_GetObject
+#define initbuiltin PyBuiltin_Init
+#define initmarshal PyMarshal_Init
+#define initmodule Py_InitModule
+#define initmodule4 Py_InitModule4
+#define rd_long PyMarshal_ReadLongFromFile
+#define rd_object PyMarshal_ReadObjectFromFile
+#define rds_object PyMarshal_ReadObjectFromString
+#define wr_long PyMarshal_WriteLongToFile
+#define wr_object PyMarshal_WriteObjectToFile
+#define initsys PySys_Init
+#define setpythonargv PySys_SetArgv
+#define setpythonpath PySys_SetPath
+#define sysget PySys_GetObject
+#define sysgetfile PySys_GetFile
+#define sysset PySys_SetObject
+#define compile_string Py_CompileString
+#define fatal Py_FatalError
+#define goaway Py_Exit
+#define initall Py_Initialize
+#define print_error PyErr_Print
+#define parse_file PyParser_SimpleParseFile
+#define parse_string PyParser_SimpleParseString
+#define run PyRun_AnyFile
+#define run_script PyRun_SimpleFile
+#define run_command PyRun_SimpleString
+#define run_file PyRun_File
+#define run_string PyRun_String
+#define run_tty_1 PyRun_InteractiveOne
+#define run_tty_loop PyRun_InteractiveLoop
+#define getmember PyMember_Get
+#define setmember PyMember_Set
+#define mkvalue Py_BuildValue
+#define vmkvalue Py_VaBuildValue
+#define getargs PyArg_Parse
+#define newgetargs PyArg_ParseTuple
+#define getichararg PyArg_GetChar
+#define getidoublearray PyArg_GetDoubleArray
+#define getifloatarg PyArg_GetFloat
+#define getifloatarray PyArg_GetFloatArray
+#define getnoarg(v) PyArg_NoArgs(v)
+#define getintarg(v,a) getargs((v),"i",(a))
+#define getlongarg(v,a) getargs((v),"l",(a))
+#define getstrarg(v,a) getargs((v),"s",(a))
+#define getilongarg PyArg_GetLong
+#define getilongarray PyArg_GetLongArray
+#define getilongarraysize PyArg_GetLongArraySize
+#define getiobjectarg PyArg_GetObject
+#define getishortarg PyArg_GetShort
+#define getishortarray PyArg_GetShortArray
+#define getishortarraysize PyArg_GetShortArraySize
+#define getistringarg PyArg_GetString
+#define err_badarg PyErr_BadArgument
+#define err_badcall PyErr_BadInternalCall
+#define err_input PyErr_Input
+#define err_nomem PyErr_NoMemory
+#define err_errno PyErr_SetFromErrno
+#define err_set PyErr_SetNone
+#define err_setstr PyErr_SetString
+#define err_setval PyErr_SetObject
+#define err_occurred PyErr_Occurred
+#define err_fetch PyErr_Fetch
+#define err_restore PyErr_Restore
+#define err_clear PyErr_Clear
+#define fgets_intr PyOS_InterruptableGetString
+#define initintr PyOS_InitInterrupts
+#define intrcheck PyOS_InterruptOccurred
+#define getmtime PyOS_GetLastModificationTime
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_OLDNAMES_H */
diff --git a/Include/stringobject.h b/Include/stringobject.h
index 67bb57b..1dac98e 100644
--- a/Include/stringobject.h
+++ b/Include/stringobject.h
@@ -33,7 +33,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/*
123456789-123456789-123456789-123456789-123456789-123456789-123456789-12
-Type stringobject represents a character string. An extra zero byte is
+Type PyStringObject represents a character string. An extra zero byte is
reserved at the end to ensure it is zero-terminated, but a size is
present so strings with null bytes in them can be represented. This
is an immutable object type.
@@ -50,28 +50,28 @@ functions should be applied to nil objects.
/* NB The type is revealed here only because it is used in dictobject.c */
typedef struct {
- OB_VARHEAD
+ PyObject_VAR_HEAD
#ifdef CACHE_HASH
long ob_shash;
#endif
char ob_sval[1];
-} stringobject;
+} PyStringObject;
-extern DL_IMPORT typeobject Stringtype;
+extern DL_IMPORT PyTypeObject PyString_Type;
-#define is_stringobject(op) ((op)->ob_type == &Stringtype)
+#define PyString_Check(op) ((op)->ob_type == &PyString_Type)
-extern object *newsizedstringobject PROTO((char *, int));
-extern object *newstringobject PROTO((char *));
-extern int getstringsize PROTO((object *));
-extern char *getstringvalue PROTO((object *));
-extern void joinstring PROTO((object **, object *));
-extern void joinstring_decref PROTO((object **, object *));
-extern int resizestring PROTO((object **, int));
-extern object *formatstring PROTO((object *, object *));
+extern PyObject *PyString_FromStringAndSize Py_PROTO((char *, int));
+extern PyObject *PyString_FromString Py_PROTO((char *));
+extern int PyString_Size Py_PROTO((PyObject *));
+extern char *PyString_AsString Py_PROTO((PyObject *));
+extern void PyString_Concat Py_PROTO((PyObject **, PyObject *));
+extern void joinstring_decref Py_PROTO((PyObject **, PyObject *));
+extern int _PyString_Resize Py_PROTO((PyObject **, int));
+extern PyObject *PyString_Format Py_PROTO((PyObject *, PyObject *));
/* Macro, trading safety for speed */
-#define GETSTRINGVALUE(op) ((op)->ob_sval)
+#define PyString_AS_STRING(op) ((op)->ob_sval)
#ifdef __cplusplus
}
diff --git a/Include/structmember.h b/Include/structmember.h
index 50589fa..0c00856 100644
--- a/Include/structmember.h
+++ b/Include/structmember.h
@@ -46,7 +46,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* An array of memberlist structures defines the name, type and offset
of selected members of a C structure. These can be read by
- getmember() and set by setmember() (except if their READONLY flag
+ PyMember_Get() and set by PyMember_Set() (except if their READONLY flag
is set). The array must be terminated with an entry whose name
pointer is NULL. */
@@ -85,8 +85,8 @@ struct memberlist {
#define READONLY 1
#define RO READONLY /* Shorthand */
-object *getmember PROTO((char *, struct memberlist *, char *));
-int setmember PROTO((char *, struct memberlist *, char *, object *));
+PyObject *PyMember_Get Py_PROTO((char *, struct memberlist *, char *));
+int PyMember_Set Py_PROTO((char *, struct memberlist *, char *, PyObject *));
#ifdef __cplusplus
}
diff --git a/Include/sysmodule.h b/Include/sysmodule.h
index 1f1589a..8d31748 100644
--- a/Include/sysmodule.h
+++ b/Include/sysmodule.h
@@ -30,13 +30,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* System module interface */
-object *sysget PROTO((char *));
-int sysset PROTO((char *, object *));
-FILE *sysgetfile PROTO((char *, FILE *));
-void initsys PROTO((void));
+PyObject *PySys_GetObject Py_PROTO((char *));
+int PySys_SetObject Py_PROTO((char *, PyObject *));
+FILE *PySys_GetFile Py_PROTO((char *, FILE *));
+void PySys_Init Py_PROTO((void));
-extern DL_IMPORT object *sys_trace, *sys_profile;
-extern DL_IMPORT int sys_checkinterval;
+extern DL_IMPORT PyObject *_PySys_TraceFunc, *_PySys_ProfileFunc;
+extern DL_IMPORT int _PySys_CheckInterval;
#ifdef __cplusplus
}
diff --git a/Include/thread.h b/Include/thread.h
index 680b7fb..3a04a8b 100644
--- a/Include/thread.h
+++ b/Include/thread.h
@@ -4,11 +4,11 @@
#define NO_EXIT_PROG /* don't define exit_prog() */
/* (the result is no use of signals on SGI) */
-#ifndef PROTO
+#ifndef Py_PROTO
#if defined(__STDC__) || defined(__cplusplus)
-#define PROTO(args) args
+#define Py_PROTO(args) args
#else
-#define PROTO(args) ()
+#define Py_PROTO(args) ()
#endif
#endif
@@ -19,27 +19,27 @@ typedef void *type_sema;
extern "C" {
#endif
-void init_thread PROTO((void));
-int start_new_thread PROTO((void (*)(void *), void *));
-void exit_thread PROTO((void));
-void _exit_thread PROTO((void));
-long get_thread_ident PROTO((void));
+void init_thread Py_PROTO((void));
+int start_new_thread Py_PROTO((void (*)(void *), void *));
+void exit_thread Py_PROTO((void));
+void _exit_thread Py_PROTO((void));
+long get_thread_ident Py_PROTO((void));
-type_lock allocate_lock PROTO((void));
-void free_lock PROTO((type_lock));
-int acquire_lock PROTO((type_lock, int));
+type_lock allocate_lock Py_PROTO((void));
+void free_lock Py_PROTO((type_lock));
+int acquire_lock Py_PROTO((type_lock, int));
#define WAIT_LOCK 1
#define NOWAIT_LOCK 0
-void release_lock PROTO((type_lock));
+void release_lock Py_PROTO((type_lock));
-type_sema allocate_sema PROTO((int));
-void free_sema PROTO((type_sema));
-void down_sema PROTO((type_sema));
-void up_sema PROTO((type_sema));
+type_sema allocate_sema Py_PROTO((int));
+void free_sema Py_PROTO((type_sema));
+void down_sema Py_PROTO((type_sema));
+void up_sema Py_PROTO((type_sema));
#ifndef NO_EXIT_PROG
-void exit_prog PROTO((int));
-void _exit_prog PROTO((int));
+void exit_prog Py_PROTO((int));
+void _exit_prog Py_PROTO((int));
#endif
#ifdef __cplusplus
diff --git a/Include/token.h b/Include/token.h
index 0e138fc..2be3a30 100644
--- a/Include/token.h
+++ b/Include/token.h
@@ -66,7 +66,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define CIRCUMFLEX 33
#define LEFTSHIFT 34
#define RIGHTSHIFT 35
-/* Don't forget to update the table tok_name in tokenizer.c! */
+/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */
#define OP 36
#define ERRORTOKEN 37
#define N_TOKENS 38
@@ -80,9 +80,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define ISEOF(x) ((x) == ENDMARKER)
-extern char *tok_name[]; /* Token names */
-extern int tok_1char PROTO((int));
-extern int tok_2char PROTO((int, int));
+extern char *_PyParser_TokenNames[]; /* Token names */
+extern int PyToken_OneChar Py_PROTO((int));
+extern int PyToken_TwoChars Py_PROTO((int, int));
#ifdef __cplusplus
}
diff --git a/Include/traceback.h b/Include/traceback.h
index bc9422b..c04f515 100644
--- a/Include/traceback.h
+++ b/Include/traceback.h
@@ -32,10 +32,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
struct _frame;
-int tb_here PROTO((struct _frame *));
-object *tb_fetch PROTO((void));
-int tb_store PROTO((object *));
-int tb_print PROTO((object *, object *));
+int PyTraceBack_Here Py_PROTO((struct _frame *));
+PyObject *PyTraceBack_Fetch Py_PROTO((void));
+int PyTraceBack_Store Py_PROTO((PyObject *));
+int PyTraceBack_Print Py_PROTO((PyObject *, PyObject *));
#ifdef __cplusplus
}
diff --git a/Include/tupleobject.h b/Include/tupleobject.h
index b57c017..17d6c4a 100644
--- a/Include/tupleobject.h
+++ b/Include/tupleobject.h
@@ -37,31 +37,31 @@ Another generally useful object type is an tuple of object pointers.
This is a mutable type: the tuple items can be changed (but not their
number). Out-of-range indices or non-tuple objects are ignored.
-*** WARNING *** settupleitem does not increment the new item's reference
+*** WARNING *** PyTuple_SetItem does not increment the new item's reference
count, but does decrement the reference count of the item it replaces,
if not nil. It does *decrement* the reference count if it is *not*
-inserted in the tuple. Similarly, gettupleitem does not increment the
+inserted in the tuple. Similarly, PyTuple_GetItem does not increment the
returned item's reference count.
*/
typedef struct {
- OB_VARHEAD
- object *ob_item[1];
-} tupleobject;
+ PyObject_VAR_HEAD
+ PyObject *ob_item[1];
+} PyTupleObject;
-extern DL_IMPORT typeobject Tupletype;
+extern DL_IMPORT PyTypeObject PyTuple_Type;
-#define is_tupleobject(op) ((op)->ob_type == &Tupletype)
+#define PyTuple_Check(op) ((op)->ob_type == &PyTuple_Type)
-extern object *newtupleobject PROTO((int size));
-extern int gettuplesize PROTO((object *));
-extern object *gettupleitem PROTO((object *, int));
-extern int settupleitem PROTO((object *, int, object *));
-extern object *gettupleslice PROTO((object *, int, int));
-extern int resizetuple PROTO((object **, int, int));
+extern PyObject *PyTuple_New Py_PROTO((int size));
+extern int PyTuple_Size Py_PROTO((PyObject *));
+extern PyObject *PyTuple_GetItem Py_PROTO((PyObject *, int));
+extern int PyTuple_SetItem Py_PROTO((PyObject *, int, PyObject *));
+extern PyObject *PyTuple_GetSlice Py_PROTO((PyObject *, int, int));
+extern int resizetuple Py_PROTO((PyObject **, int, int));
/* Macro, trading safety for speed */
-#define GETTUPLEITEM(op, i) ((op)->ob_item[i])
+#define PyTuple_GET_ITEM(op, i) ((op)->ob_item[i])
#ifdef __cplusplus
}