Commit c7c96a90 authored by Antoine Pitrou's avatar Antoine Pitrou

Recorded merge of revisions 81029 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
parent ba32864b
...@@ -6,40 +6,40 @@ void initxyzzy(void); /* Forward */ ...@@ -6,40 +6,40 @@ void initxyzzy(void); /* Forward */
main(int argc, char **argv) main(int argc, char **argv)
{ {
/* Pass argv[0] to the Python interpreter */ /* Pass argv[0] to the Python interpreter */
Py_SetProgramName(argv[0]); Py_SetProgramName(argv[0]);
/* Initialize the Python interpreter. Required. */ /* Initialize the Python interpreter. Required. */
Py_Initialize(); Py_Initialize();
/* Add a static module */ /* Add a static module */
initxyzzy(); initxyzzy();
/* Define sys.argv. It is up to the application if you /* Define sys.argv. It is up to the application if you
want this; you can also let it undefined (since the Python want this; you can also let it undefined (since the Python
code is generally not a main program it has no business code is generally not a main program it has no business
touching sys.argv...) */ touching sys.argv...) */
PySys_SetArgv(argc, argv); PySys_SetArgv(argc, argv);
/* Do some application specific code */ /* Do some application specific code */
printf("Hello, brave new world\n\n"); printf("Hello, brave new world\n\n");
/* Execute some Python statements (in module __main__) */ /* Execute some Python statements (in module __main__) */
PyRun_SimpleString("import sys\n"); PyRun_SimpleString("import sys\n");
PyRun_SimpleString("print sys.builtin_module_names\n"); PyRun_SimpleString("print sys.builtin_module_names\n");
PyRun_SimpleString("print sys.modules.keys()\n"); PyRun_SimpleString("print sys.modules.keys()\n");
PyRun_SimpleString("print sys.executable\n"); PyRun_SimpleString("print sys.executable\n");
PyRun_SimpleString("print sys.argv\n"); PyRun_SimpleString("print sys.argv\n");
/* Note that you can call any public function of the Python /* Note that you can call any public function of the Python
interpreter here, e.g. call_object(). */ interpreter here, e.g. call_object(). */
/* Some more application specific code */ /* Some more application specific code */
printf("\nGoodbye, cruel world\n"); printf("\nGoodbye, cruel world\n");
/* Exit, cleaning up the interpreter */ /* Exit, cleaning up the interpreter */
Py_Exit(0); Py_Exit(0);
/*NOTREACHED*/ /*NOTREACHED*/
} }
/* A static module */ /* A static module */
...@@ -48,18 +48,18 @@ main(int argc, char **argv) ...@@ -48,18 +48,18 @@ main(int argc, char **argv)
static PyObject * static PyObject *
xyzzy_foo(PyObject *self, PyObject* args) xyzzy_foo(PyObject *self, PyObject* args)
{ {
return PyInt_FromLong(42L); return PyInt_FromLong(42L);
} }
static PyMethodDef xyzzy_methods[] = { static PyMethodDef xyzzy_methods[] = {
{"foo", xyzzy_foo, METH_NOARGS, {"foo", xyzzy_foo, METH_NOARGS,
"Return the meaning of everything."}, "Return the meaning of everything."},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };
void void
initxyzzy(void) initxyzzy(void)
{ {
PyImport_AddModule("xyzzy"); PyImport_AddModule("xyzzy");
Py_InitModule("xyzzy", xyzzy_methods); Py_InitModule("xyzzy", xyzzy_methods);
} }
...@@ -6,28 +6,28 @@ ...@@ -6,28 +6,28 @@
main(int argc, char **argv) main(int argc, char **argv)
{ {
int count = -1; int count = -1;
char *command; char *command;
if (argc < 2 || argc > 3) { if (argc < 2 || argc > 3) {
fprintf(stderr, "usage: loop <python-command> [count]\n"); fprintf(stderr, "usage: loop <python-command> [count]\n");
exit(2); exit(2);
} }
command = argv[1]; command = argv[1];
if (argc == 3) { if (argc == 3) {
count = atoi(argv[2]); count = atoi(argv[2]);
} }
Py_SetProgramName(argv[0]); Py_SetProgramName(argv[0]);
/* uncomment this if you don't want to load site.py */ /* uncomment this if you don't want to load site.py */
/* Py_NoSiteFlag = 1; */ /* Py_NoSiteFlag = 1; */
while (count == -1 || --count >= 0 ) { while (count == -1 || --count >= 0 ) {
Py_Initialize(); Py_Initialize();
PyRun_SimpleString(command); PyRun_SimpleString(command);
Py_Finalize(); Py_Finalize();
} }
return 0; return 0;
} }
This diff is collapsed.
This diff is collapsed.
...@@ -8,7 +8,7 @@ extern "C" { ...@@ -8,7 +8,7 @@ extern "C" {
/* Interface to random parts in ceval.c */ /* Interface to random parts in ceval.c */
PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
PyObject *, PyObject *, PyObject *); PyObject *, PyObject *, PyObject *);
/* DLL-level Backwards compatibility: */ /* DLL-level Backwards compatibility: */
#undef PyEval_CallObject #undef PyEval_CallObject
...@@ -16,7 +16,7 @@ PyAPI_FUNC(PyObject *) PyEval_CallObject(PyObject *, PyObject *); ...@@ -16,7 +16,7 @@ PyAPI_FUNC(PyObject *) PyEval_CallObject(PyObject *, PyObject *);
/* Inline this */ /* Inline this */
#define PyEval_CallObject(func,arg) \ #define PyEval_CallObject(func,arg) \
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj,
const char *format, ...); const char *format, ...);
...@@ -50,10 +50,10 @@ PyAPI_FUNC(void) Py_SetRecursionLimit(int); ...@@ -50,10 +50,10 @@ PyAPI_FUNC(void) Py_SetRecursionLimit(int);
PyAPI_FUNC(int) Py_GetRecursionLimit(void); PyAPI_FUNC(int) Py_GetRecursionLimit(void);
#define Py_EnterRecursiveCall(where) \ #define Py_EnterRecursiveCall(where) \
(_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \
_Py_CheckRecursiveCall(where)) _Py_CheckRecursiveCall(where))
#define Py_LeaveRecursiveCall() \ #define Py_LeaveRecursiveCall() \
(--PyThreadState_GET()->recursion_depth) (--PyThreadState_GET()->recursion_depth)
PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where); PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where);
PyAPI_DATA(int) _Py_CheckRecursionLimit; PyAPI_DATA(int) _Py_CheckRecursionLimit;
#ifdef USE_STACKCHECK #ifdef USE_STACKCHECK
...@@ -79,31 +79,31 @@ PyAPI_DATA(int) _Py_CheckInterval; ...@@ -79,31 +79,31 @@ PyAPI_DATA(int) _Py_CheckInterval;
that lasts a long time and doesn't touch Python data) can allow other that lasts a long time and doesn't touch Python data) can allow other
threads to run as follows: threads to run as follows:
...preparations here... ...preparations here...
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
...blocking system call here... ...blocking system call here...
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
...interpret result here... ...interpret result here...
The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a
{}-surrounded block. {}-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 Py_BLOCK_THREADS before the return, e.g. a line containing Py_BLOCK_THREADS before the return, e.g.
if (...premature_exit...) { if (...premature_exit...) {
Py_BLOCK_THREADS Py_BLOCK_THREADS
PyErr_SetFromErrno(PyExc_IOError); PyErr_SetFromErrno(PyExc_IOError);
return NULL; return NULL;
} }
An alternative is: An alternative is:
Py_BLOCK_THREADS Py_BLOCK_THREADS
if (...premature_exit...) { if (...premature_exit...) {
PyErr_SetFromErrno(PyExc_IOError); PyErr_SetFromErrno(PyExc_IOError);
return NULL; return NULL;
} }
Py_UNBLOCK_THREADS Py_UNBLOCK_THREADS
For convenience, that the value of 'errno' is restored across For convenience, that the value of 'errno' is restored across
Py_END_ALLOW_THREADS and Py_BLOCK_THREADS. Py_END_ALLOW_THREADS and Py_BLOCK_THREADS.
...@@ -132,12 +132,12 @@ PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); ...@@ -132,12 +132,12 @@ PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
PyAPI_FUNC(void) PyEval_ReInitThreads(void); PyAPI_FUNC(void) PyEval_ReInitThreads(void);
#define Py_BEGIN_ALLOW_THREADS { \ #define Py_BEGIN_ALLOW_THREADS { \
PyThreadState *_save; \ PyThreadState *_save; \
_save = PyEval_SaveThread(); _save = PyEval_SaveThread();
#define Py_BLOCK_THREADS PyEval_RestoreThread(_save); #define Py_BLOCK_THREADS PyEval_RestoreThread(_save);
#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread(); #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \ #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
} }
#else /* !WITH_THREAD */ #else /* !WITH_THREAD */
......
...@@ -11,13 +11,13 @@ extern "C" { ...@@ -11,13 +11,13 @@ extern "C" {
* big-endian, unless otherwise noted: * big-endian, unless otherwise noted:
* *
* byte offset * byte offset
* 0 year 2 bytes, 1-9999 * 0 year 2 bytes, 1-9999
* 2 month 1 byte, 1-12 * 2 month 1 byte, 1-12
* 3 day 1 byte, 1-31 * 3 day 1 byte, 1-31
* 4 hour 1 byte, 0-23 * 4 hour 1 byte, 0-23
* 5 minute 1 byte, 0-59 * 5 minute 1 byte, 0-59
* 6 second 1 byte, 0-59 * 6 second 1 byte, 0-59
* 7 usecond 3 bytes, 0-999999 * 7 usecond 3 bytes, 0-999999
* 10 * 10
*/ */
...@@ -33,26 +33,26 @@ extern "C" { ...@@ -33,26 +33,26 @@ extern "C" {
typedef struct typedef struct
{ {
PyObject_HEAD PyObject_HEAD
long hashcode; /* -1 when unknown */ long hashcode; /* -1 when unknown */
int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */ int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
int seconds; /* 0 <= seconds < 24*3600 is invariant */ int seconds; /* 0 <= seconds < 24*3600 is invariant */
int microseconds; /* 0 <= microseconds < 1000000 is invariant */ int microseconds; /* 0 <= microseconds < 1000000 is invariant */
} PyDateTime_Delta; } PyDateTime_Delta;
typedef struct typedef struct
{ {
PyObject_HEAD /* a pure abstract base clase */ PyObject_HEAD /* a pure abstract base clase */
} PyDateTime_TZInfo; } PyDateTime_TZInfo;
/* The datetime and time types have hashcodes, and an optional tzinfo member, /* The datetime and time types have hashcodes, and an optional tzinfo member,
* present if and only if hastzinfo is true. * present if and only if hastzinfo is true.
*/ */
#define _PyTZINFO_HEAD \ #define _PyTZINFO_HEAD \
PyObject_HEAD \ PyObject_HEAD \
long hashcode; \ long hashcode; \
char hastzinfo; /* boolean flag */ char hastzinfo; /* boolean flag */
/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something /* No _PyDateTime_BaseTZInfo is allocated; it's just to have something
* convenient to cast to, when getting at the hastzinfo member of objects * convenient to cast to, when getting at the hastzinfo member of objects
...@@ -60,7 +60,7 @@ typedef struct ...@@ -60,7 +60,7 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
_PyTZINFO_HEAD _PyTZINFO_HEAD
} _PyDateTime_BaseTZInfo; } _PyDateTime_BaseTZInfo;
/* All time objects are of PyDateTime_TimeType, but that can be allocated /* All time objects are of PyDateTime_TimeType, but that can be allocated
...@@ -69,20 +69,20 @@ typedef struct ...@@ -69,20 +69,20 @@ typedef struct
* internal struct used to allocate the right amount of space for the * internal struct used to allocate the right amount of space for the
* "without" case. * "without" case.
*/ */
#define _PyDateTime_TIMEHEAD \ #define _PyDateTime_TIMEHEAD \
_PyTZINFO_HEAD \ _PyTZINFO_HEAD \
unsigned char data[_PyDateTime_TIME_DATASIZE]; unsigned char data[_PyDateTime_TIME_DATASIZE];
typedef struct typedef struct
{ {
_PyDateTime_TIMEHEAD _PyDateTime_TIMEHEAD
} _PyDateTime_BaseTime; /* hastzinfo false */ } _PyDateTime_BaseTime; /* hastzinfo false */
typedef struct typedef struct
{ {
_PyDateTime_TIMEHEAD _PyDateTime_TIMEHEAD
PyObject *tzinfo; PyObject *tzinfo;
} PyDateTime_Time; /* hastzinfo true */ } PyDateTime_Time; /* hastzinfo true */
/* All datetime objects are of PyDateTime_DateTimeType, but that can be /* All datetime objects are of PyDateTime_DateTimeType, but that can be
...@@ -92,48 +92,48 @@ typedef struct ...@@ -92,48 +92,48 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
_PyTZINFO_HEAD _PyTZINFO_HEAD
unsigned char data[_PyDateTime_DATE_DATASIZE]; unsigned char data[_PyDateTime_DATE_DATASIZE];
} PyDateTime_Date; } PyDateTime_Date;
#define _PyDateTime_DATETIMEHEAD \ #define _PyDateTime_DATETIMEHEAD \
_PyTZINFO_HEAD \ _PyTZINFO_HEAD \
unsigned char data[_PyDateTime_DATETIME_DATASIZE]; unsigned char data[_PyDateTime_DATETIME_DATASIZE];
typedef struct typedef struct
{ {
_PyDateTime_DATETIMEHEAD _PyDateTime_DATETIMEHEAD
} _PyDateTime_BaseDateTime; /* hastzinfo false */ } _PyDateTime_BaseDateTime; /* hastzinfo false */
typedef struct typedef struct
{ {
_PyDateTime_DATETIMEHEAD _PyDateTime_DATETIMEHEAD
PyObject *tzinfo; PyObject *tzinfo;
} PyDateTime_DateTime; /* hastzinfo true */ } PyDateTime_DateTime; /* hastzinfo true */
/* Apply for date and datetime instances. */ /* Apply for date and datetime instances. */
#define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \ #define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \
((PyDateTime_Date*)o)->data[1]) ((PyDateTime_Date*)o)->data[1])
#define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2]) #define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2])
#define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3]) #define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3])
#define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4]) #define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4])
#define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5]) #define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5])
#define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6]) #define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6])
#define PyDateTime_DATE_GET_MICROSECOND(o) \ #define PyDateTime_DATE_GET_MICROSECOND(o) \
((((PyDateTime_DateTime*)o)->data[7] << 16) | \ ((((PyDateTime_DateTime*)o)->data[7] << 16) | \
(((PyDateTime_DateTime*)o)->data[8] << 8) | \ (((PyDateTime_DateTime*)o)->data[8] << 8) | \
((PyDateTime_DateTime*)o)->data[9]) ((PyDateTime_DateTime*)o)->data[9])
/* Apply for time instances. */ /* Apply for time instances. */
#define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0]) #define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0])
#define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1]) #define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1])
#define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2]) #define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2])
#define PyDateTime_TIME_GET_MICROSECOND(o) \ #define PyDateTime_TIME_GET_MICROSECOND(o) \
((((PyDateTime_Time*)o)->data[3] << 16) | \ ((((PyDateTime_Time*)o)->data[3] << 16) | \
(((PyDateTime_Time*)o)->data[4] << 8) | \ (((PyDateTime_Time*)o)->data[4] << 8) | \
((PyDateTime_Time*)o)->data[5]) ((PyDateTime_Time*)o)->data[5])
/* Define structure for C API. */ /* Define structure for C API. */
...@@ -148,7 +148,7 @@ typedef struct { ...@@ -148,7 +148,7 @@ typedef struct {
/* constructors */ /* constructors */
PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*); PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*);
PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int, PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int,
PyObject*, PyTypeObject*); PyObject*, PyTypeObject*);
PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*); PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*);
PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*); PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*);
...@@ -186,14 +186,14 @@ typedef struct { ...@@ -186,14 +186,14 @@ typedef struct {
static PyDateTime_CAPI *PyDateTimeAPI; static PyDateTime_CAPI *PyDateTimeAPI;
#define PyDateTime_IMPORT \ #define PyDateTime_IMPORT \
PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import("datetime", \ PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import("datetime", \
"datetime_CAPI") "datetime_CAPI")
/* This macro would be used if PyCObject_ImportEx() was created. /* This macro would be used if PyCObject_ImportEx() was created.
#define PyDateTime_IMPORT \ #define PyDateTime_IMPORT \
PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_ImportEx("datetime", \ PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_ImportEx("datetime", \
"datetime_CAPI", \ "datetime_CAPI", \
DATETIME_API_MAGIC) DATETIME_API_MAGIC)
*/ */
/* Macros for type checking when not building the Python core. */ /* Macros for type checking when not building the Python core. */
...@@ -214,30 +214,30 @@ static PyDateTime_CAPI *PyDateTimeAPI; ...@@ -214,30 +214,30 @@ static PyDateTime_CAPI *PyDateTimeAPI;
/* Macros for accessing constructors in a simplified fashion. */ /* Macros for accessing constructors in a simplified fashion. */
#define PyDate_FromDate(year, month, day) \ #define PyDate_FromDate(year, month, day) \
PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType) PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType)
#define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \ #define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \
PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \ PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \
min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType) min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType)
#define PyTime_FromTime(hour, minute, second, usecond) \ #define PyTime_FromTime(hour, minute, second, usecond) \
PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \ PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \
Py_None, PyDateTimeAPI->TimeType) Py_None, PyDateTimeAPI->TimeType)
#define PyDelta_FromDSU(days, seconds, useconds) \ #define PyDelta_FromDSU(days, seconds, useconds) \
PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \ PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \
PyDateTimeAPI->DeltaType) PyDateTimeAPI->DeltaType)
/* Macros supporting the DB API. */ /* Macros supporting the DB API. */
#define PyDateTime_FromTimestamp(args) \ #define PyDateTime_FromTimestamp(args) \
PyDateTimeAPI->DateTime_FromTimestamp( \ PyDateTimeAPI->DateTime_FromTimestamp( \
(PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL) (PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL)
#define PyDate_FromTimestamp(args) \ #define PyDate_FromTimestamp(args) \
PyDateTimeAPI->Date_FromTimestamp( \ PyDateTimeAPI->Date_FromTimestamp( \
(PyObject*) (PyDateTimeAPI->DateType), args) (PyObject*) (PyDateTimeAPI->DateType), args)
#endif /* Py_BUILD_CORE */ #endif /* Py_BUILD_CORE */
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -9,27 +9,27 @@ typedef PyObject *(*getter)(PyObject *, void *); ...@@ -9,27 +9,27 @@ typedef PyObject *(*getter)(PyObject *, void *);
typedef int (*setter)(PyObject *, PyObject *, void *); typedef int (*setter)(PyObject *, PyObject *, void *);
typedef struct PyGetSetDef { typedef struct PyGetSetDef {
char *name; char *name;
getter get; getter get;
setter set; setter set;
char *doc; char *doc;
void *closure; void *closure;
} PyGetSetDef; } PyGetSetDef;
typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
void *wrapped); void *wrapped);
typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
void *wrapped, PyObject *kwds); void *wrapped, PyObject *kwds);
struct wrapperbase { struct wrapperbase {
char *name; char *name;
int offset; int offset;
void *function; void *function;
wrapperfunc wrapper; wrapperfunc wrapper;
char *doc; char *doc;
int flags; int flags;
PyObject *name_strobj; PyObject *name_strobj;
}; };
/* Flags for above struct */ /* Flags for above struct */
...@@ -38,33 +38,33 @@ struct wrapperbase { ...@@ -38,33 +38,33 @@ struct wrapperbase {
/* Various kinds of descriptor objects */ /* Various kinds of descriptor objects */
#define PyDescr_COMMON \ #define PyDescr_COMMON \
PyObject_HEAD \ PyObject_HEAD \
PyTypeObject *d_type; \ PyTypeObject *d_type; \
PyObject *d_name PyObject *d_name
typedef struct { typedef struct {
PyDescr_COMMON; PyDescr_COMMON;
} PyDescrObject; } PyDescrObject;
typedef struct { typedef struct {
PyDescr_COMMON; PyDescr_COMMON;
PyMethodDef *d_method; PyMethodDef *d_method;
} PyMethodDescrObject; } PyMethodDescrObject;
typedef struct { typedef struct {
PyDescr_COMMON; PyDescr_COMMON;
struct PyMemberDef *d_member; struct PyMemberDef *d_member;
} PyMemberDescrObject; } PyMemberDescrObject;
typedef struct { typedef struct {
PyDescr_COMMON; PyDescr_COMMON;
PyGetSetDef *d_getset; PyGetSetDef *d_getset;
} PyGetSetDescrObject; } PyGetSetDescrObject;
typedef struct { typedef struct {
PyDescr_COMMON; PyDescr_COMMON;
struct wrapperbase *d_base; struct wrapperbase *d_base;
void *d_wrapped; /* This can be any function pointer */ void *d_wrapped; /* This can be any function pointer */
} PyWrapperDescrObject; } PyWrapperDescrObject;
PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
...@@ -75,11 +75,11 @@ PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; ...@@ -75,11 +75,11 @@ PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
struct PyMemberDef *); struct PyMemberDef *);
PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
struct PyGetSetDef *); struct PyGetSetDef *);
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
struct wrapperbase *, void *); struct wrapperbase *, void *);
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
......
...@@ -48,13 +48,13 @@ meaning otherwise. ...@@ -48,13 +48,13 @@ meaning otherwise.
#define PyDict_MINSIZE 8 #define PyDict_MINSIZE 8
typedef struct { typedef struct {
/* Cached hash code of me_key. Note that hash codes are C longs. /* Cached hash code of me_key. Note that hash codes are C longs.
* We have to use Py_ssize_t instead because dict_popitem() abuses * We have to use Py_ssize_t instead because dict_popitem() abuses
* me_hash to hold a search finger. * me_hash to hold a search finger.
*/ */
Py_ssize_t me_hash; Py_ssize_t me_hash;
PyObject *me_key; PyObject *me_key;
PyObject *me_value; PyObject *me_value;
} PyDictEntry; } PyDictEntry;
/* /*
...@@ -68,24 +68,24 @@ it's two-thirds full. ...@@ -68,24 +68,24 @@ it's two-thirds full.
*/ */
typedef struct _dictobject PyDictObject; typedef struct _dictobject PyDictObject;
struct _dictobject { struct _dictobject {
PyObject_HEAD PyObject_HEAD
Py_ssize_t ma_fill; /* # Active + # Dummy */ Py_ssize_t ma_fill; /* # Active + # Dummy */
Py_ssize_t ma_used; /* # Active */ Py_ssize_t ma_used; /* # Active */
/* The table contains ma_mask + 1 slots, and that's a power of 2. /* The table contains ma_mask + 1 slots, and that's a power of 2.
* We store the mask instead of the size because the mask is more * We store the mask instead of the size because the mask is more
* frequently needed. * frequently needed.
*/ */
Py_ssize_t ma_mask; Py_ssize_t ma_mask;
/* ma_table points to ma_smalltable for small tables, else to /* ma_table points to ma_smalltable for small tables, else to
* additional malloc'ed memory. ma_table is never NULL! This rule * additional malloc'ed memory. ma_table is never NULL! This rule
* saves repeated runtime null-tests in the workhorse getitem and * saves repeated runtime null-tests in the workhorse getitem and
* setitem calls. * setitem calls.
*/ */
PyDictEntry *ma_table; PyDictEntry *ma_table;
PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash); PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
PyDictEntry ma_smalltable[PyDict_MINSIZE]; PyDictEntry ma_smalltable[PyDict_MINSIZE];
}; };
PyAPI_DATA(PyTypeObject) PyDict_Type; PyAPI_DATA(PyTypeObject) PyDict_Type;
...@@ -100,9 +100,9 @@ PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); ...@@ -100,9 +100,9 @@ PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
PyAPI_FUNC(int) PyDict_Next( PyAPI_FUNC(int) PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
PyAPI_FUNC(int) _PyDict_Next( PyAPI_FUNC(int) _PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash); PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash);
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
...@@ -121,8 +121,8 @@ PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); ...@@ -121,8 +121,8 @@ PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other);
dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). dict.update(other) is equivalent to PyDict_Merge(dict, other, 1).
*/ */
PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
PyObject *other, PyObject *other,
int override); int override);
/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing /* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
iterable objects of length 2. If override is true, the last occurrence iterable objects of length 2. If override is true, the last occurrence
...@@ -130,8 +130,8 @@ PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, ...@@ -130,8 +130,8 @@ PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1).
*/ */
PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
PyObject *seq2, PyObject *seq2,
int override); int override);
PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key); PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item); PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
......
...@@ -8,28 +8,28 @@ extern "C" { ...@@ -8,28 +8,28 @@ extern "C" {
#endif #endif
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
FILE *f_fp; FILE *f_fp;
PyObject *f_name; PyObject *f_name;
PyObject *f_mode; PyObject *f_mode;
int (*f_close)(FILE *); int (*f_close)(FILE *);
int f_softspace; /* Flag used by 'print' command */ int f_softspace; /* Flag used by 'print' command */
int f_binary; /* Flag which indicates whether the file is int f_binary; /* Flag which indicates whether the file is
open in binary (1) or text (0) mode */ open in binary (1) or text (0) mode */
char* f_buf; /* Allocated readahead buffer */ char* f_buf; /* Allocated readahead buffer */
char* f_bufend; /* Points after last occupied position */ char* f_bufend; /* Points after last occupied position */
char* f_bufptr; /* Current buffer position */ char* f_bufptr; /* Current buffer position */
char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */ char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */
int f_univ_newline; /* Handle any newline convention */ int f_univ_newline; /* Handle any newline convention */
int f_newlinetypes; /* Types of newlines seen */ int f_newlinetypes; /* Types of newlines seen */
int f_skipnextlf; /* Skip next \n */ int f_skipnextlf; /* Skip next \n */
PyObject *f_encoding; PyObject *f_encoding;
PyObject *f_errors; PyObject *f_errors;
PyObject *weakreflist; /* List of weak references */ PyObject *weakreflist; /* List of weak references */
int unlocked_count; /* Num. currently running sections of code int unlocked_count; /* Num. currently running sections of code
using f_fp with the GIL released. */ using f_fp with the GIL released. */
int readable; int readable;
int writable; int writable;
} PyFileObject; } PyFileObject;
PyAPI_DATA(PyTypeObject) PyFile_Type; PyAPI_DATA(PyTypeObject) PyFile_Type;
......
This diff is collapsed.
This diff is collapsed.
...@@ -94,25 +94,25 @@ PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); ...@@ -94,25 +94,25 @@ PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
/* */ /* */
#define PyExceptionClass_Check(x) \ #define PyExceptionClass_Check(x) \
(PyClass_Check((x)) || (PyType_Check((x)) && \ (PyClass_Check((x)) || (PyType_Check((x)) && \
PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))) PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)))
#define PyExceptionInstance_Check(x) \ #define PyExceptionInstance_Check(x) \
(PyInstance_Check((x)) || \ (PyInstance_Check((x)) || \
PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)) PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS))
#define PyExceptionClass_Name(x) \ #define PyExceptionClass_Name(x) \
(PyClass_Check((x)) \ (PyClass_Check((x)) \
? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \ ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \
: (char *)(((PyTypeObject*)(x))->tp_name)) : (char *)(((PyTypeObject*)(x))->tp_name))
#define PyExceptionInstance_Class(x) \
((PyInstance_Check((x)) \
? (PyObject*)((PyInstanceObject*)(x))->in_class \
: (PyObject*)((x)->ob_type)))
#define PyExceptionInstance_Class(x) \
((PyInstance_Check((x)) \
? (PyObject*)((PyInstanceObject*)(x))->in_class \
: (PyObject*)((x)->ob_type)))
/* Predefined exceptions */ /* Predefined exceptions */
PyAPI_DATA(PyObject *) PyExc_BaseException; PyAPI_DATA(PyObject *) PyExc_BaseException;
...@@ -184,33 +184,33 @@ PyAPI_FUNC(int) PyErr_BadArgument(void); ...@@ -184,33 +184,33 @@ PyAPI_FUNC(int) PyErr_BadArgument(void);
PyAPI_FUNC(PyObject *) PyErr_NoMemory(void); PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
PyObject *, PyObject *); PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *);
#ifdef Py_WIN_WIDE_FILENAMES #ifdef Py_WIN_WIDE_FILENAMES
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
PyObject *, Py_UNICODE *); PyObject *, Py_UNICODE *);
#endif /* Py_WIN_WIDE_FILENAMES */ #endif /* Py_WIN_WIDE_FILENAMES */
PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...)
Py_GCC_ATTRIBUTE((format(printf, 2, 3))); Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject( PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject(
int, const char *); int, const char *);
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename( PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
int, const char *); int, const char *);
#ifdef Py_WIN_WIDE_FILENAMES #ifdef Py_WIN_WIDE_FILENAMES
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
int, const Py_UNICODE *); int, const Py_UNICODE *);
#endif /* Py_WIN_WIDE_FILENAMES */ #endif /* Py_WIN_WIDE_FILENAMES */
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
PyObject *,int, PyObject *); PyObject *,int, PyObject *);
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
PyObject *,int, const char *); PyObject *,int, const char *);
#ifdef Py_WIN_WIDE_FILENAMES #ifdef Py_WIN_WIDE_FILENAMES
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
PyObject *,int, const Py_UNICODE *); PyObject *,int, const Py_UNICODE *);
#endif /* Py_WIN_WIDE_FILENAMES */ #endif /* Py_WIN_WIDE_FILENAMES */
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
#endif /* MS_WINDOWS */ #endif /* MS_WINDOWS */
...@@ -244,15 +244,15 @@ PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int); ...@@ -244,15 +244,15 @@ PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int);
/* create a UnicodeDecodeError object */ /* create a UnicodeDecodeError object */
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create( PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
/* create a UnicodeEncodeError object */ /* create a UnicodeEncodeError object */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
/* create a UnicodeTranslateError object */ /* create a UnicodeTranslateError object */
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
/* get the encoding attribute */ /* get the encoding attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);
...@@ -295,11 +295,11 @@ PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *); ...@@ -295,11 +295,11 @@ PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *);
/* assign a new value to the reason attribute /* assign a new value to the reason attribute
return 0 on success, -1 on failure */ return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason( PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(
PyObject *, const char *); PyObject *, const char *);
PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason( PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
PyObject *, const char *); PyObject *, const char *);
PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
PyObject *, const char *); PyObject *, const char *);
#endif #endif
...@@ -319,9 +319,9 @@ PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( ...@@ -319,9 +319,9 @@ PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
#include <stdarg.h> #include <stdarg.h>
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 3, 4))); Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
Py_GCC_ATTRIBUTE((format(printf, 3, 0))); Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* This file moves some of the autoconf magic to compile-time * This file moves some of the autoconf magic to compile-time
* when building on MacOSX. This is needed for building 4-way * when building on MacOSX. This is needed for building 4-way
* universal binaries and for 64-bit universal binaries because * universal binaries and for 64-bit universal binaries because
* the values redefined below aren't configure-time constant but * the values redefined below aren't configure-time constant but
* only compile-time constant in these scenarios. * only compile-time constant in these scenarios.
*/ */
...@@ -30,36 +30,36 @@ ...@@ -30,36 +30,36 @@
# undef SIZEOF_LONG # undef SIZEOF_LONG
# ifdef __LP64__ # ifdef __LP64__
# define SIZEOF__BOOL 1 # define SIZEOF__BOOL 1
# define SIZEOF__BOOL 1 # define SIZEOF__BOOL 1
# define SIZEOF_LONG 8 # define SIZEOF_LONG 8
# define SIZEOF_PTHREAD_T 8 # define SIZEOF_PTHREAD_T 8
# define SIZEOF_SIZE_T 8 # define SIZEOF_SIZE_T 8
# define SIZEOF_TIME_T 8 # define SIZEOF_TIME_T 8
# define SIZEOF_VOID_P 8 # define SIZEOF_VOID_P 8
# else # else
# ifdef __ppc__ # ifdef __ppc__
# define SIZEOF__BOOL 4 # define SIZEOF__BOOL 4
# else # else
# define SIZEOF__BOOL 1 # define SIZEOF__BOOL 1
# endif # endif
# define SIZEOF_LONG 4 # define SIZEOF_LONG 4
# define SIZEOF_PTHREAD_T 4 # define SIZEOF_PTHREAD_T 4
# define SIZEOF_SIZE_T 4 # define SIZEOF_SIZE_T 4
# define SIZEOF_TIME_T 4 # define SIZEOF_TIME_T 4
# define SIZEOF_VOID_P 4 # define SIZEOF_VOID_P 4
# endif # endif
# if defined(__LP64__) # if defined(__LP64__)
/* MacOSX 10.4 (the first release to suppport 64-bit code /* MacOSX 10.4 (the first release to suppport 64-bit code
* at all) only supports 64-bit in the UNIX layer. * at all) only supports 64-bit in the UNIX layer.
* Therefore surpress the toolbox-glue in 64-bit mode. * Therefore surpress the toolbox-glue in 64-bit mode.
*/ */
/* In 64-bit mode setpgrp always has no argments, in 32-bit /* In 64-bit mode setpgrp always has no argments, in 32-bit
* mode that depends on the compilation environment * mode that depends on the compilation environment
*/ */
# undef SETPGRP_HAVE_ARG # undef SETPGRP_HAVE_ARG
# endif # endif
...@@ -67,17 +67,17 @@ ...@@ -67,17 +67,17 @@
#define WORDS_BIGENDIAN 1 #define WORDS_BIGENDIAN 1
#endif /* __BIG_ENDIAN */ #endif /* __BIG_ENDIAN */
/* /*
* The definition in pyconfig.h is only valid on the OS release * The definition in pyconfig.h is only valid on the OS release
* where configure ran on and not necessarily for all systems where * where configure ran on and not necessarily for all systems where
* the executable can be used on. * the executable can be used on.
* *
* Specifically: OSX 10.4 has limited supported for '%zd', while * Specifically: OSX 10.4 has limited supported for '%zd', while
* 10.5 has full support for '%zd'. A binary built on 10.5 won't * 10.5 has full support for '%zd'. A binary built on 10.5 won't
* work properly on 10.4 unless we surpress the definition * work properly on 10.4 unless we surpress the definition
* of PY_FORMAT_SIZE_T * of PY_FORMAT_SIZE_T
*/ */
#undef PY_FORMAT_SIZE_T #undef PY_FORMAT_SIZE_T
#endif /* defined(_APPLE__) */ #endif /* defined(_APPLE__) */
......
This diff is collapsed.
...@@ -16,7 +16,7 @@ extern "C" { ...@@ -16,7 +16,7 @@ extern "C" {
#define PyCF_ONLY_AST 0x0400 #define PyCF_ONLY_AST 0x0400
typedef struct { typedef struct {
int cf_flags; /* bitmask of CO_xxx flags relevant to future */ int cf_flags; /* bitmask of CO_xxx flags relevant to future */
} PyCompilerFlags; } PyCompilerFlags;
PyAPI_FUNC(void) Py_SetProgramName(char *); PyAPI_FUNC(void) Py_SetProgramName(char *);
...@@ -39,32 +39,32 @@ PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFla ...@@ -39,32 +39,32 @@ PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFla
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *, PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *,
int, PyCompilerFlags *flags, int, PyCompilerFlags *flags,
PyArena *); PyArena *);
PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int,
char *, char *, char *, char *,
PyCompilerFlags *, int *, PyCompilerFlags *, int *,
PyArena *); PyArena *);
#define PyParser_SimpleParseString(S, B) \ #define PyParser_SimpleParseString(S, B) \
PyParser_SimpleParseStringFlags(S, B, 0) PyParser_SimpleParseStringFlags(S, B, 0)
#define PyParser_SimpleParseFile(FP, S, B) \ #define PyParser_SimpleParseFile(FP, S, B) \
PyParser_SimpleParseFileFlags(FP, S, B, 0) PyParser_SimpleParseFileFlags(FP, S, B, 0)
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
int); int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
int, int); int, int);
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
PyObject *, PyCompilerFlags *); PyObject *, PyCompilerFlags *);
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int,
PyObject *, PyObject *, int, PyObject *, PyObject *, int,
PyCompilerFlags *); PyCompilerFlags *);
#define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL) #define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL)
PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int, PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
PyCompilerFlags *); PyCompilerFlags *);
PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int); PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int);
PyAPI_FUNC(void) PyErr_Print(void); PyAPI_FUNC(void) PyErr_Print(void);
...@@ -84,20 +84,20 @@ PyAPI_FUNC(int) Py_Main(int argc, char **argv); ...@@ -84,20 +84,20 @@ PyAPI_FUNC(int) Py_Main(int argc, char **argv);
#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) #define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
#define PyRun_AnyFileEx(fp, name, closeit) \ #define PyRun_AnyFileEx(fp, name, closeit) \
PyRun_AnyFileExFlags(fp, name, closeit, NULL) PyRun_AnyFileExFlags(fp, name, closeit, NULL)
#define PyRun_AnyFileFlags(fp, name, flags) \ #define PyRun_AnyFileFlags(fp, name, flags) \
PyRun_AnyFileExFlags(fp, name, 0, flags) PyRun_AnyFileExFlags(fp, name, 0, flags)
#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) #define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) #define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) #define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) #define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) #define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
#define PyRun_File(fp, p, s, g, l) \ #define PyRun_File(fp, p, s, g, l) \
PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
#define PyRun_FileEx(fp, p, s, g, l, c) \ #define PyRun_FileEx(fp, p, s, g, l, c) \
PyRun_FileExFlags(fp, p, s, g, l, c, NULL) PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
#define PyRun_FileFlags(fp, p, s, g, l, flags) \ #define PyRun_FileFlags(fp, p, s, g, l, flags) \
PyRun_FileExFlags(fp, p, s, g, l, 0, flags) PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
/* In getpath.c */ /* In getpath.c */
PyAPI_FUNC(char *) Py_GetProgramFullPath(void); PyAPI_FUNC(char *) Py_GetProgramFullPath(void);
......
...@@ -22,8 +22,8 @@ no meaning otherwise. ...@@ -22,8 +22,8 @@ no meaning otherwise.
#define PySet_MINSIZE 8 #define PySet_MINSIZE 8
typedef struct { typedef struct {
long hash; /* cached hash code for the entry key */ long hash; /* cached hash code for the entry key */
PyObject *key; PyObject *key;
} setentry; } setentry;
...@@ -33,27 +33,27 @@ This data structure is shared by set and frozenset objects. ...@@ -33,27 +33,27 @@ This data structure is shared by set and frozenset objects.
typedef struct _setobject PySetObject; typedef struct _setobject PySetObject;
struct _setobject { struct _setobject {
PyObject_HEAD PyObject_HEAD
Py_ssize_t fill; /* # Active + # Dummy */ Py_ssize_t fill; /* # Active + # Dummy */
Py_ssize_t used; /* # Active */ Py_ssize_t used; /* # Active */
/* The table contains mask + 1 slots, and that's a power of 2. /* The table contains mask + 1 slots, and that's a power of 2.
* We store the mask instead of the size because the mask is more * We store the mask instead of the size because the mask is more
* frequently needed. * frequently needed.
*/ */
Py_ssize_t mask; Py_ssize_t mask;
/* table points to smalltable for small tables, else to /* table points to smalltable for small tables, else to
* additional malloc'ed memory. table is never NULL! This rule * additional malloc'ed memory. table is never NULL! This rule
* saves repeated runtime null-tests. * saves repeated runtime null-tests.
*/ */
setentry *table; setentry *table;
setentry *(*lookup)(PySetObject *so, PyObject *key, long hash); setentry *(*lookup)(PySetObject *so, PyObject *key, long hash);
setentry smalltable[PySet_MINSIZE]; setentry smalltable[PySet_MINSIZE];
long hash; /* only used by frozenset objects */ long hash; /* only used by frozenset objects */
PyObject *weakreflist; /* List of weak references */ PyObject *weakreflist; /* List of weak references */
}; };
PyAPI_DATA(PyTypeObject) PySet_Type; PyAPI_DATA(PyTypeObject) PySet_Type;
...@@ -68,17 +68,17 @@ PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; ...@@ -68,17 +68,17 @@ PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;
#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) #define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type)
#define PyAnySet_CheckExact(ob) \ #define PyAnySet_CheckExact(ob) \
(Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type)
#define PyAnySet_Check(ob) \ #define PyAnySet_Check(ob) \
(Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
#define PySet_Check(ob) \ #define PySet_Check(ob) \
(Py_TYPE(ob) == &PySet_Type || \ (Py_TYPE(ob) == &PySet_Type || \
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
#define PyFrozenSet_Check(ob) \ #define PyFrozenSet_Check(ob) \
(Py_TYPE(ob) == &PyFrozenSet_Type || \ (Py_TYPE(ob) == &PyFrozenSet_Type || \
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
PyAPI_FUNC(PyObject *) PySet_New(PyObject *); PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *); PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);
......
...@@ -62,9 +62,9 @@ PyAPI_DATA(PyTypeObject) PyString_Type; ...@@ -62,9 +62,9 @@ PyAPI_DATA(PyTypeObject) PyString_Type;
PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t);
PyAPI_FUNC(PyObject *) PyString_FromString(const char *); PyAPI_FUNC(PyObject *) PyString_FromString(const char *);
PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list)
Py_GCC_ATTRIBUTE((format(printf, 1, 0))); Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2))); Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *);
PyAPI_FUNC(char *) PyString_AsString(PyObject *); PyAPI_FUNC(char *) PyString_AsString(PyObject *);
PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int);
...@@ -74,10 +74,10 @@ PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t); ...@@ -74,10 +74,10 @@ PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t);
PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*);
PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int,
int, char**, int*); int, char**, int*);
PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t,
const char *, Py_ssize_t, const char *, Py_ssize_t,
const char *); const char *);
PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); PyAPI_FUNC(void) PyString_InternInPlace(PyObject **);
PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); PyAPI_FUNC(void) PyString_InternImmortal(PyObject **);
...@@ -107,7 +107,7 @@ PyAPI_FUNC(PyObject*) PyString_Decode( ...@@ -107,7 +107,7 @@ PyAPI_FUNC(PyObject*) PyString_Decode(
const char *errors /* error handling */ const char *errors /* error handling */
); );
/* Encodes a char buffer of the given size and returns a /* Encodes a char buffer of the given size and returns a
Python object. */ Python object. */
PyAPI_FUNC(PyObject*) PyString_Encode( PyAPI_FUNC(PyObject*) PyString_Encode(
...@@ -117,50 +117,50 @@ PyAPI_FUNC(PyObject*) PyString_Encode( ...@@ -117,50 +117,50 @@ PyAPI_FUNC(PyObject*) PyString_Encode(
const char *errors /* error handling */ const char *errors /* error handling */
); );
/* Encodes a string object and returns the result as Python /* Encodes a string object and returns the result as Python
object. */ object. */
PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( PyAPI_FUNC(PyObject*) PyString_AsEncodedObject(
PyObject *str, /* string object */ PyObject *str, /* string object */
const char *encoding, /* encoding */ const char *encoding, /* encoding */
const char *errors /* error handling */ const char *errors /* error handling */
); );
/* Encodes a string object and returns the result as Python string /* Encodes a string object and returns the result as Python string
object. object.
If the codec returns an Unicode object, the object is converted If the codec returns an Unicode object, the object is converted
back to a string using the default encoding. back to a string using the default encoding.
DEPRECATED - use PyString_AsEncodedObject() instead. */ DEPRECATED - use PyString_AsEncodedObject() instead. */
PyAPI_FUNC(PyObject*) PyString_AsEncodedString( PyAPI_FUNC(PyObject*) PyString_AsEncodedString(
PyObject *str, /* string object */ PyObject *str, /* string object */
const char *encoding, /* encoding */ const char *encoding, /* encoding */
const char *errors /* error handling */ const char *errors /* error handling */
); );
/* Decodes a string object and returns the result as Python /* Decodes a string object and returns the result as Python
object. */ object. */
PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( PyAPI_FUNC(PyObject*) PyString_AsDecodedObject(
PyObject *str, /* string object */ PyObject *str, /* string object */
const char *encoding, /* encoding */ const char *encoding, /* encoding */
const char *errors /* error handling */ const char *errors /* error handling */
); );
/* Decodes a string object and returns the result as Python string /* Decodes a string object and returns the result as Python string
object. object.
If the codec returns an Unicode object, the object is converted If the codec returns an Unicode object, the object is converted
back to a string using the default encoding. back to a string using the default encoding.
DEPRECATED - use PyString_AsDecodedObject() instead. */ DEPRECATED - use PyString_AsDecodedObject() instead. */
PyAPI_FUNC(PyObject*) PyString_AsDecodedString( PyAPI_FUNC(PyObject*) PyString_AsDecodedString(
PyObject *str, /* string object */ PyObject *str, /* string object */
const char *encoding, /* encoding */ const char *encoding, /* encoding */
const char *errors /* error handling */ const char *errors /* error handling */
); );
/* Provides access to the internal data buffer and size of a string /* Provides access to the internal data buffer and size of a string
...@@ -170,11 +170,11 @@ PyAPI_FUNC(PyObject*) PyString_AsDecodedString( ...@@ -170,11 +170,11 @@ PyAPI_FUNC(PyObject*) PyString_AsDecodedString(
cause an exception). */ cause an exception). */
PyAPI_FUNC(int) PyString_AsStringAndSize( PyAPI_FUNC(int) PyString_AsStringAndSize(
register PyObject *obj, /* string or Unicode object */ register PyObject *obj, /* string or Unicode object */
register char **s, /* pointer to buffer variable */ register char **s, /* pointer to buffer variable */
register Py_ssize_t *len /* pointer to length variable or NULL register Py_ssize_t *len /* pointer to length variable or NULL
(only possible for 0-terminated (only possible for 0-terminated
strings) */ strings) */
); );
/* Using the current locale, insert the thousands grouping /* Using the current locale, insert the thousands grouping
...@@ -182,17 +182,17 @@ PyAPI_FUNC(int) PyString_AsStringAndSize( ...@@ -182,17 +182,17 @@ PyAPI_FUNC(int) PyString_AsStringAndSize(
see Objects/stringlib/localeutil.h */ see Objects/stringlib/localeutil.h */
PyAPI_FUNC(int) _PyString_InsertThousandsGrouping(char *buffer, PyAPI_FUNC(int) _PyString_InsertThousandsGrouping(char *buffer,
Py_ssize_t n_buffer, Py_ssize_t n_buffer,
Py_ssize_t n_digits, Py_ssize_t n_digits,
Py_ssize_t buf_size, Py_ssize_t buf_size,
Py_ssize_t *count, Py_ssize_t *count,
int append_zero_char); int append_zero_char);
/* Format the object based on the format_spec, as defined in PEP 3101 /* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */ (Advanced String Formatting). */
PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj, PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj,
char *format_spec, char *format_spec,
Py_ssize_t format_spec_len); Py_ssize_t format_spec_len);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -26,50 +26,50 @@ extern "C" { ...@@ -26,50 +26,50 @@ extern "C" {
pointer is NULL. */ pointer is NULL. */
struct memberlist { struct memberlist {
/* Obsolete version, for binary backwards compatibility */ /* Obsolete version, for binary backwards compatibility */
char *name; char *name;
int type; int type;
int offset; int offset;
int flags; int flags;
}; };
typedef struct PyMemberDef { typedef struct PyMemberDef {
/* Current version, use this */ /* Current version, use this */
char *name; char *name;
int type; int type;
Py_ssize_t offset; Py_ssize_t offset;
int flags; int flags;
char *doc; char *doc;
} PyMemberDef; } PyMemberDef;
/* Types */ /* Types */
#define T_SHORT 0 #define T_SHORT 0
#define T_INT 1 #define T_INT 1
#define T_LONG 2 #define T_LONG 2
#define T_FLOAT 3 #define T_FLOAT 3
#define T_DOUBLE 4 #define T_DOUBLE 4
#define T_STRING 5 #define T_STRING 5
#define T_OBJECT 6 #define T_OBJECT 6
/* XXX the ordering here is weird for binary compatibility */ /* XXX the ordering here is weird for binary compatibility */
#define T_CHAR 7 /* 1-character string */ #define T_CHAR 7 /* 1-character string */
#define T_BYTE 8 /* 8-bit signed int */ #define T_BYTE 8 /* 8-bit signed int */
/* unsigned variants: */ /* unsigned variants: */
#define T_UBYTE 9 #define T_UBYTE 9
#define T_USHORT 10 #define T_USHORT 10
#define T_UINT 11 #define T_UINT 11
#define T_ULONG 12 #define T_ULONG 12
/* Added by Jack: strings contained in the structure */ /* Added by Jack: strings contained in the structure */
#define T_STRING_INPLACE 13 #define T_STRING_INPLACE 13
/* Added by Lillo: bools contained in the structure (assumed char) */ /* Added by Lillo: bools contained in the structure (assumed char) */
#define T_BOOL 14 #define T_BOOL 14
#define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError
when the value is NULL, instead of when the value is NULL, instead of
converting to None. */ converting to None. */
#ifdef HAVE_LONG_LONG #ifdef HAVE_LONG_LONG
#define T_LONGLONG 17 #define T_LONGLONG 17
#define T_ULONGLONG 18 #define T_ULONGLONG 18
#endif /* HAVE_LONG_LONG */ #endif /* HAVE_LONG_LONG */
...@@ -77,11 +77,11 @@ typedef struct PyMemberDef { ...@@ -77,11 +77,11 @@ typedef struct PyMemberDef {
/* Flags */ /* Flags */
#define READONLY 1 #define READONLY 1
#define RO READONLY /* Shorthand */ #define RO READONLY /* Shorthand */
#define READ_RESTRICTED 2 #define READ_RESTRICTED 2
#define PY_WRITE_RESTRICTED 4 #define PY_WRITE_RESTRICTED 4
#define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) #define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED)
/* Obsolete API, for binary backwards compatibility */ /* Obsolete API, for binary backwards compatibility */
......
...@@ -11,40 +11,40 @@ typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock } ...@@ -11,40 +11,40 @@ typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock }
struct _symtable_entry; struct _symtable_entry;
struct symtable { struct symtable {
const char *st_filename; /* name of file being compiled */ const char *st_filename; /* name of file being compiled */
struct _symtable_entry *st_cur; /* current symbol table entry */ struct _symtable_entry *st_cur; /* current symbol table entry */
struct _symtable_entry *st_top; /* module entry */ struct _symtable_entry *st_top; /* module entry */
PyObject *st_symbols; /* dictionary of symbol table entries */ PyObject *st_symbols; /* dictionary of symbol table entries */
PyObject *st_stack; /* stack of namespace info */ PyObject *st_stack; /* stack of namespace info */
PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ PyObject *st_global; /* borrowed ref to MODULE in st_symbols */
int st_nblocks; /* number of blocks */ int st_nblocks; /* number of blocks */
PyObject *st_private; /* name of current class or NULL */ PyObject *st_private; /* name of current class or NULL */
int st_tmpname; /* temporary name counter */ int st_tmpname; /* temporary name counter */
PyFutureFeatures *st_future; /* module's future features */ PyFutureFeatures *st_future; /* module's future features */
}; };
typedef struct _symtable_entry { typedef struct _symtable_entry {
PyObject_HEAD PyObject_HEAD
PyObject *ste_id; /* int: key in st_symbols */ PyObject *ste_id; /* int: key in st_symbols */
PyObject *ste_symbols; /* dict: name to flags */ PyObject *ste_symbols; /* dict: name to flags */
PyObject *ste_name; /* string: name of block */ PyObject *ste_name; /* string: name of block */
PyObject *ste_varnames; /* list of variable names */ PyObject *ste_varnames; /* list of variable names */
PyObject *ste_children; /* list of child ids */ PyObject *ste_children; /* list of child ids */
_Py_block_ty ste_type; /* module, class, or function */ _Py_block_ty ste_type; /* module, class, or function */
int ste_unoptimized; /* false if namespace is optimized */ int ste_unoptimized; /* false if namespace is optimized */
int ste_nested; /* true if block is nested */ int ste_nested; /* true if block is nested */
unsigned ste_free : 1; /* true if block has free variables */ unsigned ste_free : 1; /* true if block has free variables */
unsigned ste_child_free : 1; /* true if a child block has free vars, unsigned ste_child_free : 1; /* true if a child block has free vars,
including free refs to globals */ including free refs to globals */
unsigned ste_generator : 1; /* true if namespace is a generator */ unsigned ste_generator : 1; /* true if namespace is a generator */
unsigned ste_varargs : 1; /* true if block has varargs */ unsigned ste_varargs : 1; /* true if block has varargs */
unsigned ste_varkeywords : 1; /* true if block has varkeywords */ unsigned ste_varkeywords : 1; /* true if block has varkeywords */
unsigned ste_returns_value : 1; /* true if namespace uses return with unsigned ste_returns_value : 1; /* true if namespace uses return with
an argument */ an argument */
int ste_lineno; /* first line of block */ int ste_lineno; /* first line of block */
int ste_opt_lineno; /* lineno of last exec or import * */ int ste_opt_lineno; /* lineno of last exec or import * */
int ste_tmpname; /* counter for listcomp temp vars */ int ste_tmpname; /* counter for listcomp temp vars */
struct symtable *ste_table; struct symtable *ste_table;
} PySTEntryObject; } PySTEntryObject;
PyAPI_DATA(PyTypeObject) PySTEntry_Type; PyAPI_DATA(PyTypeObject) PySTEntry_Type;
...@@ -53,8 +53,8 @@ PyAPI_DATA(PyTypeObject) PySTEntry_Type; ...@@ -53,8 +53,8 @@ PyAPI_DATA(PyTypeObject) PySTEntry_Type;
PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *); PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *);
PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *, PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *,
PyFutureFeatures *); PyFutureFeatures *);
PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *);
PyAPI_FUNC(void) PySymtable_Free(struct symtable *); PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
...@@ -76,7 +76,7 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *); ...@@ -76,7 +76,7 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
#define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT)
/* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol /* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol
table. GLOBAL is returned from PyST_GetScope() for either of them. table. GLOBAL is returned from PyST_GetScope() for either of them.
It is stored in ste_symbols at bits 12-14. It is stored in ste_symbols at bits 12-14.
*/ */
#define SCOPE_OFF 11 #define SCOPE_OFF 11
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -4,10 +4,10 @@ The Netherlands. ...@@ -4,10 +4,10 @@ The Netherlands.
All Rights Reserved All Rights Reserved
Permission to use, copy, modify, and distribute this software and its Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission. distribution of the software without specific, written prior permission.
...@@ -32,24 +32,24 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -32,24 +32,24 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
static PyObject * static PyObject *
gestalt_gestalt(PyObject *self, PyObject *args) gestalt_gestalt(PyObject *self, PyObject *args)
{ {
OSErr iErr; OSErr iErr;
OSType selector; OSType selector;
SInt32 response; SInt32 response;
if (!PyArg_ParseTuple(args, "O&", PyMac_GetOSType, &selector)) if (!PyArg_ParseTuple(args, "O&", PyMac_GetOSType, &selector))
return NULL; return NULL;
iErr = Gestalt ( selector, &response ); iErr = Gestalt ( selector, &response );
if (iErr != 0) if (iErr != 0)
return PyMac_Error(iErr); return PyMac_Error(iErr);
return PyInt_FromLong(response); return PyInt_FromLong(response);
} }
static struct PyMethodDef gestalt_methods[] = { static struct PyMethodDef gestalt_methods[] = {
{"gestalt", gestalt_gestalt, METH_VARARGS}, {"gestalt", gestalt_gestalt, METH_VARARGS},
{NULL, NULL} /* Sentinel */ {NULL, NULL} /* Sentinel */
}; };
void void
initgestalt(void) initgestalt(void)
{ {
Py_InitModule("gestalt", gestalt_methods); Py_InitModule("gestalt", gestalt_methods);
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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