Patched PyCXX 6.2.5 with original FreeCAD changes made in 6.2.0

This commit is contained in:
Yorik van Havre
2014-09-18 18:40:40 -03:00
parent f5e87dd358
commit 29cadd9681
23 changed files with 621 additions and 472 deletions

View File

@@ -39,29 +39,29 @@
namespace Py
{
bool _CFunction_Check( PyObject *op ) { return op->ob_type == _CFunction_Type(); }
bool _Complex_Check( PyObject *op ) { return op->ob_type == _Complex_Type(); }
bool _Dict_Check( PyObject *op ) { return op->ob_type == _Dict_Type(); }
bool _Float_Check( PyObject *op ) { return op->ob_type == _Float_Type(); }
bool _Function_Check( PyObject *op ) { return op->ob_type == _Function_Type(); }
bool _Boolean_Check( PyObject *op ) { return op->ob_type == _Bool_Type(); }
bool _List_Check( PyObject *op ) { return op->ob_type == _List_Type(); }
bool _Long_Check( PyObject *op ) { return op->ob_type == _Long_Type(); }
bool _Method_Check( PyObject *op ) { return op->ob_type == _Method_Type(); }
bool _Module_Check( PyObject *op ) { return op->ob_type == _Module_Type(); }
bool _Range_Check( PyObject *op ) { return op->ob_type == _Range_Type(); }
bool _Slice_Check( PyObject *op ) { return op->ob_type == _Slice_Type(); }
bool _TraceBack_Check( PyObject *op ) { return op->ob_type == _TraceBack_Type(); }
bool _Tuple_Check( PyObject *op ) { return op->ob_type == _Tuple_Type(); }
bool _Type_Check( PyObject *op ) { return op->ob_type == _Type_Type(); }
bool _Unicode_Check( PyObject *op ) { return op->ob_type == _Unicode_Type(); }
PYCXX_EXPORT bool _CFunction_Check( PyObject *op ) { return op->ob_type == _CFunction_Type(); }
PYCXX_EXPORT bool _Complex_Check( PyObject *op ) { return op->ob_type == _Complex_Type(); }
PYCXX_EXPORT bool _Dict_Check( PyObject *op ) { return op->ob_type == _Dict_Type(); }
PYCXX_EXPORT bool _Float_Check( PyObject *op ) { return op->ob_type == _Float_Type(); }
PYCXX_EXPORT bool _Function_Check( PyObject *op ) { return op->ob_type == _Function_Type(); }
PYCXX_EXPORT bool _Boolean_Check( PyObject *op ) { return op->ob_type == _Bool_Type(); }
PYCXX_EXPORT bool _List_Check( PyObject *op ) { return op->ob_type == _List_Type(); }
PYCXX_EXPORT bool _Long_Check( PyObject *op ) { return op->ob_type == _Long_Type(); }
PYCXX_EXPORT bool _Method_Check( PyObject *op ) { return op->ob_type == _Method_Type(); }
PYCXX_EXPORT bool _Module_Check( PyObject *op ) { return op->ob_type == _Module_Type(); }
PYCXX_EXPORT bool _Range_Check( PyObject *op ) { return op->ob_type == _Range_Type(); }
PYCXX_EXPORT bool _Slice_Check( PyObject *op ) { return op->ob_type == _Slice_Type(); }
PYCXX_EXPORT bool _TraceBack_Check( PyObject *op ) { return op->ob_type == _TraceBack_Type(); }
PYCXX_EXPORT bool _Tuple_Check( PyObject *op ) { return op->ob_type == _Tuple_Type(); }
PYCXX_EXPORT bool _Type_Check( PyObject *op ) { return op->ob_type == _Type_Type(); }
PYCXX_EXPORT bool _Unicode_Check( PyObject *op ) { return op->ob_type == _Unicode_Type(); }
#if PY_MAJOR_VERSION == 2
bool _String_Check( PyObject *op ) { return op->ob_type == _String_Type(); }
bool _Int_Check( PyObject *op ) { return op->ob_type == _Int_Type(); }
bool _CObject_Check( PyObject *op ) { return op->ob_type == _CObject_Type(); }
PYCXX_EXPORT bool _String_Check( PyObject *op ) { return op->ob_type == _String_Type(); }
PYCXX_EXPORT bool _Int_Check( PyObject *op ) { return op->ob_type == _Int_Type(); }
PYCXX_EXPORT bool _CObject_Check( PyObject *op ) { return op->ob_type == _CObject_Type(); }
#endif
#if PY_MAJOR_VERSION >= 3
bool _Bytes_Check( PyObject *op ) { return op->ob_type == _Bytes_Type(); }
PYCXX_EXPORT bool _Bytes_Check( PyObject *op ) { return op->ob_type == _Bytes_Type(); }
#endif
#if defined(PY_WIN32_DELAYLOAD_PYTHON_DLL)
@@ -324,84 +324,84 @@ bool InitialisePythonIndirectInterface()
//
// Wrap variables as function calls
//
PyObject *_Exc_ArithmeticError() { return ptr__Exc_ArithmeticError; }
PyObject *_Exc_AssertionError() { return ptr__Exc_AssertionError; }
PyObject *_Exc_AttributeError() { return ptr__Exc_AttributeError; }
PyObject *_Exc_EnvironmentError() { return ptr__Exc_EnvironmentError; }
PyObject *_Exc_EOFError() { return ptr__Exc_EOFError; }
PyObject *_Exc_Exception() { return ptr__Exc_Exception; }
PyObject *_Exc_FloatingPointError() { return ptr__Exc_FloatingPointError; }
PyObject *_Exc_ImportError() { return ptr__Exc_ImportError; }
PyObject *_Exc_IndexError() { return ptr__Exc_IndexError; }
PyObject *_Exc_IOError() { return ptr__Exc_IOError; }
PyObject *_Exc_KeyboardInterrupt() { return ptr__Exc_KeyboardInterrupt; }
PyObject *_Exc_KeyError() { return ptr__Exc_KeyError; }
PyObject *_Exc_LookupError() { return ptr__Exc_LookupError; }
PyObject *_Exc_MemoryError() { return ptr__Exc_MemoryError; }
PyObject *_Exc_NameError() { return ptr__Exc_NameError; }
PyObject *_Exc_NotImplementedError() { return ptr__Exc_NotImplementedError; }
PyObject *_Exc_OSError() { return ptr__Exc_OSError; }
PyObject *_Exc_OverflowError() { return ptr__Exc_OverflowError; }
PyObject *_Exc_RuntimeError() { return ptr__Exc_RuntimeError; }
PyObject *_Exc_StandardError() { return ptr__Exc_StandardError; }
PyObject *_Exc_SyntaxError() { return ptr__Exc_SyntaxError; }
PyObject *_Exc_SystemError() { return ptr__Exc_SystemError; }
PyObject *_Exc_SystemExit() { return ptr__Exc_SystemExit; }
PyObject *_Exc_TypeError() { return ptr__Exc_TypeError; }
PyObject *_Exc_ValueError() { return ptr__Exc_ValueError; }
PYCXX_EXPORT PyObject *_Exc_ArithmeticError() { return ptr__Exc_ArithmeticError; }
PYCXX_EXPORT PyObject *_Exc_AssertionError() { return ptr__Exc_AssertionError; }
PYCXX_EXPORT PyObject *_Exc_AttributeError() { return ptr__Exc_AttributeError; }
PYCXX_EXPORT PyObject *_Exc_EnvironmentError() { return ptr__Exc_EnvironmentError; }
PYCXX_EXPORT PyObject *_Exc_EOFError() { return ptr__Exc_EOFError; }
PYCXX_EXPORT PyObject *_Exc_Exception() { return ptr__Exc_Exception; }
PYCXX_EXPORT PyObject *_Exc_FloatingPointError() { return ptr__Exc_FloatingPointError; }
PYCXX_EXPORT PyObject *_Exc_ImportError() { return ptr__Exc_ImportError; }
PYCXX_EXPORT PyObject *_Exc_IndexError() { return ptr__Exc_IndexError; }
PYCXX_EXPORT PyObject *_Exc_IOError() { return ptr__Exc_IOError; }
PYCXX_EXPORT PyObject *_Exc_KeyboardInterrupt() { return ptr__Exc_KeyboardInterrupt; }
PYCXX_EXPORT PyObject *_Exc_KeyError() { return ptr__Exc_KeyError; }
PYCXX_EXPORT PyObject *_Exc_LookupError() { return ptr__Exc_LookupError; }
PYCXX_EXPORT PyObject *_Exc_MemoryError() { return ptr__Exc_MemoryError; }
PYCXX_EXPORT PyObject *_Exc_NameError() { return ptr__Exc_NameError; }
PYCXX_EXPORT PyObject *_Exc_NotImplementedError() { return ptr__Exc_NotImplementedError; }
PYCXX_EXPORT PyObject *_Exc_OSError() { return ptr__Exc_OSError; }
PYCXX_EXPORT PyObject *_Exc_OverflowError() { return ptr__Exc_OverflowError; }
PYCXX_EXPORT PyObject *_Exc_RuntimeError() { return ptr__Exc_RuntimeError; }
PYCXX_EXPORT PyObject *_Exc_StandardError() { return ptr__Exc_StandardError; }
PYCXX_EXPORT PyObject *_Exc_SyntaxError() { return ptr__Exc_SyntaxError; }
PYCXX_EXPORT PyObject *_Exc_SystemError() { return ptr__Exc_SystemError; }
PYCXX_EXPORT PyObject *_Exc_SystemExit() { return ptr__Exc_SystemExit; }
PYCXX_EXPORT PyObject *_Exc_TypeError() { return ptr__Exc_TypeError; }
PYCXX_EXPORT PyObject *_Exc_ValueError() { return ptr__Exc_ValueError; }
#ifdef MS_WINDOWS
PyObject *_Exc_WindowsError() { return ptr__Exc_WindowsError; }
PYCXX_EXPORT PyObject *_Exc_WindowsError() { return ptr__Exc_WindowsError; }
#endif
PyObject *_Exc_ZeroDivisionError() { return ptr__Exc_ZeroDivisionError; }
PyObject *_Exc_IndentationError() { return ptr__Exc_IndentationError; }
PyObject *_Exc_TabError() { return ptr__Exc_TabError; }
PyObject *_Exc_UnboundLocalError() { return ptr__Exc_UnboundLocalError; }
PyObject *_Exc_UnicodeError() { return ptr__Exc_UnicodeError; }
PYCXX_EXPORT PyObject *_Exc_ZeroDivisionError() { return ptr__Exc_ZeroDivisionError; }
PYCXX_EXPORT PyObject *_Exc_IndentationError() { return ptr__Exc_IndentationError; }
PYCXX_EXPORT PyObject *_Exc_TabError() { return ptr__Exc_TabError; }
PYCXX_EXPORT PyObject *_Exc_UnboundLocalError() { return ptr__Exc_UnboundLocalError; }
PYCXX_EXPORT PyObject *_Exc_UnicodeError() { return ptr__Exc_UnicodeError; }
//
// wrap items in Object.h
//
PyObject *_None() { return ptr__PyNone; }
PYCXX_EXPORT PyObject *_None() { return ptr__PyNone; }
PyObject *_False() { return ptr__PyFalse; }
PyObject *_True() { return ptr__PyTrue; }
PYCXX_EXPORT PyObject *_False() { return ptr__PyFalse; }
PYCXX_EXPORT PyObject *_True() { return ptr__PyTrue; }
PyTypeObject *_CFunction_Type() { return ptr__CFunction_Type; }
PyTypeObject *_Complex_Type() { return ptr__Complex_Type; }
PyTypeObject *_Dict_Type() { return ptr__Dict_Type; }
PyTypeObject *_Float_Type() { return ptr__Float_Type; }
PyTypeObject *_Function_Type() { return ptr__Function_Type; }
PyTypeObject *_Bool_Type() { return ptr__Bool_Type; }
PyTypeObject *_List_Type() { return ptr__List_Type; }
PyTypeObject *_Long_Type() { return ptr__Long_Type; }
PyTypeObject *_Method_Type() { return ptr__Method_Type; }
PyTypeObject *_Module_Type() { return ptr__Module_Type; }
PyTypeObject *_Range_Type() { return ptr__Range_Type; }
PyTypeObject *_Slice_Type() { return ptr__Slice_Type; }
PyTypeObject *_TraceBack_Type() { return ptr__TraceBack_Type; }
PyTypeObject *_Tuple_Type() { return ptr__Tuple_Type; }
PyTypeObject *_Type_Type() { return ptr__Type_Type; }
PyTypeObject *_Unicode_Type() { return ptr__Unicode_Type; }
PYCXX_EXPORT PyTypeObject *_CFunction_Type() { return ptr__CFunction_Type; }
PYCXX_EXPORT PyTypeObject *_Complex_Type() { return ptr__Complex_Type; }
PYCXX_EXPORT PyTypeObject *_Dict_Type() { return ptr__Dict_Type; }
PYCXX_EXPORT PyTypeObject *_Float_Type() { return ptr__Float_Type; }
PYCXX_EXPORT PyTypeObject *_Function_Type() { return ptr__Function_Type; }
PYCXX_EXPORT PyTypeObject *_Bool_Type() { return ptr__Bool_Type; }
PYCXX_EXPORT PyTypeObject *_List_Type() { return ptr__List_Type; }
PYCXX_EXPORT PyTypeObject *_Long_Type() { return ptr__Long_Type; }
PYCXX_EXPORT PyTypeObject *_Method_Type() { return ptr__Method_Type; }
PYCXX_EXPORT PyTypeObject *_Module_Type() { return ptr__Module_Type; }
PYCXX_EXPORT PyTypeObject *_Range_Type() { return ptr__Range_Type; }
PYCXX_EXPORT PyTypeObject *_Slice_Type() { return ptr__Slice_Type; }
PYCXX_EXPORT PyTypeObject *_TraceBack_Type() { return ptr__TraceBack_Type; }
PYCXX_EXPORT PyTypeObject *_Tuple_Type() { return ptr__Tuple_Type; }
PYCXX_EXPORT PyTypeObject *_Type_Type() { return ptr__Type_Type; }
PYCXX_EXPORT PyTypeObject *_Unicode_Type() { return ptr__Unicode_Type; }
#if PY_MAJOR_VERSION == 2
PyTypeObject *_String_Type() { return ptr__String_Type; }
PyTypeObject *_Int_Type() { return ptr__Int_Type; }
PyTypeObject *_CObject_Type() { return ptr__CObject_Type; }
PYCXX_EXPORT PyTypeObject *_String_Type() { return ptr__String_Type; }
PYCXX_EXPORT PyTypeObject *_Int_Type() { return ptr__Int_Type; }
PYCXX_EXPORT PyTypeObject *_CObject_Type() { return ptr__CObject_Type; }
#endif
#if PY_MAJOR_VERSION >= 3
PyTypeObject *_Bytes_Type() { return ptr__Bytes_Type; }
PYCXX_EXPORT PyTypeObject *_Bytes_Type() { return ptr__Bytes_Type; }
#endif
char *__Py_PackageContext() { return *ptr__Py_PackageContext; }
PYCXX_EXPORT char *__Py_PackageContext() { return *ptr__Py_PackageContext; }
//
// wrap the Python Flag variables
//
int &_Py_DebugFlag() { return *ptr_Py_DebugFlag; }
int &_Py_InteractiveFlag() { return *ptr_Py_InteractiveFlag; }
int &_Py_OptimizeFlag() { return *ptr_Py_OptimizeFlag; }
int &_Py_NoSiteFlag() { return *ptr_Py_NoSiteFlag; }
int &_Py_VerboseFlag() { return *ptr_Py_VerboseFlag; }
PYCXX_EXPORT int &_Py_DebugFlag() { return *ptr_Py_DebugFlag; }
PYCXX_EXPORT int &_Py_InteractiveFlag() { return *ptr_Py_InteractiveFlag; }
PYCXX_EXPORT int &_Py_OptimizeFlag() { return *ptr_Py_OptimizeFlag; }
PYCXX_EXPORT int &_Py_NoSiteFlag() { return *ptr_Py_NoSiteFlag; }
PYCXX_EXPORT int &_Py_VerboseFlag() { return *ptr_Py_VerboseFlag; }
#if 0
#define Py_INCREF(op) ( \
@@ -460,38 +460,38 @@ void _XDECREF( PyObject *op )
// Wrap variables as function calls
//
PyObject *_Exc_ArithmeticError() { return ::PyExc_ArithmeticError; }
PyObject *_Exc_AssertionError() { return ::PyExc_AssertionError; }
PyObject *_Exc_AttributeError() { return ::PyExc_AttributeError; }
PyObject *_Exc_EnvironmentError() { return ::PyExc_EnvironmentError; }
PyObject *_Exc_EOFError() { return ::PyExc_EOFError; }
PyObject *_Exc_Exception() { return ::PyExc_Exception; }
PyObject *_Exc_FloatingPointError() { return ::PyExc_FloatingPointError; }
PyObject *_Exc_ImportError() { return ::PyExc_ImportError; }
PyObject *_Exc_IndexError() { return ::PyExc_IndexError; }
PyObject *_Exc_IOError() { return ::PyExc_IOError; }
PyObject *_Exc_KeyboardInterrupt() { return ::PyExc_KeyboardInterrupt; }
PyObject *_Exc_KeyError() { return ::PyExc_KeyError; }
PyObject *_Exc_LookupError() { return ::PyExc_LookupError; }
PyObject *_Exc_MemoryError() { return ::PyExc_MemoryError; }
PyObject *_Exc_NameError() { return ::PyExc_NameError; }
PyObject *_Exc_NotImplementedError() { return ::PyExc_NotImplementedError; }
PyObject *_Exc_OSError() { return ::PyExc_OSError; }
PyObject *_Exc_OverflowError() { return ::PyExc_OverflowError; }
PyObject *_Exc_RuntimeError() { return ::PyExc_RuntimeError; }
PyObject *_Exc_SyntaxError() { return ::PyExc_SyntaxError; }
PyObject *_Exc_SystemError() { return ::PyExc_SystemError; }
PyObject *_Exc_SystemExit() { return ::PyExc_SystemExit; }
PyObject *_Exc_TypeError() { return ::PyExc_TypeError; }
PyObject *_Exc_ValueError() { return ::PyExc_ValueError; }
PyObject *_Exc_ZeroDivisionError() { return ::PyExc_ZeroDivisionError; }
PyObject *_Exc_IndentationError() { return ::PyExc_IndentationError; }
PyObject *_Exc_TabError() { return ::PyExc_TabError; }
PyObject *_Exc_UnboundLocalError() { return ::PyExc_UnboundLocalError; }
PyObject *_Exc_UnicodeError() { return ::PyExc_UnicodeError; }
PYCXX_EXPORT PyObject *_Exc_ArithmeticError() { return ::PyExc_ArithmeticError; }
PYCXX_EXPORT PyObject *_Exc_AssertionError() { return ::PyExc_AssertionError; }
PYCXX_EXPORT PyObject *_Exc_AttributeError() { return ::PyExc_AttributeError; }
PYCXX_EXPORT PyObject *_Exc_EnvironmentError() { return ::PyExc_EnvironmentError; }
PYCXX_EXPORT PyObject *_Exc_EOFError() { return ::PyExc_EOFError; }
PYCXX_EXPORT PyObject *_Exc_Exception() { return ::PyExc_Exception; }
PYCXX_EXPORT PyObject *_Exc_FloatingPointError() { return ::PyExc_FloatingPointError; }
PYCXX_EXPORT PyObject *_Exc_ImportError() { return ::PyExc_ImportError; }
PYCXX_EXPORT PyObject *_Exc_IndexError() { return ::PyExc_IndexError; }
PYCXX_EXPORT PyObject *_Exc_IOError() { return ::PyExc_IOError; }
PYCXX_EXPORT PyObject *_Exc_KeyboardInterrupt() { return ::PyExc_KeyboardInterrupt; }
PYCXX_EXPORT PyObject *_Exc_KeyError() { return ::PyExc_KeyError; }
PYCXX_EXPORT PyObject *_Exc_LookupError() { return ::PyExc_LookupError; }
PYCXX_EXPORT PyObject *_Exc_MemoryError() { return ::PyExc_MemoryError; }
PYCXX_EXPORT PyObject *_Exc_NameError() { return ::PyExc_NameError; }
PYCXX_EXPORT PyObject *_Exc_NotImplementedError() { return ::PyExc_NotImplementedError; }
PYCXX_EXPORT PyObject *_Exc_OSError() { return ::PyExc_OSError; }
PYCXX_EXPORT PyObject *_Exc_OverflowError() { return ::PyExc_OverflowError; }
PYCXX_EXPORT PyObject *_Exc_RuntimeError() { return ::PyExc_RuntimeError; }
PYCXX_EXPORT PyObject *_Exc_SyntaxError() { return ::PyExc_SyntaxError; }
PYCXX_EXPORT PyObject *_Exc_SystemError() { return ::PyExc_SystemError; }
PYCXX_EXPORT PyObject *_Exc_SystemExit() { return ::PyExc_SystemExit; }
PYCXX_EXPORT PyObject *_Exc_TypeError() { return ::PyExc_TypeError; }
PYCXX_EXPORT PyObject *_Exc_ValueError() { return ::PyExc_ValueError; }
PYCXX_EXPORT PyObject *_Exc_ZeroDivisionError() { return ::PyExc_ZeroDivisionError; }
PYCXX_EXPORT PyObject *_Exc_IndentationError() { return ::PyExc_IndentationError; }
PYCXX_EXPORT PyObject *_Exc_TabError() { return ::PyExc_TabError; }
PYCXX_EXPORT PyObject *_Exc_UnboundLocalError() { return ::PyExc_UnboundLocalError; }
PYCXX_EXPORT PyObject *_Exc_UnicodeError() { return ::PyExc_UnicodeError; }
#ifdef MS_WINDOWS
PyObject *_Exc_WindowsError() { return ::PyExc_WindowsError; }
PYCXX_EXPORT PyObject *_Exc_WindowsError() { return ::PyExc_WindowsError; }
#endif
@@ -500,45 +500,45 @@ PyObject *_Exc_WindowsError() { return ::PyExc_WindowsError; }
//
// wrap items in Object.h
//
PyObject *_None() { return &::_Py_NoneStruct; }
PYCXX_EXPORT PyObject *_None() { return &::_Py_NoneStruct; }
PyObject *_False() { return Py_False; }
PyObject *_True() { return Py_True; }
PYCXX_EXPORT PyObject *_False() { return Py_False; }
PYCXX_EXPORT PyObject *_True() { return Py_True; }
PyTypeObject *_CFunction_Type() { return &PyCFunction_Type; }
PyTypeObject *_Complex_Type() { return &PyComplex_Type; }
PyTypeObject *_Dict_Type() { return &PyDict_Type; }
PyTypeObject *_Float_Type() { return &PyFloat_Type; }
PyTypeObject *_Function_Type() { return &PyFunction_Type; }
PyTypeObject *_Bool_Type() { return &PyBool_Type; }
PyTypeObject *_List_Type() { return &PyList_Type; }
PyTypeObject *_Long_Type() { return &PyLong_Type; }
PyTypeObject *_Method_Type() { return &PyMethod_Type; }
PyTypeObject *_Module_Type() { return &PyModule_Type; }
PyTypeObject *_Range_Type() { return &PyRange_Type; }
PyTypeObject *_Slice_Type() { return &PySlice_Type; }
PyTypeObject *_TraceBack_Type() { return &PyTraceBack_Type; }
PyTypeObject *_Tuple_Type() { return &PyTuple_Type; }
PyTypeObject *_Type_Type() { return &PyType_Type; }
PyTypeObject *_Unicode_Type() { return &PyUnicode_Type; }
PYCXX_EXPORT PyTypeObject *_CFunction_Type() { return &PyCFunction_Type; }
PYCXX_EXPORT PyTypeObject *_Complex_Type() { return &PyComplex_Type; }
PYCXX_EXPORT PyTypeObject *_Dict_Type() { return &PyDict_Type; }
PYCXX_EXPORT PyTypeObject *_Float_Type() { return &PyFloat_Type; }
PYCXX_EXPORT PyTypeObject *_Function_Type() { return &PyFunction_Type; }
PYCXX_EXPORT PyTypeObject *_Bool_Type() { return &PyBool_Type; }
PYCXX_EXPORT PyTypeObject *_List_Type() { return &PyList_Type; }
PYCXX_EXPORT PyTypeObject *_Long_Type() { return &PyLong_Type; }
PYCXX_EXPORT PyTypeObject *_Method_Type() { return &PyMethod_Type; }
PYCXX_EXPORT PyTypeObject *_Module_Type() { return &PyModule_Type; }
PYCXX_EXPORT PyTypeObject *_Range_Type() { return &PyRange_Type; }
PYCXX_EXPORT PyTypeObject *_Slice_Type() { return &PySlice_Type; }
PYCXX_EXPORT PyTypeObject *_TraceBack_Type() { return &PyTraceBack_Type; }
PYCXX_EXPORT PyTypeObject *_Tuple_Type() { return &PyTuple_Type; }
PYCXX_EXPORT PyTypeObject *_Type_Type() { return &PyType_Type; }
PYCXX_EXPORT PyTypeObject *_Unicode_Type() { return &PyUnicode_Type; }
#if PY_MAJOR_VERSION == 2
PyTypeObject *_String_Type() { return &PyString_Type; }
PyTypeObject *_Int_Type() { return &PyInt_Type; }
PyTypeObject *_CObject_Type() { return &PyCObject_Type; }
PYCXX_EXPORT PyTypeObject *_String_Type() { return &PyString_Type; }
PYCXX_EXPORT PyTypeObject *_Int_Type() { return &PyInt_Type; }
PYCXX_EXPORT PyTypeObject *_CObject_Type() { return &PyCObject_Type; }
#endif
#if PY_MAJOR_VERSION >= 3
PyTypeObject *_Bytes_Type() { return &PyBytes_Type; }
PYCXX_EXPORT PyTypeObject *_Bytes_Type() { return &PyBytes_Type; }
#endif
//
// wrap flags
//
int &_Py_DebugFlag() { return Py_DebugFlag; }
int &_Py_InteractiveFlag() { return Py_InteractiveFlag; }
int &_Py_OptimizeFlag() { return Py_OptimizeFlag; }
int &_Py_NoSiteFlag() { return Py_NoSiteFlag; }
int &_Py_VerboseFlag() { return Py_VerboseFlag; }
char *__Py_PackageContext() { return _Py_PackageContext; }
PYCXX_EXPORT int &_Py_DebugFlag() { return Py_DebugFlag; }
PYCXX_EXPORT int &_Py_InteractiveFlag() { return Py_InteractiveFlag; }
PYCXX_EXPORT int &_Py_OptimizeFlag() { return Py_OptimizeFlag; }
PYCXX_EXPORT int &_Py_NoSiteFlag() { return Py_NoSiteFlag; }
PYCXX_EXPORT int &_Py_VerboseFlag() { return Py_VerboseFlag; }
PYCXX_EXPORT char *__Py_PackageContext() { return _Py_PackageContext; }
//
// Needed to keep the abstactions for delayload interface

View File

@@ -114,5 +114,19 @@
#if PY_MAJOR_VERSION < 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5)
typedef int Py_ssize_t;
#endif
// export macro
#if defined( _MSC_VER )
# pragma warning( disable : 4251 )
#endif
#if defined( _MSC_VER ) || defined( __MINGW32__ )
# ifdef PYCXX_DLL
# define PYCXX_EXPORT __declspec(dllexport)
# else
# define PYCXX_EXPORT __declspec(dllimport)
# endif
#else
# define PYCXX_EXPORT
#endif
#endif // __PyCXX_config_hh__

View File

@@ -53,7 +53,7 @@ namespace Py
class Object;
class Exception
class PYCXX_EXPORT Exception
{
public:
Exception( ExtensionExceptionType &exception, const std::string& reason );
@@ -83,28 +83,28 @@ namespace Py
// Abstract
class StandardError: public Exception
class PYCXX_EXPORT StandardError: public Exception
{
protected:
explicit StandardError()
{}
};
class LookupError: public StandardError
class PYCXX_EXPORT LookupError: public StandardError
{
protected:
explicit LookupError()
{}
};
class ArithmeticError: public StandardError
class PYCXX_EXPORT ArithmeticError: public StandardError
{
protected:
explicit ArithmeticError()
{}
};
class EnvironmentError: public StandardError
class PYCXX_EXPORT EnvironmentError: public StandardError
{
protected:
explicit EnvironmentError()
@@ -113,7 +113,7 @@ namespace Py
// Concrete
class TypeError: public StandardError
class PYCXX_EXPORT TypeError: public StandardError
{
public:
TypeError (const std::string& reason)
@@ -123,7 +123,7 @@ namespace Py
}
};
class IndexError: public LookupError
class PYCXX_EXPORT IndexError: public LookupError
{
public:
IndexError (const std::string& reason)
@@ -133,7 +133,7 @@ namespace Py
}
};
class AttributeError: public StandardError
class PYCXX_EXPORT AttributeError: public StandardError
{
public:
AttributeError (const std::string& reason)
@@ -143,7 +143,7 @@ namespace Py
}
};
class NameError: public StandardError
class PYCXX_EXPORT NameError: public StandardError
{
public:
NameError (const std::string& reason)
@@ -153,7 +153,7 @@ namespace Py
}
};
class RuntimeError: public StandardError
class PYCXX_EXPORT RuntimeError: public StandardError
{
public:
RuntimeError (const std::string& reason)
@@ -173,7 +173,7 @@ namespace Py
}
};
class SystemError: public StandardError
class PYCXX_EXPORT SystemError: public StandardError
{
public:
SystemError (const std::string& reason)
@@ -183,7 +183,7 @@ namespace Py
}
};
class KeyError: public LookupError
class PYCXX_EXPORT KeyError: public LookupError
{
public:
KeyError (const std::string& reason)
@@ -194,7 +194,7 @@ namespace Py
};
class ValueError: public StandardError
class PYCXX_EXPORT ValueError: public StandardError
{
public:
ValueError (const std::string& reason)
@@ -204,7 +204,7 @@ namespace Py
}
};
class OverflowError: public ArithmeticError
class PYCXX_EXPORT OverflowError: public ArithmeticError
{
public:
OverflowError (const std::string& reason)
@@ -214,7 +214,7 @@ namespace Py
}
};
class ZeroDivisionError: public ArithmeticError
class PYCXX_EXPORT ZeroDivisionError: public ArithmeticError
{
public:
ZeroDivisionError (const std::string& reason)
@@ -224,7 +224,7 @@ namespace Py
}
};
class FloatingPointError: public ArithmeticError
class PYCXX_EXPORT FloatingPointError: public ArithmeticError
{
public:
FloatingPointError (const std::string& reason)
@@ -234,7 +234,7 @@ namespace Py
}
};
class MemoryError: public StandardError
class PYCXX_EXPORT MemoryError: public StandardError
{
public:
MemoryError (const std::string& reason)
@@ -244,7 +244,7 @@ namespace Py
}
};
class SystemExit: public StandardError
class PYCXX_EXPORT SystemExit: public StandardError
{
public:
SystemExit (const std::string& reason)

View File

@@ -40,7 +40,7 @@
namespace Py
{
class ExtensionModuleBase
class PYCXX_EXPORT ExtensionModuleBase
{
public:
ExtensionModuleBase( const char *name );
@@ -77,11 +77,11 @@ namespace Py
};
// Note: Python calls noargs as varargs buts args==NULL
extern "C" PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple, PyObject * );
extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args );
extern "C" PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords );
extern "C" PYCXX_EXPORT PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple, PyObject * );
extern "C" PYCXX_EXPORT PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args );
extern "C" PYCXX_EXPORT PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords );
extern "C" void do_not_dealloc( void * );
extern "C" PYCXX_EXPORT void do_not_dealloc( void * );
template<TEMPLATE_TYPENAME T>
class ExtensionModule : public ExtensionModuleBase

