Commit caa63808 authored by Guido van Rossum's avatar Guido van Rossum

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".
parent 94390ec2
/* Header file to be included by modules using new naming conventions */ /* Header file to be included by modules using new naming conventions */
#define Py_USE_NEW_NAMES
#include "allobjects.h" #include "allobjects.h"
#include "rename1.h"
...@@ -46,19 +46,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -46,19 +46,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define AC_R_PUBLIC 0004 #define AC_R_PUBLIC 0004
#define AC_W_PUBLIC 0002 #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)); PyObject *newaccessobject Py_PROTO((PyObject *, PyObject *, PyTypeObject *, int));
object *getaccessvalue PROTO((object *, object *)); PyObject *getaccessvalue Py_PROTO((PyObject *, PyObject *));
int setaccessvalue PROTO((object *, object *, object *)); int setaccessvalue Py_PROTO((PyObject *, PyObject *, PyObject *));
void setaccessowner PROTO((object *, object *)); void setaccessowner Py_PROTO((PyObject *, PyObject *));
object *cloneaccessobject PROTO((object *)); PyObject *cloneaccessobject Py_PROTO((PyObject *));
int hasaccessvalue PROTO((object *)); int hasaccessvalue Py_PROTO((PyObject *));
extern DL_IMPORT typeobject Anynumbertype, Anysequencetype, Anymappingtype; extern DL_IMPORT PyTypeObject Anynumbertype, Anysequencetype, Anymappingtype;
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -49,6 +49,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -49,6 +49,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include "myproto.h" #include "myproto.h"
...@@ -76,9 +77,17 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -76,9 +77,17 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "modsupport.h" #include "modsupport.h"
#include "ceval.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 #ifdef __cplusplus
} }
#endif #endif
#ifndef Py_USE_NEW_NAMES
#include "rename2.h"
#endif
#endif /* !Py_ALLOBJECTS_H */ #endif /* !Py_ALLOBJECTS_H */
...@@ -34,12 +34,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -34,12 +34,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
typedef BYTE *bitset; typedef BYTE *bitset;
bitset newbitset PROTO((int nbits)); bitset newbitset Py_PROTO((int nbits));
void delbitset PROTO((bitset bs)); void delbitset Py_PROTO((bitset bs));
#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0) #define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
int addbit PROTO((bitset bs, int ibit)); /* Returns 0 if already set */ int addbit Py_PROTO((bitset bs, int ibit)); /* Returns 0 if already set */
int samebitset PROTO((bitset bs1, bitset bs2, int nbits)); int samebitset Py_PROTO((bitset bs1, bitset bs2, int nbits));
void mergebitset PROTO((bitset bs1, bitset bs2, int nbits)); void mergebitset Py_PROTO((bitset bs1, bitset bs2, int nbits));
#define BITSPERBYTE (8*sizeof(BYTE)) #define BITSPERBYTE (8*sizeof(BYTE))
#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) #define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
......
...@@ -30,7 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,7 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Built-in module interface */ /* Built-in module interface */
extern object *getbuiltindict PROTO(()); extern PyObject *getbuiltindict Py_PROTO(());
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,19 +30,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,19 +30,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Interface to random parts in ceval.c */ /* Interface to random parts in ceval.c */
object *call_object PROTO((object *, object *)); PyObject *PyEval_CallObject Py_PROTO((PyObject *, PyObject *));
object *getbuiltins PROTO((void)); PyObject *PyEval_GetBuiltins Py_PROTO((void));
object *getglobals PROTO((void)); PyObject *PyEval_GetGlobals Py_PROTO((void));
object *getlocals PROTO((void)); PyObject *PyEval_GetLocals Py_PROTO((void));
object *getowner PROTO((void)); PyObject *PyEval_GetOwner Py_PROTO((void));
object *getframe PROTO((void)); PyObject *PyEval_GetFrame Py_PROTO((void));
int getrestricted 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_AddPendingCall Py_PROTO((int (*func) Py_PROTO((ANY *)), ANY *arg));
int Py_MakePendingCalls PROTO((void)); int Py_MakePendingCalls Py_PROTO((void));
/* Interface for threads. /* Interface for threads.
...@@ -52,62 +52,64 @@ int Py_MakePendingCalls PROTO((void)); ...@@ -52,62 +52,64 @@ int Py_MakePendingCalls PROTO((void));
threads to run as follows: threads to run as follows:
...preparations here... ...preparations here...
BGN_SAVE Py_BEGIN_ALLOW_THREADS
...blocking system call here... ...blocking system call here...
END_SAVE Py_END_ALLOW_THREADS
...interpret result here... ...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 To leave the block in the middle (e.g., with return), you must insert
a line containing RET_SAVE before the return, e.g. a line containing RET_SAVE before the return, e.g.
if (...premature_exit...) { if (...premature_exit...) {
RET_SAVE Py_BLOCK_THREADS
err_errno(IOError); PyErr_SetFromErrno(PyExc_IOError);
return NULL; return NULL;
} }
An alternative is: An alternative is:
RET_SAVE Py_BLOCK_THREADS
if (...premature_exit...) { if (...premature_exit...) {
err_errno(IOError); PyErr_SetFromErrno(PyExc_IOError);
return NULL; return NULL;
} }
RES_SAVE Py_UNBLOCK_THREADS
For convenience, that the value of 'errno' is restored across 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". initthread() in "threadmodule.c".
Note that not yet all candidates have been converted to use this Note that not yet all candidates have been converted to use this
mechanism! mechanism!
*/ */
extern void init_save_thread PROTO((void)); extern void PyEval_InitThreads Py_PROTO((void));
extern object *save_thread PROTO((void)); extern PyObject *PyEval_SaveThread Py_PROTO((void));
extern void restore_thread PROTO((object *)); extern void PyEval_RestoreThread Py_PROTO((PyObject *));
#ifdef WITH_THREAD #ifdef WITH_THREAD
#define BGN_SAVE { \ #define Py_BEGIN_ALLOW_THREADS { \
object *_save; \ PyObject *_save; \
_save = save_thread(); _save = PyEval_SaveThread();
#define RET_SAVE restore_thread(_save); #define Py_BLOCK_THREADS PyEval_RestoreThread(_save);
#define RES_SAVE _save = save_thread(); #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
#define END_SAVE restore_thread(_save); \ #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
} }
#else /* !WITH_THREAD */ #else /* !WITH_THREAD */
#define BGN_SAVE { #define Py_BEGIN_ALLOW_THREADS {
#define RET_SAVE #define Py_BLOCK_THREADS
#define RES_SAVE #define Py_UNBLOCK_THREADS
#define END_SAVE } #define Py_END_ALLOW_THREADS }
#endif /* !WITH_THREAD */ #endif /* !WITH_THREAD */
......
...@@ -32,16 +32,16 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -32,16 +32,16 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
typedef char *string; typedef char *string;
#define mknewlongobject(x) newintobject(x) #define mknewlongobject(x) PyInt_FromLong(x)
#define mknewshortobject(x) newintobject((long)x) #define mknewshortobject(x) PyInt_FromLong((long)x)
#define mknewfloatobject(x) newfloatobject(x) #define mknewfloatobject(x) PyFloat_FromDouble(x)
#define mknewcharobject(ch) mkvalue("c", ch) #define mknewcharobject(ch) Py_BuildValue("c", ch)
extern int getiobjectarg PROTO((object *args, int nargs, int i, object **p_a)); extern int PyArg_GetObject Py_PROTO((PyObject *args, int nargs, int i, PyObject **p_a));
extern int getilongarg PROTO((object *args, int nargs, int i, long *p_a)); extern int PyArg_GetLong Py_PROTO((PyObject *args, int nargs, int i, long *p_a));
extern int getishortarg PROTO((object *args, int nargs, int i, short *p_a)); extern int PyArg_GetShort Py_PROTO((PyObject *args, int nargs, int i, short *p_a));
extern int getifloatarg PROTO((object *args, int nargs, int i, float *p_a)); extern int PyArg_GetFloat Py_PROTO((PyObject *args, int nargs, int i, float *p_a));
extern int getistringarg PROTO((object *args, int nargs, int i, string *p_a)); extern int PyArg_GetString Py_PROTO((PyObject *args, int nargs, int i, string *p_a));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -39,40 +39,42 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -39,40 +39,42 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Revealing some structures (not for general use) */ /* Revealing some structures (not for general use) */
typedef struct { typedef struct {
OB_HEAD PyObject_HEAD
object *cl_bases; /* A tuple of class objects */ PyObject *cl_bases; /* A tuple of class objects */
object *cl_dict; /* A dictionary */ PyObject *cl_dict; /* A dictionary */
object *cl_name; /* A string */ PyObject *cl_name; /* A string */
/* The following three are functions or NULL */ /* The following three are functions or NULL */
object *cl_getattr; PyObject *cl_getattr;
object *cl_setattr; PyObject *cl_setattr;
object *cl_delattr; PyObject *cl_delattr;
} classobject; } PyClassObject;
typedef struct { typedef struct {
OB_HEAD PyObject_HEAD
classobject *in_class; /* The class object */ PyClassObject *in_class; /* The class object */
object *in_dict; /* A dictionary */ PyObject *in_dict; /* A dictionary */
} instanceobject; } 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 PyClass_Check(op) ((op)->ob_type == &PyClass_Type)
#define is_instanceobject(op) ((op)->ob_type == &Instancetype) #define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)
#define is_instancemethodobject(op) ((op)->ob_type == &Instancemethodtype) #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
extern object *newclassobject PROTO((object *, object *, object *)); extern PyObject *PyClass_New Py_PROTO((PyObject *, PyObject *, PyObject *));
extern object *newinstanceobject PROTO((object *, object *)); extern PyObject *PyInstance_New Py_PROTO((PyObject *, PyObject *));
extern object *newinstancemethodobject PROTO((object *, object *, object *)); extern PyObject *PyMethod_New Py_PROTO((PyObject *, PyObject *, PyObject *));
extern object *instancemethodgetfunc PROTO((object *)); extern PyObject *PyMethod_Function Py_PROTO((PyObject *));
extern object *instancemethodgetself PROTO((object *)); extern PyObject *PyMethod_Self Py_PROTO((PyObject *));
extern object *instancemethodgetclass PROTO((object *)); 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 *, extern PyObject *instancebinop
object * (*) PROTO((object *, object *)) )); Py_PROTO((PyObject *, PyObject *,
char *, char *,
PyObject * (*) Py_PROTO((PyObject *, PyObject *)) ));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -39,24 +39,24 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -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. */ - the name of the object for which it was compiled. */
typedef struct { typedef struct {
OB_HEAD PyObject_HEAD
stringobject *co_code; /* instruction opcodes */ PyStringObject *co_code; /* instruction opcodes */
object *co_consts; /* list of immutable constant objects */ PyObject *co_consts; /* list of immutable constant objects */
object *co_names; /* list of stringobjects */ PyObject *co_names; /* list of stringobjects */
object *co_filename; /* string */ PyObject *co_filename; /* string */
object *co_name; /* string */ PyObject *co_name; /* string */
} codeobject; } 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 */ /* Public interface */
struct _node; /* Declare the existence of this type */ struct _node; /* Declare the existence of this type */
codeobject *compile PROTO((struct _node *, char *)); PyCodeObject *PyNode_Compile Py_PROTO((struct _node *, char *));
codeobject *newcodeobject PyCodeObject *PyCode_New
PROTO((object *, object *, object *, object *, object *)); Py_PROTO((PyObject *, PyObject *, PyObject *, PyObject *, PyObject *));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -32,19 +32,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -32,19 +32,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "mappingobject.h" #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 PyObject *PyDict_GetItemString Py_PROTO((PyObject *dp, char *key));
extern int dictinsert PROTO((object *dp, char *key, object *item)); extern int PyDict_SetItemString Py_PROTO((PyObject *dp, char *key, PyObject *item));
extern int dictremove PROTO((object *dp, char *key)); extern int PyDict_DelItemString Py_PROTO((PyObject *dp, char *key));
#define getdictkeys getmappingkeys #define getdictkeys PyDict_Keys
#define dict2lookup mappinglookup #define dict2lookup PyDict_GetItem
#define dict2insert mappinginsert #define dict2insert PyDict_SetItem
#define dict2remove mappingremove #define dict2remove PyDict_DelItem
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,47 +30,45 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,47 +30,45 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Error handling definitions */ /* Error handling definitions */
void err_set PROTO((object *)); void PyErr_SetNone Py_PROTO((PyObject *));
void err_setval PROTO((object *, object *)); void PyErr_SetObject Py_PROTO((PyObject *, PyObject *));
void err_restore PROTO((object *, object *, object *)); void PyErr_SetString Py_PROTO((PyObject *, char *));
void err_setstr PROTO((object *, char *)); PyObject *PyErr_Occurred Py_PROTO((void));
object *err_occurred PROTO((void)); void PyErr_Clear Py_PROTO((void));
void err_fetch PROTO((object **, object **, object **)); void PyErr_Fetch Py_PROTO((PyObject **, PyObject **, PyObject **));
void err_clear PROTO((void)); void PyErr_Restore Py_PROTO((PyObject *, PyObject *, PyObject *));
/* Predefined exceptions */ /* Predefined exceptions */
extern DL_IMPORT object *AccessError; extern DL_IMPORT PyObject *PyExc_AccessError;
extern DL_IMPORT object *AttributeError; extern DL_IMPORT PyObject *PyExc_AttributeError;
extern DL_IMPORT object *ConflictError; extern DL_IMPORT PyObject *PyExc_ConflictError;
extern DL_IMPORT object *EOFError; extern DL_IMPORT PyObject *PyExc_EOFError;
extern DL_IMPORT object *IOError; extern DL_IMPORT PyObject *PyExc_IOError;
extern DL_IMPORT object *ImportError; extern DL_IMPORT PyObject *PyExc_ImportError;
extern DL_IMPORT object *IndexError; extern DL_IMPORT PyObject *PyExc_IndexError;
extern DL_IMPORT object *KeyError; extern DL_IMPORT PyObject *PyExc_KeyError;
extern DL_IMPORT object *KeyboardInterrupt; extern DL_IMPORT PyObject *PyExc_KeyboardInterrupt;
extern DL_IMPORT object *MemoryError; extern DL_IMPORT PyObject *PyExc_MemoryError;
extern DL_IMPORT object *NameError; extern DL_IMPORT PyObject *PyExc_NameError;
extern DL_IMPORT object *OverflowError; extern DL_IMPORT PyObject *PyExc_OverflowError;
extern DL_IMPORT object *RuntimeError; extern DL_IMPORT PyObject *PyExc_RuntimeError;
extern DL_IMPORT object *SyntaxError; extern DL_IMPORT PyObject *PyExc_SyntaxError;
extern DL_IMPORT object *SystemError; extern DL_IMPORT PyObject *PyExc_SystemError;
extern DL_IMPORT object *SystemExit; extern DL_IMPORT PyObject *PyExc_SystemExit;
extern DL_IMPORT object *TypeError; extern DL_IMPORT PyObject *PyExc_TypeError;
extern DL_IMPORT object *ValueError; extern DL_IMPORT PyObject *PyExc_ValueError;
extern DL_IMPORT object *ZeroDivisionError; extern DL_IMPORT PyObject *PyExc_ZeroDivisionError;
/* Convenience functions */ /* Convenience functions */
extern int err_badarg PROTO((void)); extern int PyErr_BadArgument Py_PROTO((void));
extern object *err_nomem PROTO((void)); extern PyObject *PyErr_NoMemory Py_PROTO((void));
extern object *err_errno PROTO((object *)); 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 Py_PROTO((void)); /* In sigcheck.c or signalmodule.c */
extern int sigcheck PROTO((void)); /* In sigcheck.c or signalmodule.c */
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,8 +30,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,8 +30,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Interface to execute compiled code */ /* Interface to execute compiled code */
object *eval_code PyObject *PyEval_EvalCode
PROTO((codeobject *, object *, object *, object *, object *)); Py_PROTO((PyCodeObject *, PyObject *, PyObject *, PyObject *, PyObject *));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,17 +30,17 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,17 +30,17 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* File object interface */ /* 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 PyObject *PyFile_FromString Py_PROTO((char *, char *));
extern void setfilebufsize PROTO((object *, int)); extern void setfilebufsize Py_PROTO((PyObject *, int));
extern object *newopenfileobject extern PyObject *PyFile_FromFile
PROTO((FILE *, char *, char *, int (*)FPROTO((FILE *)))); Py_PROTO((FILE *, char *, char *, int (*)Py_FPROTO((FILE *))));
extern FILE *getfilefile PROTO((object *)); extern FILE *PyFile_AsFile Py_PROTO((PyObject *));
extern object *getfilename PROTO((object *)); extern PyObject *getfilename Py_PROTO((PyObject *));
extern object *filegetline PROTO((object *, int)); extern PyObject *PyFile_GetLine Py_PROTO((PyObject *, int));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -31,23 +31,23 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -31,23 +31,23 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Float object interface */ /* Float object interface */
/* /*
floatobject represents a (double precision) floating point number. PyFloatObject represents a (double precision) floating point number.
*/ */
typedef struct { typedef struct {
OB_HEAD PyObject_HEAD
double ob_fval; 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 PyObject *PyFloat_FromDouble Py_PROTO((double));
extern double getfloatvalue PROTO((object *)); extern double PyFloat_AsDouble Py_PROTO((PyObject *));
/* Macro, trading safety for speed */ /* Macro, trading safety for speed */
#define GETFLOATVALUE(op) ((op)->ob_fval) #define PyFloat_AS_DOUBLE(op) ((op)->ob_fval)
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -34,38 +34,40 @@ typedef struct { ...@@ -34,38 +34,40 @@ typedef struct {
int b_type; /* what kind of block this is */ int b_type; /* what kind of block this is */
int b_handler; /* where to jump to find handler */ int b_handler; /* where to jump to find handler */
int b_level; /* value stack level to pop to */ int b_level; /* value stack level to pop to */
} block; } PyTryBlock;
typedef struct _frame { typedef struct _frame {
OB_HEAD PyObject_HEAD
struct _frame *f_back; /* previous frame, or NULL */ struct _frame *f_back; /* previous frame, or NULL */
codeobject *f_code; /* code segment */ PyCodeObject *f_code; /* code segment */
object *f_builtins; /* builtin symbol table (dictobject) */ PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
object *f_globals; /* global symbol table (dictobject) */ PyObject *f_globals; /* global symbol table (PyDictObject) */
object *f_locals; /* local symbol table (dictobject) */ PyObject *f_locals; /* local symbol table (PyDictObject) */
object *f_owner; /* owner (e.g. class or module) or NULL */ PyObject *f_owner; /* owner (e.g. class or module) or NULL */
object *f_fastlocals; /* fast local variables (listobject) */ PyObject *f_fastlocals; /* fast local variables (PyListObject) */
object *f_localmap; /* local variable names (dictobject) */ PyObject *f_localmap; /* local variable names (PyDictObject) */
object **f_valuestack; /* malloc'ed array */ PyObject **f_valuestack; /* malloc'ed array */
block *f_blockstack; /* malloc'ed array */ PyTryBlock *f_blockstack; /* malloc'ed array */
int f_nvalues; /* size of f_valuestack */ int f_nvalues; /* size of f_valuestack */
int f_nblocks; /* size of f_blockstack */ int f_nblocks; /* size of f_blockstack */
int f_iblock; /* index in f_blockstack */ int f_iblock; /* index in f_blockstack */
int f_lasti; /* Last instruction if called */ int f_lasti; /* Last instruction if called */
int f_lineno; /* Current line number */ int f_lineno; /* Current line number */
int f_restricted; /* Flag set if restricted operations in this scope */ int f_restricted; /* Flag set if restricted operations
object *f_trace; /* Trace function */ in this scope */
} frameobject; PyObject *f_trace; /* Trace function */
} PyFrameObject;
/* Standard object interface */ /* 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( PyFrameObject * PyFrame_New
(frameobject *, codeobject *, object *, object *, object *, int, int)); Py_PROTO((PyFrameObject *, PyCodeObject *,
PyObject *, PyObject *, PyObject *, int, int));
/* The rest of the interface is specific for frame objects */ /* The rest of the interface is specific for frame objects */
...@@ -73,14 +75,15 @@ frameobject * newframeobject PROTO( ...@@ -73,14 +75,15 @@ frameobject * newframeobject PROTO(
/* List access macros */ /* List access macros */
#ifdef NDEBUG #ifdef NDEBUG
#define GETITEM(v, i) GETTUPLEITEM((tupleobject *)(v), (i)) #define GETITEM(v, i) PyTuple_GET_ITEM((PyTupleObject *)(v), (i))
#define GETITEMNAME(v, i) GETSTRINGVALUE((stringobject *)GETITEM((v), (i))) #define GETITEMNAME(v, i) \
PyString_AS_STRING((PyStringObject *)GETITEM((v), (i)))
#else #else
#define GETITEM(v, i) gettupleitem((v), (i)) #define GETITEM(v, i) PyTuple_GetItem((v), (i))
#define GETITEMNAME(v, i) getstringvalue(GETITEM(v, i)) #define GETITEMNAME(v, i) PyString_AsString(GETITEM(v, i))
#endif #endif
#define GETUSTRINGVALUE(s) ((unsigned char *)GETSTRINGVALUE(s)) #define GETUSTRINGVALUE(s) ((unsigned char *)PyString_AS_STRING(s))
/* Code access macros */ /* Code access macros */
...@@ -91,17 +94,17 @@ frameobject * newframeobject PROTO( ...@@ -91,17 +94,17 @@ frameobject * newframeobject PROTO(
/* Block management functions */ /* Block management functions */
void setup_block PROTO((frameobject *, int, int, int)); void PyFrame_BlockSetup Py_PROTO((PyFrameObject *, int, int, int));
block *pop_block PROTO((frameobject *)); PyTryBlock *PyFrame_BlockPop Py_PROTO((PyFrameObject *));
/* Extend the value stack */ /* 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 */ /* Conversions between "fast locals" and locals in dictionary */
void locals_2_fast PROTO((frameobject *, int)); void locals_2_fast Py_PROTO((PyFrameObject *, int));
void fast_2_locals PROTO((frameobject *)); void fast_2_locals Py_PROTO((PyFrameObject *));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -31,24 +31,24 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -31,24 +31,24 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Function object interface */ /* Function object interface */
typedef struct { typedef struct {
OB_HEAD PyObject_HEAD
object *func_code; PyObject *func_code;
object *func_globals; PyObject *func_globals;
object *func_name; PyObject *func_name;
int func_argcount; int func_argcount;
object *func_argdefs; PyObject *func_argdefs;
object *func_doc; PyObject *func_doc;
} funcobject; } 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 PyObject *PyFunction_New Py_PROTO((PyObject *, PyObject *));
extern object *getfunccode PROTO((object *)); extern PyObject *PyFunction_GetCode Py_PROTO((PyObject *));
extern object *getfuncglobals PROTO((object *)); extern PyObject *PyFunction_GetGlobals Py_PROTO((PyObject *));
extern object *getfuncargstuff PROTO((object *, int *)); extern PyObject *getfuncargstuff Py_PROTO((PyObject *, int *));
extern int setfuncargstuff PROTO((object *, int, object *)); extern int setfuncargstuff Py_PROTO((PyObject *, int, PyObject *));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -91,24 +91,24 @@ typedef struct { ...@@ -91,24 +91,24 @@ typedef struct {
/* FUNCTIONS */ /* FUNCTIONS */
grammar *newgrammar PROTO((int start)); grammar *newgrammar Py_PROTO((int start));
dfa *adddfa PROTO((grammar *g, int type, char *name)); dfa *adddfa Py_PROTO((grammar *g, int type, char *name));
int addstate PROTO((dfa *d)); int addstate Py_PROTO((dfa *d));
void addarc PROTO((dfa *d, int from, int to, int lbl)); void addarc Py_PROTO((dfa *d, int from, int to, int lbl));
dfa *finddfa PROTO((grammar *g, int type)); dfa *PyGrammar_FindDFA Py_PROTO((grammar *g, int type));
char *typename PROTO((grammar *g, int lbl)); char *typename Py_PROTO((grammar *g, int lbl));
int addlabel PROTO((labellist *ll, int type, char *str)); int addlabel Py_PROTO((labellist *ll, int type, char *str));
int findlabel PROTO((labellist *ll, int type, char *str)); int findlabel Py_PROTO((labellist *ll, int type, char *str));
char *labelrepr PROTO((label *lb)); char *PyGrammar_LabelRepr Py_PROTO((label *lb));
void translatelabels PROTO((grammar *g)); 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 printgrammar Py_PROTO((grammar *g, FILE *fp));
void printnonterminals PROTO((grammar *g, FILE *fp)); void printnonterminals Py_PROTO((grammar *g, FILE *fp));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -31,11 +31,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -31,11 +31,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Module definition and import interface */ /* Module definition and import interface */
long get_pyc_magic PROTO((void)); long get_pyc_magic PROTO((void));
object *get_modules PROTO((void)); PyObject *PyImport_GetModuleDict Py_PROTO((void));
object *add_module PROTO((char *name)); PyObject *PyImport_AddModule Py_PROTO((char *name));
object *import_module PROTO((char *name)); PyObject *PyImport_ImportModule Py_PROTO((char *name));
object *reload_module PROTO((object *m)); PyObject *PyImport_ReloadModule Py_PROTO((PyObject *m));
void doneimport PROTO((void)); void PyImport_Cleanup Py_PROTO((void));
extern struct { extern struct {
char *name; char *name;
......
...@@ -33,29 +33,29 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -33,29 +33,29 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* /*
123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 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. an integer cannot change its value after creation.
There are functions to create new integer objects, to test an object There are functions to create new integer objects, to test an object
for integer-ness, and to get the integer value. The latter functions 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. None of the functions should be applied to nil objects.
The type intobject is (unfortunately) exposed bere so we can declare The type PyIntObject is (unfortunately) exposed here so we can declare
TrueObject and FalseObject below; don't use this. _Py_TrueStruct and _Py_ZeroStruct below; don't use this.
*/ */
typedef struct { typedef struct {
OB_HEAD PyObject_HEAD
long ob_ival; 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 PyObject *PyInt_FromLong Py_PROTO((long));
extern long getintvalue PROTO((object *)); extern long PyInt_AsLong Py_PROTO((PyObject *));
/* /*
...@@ -66,16 +66,16 @@ All values of type Boolean must point to either of these; but in ...@@ -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). contexts where integers are required they are integers (valued 0 and 1).
Hope these macros don't conflict with other people's. 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 Py_False ((PyObject *) &_Py_ZeroStruct)
#define True ((object *) &TrueObject) #define Py_True ((PyObject *) &_Py_TrueStruct)
/* Macro, trading safety for speed */ /* Macro, trading safety for speed */
#define GETINTVALUE(op) ((op)->ob_ival) #define PyInt_AS_LONG(op) ((op)->ob_ival)
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -28,8 +28,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -28,8 +28,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/ ******************************************************************/
extern int intrcheck PROTO((void)); extern int PyOS_InterruptOccurred Py_PROTO((void));
extern void initintr PROTO((void)); extern void PyOS_InitInterrupts Py_PROTO((void));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -37,35 +37,35 @@ Another generally useful object type is an list of object pointers. ...@@ -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 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. 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, 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* 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. returned item's reference count.
*/ */
typedef struct { typedef struct {
OB_VARHEAD PyObject_VAR_HEAD
object **ob_item; PyObject **ob_item;
} listobject; } 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 PyObject *PyList_New Py_PROTO((int size));
extern int getlistsize PROTO((object *)); extern int PyList_Size Py_PROTO((PyObject *));
extern object *getlistitem PROTO((object *, int)); extern PyObject *PyList_GetItem Py_PROTO((PyObject *, int));
extern int setlistitem PROTO((object *, int, object *)); extern int PyList_SetItem Py_PROTO((PyObject *, int, PyObject *));
extern int inslistitem PROTO((object *, int, object *)); extern int PyList_Insert Py_PROTO((PyObject *, int, PyObject *));
extern int addlistitem PROTO((object *, object *)); extern int PyList_Append Py_PROTO((PyObject *, PyObject *));
extern object *getlistslice PROTO((object *, int, int)); extern PyObject *PyList_GetSlice Py_PROTO((PyObject *, int, int));
extern int setlistslice PROTO((object *, int, int, object *)); extern int PyList_SetSlice Py_PROTO((PyObject *, int, int, PyObject *));
extern int sortlist PROTO((object *)); extern int PyList_Sort Py_PROTO((PyObject *));
extern object *listtuple PROTO((object *)); extern PyObject *listtuple Py_PROTO((PyObject *));
/* Macro, trading safety for speed */ /* 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 #ifdef __cplusplus
} }
......
...@@ -61,12 +61,12 @@ typedef long stwodigits; /* signed variant of twodigits */ ...@@ -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. */ so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. */
struct _longobject { struct _longobject {
OB_HEAD PyObject_HEAD
int ob_size; /* XXX Hack! newvarobj() stores it as unsigned! */ int ob_size; /* XXX Hack! newvarobj() stores it as unsigned! */
digit ob_digit[1]; digit ob_digit[1];
}; };
longobject *alloclongobject PROTO((int)); PyLongObject *_PyLong_New Py_PROTO((int));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,19 +30,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,19 +30,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Long (arbitrary precision) integer object interface */ /* 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 PyObject *PyLong_FromLong Py_PROTO((long));
extern object *dnewlongobject PROTO((double)); extern PyObject *PyLong_FromDouble Py_PROTO((double));
extern long getlongvalue PROTO((object *)); extern long PyLong_AsLong Py_PROTO((PyObject *));
extern double dgetlongvalue PROTO((object *)); extern double PyLong_AsDouble Py_PROTO((PyObject *));
object *long_scan PROTO((char *, int)); PyObject *PyLong_FromString Py_PROTO((char *, int));
object *long_escan PROTO((char *, char **, int)); PyObject *long_escan Py_PROTO((char *, char **, int));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,21 +30,21 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -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 */ /* 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) #define is_mappingobject(op) ((op)->ob_type == &Mappingtype)
extern object *newmappingobject PROTO((void)); extern PyObject *PyDict_New Py_PROTO((void));
extern object *mappinglookup PROTO((object *mp, object *key)); extern PyObject *PyDict_GetItem Py_PROTO((PyObject *mp, PyObject *key));
extern int mappinginsert PROTO((object *mp, object *key, object *item)); extern int PyDict_SetItem Py_PROTO((PyObject *mp, PyObject *key, PyObject *item));
extern int mappingremove PROTO((object *mp, object *key)); extern int PyDict_DelItem Py_PROTO((PyObject *mp, PyObject *key));
extern void mappingclear PROTO((object *mp)); extern void PyDict_Clear Py_PROTO((PyObject *mp));
extern int mappinggetnext extern int PyDict_Next
PROTO((object *mp, int *pos, object **key, object **value)); Py_PROTO((PyObject *mp, int *pos, PyObject **key, PyObject **value));
extern object *getmappingkeys PROTO((object *mp)); extern PyObject *PyDict_Keys Py_PROTO((PyObject *mp));
extern object *getmappingvalues PROTO((object *mp)); extern PyObject *PyDict_Values Py_PROTO((PyObject *mp));
extern object *getmappingitems PROTO((object *mp)); extern PyObject *PyDict_Items Py_PROTO((PyObject *mp));
extern int getmappingsize PROTO((object *mp)); extern int getmappingsize Py_PROTO((PyObject *mp));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,14 +30,14 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,14 +30,14 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Interface for marshal.c */ /* Interface for marshal.c */
void wr_long PROTO((long, FILE *)); void PyMarshal_WriteLongToFile Py_PROTO((long, FILE *));
void wr_short PROTO((int, FILE *)); void wr_short Py_PROTO((int, FILE *));
void wr_object PROTO((object *, FILE *)); void PyMarshal_WriteObjectToFile Py_PROTO((PyObject *, FILE *));
long rd_long PROTO((FILE *)); long PyMarshal_ReadLongFromFile Py_PROTO((FILE *));
int rd_short PROTO((FILE *)); int rd_short Py_PROTO((FILE *));
object *rd_object PROTO((FILE *)); PyObject *PyMarshal_ReadObjectFromFile Py_PROTO((FILE *));
object *rds_object PROTO((char *, int)); PyObject *PyMarshal_ReadObjectFromString Py_PROTO((char *, int));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,26 +30,29 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,26 +30,29 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Method object interface */ /* 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 PyCFunction PyCFunction_GetFunction Py_PROTO((PyObject *));
extern object *getself PROTO((object *)); extern PyObject *PyCFunction_GetSelf Py_PROTO((PyObject *));
extern int getvarargs PROTO((object *)); extern int PyCFunction_IsVarArgs Py_PROTO((PyObject *));
struct methodlist { struct PyMethodDef {
char *ml_name; char *ml_name;
method ml_meth; PyCFunction ml_meth;
int ml_flags; int ml_flags;
char *ml_doc; 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 */ /* Flag passed to newmethodobject */
#define METH_VARARGS 0x0001 #define METH_VARARGS 0x0001
......
...@@ -34,24 +34,25 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -34,24 +34,25 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdarg.h> #include <stdarg.h>
extern int getargs PROTO((object *, char *, ...)); extern int PyArg_Parse Py_PROTO((PyObject *, char *, ...));
extern int newgetargs PROTO((object *, char *, ...)); extern int PyArg_ParseTuple Py_PROTO((PyObject *, char *, ...));
extern object *mkvalue PROTO((char *, ...)); extern PyObject *Py_BuildValue Py_PROTO((char *, ...));
#else #else
#include <varargs.h> #include <varargs.h>
/* Better to have no prototypes at all for varargs functions in this case */ /* Better to have no prototypes at all for varargs functions in this case */
extern int getargs(); extern int PyArg_Parse();
extern object *mkvalue(); extern int PyArg_ParseTuple();
extern PyObject *Py_BuildValue();
#endif #endif
extern int vgetargs PROTO((object *, char *, va_list)); extern int PyArg_VaParse Py_PROTO((PyObject *, char *, va_list));
extern object *vmkvalue PROTO((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) /* The API version is maintained (independently from the Python version)
so we can detect mismatches between the interpreter and dynamically so we can detect mismatches between the interpreter and dynamically
loaded modules. loaded modules.
...@@ -59,20 +60,16 @@ extern object *vmkvalue PROTO((char *, va_list)); ...@@ -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 Please add a line or two to the top of this log for each API
version change: version change:
10-Jan-1995 GvR Renamed globals to new naming scheme
9-Jan-1995 GvR Initial version (incompatible with older API) 9-Jan-1995 GvR Initial version (incompatible with older API)
*/ */
extern object *initmodule4 PROTO((char *, struct methodlist *, extern PyObject *Py_InitModule4 Py_PROTO((char *, PyMethodDef *,
char *, object *, int)); char *, PyObject *, int));
#define initmodule(name, methods) \ #define Py_InitModule(name, methods) \
initmodule4(name, methods, (char *)NULL, (object *)NULL, \ Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
PYTHON_API_VERSION) 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)
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,13 +30,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,13 +30,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Module object interface */ /* 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 PyObject *PyModule_New Py_PROTO((char *));
extern object *getmoduledict PROTO((object *)); extern PyObject *PyModule_GetDict Py_PROTO((PyObject *));
extern char *getmodulename PROTO((object *)); extern char *PyModule_GetName Py_PROTO((PyObject *));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -57,10 +57,10 @@ extern "C" { ...@@ -57,10 +57,10 @@ extern "C" {
#endif #endif
#ifndef HAVE_STDLIB_H #ifndef HAVE_STDLIB_H
extern ANY *malloc PROTO((size_t)); extern ANY *malloc Py_PROTO((size_t));
extern ANY *calloc PROTO((size_t, size_t)); extern ANY *calloc Py_PROTO((size_t, size_t));
extern ANY *realloc PROTO((ANY *, size_t)); extern ANY *realloc Py_PROTO((ANY *, size_t));
extern void free PROTO((ANY *)); /* XXX sometimes int on Unix old systems */ extern void free Py_PROTO((ANY *)); /* XXX sometimes int on Unix old systems */
#endif /* !HAVE_STDLIB */ #endif /* !HAVE_STDLIB */
#ifndef NULL #ifndef NULL
...@@ -69,16 +69,20 @@ extern void free PROTO((ANY *)); /* XXX sometimes int on Unix old systems */ ...@@ -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 Always allocate one extra byte, since some malloc's return NULL
XXX for malloc(0) or realloc(p, 0). */ XXX for malloc(0) or realloc(p, 0). */
#define NEW(type, n) ( (type *) malloc(1 + (n) * sizeof(type)) ) #define PyMem_NEW(type, n) ( (type *) malloc(1 + (n) * sizeof(type)) )
#define RESIZE(p, type, n) \ #define PyMem_RESIZE(p, type, n) \
if ((p) == NULL) \ if ((p) == NULL) \
(p) = (type *) malloc(1 + (n) * sizeof(type)); \ (p) = (type *) malloc(1 + (n) * sizeof(type)); \
else \ else \
(p) = (type *) realloc((ANY *)(p), 1 + (n) * sizeof(type)) (p) = (type *) realloc((ANY *)(p), 1 + (n) * sizeof(type))
#define DEL(p) free((ANY *)p) #define PyMem_DEL(p) free((ANY *)p)
#define XDEL(p) if ((p) == NULL) ; else DEL(p) #define PyMem_XDEL(p) if ((p) == NULL) ; else PyMem_DEL(p)
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#ifndef Py_USE_NEW_NAMES
#include "rename2.h"
#endif
#endif /* !Py_MYMALLOC_H */ #endif /* !Py_MYMALLOC_H */
...@@ -29,16 +29,21 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -29,16 +29,21 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/ ******************************************************************/
#ifdef HAVE_PROTOTYPES #ifdef HAVE_PROTOTYPES
#define PROTO(x) x #define Py_PROTO(x) x
#else #else
#define PROTO(x) () #define Py_PROTO(x) ()
#endif #endif
#ifndef FPROTO #ifndef Py_FPROTO
#define FPROTO(x) PROTO(x) #define Py_FPROTO(x) Py_PROTO(x)
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#ifndef Py_USE_NEW_NAMES
#include "rename2.h"
#endif
#endif /* !Py_PROTO_H */ #endif /* !Py_PROTO_H */
...@@ -38,9 +38,9 @@ typedef struct _node { ...@@ -38,9 +38,9 @@ typedef struct _node {
struct _node *n_child; struct _node *n_child;
} node; } node;
extern node *newtree PROTO((int type)); extern node *PyNode_New Py_PROTO((int type));
extern node *addchild PROTO((node *n, int type, char *str, int lineno)); extern node *PyNode_AddChild Py_PROTO((node *n, int type, char *str, int lineno));
extern void freetree PROTO((node *n)); extern void PyNode_Free Py_PROTO((node *n));
/* Node access functions */ /* Node access functions */
#define NCH(n) ((n)->n_nchildren) #define NCH(n) ((n)->n_nchildren)
...@@ -60,7 +60,7 @@ extern void freetree PROTO((node *n)); ...@@ -60,7 +60,7 @@ extern void freetree PROTO((node *n));
} } } }
#endif #endif
extern void listtree PROTO((node *)); extern void PyNode_ListTree Py_PROTO((node *));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
This diff is collapsed.
...@@ -34,7 +34,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -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. Additional macros for modules that implement new object types.
You must first include "object.h". 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 type; here 'type' must be the C structure type used to represent the
object and 'typeobj' the address of the corresponding type object. object and 'typeobj' the address of the corresponding type object.
Reference count and type pointer are filled in; the rest of the bytes of 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 *'. ...@@ -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 The size of the object is actually determined by the tp_basicsize field
of the type object. of the type object.
NEWVAROBJ(type, typeobj, n) is similar but allocates a variable-size PyObject_NEW_VAR(type, typeobj, n) is similar but allocates a variable-size
object with n extra items. The size is computer as tp_basicsize plus 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. n * tp_itemsize. This fills in the ob_size field as well.
*/ */
extern object *newobject PROTO((typeobject *)); extern PyObject *_PyObject_New Py_PROTO((PyTypeObject *));
extern varobject *newvarobject PROTO((typeobject *, unsigned int)); extern varobject *_PyObject_NewVar Py_PROTO((PyTypeObject *, unsigned int));
#define NEWOBJ(type, typeobj) ((type *) newobject(typeobj)) #define PyObject_NEW(type, typeobj) ((type *) _PyObject_New(typeobj))
#define NEWVAROBJ(type, typeobj, n) ((type *) newvarobject(typeobj, n)) #define PyObject_NEW_VAR(type, typeobj, n) ((type *) _PyObject_NewVar(typeobj, n))
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -38,8 +38,8 @@ typedef struct { ...@@ -38,8 +38,8 @@ typedef struct {
char *text; char *text;
} perrdetail; } perrdetail;
extern node *parsestring PROTO((char *, grammar *, int, perrdetail *)); extern node *PyParser_ParseString Py_PROTO((char *, grammar *, int, perrdetail *));
extern node *parsefile PROTO((FILE *, char *, grammar *, int, extern node *PyParser_ParseFile Py_PROTO((FILE *, char *, grammar *, int,
char *, char *, perrdetail *)); char *, char *, perrdetail *));
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -49,7 +49,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -49,7 +49,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "myproto.h" #include "myproto.h"
#include "mymalloc.h" #include "mymalloc.h"
extern void fatal PROTO((char *)); extern void Py_FatalError Py_PROTO((char *));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,47 +30,45 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,47 +30,45 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Error handling definitions */ /* Error handling definitions */
void err_set PROTO((object *)); void PyErr_SetNone Py_PROTO((PyObject *));
void err_setval PROTO((object *, object *)); void PyErr_SetObject Py_PROTO((PyObject *, PyObject *));
void err_restore PROTO((object *, object *, object *)); void PyErr_SetString Py_PROTO((PyObject *, char *));
void err_setstr PROTO((object *, char *)); PyObject *PyErr_Occurred Py_PROTO((void));
object *err_occurred PROTO((void)); void PyErr_Clear Py_PROTO((void));
void err_fetch PROTO((object **, object **, object **)); void PyErr_Fetch Py_PROTO((PyObject **, PyObject **, PyObject **));
void err_clear PROTO((void)); void PyErr_Restore Py_PROTO((PyObject *, PyObject *, PyObject *));
/* Predefined exceptions */ /* Predefined exceptions */
extern DL_IMPORT object *AccessError; extern DL_IMPORT PyObject *PyExc_AccessError;
extern DL_IMPORT object *AttributeError; extern DL_IMPORT PyObject *PyExc_AttributeError;
extern DL_IMPORT object *ConflictError; extern DL_IMPORT PyObject *PyExc_ConflictError;
extern DL_IMPORT object *EOFError; extern DL_IMPORT PyObject *PyExc_EOFError;
extern DL_IMPORT object *IOError; extern DL_IMPORT PyObject *PyExc_IOError;
extern DL_IMPORT object *ImportError; extern DL_IMPORT PyObject *PyExc_ImportError;
extern DL_IMPORT object *IndexError; extern DL_IMPORT PyObject *PyExc_IndexError;
extern DL_IMPORT object *KeyError; extern DL_IMPORT PyObject *PyExc_KeyError;
extern DL_IMPORT object *KeyboardInterrupt; extern DL_IMPORT PyObject *PyExc_KeyboardInterrupt;
extern DL_IMPORT object *MemoryError; extern DL_IMPORT PyObject *PyExc_MemoryError;
extern DL_IMPORT object *NameError; extern DL_IMPORT PyObject *PyExc_NameError;
extern DL_IMPORT object *OverflowError; extern DL_IMPORT PyObject *PyExc_OverflowError;
extern DL_IMPORT object *RuntimeError; extern DL_IMPORT PyObject *PyExc_RuntimeError;
extern DL_IMPORT object *SyntaxError; extern DL_IMPORT PyObject *PyExc_SyntaxError;
extern DL_IMPORT object *SystemError; extern DL_IMPORT PyObject *PyExc_SystemError;
extern DL_IMPORT object *SystemExit; extern DL_IMPORT PyObject *PyExc_SystemExit;
extern DL_IMPORT object *TypeError; extern DL_IMPORT PyObject *PyExc_TypeError;
extern DL_IMPORT object *ValueError; extern DL_IMPORT PyObject *PyExc_ValueError;
extern DL_IMPORT object *ZeroDivisionError; extern DL_IMPORT PyObject *PyExc_ZeroDivisionError;
/* Convenience functions */ /* Convenience functions */
extern int err_badarg PROTO((void)); extern int PyErr_BadArgument Py_PROTO((void));
extern object *err_nomem PROTO((void)); extern PyObject *PyErr_NoMemory Py_PROTO((void));
extern object *err_errno PROTO((object *)); 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 Py_PROTO((void)); /* In sigcheck.c or signalmodule.c */
extern int sigcheck PROTO((void)); /* In sigcheck.c or signalmodule.c */
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,31 +30,31 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -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 */ /* 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 PyRun_SimpleString Py_PROTO((char *));
int run_script PROTO((FILE *, char *)); int PyRun_SimpleFile Py_PROTO((FILE *, char *));
int run_tty_1 PROTO((FILE *, char *)); int PyRun_InteractiveOne Py_PROTO((FILE *, char *));
int run_tty_loop PROTO((FILE *, char *)); int PyRun_InteractiveLoop Py_PROTO((FILE *, char *));
struct _node *parse_string PROTO((char *, int)); struct _node *PyParser_SimpleParseString Py_PROTO((char *, int));
struct _node *parse_file PROTO((FILE *, char *, int)); struct _node *PyParser_SimpleParseFile Py_PROTO((FILE *, char *, int));
object *run_string PROTO((char *, int, object *, object *)); PyObject *PyRun_String Py_PROTO((char *, int, PyObject *, PyObject *));
object *run_file PROTO((FILE *, char *, int, object *, object *)); PyObject *PyRun_File Py_PROTO((FILE *, char *, int, PyObject *, PyObject *));
object *run_pyc_file PROTO((FILE *, char *, object *, object *)); 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 #ifdef __cplusplus
} }
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
#define NO_EXIT_PROG /* don't define exit_prog() */ #define NO_EXIT_PROG /* don't define exit_prog() */
/* (the result is no use of signals on SGI) */ /* (the result is no use of signals on SGI) */
#ifndef PROTO #ifndef Py_PROTO
#if defined(__STDC__) || defined(__cplusplus) #if defined(__STDC__) || defined(__cplusplus)
#define PROTO(args) args #define Py_PROTO(args) args
#else #else
#define PROTO(args) () #define Py_PROTO(args) ()
#endif #endif
#endif #endif
...@@ -19,27 +19,27 @@ typedef void *type_sema; ...@@ -19,27 +19,27 @@ typedef void *type_sema;
extern "C" { extern "C" {
#endif #endif
void init_thread PROTO((void)); void init_thread Py_PROTO((void));
int start_new_thread PROTO((void (*)(void *), void *)); int start_new_thread Py_PROTO((void (*)(void *), void *));
void exit_thread PROTO((void)); void exit_thread Py_PROTO((void));
void _exit_thread PROTO((void)); void _exit_thread Py_PROTO((void));
long get_thread_ident PROTO((void)); long get_thread_ident Py_PROTO((void));
type_lock allocate_lock PROTO((void)); type_lock allocate_lock Py_PROTO((void));
void free_lock PROTO((type_lock)); void free_lock Py_PROTO((type_lock));
int acquire_lock PROTO((type_lock, int)); int acquire_lock Py_PROTO((type_lock, int));
#define WAIT_LOCK 1 #define WAIT_LOCK 1
#define NOWAIT_LOCK 0 #define NOWAIT_LOCK 0
void release_lock PROTO((type_lock)); void release_lock Py_PROTO((type_lock));
type_sema allocate_sema PROTO((int)); type_sema allocate_sema Py_PROTO((int));
void free_sema PROTO((type_sema)); void free_sema Py_PROTO((type_sema));
void down_sema PROTO((type_sema)); void down_sema Py_PROTO((type_sema));
void up_sema PROTO((type_sema)); void up_sema Py_PROTO((type_sema));
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
void exit_prog PROTO((int)); void exit_prog Py_PROTO((int));
void _exit_prog PROTO((int)); void _exit_prog Py_PROTO((int));
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -34,8 +34,8 @@ Range objects behave like the corresponding tuple objects except that ...@@ -34,8 +34,8 @@ Range objects behave like the corresponding tuple objects except that
they are represented by a start, stop, and step datamembers. 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) #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));
This diff is collapsed.
...@@ -33,7 +33,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -33,7 +33,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* /*
123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 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 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 present so strings with null bytes in them can be represented. This
is an immutable object type. is an immutable object type.
...@@ -50,28 +50,28 @@ functions should be applied to nil objects. ...@@ -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 */ /* NB The type is revealed here only because it is used in dictobject.c */
typedef struct { typedef struct {
OB_VARHEAD PyObject_VAR_HEAD
#ifdef CACHE_HASH #ifdef CACHE_HASH
long ob_shash; long ob_shash;
#endif #endif
char ob_sval[1]; 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 PyObject *PyString_FromStringAndSize Py_PROTO((char *, int));
extern object *newstringobject PROTO((char *)); extern PyObject *PyString_FromString Py_PROTO((char *));
extern int getstringsize PROTO((object *)); extern int PyString_Size Py_PROTO((PyObject *));
extern char *getstringvalue PROTO((object *)); extern char *PyString_AsString Py_PROTO((PyObject *));
extern void joinstring PROTO((object **, object *)); extern void PyString_Concat Py_PROTO((PyObject **, PyObject *));
extern void joinstring_decref PROTO((object **, object *)); extern void joinstring_decref Py_PROTO((PyObject **, PyObject *));
extern int resizestring PROTO((object **, int)); extern int _PyString_Resize Py_PROTO((PyObject **, int));
extern object *formatstring PROTO((object *, object *)); extern PyObject *PyString_Format Py_PROTO((PyObject *, PyObject *));
/* Macro, trading safety for speed */ /* Macro, trading safety for speed */
#define GETSTRINGVALUE(op) ((op)->ob_sval) #define PyString_AS_STRING(op) ((op)->ob_sval)
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -46,7 +46,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -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 /* An array of memberlist structures defines the name, type and offset
of selected members of a C structure. These can be read by 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 is set). The array must be terminated with an entry whose name
pointer is NULL. */ pointer is NULL. */
...@@ -85,8 +85,8 @@ struct memberlist { ...@@ -85,8 +85,8 @@ struct memberlist {
#define READONLY 1 #define READONLY 1
#define RO READONLY /* Shorthand */ #define RO READONLY /* Shorthand */
object *getmember PROTO((char *, struct memberlist *, char *)); PyObject *PyMember_Get Py_PROTO((char *, struct memberlist *, char *));
int setmember PROTO((char *, struct memberlist *, char *, object *)); int PyMember_Set Py_PROTO((char *, struct memberlist *, char *, PyObject *));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -30,13 +30,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -30,13 +30,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* System module interface */ /* System module interface */
object *sysget PROTO((char *)); PyObject *PySys_GetObject Py_PROTO((char *));
int sysset PROTO((char *, object *)); int PySys_SetObject Py_PROTO((char *, PyObject *));
FILE *sysgetfile PROTO((char *, FILE *)); FILE *PySys_GetFile Py_PROTO((char *, FILE *));
void initsys PROTO((void)); void PySys_Init Py_PROTO((void));
extern DL_IMPORT object *sys_trace, *sys_profile; extern DL_IMPORT PyObject *_PySys_TraceFunc, *_PySys_ProfileFunc;
extern DL_IMPORT int sys_checkinterval; extern DL_IMPORT int _PySys_CheckInterval;
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
#define NO_EXIT_PROG /* don't define exit_prog() */ #define NO_EXIT_PROG /* don't define exit_prog() */
/* (the result is no use of signals on SGI) */ /* (the result is no use of signals on SGI) */
#ifndef PROTO #ifndef Py_PROTO
#if defined(__STDC__) || defined(__cplusplus) #if defined(__STDC__) || defined(__cplusplus)
#define PROTO(args) args #define Py_PROTO(args) args
#else #else
#define PROTO(args) () #define Py_PROTO(args) ()
#endif #endif
#endif #endif
...@@ -19,27 +19,27 @@ typedef void *type_sema; ...@@ -19,27 +19,27 @@ typedef void *type_sema;
extern "C" { extern "C" {
#endif #endif
void init_thread PROTO((void)); void init_thread Py_PROTO((void));
int start_new_thread PROTO((void (*)(void *), void *)); int start_new_thread Py_PROTO((void (*)(void *), void *));
void exit_thread PROTO((void)); void exit_thread Py_PROTO((void));
void _exit_thread PROTO((void)); void _exit_thread Py_PROTO((void));
long get_thread_ident PROTO((void)); long get_thread_ident Py_PROTO((void));
type_lock allocate_lock PROTO((void)); type_lock allocate_lock Py_PROTO((void));
void free_lock PROTO((type_lock)); void free_lock Py_PROTO((type_lock));
int acquire_lock PROTO((type_lock, int)); int acquire_lock Py_PROTO((type_lock, int));
#define WAIT_LOCK 1 #define WAIT_LOCK 1
#define NOWAIT_LOCK 0 #define NOWAIT_LOCK 0
void release_lock PROTO((type_lock)); void release_lock Py_PROTO((type_lock));
type_sema allocate_sema PROTO((int)); type_sema allocate_sema Py_PROTO((int));
void free_sema PROTO((type_sema)); void free_sema Py_PROTO((type_sema));
void down_sema PROTO((type_sema)); void down_sema Py_PROTO((type_sema));
void up_sema PROTO((type_sema)); void up_sema Py_PROTO((type_sema));
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
void exit_prog PROTO((int)); void exit_prog Py_PROTO((int));
void _exit_prog PROTO((int)); void _exit_prog Py_PROTO((int));
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -66,7 +66,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -66,7 +66,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define CIRCUMFLEX 33 #define CIRCUMFLEX 33
#define LEFTSHIFT 34 #define LEFTSHIFT 34
#define RIGHTSHIFT 35 #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 OP 36
#define ERRORTOKEN 37 #define ERRORTOKEN 37
#define N_TOKENS 38 #define N_TOKENS 38
...@@ -80,9 +80,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -80,9 +80,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define ISEOF(x) ((x) == ENDMARKER) #define ISEOF(x) ((x) == ENDMARKER)
extern char *tok_name[]; /* Token names */ extern char *_PyParser_TokenNames[]; /* Token names */
extern int tok_1char PROTO((int)); extern int PyToken_OneChar Py_PROTO((int));
extern int tok_2char PROTO((int, int)); extern int PyToken_TwoChars Py_PROTO((int, int));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -32,10 +32,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -32,10 +32,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
struct _frame; struct _frame;
int tb_here PROTO((struct _frame *)); int PyTraceBack_Here Py_PROTO((struct _frame *));
object *tb_fetch PROTO((void)); PyObject *PyTraceBack_Fetch Py_PROTO((void));
int tb_store PROTO((object *)); int PyTraceBack_Store Py_PROTO((PyObject *));
int tb_print PROTO((object *, object *)); int PyTraceBack_Print Py_PROTO((PyObject *, PyObject *));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -37,31 +37,31 @@ Another generally useful object type is an tuple of object pointers. ...@@ -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 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. 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, 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* 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. returned item's reference count.
*/ */
typedef struct { typedef struct {
OB_VARHEAD PyObject_VAR_HEAD
object *ob_item[1]; PyObject *ob_item[1];
} tupleobject; } 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 PyObject *PyTuple_New Py_PROTO((int size));
extern int gettuplesize PROTO((object *)); extern int PyTuple_Size Py_PROTO((PyObject *));
extern object *gettupleitem PROTO((object *, int)); extern PyObject *PyTuple_GetItem Py_PROTO((PyObject *, int));
extern int settupleitem PROTO((object *, int, object *)); extern int PyTuple_SetItem Py_PROTO((PyObject *, int, PyObject *));
extern object *gettupleslice PROTO((object *, int, int)); extern PyObject *PyTuple_GetSlice Py_PROTO((PyObject *, int, int));
extern int resizetuple PROTO((object **, int, int)); extern int resizetuple Py_PROTO((PyObject **, int, int));
/* Macro, trading safety for speed */ /* 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 #ifdef __cplusplus
} }
......
...@@ -32,16 +32,16 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -32,16 +32,16 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
typedef char *string; typedef char *string;
#define mknewlongobject(x) newintobject(x) #define mknewlongobject(x) PyInt_FromLong(x)
#define mknewshortobject(x) newintobject((long)x) #define mknewshortobject(x) PyInt_FromLong((long)x)
#define mknewfloatobject(x) newfloatobject(x) #define mknewfloatobject(x) PyFloat_FromDouble(x)
#define mknewcharobject(ch) mkvalue("c", ch) #define mknewcharobject(ch) Py_BuildValue("c", ch)
extern int getiobjectarg PROTO((object *args, int nargs, int i, object **p_a)); extern int PyArg_GetObject Py_PROTO((PyObject *args, int nargs, int i, PyObject **p_a));
extern int getilongarg PROTO((object *args, int nargs, int i, long *p_a)); extern int PyArg_GetLong Py_PROTO((PyObject *args, int nargs, int i, long *p_a));
extern int getishortarg PROTO((object *args, int nargs, int i, short *p_a)); extern int PyArg_GetShort Py_PROTO((PyObject *args, int nargs, int i, short *p_a));
extern int getifloatarg PROTO((object *args, int nargs, int i, float *p_a)); extern int PyArg_GetFloat Py_PROTO((PyObject *args, int nargs, int i, float *p_a));
extern int getistringarg PROTO((object *args, int nargs, int i, string *p_a)); extern int PyArg_GetString Py_PROTO((PyObject *args, int nargs, int i, string *p_a));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment