00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifndef __PY_CPythonAPI_h__
00053 #define __PY_CPythonAPI_h__
00054
00055 #define COMPILE_TIME_DEPENDENCY_ON_PYTHON
00056
00057 #if defined(COMPILE_TIME_DEPENDENCY_ON_PYTHON)
00058
00059
00060
00061 #include <python2.5/Python.h>
00062 #include <python2.5/pythread.h>
00063 #include <python2.5/marshal.h>
00064 #include <python2.5/frameobject.h>
00065 #endif // COMPILE_TIME_DEPENDENCY_ON_PYTHON
00066
00067 #include "PY_API.h"
00068 #include <SYS/SYS_Types.h>
00069 #include <boost/preprocessor/seq/for_each.hpp>
00070 #include <boost/preprocessor/seq/for_each_i.hpp>
00071 #include <boost/preprocessor/seq/seq.hpp>
00072 #include <boost/preprocessor/punctuation/comma_if.hpp>
00073 #include <boost/preprocessor/cat.hpp>
00074 #include <boost/preprocessor/stringize.hpp>
00075 #include <string.h>
00076 #include <stdarg.h>
00077
00078 #ifdef WIN32
00079
00080
00081
00082 #pragma warning(disable:4003)
00083 #endif
00084
00085
00086
00087
00088
00089 #define PY_WRAPPED_FUNCTIONS \
00090 ((Py_InitializeEx)(void)((int))) \
00091 ((Py_IsInitialized)(int)()) \
00092 ((PyGILState_Ensure)(PY_PyGILState_STATE)()) \
00093 ((PyGILState_Release)(void)((PY_PyGILState_STATE))) \
00094 ((PyGILState_GetThisThreadState)(PY_PyThreadState *)()) \
00095 ((PyRun_SimpleStringFlags)(int)((const char *)(PY_PyCompilerFlags *))) \
00096 ((Py_CompileStringFlags)(PY_PyObject *) \
00097 ((const char *)(const char *)(int)(PY_PyCompilerFlags *))) \
00098 ((PyEval_InitThreads)(void)()) \
00099 ((PyEval_SaveThread)(PY_PyThreadState *)()) \
00100 ((PyEval_RestoreThread)(void)((PY_PyThreadState *))) \
00101 ((PyEval_GetFrame)(PY_PyFrameObject *)()) \
00102 ((PyEval_EvalCode)(PY_PyObject *) \
00103 ((PY_PyCodeObject *)(PY_PyObject *)(PY_PyObject *))) \
00104 ((PyThread_get_thread_ident)(long)()) \
00105 ((PyThreadState_SetAsyncExc)(int)((long)(PY_PyObject *))) \
00106 ((PyMem_Malloc)(void *)((size_t))) \
00107 ((Py_Main)(int)((int)(char **))) \
00108 ((Py_IncRef)(void)((PY_PyObject *))) \
00109 ((Py_DecRef)(void)((PY_PyObject *))) \
00110 ((PyObject_GetAttr)(PY_PyObject *)((PY_PyObject *)(PY_PyObject *))) \
00111 ((PyObject_GetAttrString)(PY_PyObject *)((PY_PyObject *)(const char *))) \
00112 ((PyObject_SetAttr)(int)((PY_PyObject *)(PY_PyObject *)(PY_PyObject *))) \
00113 ((PyObject_Str)(PY_PyObject *)((PY_PyObject *))) \
00114 ((PyObject_IsTrue)(int)((PY_PyObject *))) \
00115 ((PyObject_CallObject)(PY_PyObject *)((PY_PyObject *)(PY_PyObject *))) \
00116 ((PyObject_Call)(PY_PyObject *) \
00117 ((PY_PyObject *)(PY_PyObject *)(PY_PyObject *))) \
00118 ((PyObject_GetIter)(PY_PyObject *)((PY_PyObject *))) \
00119 ((PyObject_RichCompareBool)(int)((PY_PyObject *)(PY_PyObject *)(int))) \
00120 ((Py_VaBuildValue)(PY_PyObject *)((const char *)(va_list))) \
00121 ((PyArg_VaParse)(int)((PY_PyObject *)(const char *)(va_list))) \
00122 ((PyType_IsSubtype)(int)((PY_PyTypeObject *)(PY_PyTypeObject *))) \
00123 ((PyType_Ready)(int)((PY_PyTypeObject *))) \
00124 ((PyErr_Occurred)(PY_PyObject *)()) \
00125 ((PyErr_ExceptionMatches)(int)((PY_PyObject *))) \
00126 ((PyErr_Fetch)(void)((PY_PyObject **)(PY_PyObject **)(PY_PyObject **))) \
00127 ((PyErr_Clear)(void)()) \
00128 ((PyErr_SetString)(void)((PY_PyObject *)(const char *))) \
00129 ((PyErr_SetNone)(void)((PY_PyObject *))) \
00130 ((PyErr_SetObject)(void)((PY_PyObject *)(PY_PyObject *))) \
00131 ((PyErr_CheckSignals)(int)()) \
00132 ((PyCObject_GetDesc)(void *)((PY_PyObject *))) \
00133 ((PyCObject_AsVoidPtr)(void *)((PY_PyObject *))) \
00134 ((PyLong_FromLongLong)(PY_PyObject *)((int64))) \
00135 ((PyLong_FromLong)(PY_PyObject *)((long))) \
00136 ((PyLong_AsLong)(long)((PY_PyObject *))) \
00137 ((PyFloat_AsDouble)(double)((PY_PyObject *))) \
00138 ((PyFloat_FromDouble)(PY_PyObject *)((double))) \
00139 ((PySequence_Check)(int)((PY_PyObject *))) \
00140 ((PySequence_Size)(PY_Py_ssize_t)((PY_PyObject *))) \
00141 ((PySequence_GetItem)(PY_PyObject *)((PY_PyObject *)(PY_Py_ssize_t))) \
00142 ((PyList_New)(PY_PyObject *)((PY_Py_ssize_t))) \
00143 ((PyList_Size)(PY_Py_ssize_t)((PY_PyObject *))) \
00144 ((PyList_GetItem)(PY_PyObject *)((PY_PyObject *)(PY_Py_ssize_t))) \
00145 ((PyList_SetItem)(int)((PY_PyObject *)(PY_Py_ssize_t)(PY_PyObject *))) \
00146 ((PyList_Append)(int)((PY_PyObject *)(PY_PyObject *))) \
00147 ((PyTuple_New)(PY_PyObject *)((PY_Py_ssize_t))) \
00148 ((PyTuple_SetItem)(int)((PY_PyObject *)(PY_Py_ssize_t)(PY_PyObject *))) \
00149 ((PyDict_New)(PY_PyObject *)()) \
00150 ((PyDict_Clear)(void)((PY_PyObject *))) \
00151 ((PyDict_Next)(int) \
00152 ((PY_PyObject *)(PY_Py_ssize_t *)(PY_PyObject **)(PY_PyObject **))) \
00153 ((PyDict_GetItemString)(PY_PyObject *)((PY_PyObject *)(const char *))) \
00154 ((PyDict_SetItemString)(int) \
00155 ((PY_PyObject *)(const char *)(PY_PyObject *))) \
00156 ((PyDict_SetItem)(int)((PY_PyObject *)(PY_PyObject *)(PY_PyObject *))) \
00157 ((PyIter_Next)(PY_PyObject *)((PY_PyObject *))) \
00158 ((PyFunction_GetCode)(PY_PyObject *)((PY_PyObject *))) \
00159 ((PyCallable_Check)(int)((PY_PyObject *))) \
00160 ((PyImport_ImportModule)(PY_PyObject *)((const char *))) \
00161 ((PyImport_ExecCodeModule)(PY_PyObject *)((char *)(PY_PyObject *))) \
00162 ((PyImport_AddModule)(PY_PyObject *)((const char *))) \
00163 ((PyModule_GetDict)(PY_PyObject *)((PY_PyObject *))) \
00164 ((PyModule_AddObject)(int)((PY_PyObject *)(const char *)(PY_PyObject *))) \
00165 ((PySys_SetArgv)(void)((int)(char **))) \
00166 ((PySys_GetObject)(PY_PyObject *)((char *))) \
00167 ((PyOS_InitInterrupts)(void)()) \
00168 ((PyMarshal_ReadObjectFromString)(PY_PyObject *)((char *)(PY_Py_ssize_t))) \
00169 ((PyMarshal_WriteObjectToString)(PY_PyObject *)((PY_PyObject *)(int))) \
00170 ((PyRun_InteractiveLoopFlags)(int) \
00171 ((FILE *)(const char *)(PY_PyCompilerFlags *)))
00172
00173
00174
00175
00176 typedef char *(*PY_PyOS_ReadlineFunctionPointerType)(FILE *, FILE *, char *);
00177 #define PY_WRAPPED_CONSTANTS \
00178 ((_Py_NoneStruct)(PY_PyObject)) \
00179 ((_PyOS_ReadlineTState)(PY_PyThreadState *)) \
00180 ((_PyThreadState_Current)(PY_PyThreadState *)) \
00181 ((PyOS_ReadlineFunctionPointer)(PY_PyOS_ReadlineFunctionPointerType)) \
00182 ((PyExc_RuntimeError)(PY_PyObject *)) \
00183 ((PyExc_IndexError)(PY_PyObject *)) \
00184 ((PyExc_AttributeError)(PY_PyObject *)) \
00185 ((PyExc_TypeError)(PY_PyObject *)) \
00186 ((PyExc_KeyboardInterrupt)(PY_PyObject *)) \
00187 ((PyExc_SystemExit)(PY_PyObject *)) \
00188 ((PyExc_BaseException)(PY_PyObject *)) \
00189 ((PyLong_Type)(PY_PyTypeObject)) \
00190 ((PyFloat_Type)(PY_PyTypeObject)) \
00191 ((PyUnicode_Type)(PY_PyTypeObject)) \
00192 ((PyTuple_Type)(PY_PyTypeObject)) \
00193 ((PyList_Type)(PY_PyTypeObject)) \
00194 ((PyDict_Type)(PY_PyTypeObject)) \
00195 ((PyFunction_Type)(PY_PyTypeObject))
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218 #define PY_FOR_EACH_SEQ_OF_2(macro, seq) \
00219 BOOST_PP_SEQ_FOR_EACH(PY_CALLBACK_SEQ_OF_2, macro, seq)
00220
00221
00222
00223 #define PY_CALLBACK_SEQ_OF_2(r, macro, seq) \
00224 macro(PY_SEQ_ELEM_0(seq), PY_SEQ_ELEM_1(seq))
00225
00226
00227
00228
00229 #define PY_FOR_EACH_SEQ_OF_3(macro, seq) \
00230 BOOST_PP_SEQ_FOR_EACH(PY_CALLBACK_SEQ_OF_3, macro, seq)
00231 #define PY_CALLBACK_SEQ_OF_3(r, macro, seq) \
00232 macro(PY_SEQ_ELEM_0(seq), PY_SEQ_ELEM_1(seq), PY_SEQ_ELEM_2(seq))
00233
00234
00235
00236
00237 #define PY_SEQ_ELEM_0(seq) \
00238 BOOST_PP_SEQ_HEAD(seq)
00239 #define PY_SEQ_ELEM_1(seq) \
00240 BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq))
00241 #define PY_SEQ_ELEM_2(seq) \
00242 BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_TAIL(seq)))
00243
00244
00245
00246
00247
00248
00249 #define PY_MAKE_PARM_LIST(parm_types) \
00250 BOOST_PP_SEQ_FOR_EACH_I(PY_MAKE_PARM, _, parm_types)
00251
00252
00253
00254
00255
00256 #define PY_MAKE_PARM(r, unused_data, i, elem) \
00257 BOOST_PP_COMMA_IF(i) elem BOOST_PP_CAT(arg, i)
00258
00259
00260
00261
00262
00263
00264 #define PY_MAKE_ARG_LIST(parm_types) \
00265 BOOST_PP_SEQ_FOR_EACH_I(PY_MAKE_ARG, _, parm_types)
00266
00267 #define PY_MAKE_ARG(r, unused_data, i, unused_elem) \
00268 BOOST_PP_COMMA_IF(i) BOOST_PP_CAT(arg, i)
00269
00270
00271
00272 #if !defined(COMPILE_TIME_DEPENDENCY_ON_PYTHON)
00273
00274
00275 PY_API class PY_PyTypeObject;
00276 PY_API class PY_PyCodeObject;
00277 PY_API class PY_PyCompilerFlags;
00278 PY_API class PY_PyThreadState;
00279 PY_API class PY_PyMethodDef;
00280 typedef int PY_PyGILState_STATE;
00281
00282 #if defined(WIN32)
00283
00284
00285
00286
00287 #if SIZEOF_VOID_P == 8
00288 typedef int64 PY_Py_ssize_t;
00289 #else
00290 typedef int32 PY_Py_ssize_t;
00291 #endif
00292 #else
00293 typedef ssize_t PY_Py_ssize_t;
00294 #endif
00295
00296
00297
00298
00299
00300
00301 template <typename RETURN_TYPE>
00302 static inline RETURN_TYPE &
00303 pyAccessStructMember(void *c_struct, int offset)
00304 { return *(RETURN_TYPE *)((char *)c_struct + offset); }
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325 PY_API class PY_PyObject_HEAD_EXTRA
00326 {
00327 public:
00328 static int theStructSize;
00329 private:
00330 PY_PyObject_HEAD_EXTRA();
00331 };
00332
00333
00334 #define PY_ADD_SUBCLASS_1(subclass, base_class, member1_type, member1_name) \
00335 PY_API class subclass : public base_class \
00336 { \
00337 public: \
00338 member1_type member1_name() \
00339 { return pyAccessStructMember<member1_type>( \
00340 this, base_class::theStructSize); } \
00341 \
00342 static void computeStructSize() \
00343 { theStructSize = base_class::theStructSize + sizeof(member1_type); } \
00344 \
00345 static int theStructSize; \
00346 };
00347
00348
00349 #define PY_ADD_SUBCLASS_2(subclass, base_class, \
00350 member1_type, member1_name, member2_type, member2_name) \
00351 PY_API class subclass : public base_class \
00352 { \
00353 public: \
00354 member1_type member1_name() \
00355 { return pyAccessStructMember<member1_type>( \
00356 this, base_class::theStructSize); } \
00357 \
00358 member2_type member2_name() \
00359 { return pyAccessStructMember<member2_type>( \
00360 this, base_class::theStructSize + sizeof(member1_type)); } \
00361 \
00362 static void computeStructSize() \
00363 { theStructSize = base_class::theStructSize + \
00364 sizeof(member1_type) + sizeof(member2_type); } \
00365 \
00366 static int theStructSize; \
00367 };
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404 PY_ADD_SUBCLASS_2(PY_PyObject, PY_PyObject_HEAD_EXTRA,
00405 PY_Py_ssize_t, ob_refcnt,
00406 PY_PyTypeObject *, ob_type)
00407
00408 PY_ADD_SUBCLASS_1(PY_PyVarObject, PY_PyObject,
00409 PY_Py_ssize_t, ob_size)
00410
00411 PY_ADD_SUBCLASS_1(PY_PyTypeObject, PY_PyVarObject,
00412 const char *, tp_name)
00413
00414 PY_ADD_SUBCLASS_2(PY_PyFrameObject, PY_PyVarObject,
00415 PY_PyFrameObject *, f_back,
00416 PY_PyCodeObject *, f_code)
00417
00418 PY_ADD_SUBCLASS_1(PY_PyListObject, PY_PyVarObject,
00419 PY_PyObject **, ob_item)
00420
00421
00422
00423
00424
00425 PY_API class PY_PyTupleObject : public PY_PyVarObject
00426 {
00427 public:
00428 PY_PyObject **ob_item()
00429 { return (PY_PyObject **)((char *)this + PY_PyVarObject::theStructSize); }
00430 };
00431
00432
00433
00434
00435
00436
00437
00438
00439 typedef PY_PyObject *(*PY_PyCFunction)(PY_PyObject *, PY_PyObject *);
00440
00441 PY_API struct PY_PyMethodDef
00442 {
00443 const char *ml_name;
00444 PY_PyCFunction ml_meth;
00445 int ml_flags;
00446 const char *ml_doc;
00447 };
00448
00449
00450
00451
00452
00453 #define PY_DECLARE_FUNCTION_FROM_SEQ(seq) \
00454 PY_CALLBACK_SEQ_OF_3(_, PY_DECLARE_FUNCTION, seq)
00455
00456
00457
00458 #define PY_DECLARE_FUNCTION(function_name, return_type, parm_types) \
00459 PY_API return_type BOOST_PP_CAT(PY_, function_name)( \
00460 PY_MAKE_PARM_LIST(parm_types));
00461
00462
00463
00464 #define PY_DECLARE_WRAPPED_CONSTANT(constant_name, type) \
00465 PY_API type &BOOST_PP_CAT(PY_, constant_name)();
00466
00467
00468
00469
00470 PY_FOR_EACH_SEQ_OF_3(PY_DECLARE_FUNCTION, PY_WRAPPED_FUNCTIONS)
00471 PY_FOR_EACH_SEQ_OF_2(PY_DECLARE_WRAPPED_CONSTANT, PY_WRAPPED_CONSTANTS)
00472
00473
00474
00475
00476 PY_API PY_PyObject *PY_Py_InitModule(const char *name, PY_PyMethodDef *methods);
00477 PY_API int PY_PyArg_ParseTuple(PY_PyObject *args, const char *format, ...);
00478 PY_API PY_PyObject *PY_Py_BuildValue(const char *format, ...);
00479 PY_API PY_PyObject *PY_PyObject_CallMethod(
00480 PY_PyObject *o, char *name, char *format, ...);
00481
00482 #define PY_FUNC_SEQ_PyInt_AsLong (PyInt_AsLong)(long)((PY_PyObject *))
00483 #define PY_FUNC_SEQ_PyInt_FromLong (PyInt_FromLong)(PY_PyObject *)((long))
00484 #define PY_FUNC_SEQ_PyString_AsString \
00485 (PyString_AsString)(char *)((PY_PyObject *))
00486 #define PY_FUNC_SEQ_PyString_AsStringAndSize \
00487 (PyString_AsStringAndSize)(int)((PY_PyObject *)(char **)(PY_Py_ssize_t *))
00488 #define PY_FUNC_SEQ_PyString_FromString \
00489 (PyString_FromString)(PY_PyObject *)((const char *))
00490 #define PY_FUNC_SEQ_PyString_FromStringAndSize \
00491 (PyString_FromStringAndSize)(PY_PyObject *)((const char *)(PY_Py_ssize_t))
00492
00493 PY_DECLARE_FUNCTION_FROM_SEQ(PY_FUNC_SEQ_PyInt_AsLong)
00494 PY_DECLARE_FUNCTION_FROM_SEQ(PY_FUNC_SEQ_PyInt_FromLong)
00495 PY_DECLARE_FUNCTION_FROM_SEQ(PY_FUNC_SEQ_PyString_AsString)
00496 PY_DECLARE_FUNCTION_FROM_SEQ(PY_FUNC_SEQ_PyString_AsStringAndSize)
00497 PY_DECLARE_FUNCTION_FROM_SEQ(PY_FUNC_SEQ_PyString_FromString)
00498 PY_DECLARE_FUNCTION_FROM_SEQ(PY_FUNC_SEQ_PyString_FromStringAndSize)
00499
00500
00501
00502
00503
00504
00505
00506 static inline int PY_Py_single_input() { return 256; }
00507 static inline int PY_Py_file_input() { return 257; }
00508 static inline int PY_Py_eval_input() { return 258; }
00509 static inline int PY_Py_MARSHAL_VERSION() { return 2; }
00510 static inline int PY_METH_VARARGS() { return 0x0001; }
00511 static inline int PY_Py_EQ() { return 2; }
00512
00513
00514
00515
00516 PY_DECLARE_WRAPPED_CONSTANT(_Py_TrueStruct, PY_PyObject)
00517 PY_DECLARE_WRAPPED_CONSTANT(_Py_ZeroStruct, PY_PyObject)
00518
00519
00520
00521
00522
00523 PY_DECLARE_WRAPPED_CONSTANT(PyInt_Type, PY_PyTypeObject)
00524 PY_DECLARE_WRAPPED_CONSTANT(PyString_Type, PY_PyTypeObject)
00525 #define PY_PyInt_Check(op) PY_PyObject_TypeCheck(op, &PY_PyInt_Type())
00526 #define PY_PyString_Check(op) PY_PyObject_TypeCheck(op, &PY_PyString_Type())
00527
00528
00529
00530
00531
00532 #define PY_Py_INCREF PY_Py_IncRef
00533 #define PY_Py_DECREF PY_Py_DecRef
00534 #define PY_Py_XDECREF(op) if ((op) == NULL) ; else PY_Py_DECREF(op)
00535
00536 #define PY_Py_False() (&PY__Py_ZeroStruct())
00537 #define PY_Py_True() (&PY__Py_TrueStruct())
00538 #define PY_Py_None() (&PY__Py_NoneStruct())
00539
00540 #define PY_Py_RETURN_NONE return PY_Py_INCREF(PY_Py_None()), PY_Py_None()
00541 #ifdef WIN32
00542 #define PY_PyMODINIT_FUNC extern "C" __declspec(dllexport) void
00543 #else
00544 #define PY_PyMODINIT_FUNC extern "C" void
00545 #endif
00546
00547 #define PY_PyRun_SimpleString(s) PY_PyRun_SimpleStringFlags(s, NULL)
00548 #define PY_Py_CompileString(str, p, s) PY_Py_CompileStringFlags(str, p, s, NULL)
00549 #define PY_PyRun_InteractiveLoop(f, p) PY_PyRun_InteractiveLoopFlags(f, p, NULL)
00550
00551 #define PY_PyList_SET_ITEM(op, i, v) \
00552 (((PY_PyListObject *)(op))->ob_item()[i] = (v))
00553 #define PY_PyTuple_SET_ITEM(op, i, v) \
00554 (((PY_PyTupleObject *)(op))->ob_item()[i] = (v))
00555
00556
00557 #define PY_PyObject_TypeCheck(ob, tp) \
00558 ((ob)->ob_type() == (tp) || PY_PyType_IsSubtype((ob)->ob_type(), (tp)))
00559 #define PY_PyCObject_Check(op) (op->ob_type() == &PY_PyCObject_Type())
00560 #define PY_PyFloat_Check(op) PY_PyObject_TypeCheck(op, &PY_PyFloat_Type())
00561 #define PY_PyLong_Check(op) PY_PyObject_TypeCheck(op, &PY_PyLong_Type())
00562 #define PY_PyUnicode_Check(op) PY_PyObject_TypeCheck(op, &PY_PyUnicode_Type())
00563 #define PY_PyTuple_Check(op) PY_PyObject_TypeCheck(op, &PY_PyTuple_Type())
00564 #define PY_PyList_Check(op) PY_PyObject_TypeCheck(op, &PY_PyList_Type())
00565 #define PY_PyDict_Check(op) PY_PyObject_TypeCheck(op, &PY_PyDict_Type())
00566 #define PY_PyFunction_Check(op) ((op)->ob_type() == &PY_PyFunction_Type())
00567
00568
00569
00570
00571
00572 #define PY_PyExceptionInstance_Check(op) \
00573 PY_PyObject_TypeCheck(op, (PY_PyTypeObject *)&PY_PyExc_BaseException())
00574
00575
00576
00577
00578
00579 #define PY_PYFRAME_BACK(op) ((op)->f_back())
00580 #define PY_PYFRAME_CODE(op) ((op)->f_code())
00581
00582
00583
00584
00585 PY_API void PYloadPythonLibrary();
00586
00587
00588 #else // COMPILE_TIME_DEPENDENCY_ON_PYTHON
00589
00590
00591
00592
00593
00594 #define PY_PyCompilerFlags PyCompilerFlags
00595 #define PY_PyThreadState PyThreadState
00596 #define PY_PyMethodDef PyMethodDef
00597 #define PY_PyGILState_STATE PyGILState_STATE
00598 #define PY_Py_ssize_t Py_ssize_t
00599 #define PY_PyObject_HEAD_EXTRA PyObject_HEAD_EXTRA
00600 #define PY_PyObject PyObject
00601 #define PY_PyVarObject PyVarObject
00602 #define PY_PyTypeObject PyTypeObject
00603 #define PY_PyCodeObject PyCodeObject
00604 #define PY_PyFrameObject PyFrameObject
00605 #define PY_PyListObject PyListObject
00606 #define PY_PyTupleObject PyTupleObject
00607
00608
00609
00610
00611
00612
00613 #define PY_DECLARE_FUNCTION(function_name, return_type, parm_types) \
00614 static inline return_type BOOST_PP_CAT(PY_, function_name)( \
00615 PY_MAKE_PARM_LIST(parm_types)) \
00616 { return function_name(PY_MAKE_ARG_LIST(parm_types)); }
00617
00618 #define PY_DECLARE_WRAPPED_CONSTANT(constant_name, type) \
00619 static inline type &BOOST_PP_CAT(PY_, constant_name)() \
00620 { return constant_name; }
00621
00622 PY_FOR_EACH_SEQ_OF_3(PY_DECLARE_FUNCTION, PY_WRAPPED_FUNCTIONS)
00623 PY_FOR_EACH_SEQ_OF_2(PY_DECLARE_WRAPPED_CONSTANT, PY_WRAPPED_CONSTANTS)
00624
00625
00626
00627
00628
00629
00630 #define PY_Py_InitModule Py_InitModule
00631 #define PY_PyArg_ParseTuple PyArg_ParseTuple
00632 #define PY_Py_BuildValue Py_BuildValue
00633 #define PY_PyObject_CallMethod PyObject_CallMethod
00634
00635
00636 #define PY_Py_single_input() Py_single_input
00637 #define PY_Py_file_input() Py_file_input
00638 #define PY_Py_eval_input() Py_eval_input
00639 #define PY_Py_MARSHAL_VERSION() Py_MARSHAL_VERSION
00640 #define PY_METH_VARARGS() METH_VARARGS
00641 #define PY_Py_EQ() Py_EQ
00642
00643
00644 #define PY_Py_INCREF Py_INCREF
00645 #define PY_Py_DECREF Py_DECREF
00646 #define PY_Py_XDECREF Py_XDECREF
00647
00648 #define PY_Py_False() Py_False
00649 #define PY_Py_True() Py_True
00650 #define PY_Py_None() Py_None
00651
00652 #define PY_Py_RETURN_NONE Py_RETURN_NONE
00653 #define PY_PyMODINIT_FUNC PyMODINIT_FUNC
00654
00655 #define PY_PyRun_SimpleString PyRun_SimpleString
00656 #define PY_Py_CompileString Py_CompileString
00657 #define PY_PyRun_InteractiveLoop PyRun_InteractiveLoop
00658
00659 #define PY_PyList_SET_ITEM PyList_SET_ITEM
00660 #define PY_PyTuple_SET_ITEM PyTuple_SET_ITEM
00661
00662 #define PY_PyObject_TypeCheck PyObject_TypeCheck
00663 #define PY_PyExceptionInstance_Check PyExceptionInstance_Check
00664 #define PY_PyCObject_Check PyCObject_Check
00665 #define PY_PyLong_Check PyLong_Check
00666 #define PY_PyFloat_Check PyFloat_Check
00667 #define PY_PyTuple_Check PyTuple_Check
00668 #define PY_PyList_Check PyList_Check
00669 #define PY_PyDict_Check PyDict_Check
00670 #define PY_PyFunction_Check PyFunction_Check
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681 #define PY__Py_TrueStruct() _PyTrueStruct
00682 #define PY__Py_ZeroStruct() _PyZeroStruct
00683
00684
00685 #if PY_MAJOR_VERSION < 3
00686 #define PY_PyInt_AsLong PyInt_AsLong
00687 #define PY_PyInt_FromLong PyInt_FromLong
00688 #define PY_PyInt_Check PyInt_Check
00689
00690 #define PY_PyString_AsString PyString_AsString
00691 #define PY_PyString_AsStringAndSize PyString_AsStringAndSize
00692 #define PY_PyString_FromString PyString_FromString
00693 #define PY_PyString_FromStringAndSize PyString_FromStringAndSize
00694 #define PY_PyString_Check PyString_Check
00695 #else
00696 #define PY_PyInt_AsLong PyLong_AsLong
00697 #define PY_PyInt_FromLong PyLong_FromLong
00698 #define PY_PyInt_Check PyLong_Check
00699
00700 #define PY_PyString_AsString PyUnicode_AsString
00701 #define PY_PyString_AsStringAndSize PyUnicode_AsStringAndSize
00702 #define PY_PyString_FromString PyUnicode_FromString
00703 #define PY_PyString_FromStringAndSize PyUnicode_FromStringAndSize
00704 #define PY_PyString_Check PyUnicode_Check
00705 #endif
00706
00707
00708
00709
00710 #define PY_PYFRAME_BACK(op) ((op)->f_back)
00711 #define PY_PYFRAME_CODE(op) ((op)->f_code)
00712
00713
00714 static inline void PYloadPythonLibrary() {}
00715
00716 #endif // COMPILE_TIME_DEPENDENCY_ON_PYTHON
00717 #endif