View File

@@ -113,7 +113,7 @@ namespace Py
};
class ExtensionClassMethodsTable
class PYCXX_EXPORT ExtensionClassMethodsTable
{
public:
ExtensionClassMethodsTable()

View File

@@ -59,7 +59,7 @@ namespace Py
// This special deallocator does a delete on the pointer.
class PythonExtensionBase : public PyObject
class PYCXX_EXPORT PythonExtensionBase : public PyObject
{
public:
PythonExtensionBase();

View File

@@ -63,7 +63,7 @@ namespace Py
class ExtensionModuleBase;
// Make an Exception Type for use in raising custom exceptions
class ExtensionExceptionType : public Object
class PYCXX_EXPORT ExtensionExceptionType : public Object
{
public:
ExtensionExceptionType();
@@ -74,7 +74,7 @@ namespace Py
void init( ExtensionModuleBase &module, const std::string &name );
};
class MethodTable
class PYCXX_EXPORT MethodTable
{
public:
MethodTable();

View File

@@ -39,6 +39,7 @@
#define __CXX_INDIRECT_PYTHON_INTERFACE__HXX__
#include "CXX/WrapPython.h"
#include "CXX/Config.hxx"
namespace Py
{
@@ -47,152 +48,152 @@ bool InitialisePythonIndirectInterface();
//
// Wrap Exception variables as function calls
//
PyObject * _Exc_Exception();
PyObject * _Exc_StandardError();
PyObject * _Exc_ArithmeticError();
PyObject * _Exc_LookupError();
PYCXX_EXPORT PyObject * _Exc_Exception();
PYCXX_EXPORT PyObject * _Exc_StandardError();
PYCXX_EXPORT PyObject * _Exc_ArithmeticError();
PYCXX_EXPORT PyObject * _Exc_LookupError();
PyObject * _Exc_AssertionError();
PyObject * _Exc_AttributeError();
PyObject * _Exc_EOFError();
PyObject * _Exc_FloatingPointError();
PyObject * _Exc_EnvironmentError();
PyObject * _Exc_IOError();
PyObject * _Exc_OSError();
PyObject * _Exc_ImportError();
PyObject * _Exc_IndexError();
PyObject * _Exc_KeyError();
PyObject * _Exc_KeyboardInterrupt();
PyObject * _Exc_MemoryError();
PyObject * _Exc_NameError();
PyObject * _Exc_OverflowError();
PyObject * _Exc_RuntimeError();
PyObject * _Exc_NotImplementedError();
PyObject * _Exc_SyntaxError();
PyObject * _Exc_SystemError();
PyObject * _Exc_SystemExit();
PyObject * _Exc_TypeError();
PyObject * _Exc_ValueError();
PyObject * _Exc_ZeroDivisionError();
PYCXX_EXPORT PyObject * _Exc_AssertionError();
PYCXX_EXPORT PyObject * _Exc_AttributeError();
PYCXX_EXPORT PyObject * _Exc_EOFError();
PYCXX_EXPORT PyObject * _Exc_FloatingPointError();
PYCXX_EXPORT PyObject * _Exc_EnvironmentError();
PYCXX_EXPORT PyObject * _Exc_IOError();
PYCXX_EXPORT PyObject * _Exc_OSError();
PYCXX_EXPORT PyObject * _Exc_ImportError();
PYCXX_EXPORT PyObject * _Exc_IndexError();
PYCXX_EXPORT PyObject * _Exc_KeyError();
PYCXX_EXPORT PyObject * _Exc_KeyboardInterrupt();
PYCXX_EXPORT PyObject * _Exc_MemoryError();
PYCXX_EXPORT PyObject * _Exc_NameError();
PYCXX_EXPORT PyObject * _Exc_OverflowError();
PYCXX_EXPORT PyObject * _Exc_RuntimeError();
PYCXX_EXPORT PyObject * _Exc_NotImplementedError();
PYCXX_EXPORT PyObject * _Exc_SyntaxError();
PYCXX_EXPORT PyObject * _Exc_SystemError();
PYCXX_EXPORT PyObject * _Exc_SystemExit();
PYCXX_EXPORT PyObject * _Exc_TypeError();
PYCXX_EXPORT PyObject * _Exc_ValueError();
PYCXX_EXPORT PyObject * _Exc_ZeroDivisionError();
#ifdef MS_WINDOWS
PyObject * _Exc_WindowsError();
PYCXX_EXPORT PyObject * _Exc_WindowsError();
#endif
PyObject * _Exc_MemoryErrorInst();
PYCXX_EXPORT PyObject * _Exc_MemoryErrorInst();
#if PY_MAJOR_VERSION >= 2
PyObject * _Exc_IndentationError();
PyObject * _Exc_TabError();
PyObject * _Exc_UnboundLocalError();
PyObject * _Exc_UnicodeError();
PYCXX_EXPORT PyObject * _Exc_IndentationError();
PYCXX_EXPORT PyObject * _Exc_TabError();
PYCXX_EXPORT PyObject * _Exc_UnboundLocalError();
PYCXX_EXPORT PyObject * _Exc_UnicodeError();
#endif
//
// Wrap Object variables as function calls
//
PyObject * _None();
PYCXX_EXPORT PyObject * _None();
PyObject * _False();
PyObject * _True();
PYCXX_EXPORT PyObject * _False();
PYCXX_EXPORT PyObject * _True();
//
// Wrap Type variables as function calls
//
PyTypeObject * _List_Type();
bool _List_Check( PyObject *o );
PYCXX_EXPORT PyTypeObject * _List_Type();
PYCXX_EXPORT bool _List_Check( PyObject *o );
PyTypeObject * _Buffer_Type();
bool _Buffer_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Buffer_Type();
PYCXX_EXPORT bool _Buffer_Check( PyObject *op );
PyTypeObject * _Class_Type();
bool _Class_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Class_Type();
PYCXX_EXPORT bool _Class_Check( PyObject *op );
PyTypeObject * _Instance_Type();
bool _Instance_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Instance_Type();
PYCXX_EXPORT bool _Instance_Check( PyObject *op );
PyTypeObject * _Method_Type();
bool _Method_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Method_Type();
PYCXX_EXPORT bool _Method_Check( PyObject *op );
PyTypeObject * _CObject_Type();
bool _CObject_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _CObject_Type();
PYCXX_EXPORT bool _CObject_Check( PyObject *op );
PyTypeObject * _Complex_Type();
bool _Complex_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Complex_Type();
PYCXX_EXPORT bool _Complex_Check( PyObject *op );
PyTypeObject * _Dict_Type();
bool _Dict_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Dict_Type();
PYCXX_EXPORT bool _Dict_Check( PyObject *op );
PyTypeObject * _File_Type();
bool _File_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _File_Type();
PYCXX_EXPORT bool _File_Check( PyObject *op );
PyTypeObject * _Float_Type();
bool _Float_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Float_Type();
PYCXX_EXPORT bool _Float_Check( PyObject *op );
PyTypeObject * _Frame_Type();
bool _Frame_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Frame_Type();
PYCXX_EXPORT bool _Frame_Check( PyObject *op );
PyTypeObject * _Function_Type();
bool _Function_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Function_Type();
PYCXX_EXPORT bool _Function_Check( PyObject *op );
PyTypeObject * _Bool_Type();
bool _Boolean_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Bool_Type();
PYCXX_EXPORT bool _Boolean_Check( PyObject *op );
PyTypeObject * _Int_Type();
bool _Int_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Int_Type();
PYCXX_EXPORT bool _Int_Check( PyObject *op );
PyTypeObject * _List_Type();
bool _List_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _List_Type();
PYCXX_EXPORT bool _List_Check( PyObject *op );
PyTypeObject * _Long_Type();
bool _Long_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Long_Type();
PYCXX_EXPORT bool _Long_Check( PyObject *op );
PyTypeObject * _CFunction_Type();
bool _CFunction_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _CFunction_Type();
PYCXX_EXPORT bool _CFunction_Check( PyObject *op );
PyTypeObject * _Module_Type();
bool _Module_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Module_Type();
PYCXX_EXPORT bool _Module_Check( PyObject *op );
PyTypeObject * _Type_Type();
bool _Type_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Type_Type();
PYCXX_EXPORT bool _Type_Check( PyObject *op );
PyTypeObject * _Range_Type();
bool _Range_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Range_Type();
PYCXX_EXPORT bool _Range_Check( PyObject *op );
PyTypeObject * _Slice_Type();
bool _Slice_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Slice_Type();
PYCXX_EXPORT bool _Slice_Check( PyObject *op );
PyTypeObject * _String_Type();
bool _String_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _String_Type();
PYCXX_EXPORT bool _String_Check( PyObject *op );
PyTypeObject * _Unicode_Type();
bool _Unicode_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Unicode_Type();
PYCXX_EXPORT bool _Unicode_Check( PyObject *op );
PyTypeObject * _TraceBack_Type();
bool _TraceBack_Check( PyObject *v );
PYCXX_EXPORT PyTypeObject * _TraceBack_Type();
PYCXX_EXPORT bool _TraceBack_Check( PyObject *v );
PyTypeObject * _Tuple_Type();
bool _Tuple_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Tuple_Type();
PYCXX_EXPORT bool _Tuple_Check( PyObject *op );
#if PY_MAJOR_VERSION >= 2
PyTypeObject * _Unicode_Type();
bool _Unicode_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Unicode_Type();
PYCXX_EXPORT bool _Unicode_Check( PyObject *op );
#endif
int &_Py_DebugFlag();
int &_Py_InteractiveFlag();
int &_Py_OptimizeFlag();
int &_Py_NoSiteFlag();
int &_Py_TabcheckFlag();
int &_Py_VerboseFlag();
PYCXX_EXPORT int &_Py_DebugFlag();
PYCXX_EXPORT int &_Py_InteractiveFlag();
PYCXX_EXPORT int &_Py_OptimizeFlag();
PYCXX_EXPORT int &_Py_NoSiteFlag();
PYCXX_EXPORT int &_Py_TabcheckFlag();
PYCXX_EXPORT int &_Py_VerboseFlag();
#if PY_MAJOR_VERSION >= 2
int &_Py_UnicodeFlag();
PYCXX_EXPORT int &_Py_UnicodeFlag();
#endif
void _XINCREF( PyObject *op );
void _XDECREF( PyObject *op );
PYCXX_EXPORT void _XINCREF( PyObject *op );
PYCXX_EXPORT void _XDECREF( PyObject *op );
char *__Py_PackageContext();
PYCXX_EXPORT char *__Py_PackageContext();
}
#endif // __CXX_INDIRECT_PYTHON_INTERFACE__HXX__

View File

@@ -52,7 +52,7 @@
namespace Py
{
typedef int sequence_index_type; // type of an index into a sequence
typedef size_t sequence_index_type; // type of an index into a sequence
// Forward declarations
class Object;
@@ -141,7 +141,7 @@ namespace Py
// which you can use in accepts when writing a wrapper class.
// See Demo/range.h and Demo/range.cxx for an example.
class Object
class PYCXX_EXPORT Object
{
private:
// the pointer to the Python object
@@ -469,11 +469,11 @@ namespace Py
// TMM: 31May'01 - Added the #ifndef so I can exlude iostreams.
#ifndef CXX_NO_IOSTREAMS
std::ostream& operator<< (std::ostream& os, const Object& ob);
PYCXX_EXPORT std::ostream& operator<< (std::ostream& os, const Object& ob);
#endif
// Class Type
class Type: public Object
class PYCXX_EXPORT Type: public Object
{
public:
explicit Type (PyObject* pyob, bool owned = false): Object(pyob, owned)
@@ -519,7 +519,7 @@ namespace Py
// ===============================================
// class boolean
class Boolean: public Object
class PYCXX_EXPORT Boolean: public Object
{
public:
// Constructor
@@ -582,7 +582,7 @@ namespace Py
// ===============================================
// class Int
class Int: public Object
class PYCXX_EXPORT Int: public Object
{
public:
// Constructor
@@ -695,7 +695,7 @@ namespace Py
// ===============================================
// class Long
class Long: public Object
class PYCXX_EXPORT Long: public Object
{
public:
// Constructor
@@ -798,7 +798,7 @@ namespace Py
#ifdef HAVE_LONG_LONG
// ===============================================
// class LongLong
class LongLong: public Object
class PYCXX_EXPORT LongLong: public Object
{
public:
// Constructor
@@ -927,7 +927,7 @@ namespace Py
// ===============================================
// class Float
//
class Float: public Object
class PYCXX_EXPORT Float: public Object
{
public:
// Constructor
@@ -1004,7 +1004,7 @@ namespace Py
// ===============================================
// class Complex
class Complex: public Object
class PYCXX_EXPORT Complex: public Object
{
public:
// Constructor
@@ -1115,7 +1115,7 @@ namespace Py
{
protected:
SeqBase<T>& s; // the sequence
int offset; // item number
size_t offset; // item number
T the_item; // lvalue
public:
@@ -1130,7 +1130,7 @@ namespace Py
// TMM: added this seqref ctor for use with STL algorithms
seqref (Object& obj)
: s(dynamic_cast< SeqBase<T>&>(obj))
, offset( NULL )
, offset( 0 )
, the_item(s.getItem(offset))
{}
~seqref()
@@ -1449,7 +1449,7 @@ namespace Py
protected:
friend class SeqBase<T>;
SeqBase<T>* seq;
int count;
size_type count;
public:
~iterator ()
@@ -1460,7 +1460,7 @@ namespace Py
, count( 0 )
{}
iterator (SeqBase<T>* s, int where)
iterator (SeqBase<T>* s, size_type where)
: seq( s )
, count( where )
{}
@@ -1587,7 +1587,7 @@ namespace Py
sequence_index_type count;
private:
const_iterator (const SeqBase<T>* s, int where)
const_iterator (const SeqBase<T>* s, size_type where)
: seq( s )
, count( where )
{}
@@ -1724,19 +1724,19 @@ namespace Py
template <TEMPLATE_TYPENAME T> bool operator<=(const EXPLICIT_TYPENAME SeqBase<T>::const_iterator& left, const EXPLICIT_TYPENAME SeqBase<T>::const_iterator& right);
template <TEMPLATE_TYPENAME T> bool operator>=(const EXPLICIT_TYPENAME SeqBase<T>::const_iterator& left, const EXPLICIT_TYPENAME SeqBase<T>::const_iterator& right);
extern bool operator==(const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator!=(const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator< (const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator> (const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator<=(const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator>=(const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator==(const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator!=(const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator< (const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator> (const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator<=(const Sequence::iterator& left, const Sequence::iterator& right);
PYCXX_EXPORT extern bool operator>=(const Sequence::iterator& left, const Sequence::iterator& right);
extern bool operator==(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
extern bool operator!=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
extern bool operator< (const Sequence::const_iterator& left, const Sequence::const_iterator& right);
extern bool operator> (const Sequence::const_iterator& left, const Sequence::const_iterator& right);
extern bool operator<=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
extern bool operator>=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator==(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator!=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator< (const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator> (const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator<=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
PYCXX_EXPORT extern bool operator>=(const Sequence::const_iterator& left, const Sequence::const_iterator& right);
// ==================================================
// class Char
@@ -1746,7 +1746,7 @@ namespace Py
typedef std::basic_string<Py_UNICODE> unicodestring;
extern Py_UNICODE unicode_null_string[1];
class Char: public Object
class PYCXX_EXPORT Char: public Object
{
public:
explicit Char (PyObject *pyob, bool owned = false): Object(pyob, owned)
@@ -1833,7 +1833,7 @@ namespace Py
// String and Bytes compatible with Python3 version in 6.0.0 PyCXX
class Bytes;
class String: public SeqBase<Char>
class PYCXX_EXPORT String: public SeqBase<Char>
{
public:
virtual size_type capacity() const
@@ -1982,7 +1982,7 @@ namespace Py
}
}
};
class Bytes: public SeqBase<Char>
class PYCXX_EXPORT Bytes: public SeqBase<Char>
{
public:
virtual size_type capacity() const
@@ -2108,7 +2108,7 @@ namespace Py
#else
// original PyCXX 5.4.x version of String
class String: public SeqBase<Char>
class PYCXX_EXPORT String: public SeqBase<Char>
{
public:
virtual size_type capacity() const
@@ -2270,7 +2270,7 @@ namespace Py
// ==================================================
// class Tuple
class Tuple: public Sequence
class PYCXX_EXPORT Tuple: public Sequence
{
public:
virtual void setItem (sequence_index_type offset, const Object&ob)
@@ -2294,7 +2294,7 @@ namespace Py
}
// New tuple of a given size
explicit Tuple (int size = 0)
explicit Tuple (sequence_index_type size = 0)
{
set(PyTuple_New (size), true);
validate ();
@@ -2348,11 +2348,11 @@ namespace Py
};
class TupleN: public Tuple
class PYCXX_EXPORT TupleN: public Tuple
{
public:
TupleN()
: Tuple( 0 )
: Tuple( (sequence_index_type)0 )
{
}
@@ -2463,7 +2463,7 @@ namespace Py
// ==================================================
// class List
class List: public Sequence
class PYCXX_EXPORT List: public Sequence
{
public:
// Constructor
@@ -2476,7 +2476,7 @@ namespace Py
validate();
}
// Creation at a fixed size
List (int size = 0)
List (sequence_index_type size = 0)
{
set(PyList_New (size), true);
validate();
@@ -2492,7 +2492,7 @@ namespace Py
// List from a sequence
List (const Sequence& s): Sequence()
{
int n = (int)s.length();
sequence_index_type n = s.length();
set(PyList_New (n), true);
validate();
for (sequence_index_type i=0; i < n; i++)
@@ -2838,7 +2838,7 @@ namespace Py
return mapref<T>(*this, key);
}
int length () const
size_type length () const
{
return PyMapping_Length (ptr());
}
@@ -2936,7 +2936,7 @@ namespace Py
//
MapBase<T>* map;
List keys; // for iterating over the map
int pos; // index into the keys
size_type pos; // index into the keys
private:
iterator( MapBase<T>* m, List k, int p )
@@ -3039,7 +3039,7 @@ namespace Py
friend class MapBase<T>;
const MapBase<T>* map;
List keys; // for iterating over the map
int pos; // index into the keys
size_type pos; // index into the keys
private:
const_iterator( const MapBase<T>* m, List k, int p )
@@ -3128,15 +3128,15 @@ namespace Py
template <TEMPLATE_TYPENAME T> bool operator==(const EXPLICIT_TYPENAME MapBase<T>::const_iterator& left, const EXPLICIT_TYPENAME MapBase<T>::const_iterator& right);
template <TEMPLATE_TYPENAME T> bool operator!=(const EXPLICIT_TYPENAME MapBase<T>::const_iterator& left, const EXPLICIT_TYPENAME MapBase<T>::const_iterator& right);
extern bool operator==(const Mapping::iterator& left, const Mapping::iterator& right);
extern bool operator!=(const Mapping::iterator& left, const Mapping::iterator& right);
extern bool operator==(const Mapping::const_iterator& left, const Mapping::const_iterator& right);
extern bool operator!=(const Mapping::const_iterator& left, const Mapping::const_iterator& right);
PYCXX_EXPORT extern bool operator==(const Mapping::iterator& left, const Mapping::iterator& right);
PYCXX_EXPORT extern bool operator!=(const Mapping::iterator& left, const Mapping::iterator& right);
PYCXX_EXPORT extern bool operator==(const Mapping::const_iterator& left, const Mapping::const_iterator& right);
PYCXX_EXPORT extern bool operator!=(const Mapping::const_iterator& left, const Mapping::const_iterator& right);
// ==================================================
// class Dict
class Dict: public Mapping
class PYCXX_EXPORT Dict: public Mapping
{
public:
// Constructor
@@ -3174,7 +3174,7 @@ namespace Py
}
};
class Callable: public Object
class PYCXX_EXPORT Callable: public Object
{
public:
// Constructor
@@ -3227,7 +3227,7 @@ namespace Py
}
};
class Module: public Object
class PYCXX_EXPORT Module: public Object
{
public:
explicit Module (PyObject* pyob, bool owned = false): Object (pyob, owned)
@@ -3272,7 +3272,7 @@ namespace Py
inline Object Object::callMemberFunction( const std::string &function_name ) const
{
Callable target( getAttr( function_name ) );
Tuple args( 0 );
Tuple args( (sequence_index_type)0 );
return target.apply( args );
}

View File

@@ -40,7 +40,7 @@
namespace Py
{
class PythonType
class PYCXX_EXPORT PythonType
{
public:
// if you define one sequence method you must define

View File

@@ -1759,6 +1759,61 @@ extern "C" PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple
}
}
extern "C" PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple, PyObject * )
{
try
{
Tuple self_and_name_tuple( _self_and_name_tuple );
PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
void *self_as_void = PyCObject_AsVoidPtr( self_in_cobject );
if( self_as_void == NULL )
return NULL;
ExtensionModuleBase *self = static_cast<ExtensionModuleBase *>( self_as_void );
Object result
(
self->invoke_method_noargs
(
PyCObject_AsVoidPtr( self_and_name_tuple[1].ptr() )
)
);
return new_reference_to( result.ptr() );
}
catch( Exception & )
{
return 0;
}
#if 0
try
{
Tuple self_and_name_tuple( _self_and_name_tuple );
PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
void *self_as_void = PyCObject_AsVoidPtr( self_in_cobject );
if( self_as_void == NULL )
return NULL;
ExtensionModuleBase *self = static_cast<ExtensionModuleBase *>( self_as_void );
String py_name( self_and_name_tuple[1] );
std::string name( py_name.as_std_string( NULL ) );
Object result( self->invoke_method_noargs( name ) );
return new_reference_to( result.ptr() );
}
catch( Exception & )
{
return 0;
}
#else
return 0;
#endif
}
extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args )
{
try

View File

@@ -106,6 +106,20 @@
# define EXPLICIT_CLASS
# define TEMPLATE_TYPENAME class
#endif
// export macro
#if defined( _MSC_VER )
# pragma warning( disable : 4251 )
#endif
#if defined( _MSC_VER ) || defined( __MINGW32__ )
# ifdef PYCXX_DLL
# define PYCXX_EXPORT __declspec(dllexport)
# else
# define PYCXX_EXPORT __declspec(dllimport)
# endif
#else
# define PYCXX_EXPORT
#endif
// before 3.2 Py_hash_t was missing
#ifndef PY_MAJOR_VERSION

View File

@@ -54,7 +54,7 @@ namespace Py
class Object;
class Exception
class PYCXX_EXPORT Exception
{
public:
Exception( ExtensionExceptionType &exception, const std::string &reason );
@@ -84,28 +84,28 @@ namespace Py
// Abstract
class StandardError: public Exception
class PYCXX_EXPORT StandardError: public Exception
{
protected:
explicit StandardError()
{}
};
class LookupError: public StandardError
class PYCXX_EXPORT LookupError: public StandardError
{
protected:
explicit LookupError()
{}
};
class ArithmeticError: public StandardError
class PYCXX_EXPORT ArithmeticError: public StandardError
{
protected:
explicit ArithmeticError()
{}
};
class EnvironmentError: public StandardError
class PYCXX_EXPORT EnvironmentError: public StandardError
{
protected:
explicit EnvironmentError()
@@ -114,7 +114,7 @@ namespace Py
// Concrete
class TypeError: public StandardError
class PYCXX_EXPORT TypeError: public StandardError
{
public:
TypeError (const std::string& reason)
@@ -124,7 +124,7 @@ namespace Py
}
};
class IndexError: public LookupError
class PYCXX_EXPORT IndexError: public LookupError
{
public:
IndexError (const std::string& reason)
@@ -134,7 +134,7 @@ namespace Py
}
};
class AttributeError: public StandardError
class PYCXX_EXPORT AttributeError: public StandardError
{
public:
AttributeError (const std::string& reason)
@@ -144,7 +144,7 @@ namespace Py
}
};
class NameError: public StandardError
class PYCXX_EXPORT NameError: public StandardError
{
public:
NameError (const std::string& reason)
@@ -154,7 +154,7 @@ namespace Py
}
};
class RuntimeError: public StandardError
class PYCXX_EXPORT RuntimeError: public StandardError
{
public:
RuntimeError (const std::string& reason)
@@ -174,7 +174,7 @@ namespace Py
}
};
class SystemError: public StandardError
class PYCXX_EXPORT SystemError: public StandardError
{
public:
SystemError (const std::string& reason)
@@ -184,7 +184,7 @@ namespace Py
}
};
class KeyError: public LookupError
class PYCXX_EXPORT KeyError: public LookupError
{
public:
KeyError (const std::string& reason)
@@ -195,7 +195,7 @@ namespace Py
};
class ValueError: public StandardError
class PYCXX_EXPORT ValueError: public StandardError
{
public:
ValueError (const std::string& reason)
@@ -205,7 +205,7 @@ namespace Py
}
};
class OverflowError: public ArithmeticError
class PYCXX_EXPORT OverflowError: public ArithmeticError
{
public:
OverflowError (const std::string& reason)
@@ -215,7 +215,7 @@ namespace Py
}
};
class ZeroDivisionError: public ArithmeticError
class PYCXX_EXPORT ZeroDivisionError: public ArithmeticError
{
public:
ZeroDivisionError (const std::string& reason)
@@ -225,7 +225,7 @@ namespace Py
}
};
class FloatingPointError: public ArithmeticError
class PYCXX_EXPORT FloatingPointError: public ArithmeticError
{
public:
FloatingPointError (const std::string& reason)
@@ -235,7 +235,7 @@ namespace Py
}
};
class MemoryError: public StandardError
class PYCXX_EXPORT MemoryError: public StandardError
{
public:
MemoryError (const std::string& reason)
@@ -245,7 +245,7 @@ namespace Py
}
};
class SystemExit: public StandardError
class PYCXX_EXPORT SystemExit: public StandardError
{
public:
SystemExit (const std::string& reason)

View File

@@ -40,7 +40,7 @@
namespace Py
{
class ExtensionModuleBase
class PYCXX_EXPORT ExtensionModuleBase
{
public:
ExtensionModuleBase( const char *name );
@@ -78,9 +78,9 @@ namespace Py
};
// Note: Python calls noargs as varargs buts args==NULL
extern "C" PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple, PyObject * );
extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args );
extern "C" PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords );
extern "C" PYCXX_EXPORT PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple, PyObject * );
extern "C" PYCXX_EXPORT PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args );
extern "C" PYCXX_EXPORT PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords );
template<TEMPLATE_TYPENAME T>
class ExtensionModule : public ExtensionModuleBase

View File

@@ -112,7 +112,7 @@ namespace Py
};
class ExtensionClassMethodsTable
class PYCXX_EXPORT ExtensionClassMethodsTable
{
public:
ExtensionClassMethodsTable()

View File

@@ -59,7 +59,7 @@ namespace Py
// This special deallocator does a delete on the pointer.
class PythonExtensionBase : public PyObject
class PYCXX_EXPORT PythonExtensionBase : public PyObject
{
public:
PythonExtensionBase();

View File

@@ -63,7 +63,7 @@ namespace Py
class ExtensionModuleBase;
// Make an Exception Type for use in raising custom exceptions
class ExtensionExceptionType : public Object
class PYCXX_EXPORT ExtensionExceptionType : public Object
{
public:
ExtensionExceptionType();
@@ -74,7 +74,7 @@ namespace Py
void init( ExtensionModuleBase &module, const std::string &name );
};
class MethodTable
class PYCXX_EXPORT MethodTable
{
public:
MethodTable();

View File

@@ -39,6 +39,7 @@
#define __CXX_INDIRECT_PYTHON_INTERFACE__HXX__
#include "CXX/WrapPython.h"
#include "CXX/Config.hxx"
namespace Py
{
@@ -47,137 +48,137 @@ bool InitialisePythonIndirectInterface();
//
// Wrap Exception variables as function calls
//
PyObject * _Exc_Exception();
PyObject * _Exc_StandardError();
PyObject * _Exc_ArithmeticError();
PyObject * _Exc_LookupError();
PYCXX_EXPORT PyObject * _Exc_Exception();
PYCXX_EXPORT PyObject * _Exc_StandardError();
PYCXX_EXPORT PyObject * _Exc_ArithmeticError();
PYCXX_EXPORT PyObject * _Exc_LookupError();
PyObject * _Exc_AssertionError();
PyObject * _Exc_AttributeError();
PyObject * _Exc_EOFError();
PyObject * _Exc_FloatingPointError();
PyObject * _Exc_EnvironmentError();
PyObject * _Exc_IOError();
PyObject * _Exc_OSError();
PyObject * _Exc_ImportError();
PyObject * _Exc_IndexError();
PyObject * _Exc_KeyError();
PyObject * _Exc_KeyboardInterrupt();
PyObject * _Exc_MemoryError();
PyObject * _Exc_NameError();
PyObject * _Exc_OverflowError();
PyObject * _Exc_RuntimeError();
PyObject * _Exc_NotImplementedError();
PyObject * _Exc_SyntaxError();
PyObject * _Exc_SystemError();
PyObject * _Exc_SystemExit();
PyObject * _Exc_TypeError();
PyObject * _Exc_ValueError();
PyObject * _Exc_ZeroDivisionError();
PYCXX_EXPORT PyObject * _Exc_AssertionError();
PYCXX_EXPORT PyObject * _Exc_AttributeError();
PYCXX_EXPORT PyObject * _Exc_EOFError();
PYCXX_EXPORT PyObject * _Exc_FloatingPointError();
PYCXX_EXPORT PyObject * _Exc_EnvironmentError();
PYCXX_EXPORT PyObject * _Exc_IOError();
PYCXX_EXPORT PyObject * _Exc_OSError();
PYCXX_EXPORT PyObject * _Exc_ImportError();
PYCXX_EXPORT PyObject * _Exc_IndexError();
PYCXX_EXPORT PyObject * _Exc_KeyError();
PYCXX_EXPORT PyObject * _Exc_KeyboardInterrupt();
PYCXX_EXPORT PyObject * _Exc_MemoryError();
PYCXX_EXPORT PyObject * _Exc_NameError();
PYCXX_EXPORT PyObject * _Exc_OverflowError();
PYCXX_EXPORT PyObject * _Exc_RuntimeError();
PYCXX_EXPORT PyObject * _Exc_NotImplementedError();
PYCXX_EXPORT PyObject * _Exc_SyntaxError();
PYCXX_EXPORT PyObject * _Exc_SystemError();
PYCXX_EXPORT PyObject * _Exc_SystemExit();
PYCXX_EXPORT PyObject * _Exc_TypeError();
PYCXX_EXPORT PyObject * _Exc_ValueError();
PYCXX_EXPORT PyObject * _Exc_ZeroDivisionError();
#ifdef MS_WINDOWS
PyObject * _Exc_WindowsError();
PYCXX_EXPORT PyObject * _Exc_WindowsError();
#endif
PyObject * _Exc_IndentationError();
PyObject * _Exc_TabError();
PyObject * _Exc_UnboundLocalError();
PyObject * _Exc_UnicodeError();
PYCXX_EXPORT PyObject * _Exc_IndentationError();
PYCXX_EXPORT PyObject * _Exc_TabError();
PYCXX_EXPORT PyObject * _Exc_UnboundLocalError();
PYCXX_EXPORT PyObject * _Exc_UnicodeError();
//
// Wrap Object variables as function calls
//
PyObject * _None();
PYCXX_EXPORT PyObject * _None();
PyObject * _False();
PyObject * _True();
PYCXX_EXPORT PyObject * _False();
PYCXX_EXPORT PyObject * _True();
//
// Wrap Type variables as function calls
//
PyTypeObject * _List_Type();
bool _List_Check( PyObject *o );
PYCXX_EXPORT PyTypeObject * _List_Type();
PYCXX_EXPORT bool _List_Check( PyObject *o );
PyTypeObject * _Buffer_Type();
bool _Buffer_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Buffer_Type();
PYCXX_EXPORT bool _Buffer_Check( PyObject *op );
PyTypeObject * _Class_Type();
bool _Class_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Class_Type();
PYCXX_EXPORT bool _Class_Check( PyObject *op );
PyTypeObject * _Instance_Type();
bool _Instance_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Instance_Type();
PYCXX_EXPORT bool _Instance_Check( PyObject *op );
PyTypeObject * _Method_Type();
bool _Method_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Method_Type();
PYCXX_EXPORT bool _Method_Check( PyObject *op );
PyTypeObject * _Complex_Type();
bool _Complex_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Complex_Type();
PYCXX_EXPORT bool _Complex_Check( PyObject *op );
PyTypeObject * _Dict_Type();
bool _Dict_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Dict_Type();
PYCXX_EXPORT bool _Dict_Check( PyObject *op );
PyTypeObject * _File_Type();
bool _File_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _File_Type();
PYCXX_EXPORT bool _File_Check( PyObject *op );
PyTypeObject * _Float_Type();
bool _Float_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Float_Type();
PYCXX_EXPORT bool _Float_Check( PyObject *op );
PyTypeObject * _Frame_Type();
bool _Frame_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Frame_Type();
PYCXX_EXPORT bool _Frame_Check( PyObject *op );
PyTypeObject * _Function_Type();
bool _Function_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Function_Type();
PYCXX_EXPORT bool _Function_Check( PyObject *op );
PyTypeObject * _Bool_Type();
bool _Boolean_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Bool_Type();
PYCXX_EXPORT bool _Boolean_Check( PyObject *op );
PyTypeObject * _Int_Type();
bool _Int_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Int_Type();
PYCXX_EXPORT bool _Int_Check( PyObject *op );
PyTypeObject * _List_Type();
bool _List_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _List_Type();
PYCXX_EXPORT bool _List_Check( PyObject *op );
PyTypeObject * _Long_Type();
bool _Long_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Long_Type();
PYCXX_EXPORT bool _Long_Check( PyObject *op );
PyTypeObject * _CFunction_Type();
bool _CFunction_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _CFunction_Type();
PYCXX_EXPORT bool _CFunction_Check( PyObject *op );
PyTypeObject * _Module_Type();
bool _Module_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Module_Type();
PYCXX_EXPORT bool _Module_Check( PyObject *op );
PyTypeObject * _Type_Type();
bool _Type_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Type_Type();
PYCXX_EXPORT bool _Type_Check( PyObject *op );
PyTypeObject * _Range_Type();
bool _Range_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Range_Type();
PYCXX_EXPORT bool _Range_Check( PyObject *op );
PyTypeObject * _Slice_Type();
bool _Slice_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Slice_Type();
PYCXX_EXPORT bool _Slice_Check( PyObject *op );
PyTypeObject * _Unicode_Type();
bool _Unicode_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Unicode_Type();
PYCXX_EXPORT bool _Unicode_Check( PyObject *op );
PyTypeObject * _Bytes_Type();
bool _Bytes_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Bytes_Type();
PYCXX_EXPORT bool _Bytes_Check( PyObject *op );
PyTypeObject * _TraceBack_Type();
bool _TraceBack_Check( PyObject *v );
PYCXX_EXPORT PyTypeObject * _TraceBack_Type();
PYCXX_EXPORT bool _TraceBack_Check( PyObject *v );
PyTypeObject * _Tuple_Type();
bool _Tuple_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Tuple_Type();
PYCXX_EXPORT bool _Tuple_Check( PyObject *op );
int &_Py_DebugFlag();
int &_Py_InteractiveFlag();
int &_Py_OptimizeFlag();
int &_Py_NoSiteFlag();
int &_Py_TabcheckFlag();
int &_Py_VerboseFlag();
int &_Py_UnicodeFlag();
PYCXX_EXPORT int &_Py_DebugFlag();
PYCXX_EXPORT int &_Py_InteractiveFlag();
PYCXX_EXPORT int &_Py_OptimizeFlag();
PYCXX_EXPORT int &_Py_NoSiteFlag();
PYCXX_EXPORT int &_Py_TabcheckFlag();
PYCXX_EXPORT int &_Py_VerboseFlag();
PYCXX_EXPORT int &_Py_UnicodeFlag();
void _XINCREF( PyObject *op );
void _XDECREF( PyObject *op );
char *__Py_PackageContext();
PYCXX_EXPORT char *__Py_PackageContext();
};
#endif // __CXX_INDIRECT_PYTHON_INTERFACE__HXX__

View File

@@ -53,7 +53,7 @@
namespace Py
{
typedef int sequence_index_type; // type of an index into a sequence
typedef size_t sequence_index_type; // type of an index into a sequence
// Forward declarations
class Object;
@@ -134,7 +134,7 @@ namespace Py
// which you can use in accepts when writing a wrapper class.
// See Demo/range.h and Demo/range.cxx for an example.
class Object
class PYCXX_EXPORT Object
{
private:
// the pointer to the Python object
@@ -402,7 +402,7 @@ namespace Py
// End of class Object
// Null can be return from when it is require to return NULL to Python from a method
class Null: public Object
class PYCXX_EXPORT Null: public Object
{
public:
Null()
@@ -475,7 +475,7 @@ namespace Py
#endif
// Class Type
class Type: public Object
class PYCXX_EXPORT Type: public Object
{
public:
explicit Type( PyObject *pyob, bool owned = false )
@@ -516,7 +516,7 @@ namespace Py
// ===============================================
// class boolean
class Boolean: public Object
class PYCXX_EXPORT Boolean: public Object
{
public:
// Constructor
@@ -579,7 +579,7 @@ namespace Py
// ===============================================
// class Long
class Long: public Object
class PYCXX_EXPORT Long: public Object
{
public:
// Constructor
@@ -860,7 +860,7 @@ namespace Py
// ===============================================
// class Float
//
class Float: public Object
class PYCXX_EXPORT Float: public Object
{
public:
// Constructor
@@ -973,7 +973,7 @@ namespace Py
// ===============================================
// class Complex
class Complex: public Object
class PYCXX_EXPORT Complex: public Object
{
public:
// Constructor
@@ -1086,7 +1086,7 @@ namespace Py
{
protected:
SeqBase<T> &s; // the sequence
int offset; // item number
size_t offset; // item number
T the_item; // lvalue
public:
@@ -1105,7 +1105,7 @@ namespace Py
// TMM: added this seqref ctor for use with STL algorithms
seqref( Object &obj )
: s( dynamic_cast< SeqBase<T>&>( obj ) )
, offset( NULL )
, offset( 0 )
, the_item( s.getItem( offset ) )
{}
@@ -1276,7 +1276,7 @@ namespace Py
// ...the base class for all sequence types
template<TEMPLATE_TYPENAME T>
class SeqBase: public Object
class PYCXX_EXPORT SeqBase: public Object
{
public:
// STL definitions
@@ -1418,13 +1418,13 @@ namespace Py
throw IndexError( "Unexpected SeqBase<T> length." );
}
class iterator
class PYCXX_EXPORT iterator
: public random_access_iterator_parent( seqref<T> )
{
protected:
friend class SeqBase<T>;
SeqBase<T> *seq;
int count;
size_type count;
public:
~iterator()
@@ -1435,7 +1435,7 @@ namespace Py
, count( 0 )
{}
iterator( SeqBase<T> *s, int where )
iterator( SeqBase<T> *s, size_type where )
: seq( s )
, count( where )
{}
@@ -1570,7 +1570,7 @@ namespace Py
return iterator( this, length() );
}
class const_iterator
class PYCXX_EXPORT const_iterator
: public random_access_iterator_parent( const Object )
{
protected:
@@ -1587,7 +1587,7 @@ namespace Py
, count( 0 )
{}
const_iterator( const SeqBase<T> *s, int where )
const_iterator( const SeqBase<T> *s, size_type where )
: seq( s )
, count( where )
{}
@@ -1733,19 +1733,19 @@ namespace Py
template <TEMPLATE_TYPENAME T> bool operator>=( const EXPLICIT_TYPENAME SeqBase<T>::const_iterator &left, const EXPLICIT_TYPENAME SeqBase<T>::const_iterator &right );
extern bool operator==( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator!=( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator< ( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator> ( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator<=( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator>=( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator==( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator!=( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator< ( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator> ( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator<=( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator>=( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator==( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
extern bool operator!=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
extern bool operator< ( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
extern bool operator> ( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
extern bool operator<=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
extern bool operator>=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator==( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator!=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator< ( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator> ( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator<=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator>=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
// ==================================================
// class Char
@@ -1755,7 +1755,7 @@ namespace Py
typedef std::basic_string<Py_UNICODE> unicodestring;
extern Py_UNICODE unicode_null_string[1];
class Byte: public Object
class PYCXX_EXPORT Byte: public Object
{
public:
// Membership
@@ -1820,7 +1820,7 @@ namespace Py
operator Bytes() const;
};
class Bytes: public SeqBase<Byte>
class PYCXX_EXPORT Bytes: public SeqBase<Byte>
{
public:
// Membership
@@ -1915,7 +1915,7 @@ namespace Py
}
};
class Char: public Object
class PYCXX_EXPORT Char: public Object
{
public:
// Membership
@@ -1990,7 +1990,7 @@ namespace Py
operator String() const;
};
class String: public SeqBase<Char>
class PYCXX_EXPORT String: public SeqBase<Char>
{
public:
virtual size_type capacity() const
@@ -2137,7 +2137,7 @@ namespace Py
// ==================================================
// class Tuple
class Tuple: public Sequence
class PYCXX_EXPORT Tuple: public Sequence
{
public:
virtual void setItem( sequence_index_type offset, const Object&ob )
@@ -2217,11 +2217,11 @@ namespace Py
};
class TupleN: public Tuple
class PYCXX_EXPORT TupleN: public Tuple
{
public:
TupleN()
: Tuple( 0 )
: Tuple( (sequence_index_type)0 )
{
}
@@ -2331,7 +2331,7 @@ namespace Py
// ==================================================
// class List
class List: public Sequence
class PYCXX_EXPORT List: public Sequence
{
public:
// Constructor
@@ -2632,7 +2632,7 @@ namespace Py
#endif
template<TEMPLATE_TYPENAME T>
class MapBase: public Object
class PYCXX_EXPORT MapBase: public Object
{
protected:
explicit MapBase<T>()
@@ -3051,7 +3051,7 @@ namespace Py
// ==================================================
// class Dict
class Dict: public Mapping
class PYCXX_EXPORT Dict: public Mapping
{
public:
// Constructor
@@ -3093,7 +3093,7 @@ namespace Py
}
};
class Callable: public Object
class PYCXX_EXPORT Callable: public Object
{
public:
// Constructor
@@ -3150,7 +3150,7 @@ namespace Py
}
};
class Module: public Object
class PYCXX_EXPORT Module: public Object
{
public:
explicit Module( PyObject *pyob, bool owned = false )
@@ -3198,7 +3198,7 @@ namespace Py
inline Object Object::callMemberFunction( const std::string &function_name ) const
{
Callable target( getAttr( function_name ) );
Tuple args( 0 );
Tuple args( (sequence_index_type)0 );
return target.apply( args );
}

View File

@@ -40,7 +40,7 @@
namespace Py
{
class PythonType
class PYCXX_EXPORT PythonType
{
public:
// if you define one sequence method you must define

View File

@@ -1518,6 +1518,61 @@ extern "C" PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple,
}
}
extern "C" PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple, PyObject * )
{
try
{
Tuple self_and_name_tuple( _self_and_name_tuple );
PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
void *self_as_void = PyCObject_AsVoidPtr( self_in_cobject );
if( self_as_void == NULL )
return NULL;
ExtensionModuleBase *self = static_cast<ExtensionModuleBase *>( self_as_void );
Object result
(
self->invoke_method_noargs
(
PyCObject_AsVoidPtr( self_and_name_tuple[1].ptr() )
)
);
return new_reference_to( result.ptr() );
}
catch( Exception & )
{
return 0;
}
#if 0
try
{
Tuple self_and_name_tuple( _self_and_name_tuple );
PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
void *self_as_void = PyCObject_AsVoidPtr( self_in_cobject );
if( self_as_void == NULL )
return NULL;
ExtensionModuleBase *self = static_cast<ExtensionModuleBase *>( self_as_void );
String py_name( self_and_name_tuple[1] );
std::string name( py_name.as_std_string( NULL ) );
Object result( self->invoke_method_noargs( name ) );
return new_reference_to( result.ptr() );
}
catch( Exception & )
{
return 0;
}
#else
return 0;
#endif
}
extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args )
{
try

View File

@@ -56,6 +56,15 @@
// pull in python definitions
#include <Python.h>
#ifdef FC_OS_MACOSX
#undef toupper
#undef tolower
#undef isupper
#undef islower
#undef isspace
#undef isalpha
#undef isalnum
#endif
// fix issue with Python assuming that isspace, toupper etc are macros
#if defined(isspace)

View File

@@ -34,7 +34,7 @@
// DAMAGE.
//
//-----------------------------------------------------------------------------
#include "CXX/WrapPython.h"
#include "WrapPython.h"
#if PY_MAJOR_VERSION == 2
#include "Python2/cxxsupport.cxx"