Base: remove some more deprecated Py2 code
and remove deprecated void from function signature and replace 0 or NULL with nullptr
This commit is contained in:
@@ -46,10 +46,6 @@ unsigned int format2_len = 1024;
|
||||
|
||||
using namespace Base;
|
||||
|
||||
#if PY_VERSION_HEX <= 0x02050000
|
||||
#error "Use Python2.5.x or higher"
|
||||
#endif
|
||||
|
||||
PyException::PyException(const Py::Object &obj) {
|
||||
_sErrMsg = obj.as_string();
|
||||
// WARNING: we are assuming that python type object will never be
|
||||
@@ -59,7 +55,7 @@ PyException::PyException(const Py::Object &obj) {
|
||||
_errorType = obj.ptr()->ob_type->tp_name;
|
||||
}
|
||||
|
||||
PyException::PyException(void)
|
||||
PyException::PyException()
|
||||
{
|
||||
PP_Fetch_Error_Text(); /* fetch (and clear) exception */
|
||||
|
||||
@@ -104,7 +100,7 @@ PyException::~PyException() throw()
|
||||
{
|
||||
}
|
||||
|
||||
void PyException::ThrowException(void)
|
||||
void PyException::ThrowException()
|
||||
{
|
||||
PyException myexcp;
|
||||
myexcp.ReportException();
|
||||
@@ -113,11 +109,10 @@ void PyException::ThrowException(void)
|
||||
|
||||
void PyException::raiseException() {
|
||||
PyGILStateLocker locker;
|
||||
|
||||
if (PP_PyDict_Object!=NULL) {
|
||||
if (PP_PyDict_Object!=nullptr) {
|
||||
// delete the Python dict upon destruction of edict
|
||||
Py::Dict edict(PP_PyDict_Object, true);
|
||||
PP_PyDict_Object = 0;
|
||||
PP_PyDict_Object = nullptr;
|
||||
|
||||
std::string exceptionname;
|
||||
if (_exceptionType == Base::BaseExceptionFreeCADAbort)
|
||||
@@ -137,7 +132,7 @@ void PyException::raiseException() {
|
||||
throw *this;
|
||||
}
|
||||
|
||||
void PyException::ReportException (void) const
|
||||
void PyException::ReportException () const
|
||||
{
|
||||
if (!_isReported) {
|
||||
_isReported = true;
|
||||
@@ -178,7 +173,7 @@ SystemExitException::SystemExitException()
|
||||
|
||||
if (value) {
|
||||
code = PyObject_GetAttrString(value, "code");
|
||||
if (code != NULL && value != Py_None) {
|
||||
if (code != nullptr && value != Py_None) {
|
||||
Py_DECREF(value);
|
||||
value = code;
|
||||
}
|
||||
@@ -203,7 +198,7 @@ SystemExitException::SystemExitException()
|
||||
class PythonStdOutput : public Py::PythonExtension<PythonStdOutput>
|
||||
{
|
||||
public:
|
||||
static void init_type(void)
|
||||
static void init_type()
|
||||
{
|
||||
behaviors().name("PythonStdOutput");
|
||||
behaviors().doc("Python standard output");
|
||||
@@ -232,7 +227,7 @@ public:
|
||||
|
||||
InterpreterSingleton::InterpreterSingleton()
|
||||
{
|
||||
this->_global = 0;
|
||||
this->_global = nullptr;
|
||||
}
|
||||
|
||||
InterpreterSingleton::~InterpreterSingleton()
|
||||
@@ -247,10 +242,10 @@ std::string InterpreterSingleton::runString(const char *sCmd)
|
||||
|
||||
PyGILStateLocker locker;
|
||||
module = PP_Load_Module("__main__"); /* get module, init python */
|
||||
if (module == NULL)
|
||||
if (module == nullptr)
|
||||
throw PyException(); /* not incref'd */
|
||||
dict = PyModule_GetDict(module); /* get dict namespace */
|
||||
if (dict == NULL)
|
||||
if (dict == nullptr)
|
||||
throw PyException(); /* not incref'd */
|
||||
|
||||
|
||||
@@ -324,10 +319,10 @@ Py::Object InterpreterSingleton::runStringObject(const char *sCmd)
|
||||
|
||||
PyGILStateLocker locker;
|
||||
module = PP_Load_Module("__main__"); /* get module, init python */
|
||||
if (module == NULL)
|
||||
if (module == nullptr)
|
||||
throw PyException(); /* not incref'd */
|
||||
dict = PyModule_GetDict(module); /* get dict namespace */
|
||||
if (dict == NULL)
|
||||
if (dict == nullptr)
|
||||
throw PyException(); /* not incref'd */
|
||||
|
||||
|
||||
@@ -342,7 +337,7 @@ Py::Object InterpreterSingleton::runStringObject(const char *sCmd)
|
||||
return Py::asObject(presult);
|
||||
}
|
||||
|
||||
void InterpreterSingleton::systemExit(void)
|
||||
void InterpreterSingleton::systemExit()
|
||||
{
|
||||
/* This code is taken from the original Python code */
|
||||
PyObject *exception, *value, *tb;
|
||||
@@ -350,7 +345,7 @@ void InterpreterSingleton::systemExit(void)
|
||||
|
||||
PyErr_Fetch(&exception, &value, &tb);
|
||||
fflush(stdout);
|
||||
if (value == NULL || value == Py_None)
|
||||
if (value == nullptr || value == Py_None)
|
||||
goto done;
|
||||
if (PyExceptionInstance_Check(value)) {
|
||||
/* The error code should be in the `code' attribute. */
|
||||
@@ -364,8 +359,9 @@ void InterpreterSingleton::systemExit(void)
|
||||
/* If we failed to dig out the 'code' attribute,
|
||||
just let the else clause below print the error. */
|
||||
}
|
||||
if (PyLong_Check(value))
|
||||
if (PyLong_Check(value)) {
|
||||
exitcode = (int)PyLong_AsLong(value);
|
||||
}
|
||||
else {
|
||||
PyObject_Print(value, stderr, Py_PRINT_RAW);
|
||||
PySys_WriteStderr("\n");
|
||||
@@ -389,10 +385,10 @@ void InterpreterSingleton::runInteractiveString(const char *sCmd)
|
||||
|
||||
PyGILStateLocker locker;
|
||||
module = PP_Load_Module("__main__"); /* get module, init python */
|
||||
if (module == NULL)
|
||||
if (module == nullptr)
|
||||
throw PyException(); /* not incref'd */
|
||||
dict = PyModule_GetDict(module); /* get dict namespace */
|
||||
if (dict == NULL)
|
||||
if (dict == nullptr)
|
||||
throw PyException(); /* not incref'd */
|
||||
|
||||
presult = PyRun_String(sCmd, Py_single_input, dict, dict); /* eval direct */
|
||||
@@ -442,9 +438,9 @@ void InterpreterSingleton::runFile(const char*pxFileName, bool local)
|
||||
Py_INCREF(dict); // avoid to further distinguish between local and global dict
|
||||
}
|
||||
|
||||
if (PyDict_GetItemString(dict, "__file__") == NULL) {
|
||||
if (PyDict_GetItemString(dict, "__file__") == nullptr) {
|
||||
PyObject *f = PyUnicode_FromString(pxFileName);
|
||||
if (f == NULL) {
|
||||
if (f == nullptr) {
|
||||
fclose(fp);
|
||||
Py_DECREF(dict);
|
||||
return;
|
||||
@@ -514,14 +510,10 @@ void InterpreterSingleton::addPythonPath(const char* Path)
|
||||
const char* InterpreterSingleton::init(int argc,char *argv[])
|
||||
{
|
||||
if (!Py_IsInitialized()) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
#if PY_MINOR_VERSION >= 5
|
||||
Py_SetProgramName(Py_DecodeLocale(argv[0],NULL));
|
||||
#if PY_VERSION_HEX >= 0x03050000
|
||||
Py_SetProgramName(Py_DecodeLocale(argv[0],nullptr));
|
||||
#else
|
||||
Py_SetProgramName(_Py_char2wchar(argv[0],NULL));
|
||||
#endif
|
||||
#else
|
||||
Py_SetProgramName(argv[0]);
|
||||
Py_SetProgramName(_Py_char2wchar(argv[0],nullptr));
|
||||
#endif
|
||||
// There is a serious bug in VS from 2010 until 2013 where the file descriptor for stdin, stdout or stderr
|
||||
// returns a valid value for GUI applications (i.e. subsystem = Windows) where it shouldn't.
|
||||
@@ -551,22 +543,15 @@ const char* InterpreterSingleton::init(int argc,char *argv[])
|
||||
size_t size = argc;
|
||||
static std::vector<wchar_t *> _argv(size);
|
||||
for (int i = 0; i < argc; i++) {
|
||||
#if PY_MINOR_VERSION >= 5
|
||||
_argv[i] = Py_DecodeLocale(argv[i],NULL);
|
||||
#else
|
||||
_argv[i] = _Py_char2wchar(argv[i],NULL);
|
||||
#endif
|
||||
_argv[i] = Py_DecodeLocale(argv[i],nullptr);
|
||||
}
|
||||
PySys_SetArgv(argc, _argv.data());
|
||||
PythonStdOutput::init_type();
|
||||
this->_global = PyEval_SaveThread();
|
||||
}
|
||||
|
||||
PyGILStateLocker lock;
|
||||
#if PY_MINOR_VERSION >= 5
|
||||
return Py_EncodeLocale(Py_GetPath(),NULL);
|
||||
#else
|
||||
return _Py_wchar2char(Py_GetPath(),NULL);
|
||||
#endif
|
||||
return Py_EncodeLocale(Py_GetPath(),nullptr);
|
||||
}
|
||||
|
||||
void InterpreterSingleton::replaceStdOutput()
|
||||
@@ -577,7 +562,7 @@ void InterpreterSingleton::replaceStdOutput()
|
||||
PySys_SetObject("stderr", out);
|
||||
}
|
||||
|
||||
int InterpreterSingleton::cleanup(void (*func)(void))
|
||||
int InterpreterSingleton::cleanup(void (*func)())
|
||||
{
|
||||
return Py_AtExit( func );
|
||||
}
|
||||
@@ -610,9 +595,9 @@ void InterpreterSingleton::runStringArg(const char * psCom,...)
|
||||
|
||||
// Singelton:
|
||||
|
||||
InterpreterSingleton * InterpreterSingleton::_pcSingelton = 0;
|
||||
InterpreterSingleton * InterpreterSingleton::_pcSingelton = nullptr;
|
||||
|
||||
InterpreterSingleton & InterpreterSingleton::Instance(void)
|
||||
InterpreterSingleton & InterpreterSingleton::Instance()
|
||||
{
|
||||
// not initialized!
|
||||
if (!_pcSingelton)
|
||||
@@ -620,12 +605,12 @@ InterpreterSingleton & InterpreterSingleton::Instance(void)
|
||||
return *_pcSingelton;
|
||||
}
|
||||
|
||||
void InterpreterSingleton::Destruct(void)
|
||||
void InterpreterSingleton::Destruct()
|
||||
{
|
||||
// not initialized or double destruct!
|
||||
assert(_pcSingelton);
|
||||
delete _pcSingelton;
|
||||
_pcSingelton = 0;
|
||||
_pcSingelton = nullptr;
|
||||
}
|
||||
|
||||
int InterpreterSingleton::runCommandLine(const char *prompt)
|
||||
@@ -643,8 +628,8 @@ void InterpreterSingleton::runMethodVoid(PyObject *pobject, const char *method)
|
||||
PyGILStateLocker locker;
|
||||
if (PP_Run_Method(pobject , // object
|
||||
method, // run method
|
||||
0, // no return type
|
||||
0, // so no return object
|
||||
nullptr, // no return type
|
||||
nullptr, // so no return object
|
||||
"()") // no arguments
|
||||
!= 0)
|
||||
throw PyException(/*"Error running InterpreterSingleton::RunMethodVoid()"*/);
|
||||
@@ -677,7 +662,7 @@ void InterpreterSingleton::runMethod(PyObject *pobject, const char *method,
|
||||
|
||||
PyGILStateLocker locker;
|
||||
pmeth = PyObject_GetAttrString(pobject, method);
|
||||
if (pmeth == NULL) { /* get callable object */
|
||||
if (pmeth == nullptr) { /* get callable object */
|
||||
va_end(argslist);
|
||||
throw AttributeError("Error running InterpreterSingleton::RunMethod() method not defined"); /* bound method? has self */
|
||||
}
|
||||
@@ -685,7 +670,7 @@ void InterpreterSingleton::runMethod(PyObject *pobject, const char *method,
|
||||
pargs = Py_VaBuildValue(argfmt, argslist); /* args: c->python */
|
||||
va_end(argslist);
|
||||
|
||||
if (pargs == NULL) {
|
||||
if (pargs == nullptr) {
|
||||
Py_DECREF(pmeth);
|
||||
throw TypeError("InterpreterSingleton::RunMethod() wrong arguments");
|
||||
}
|
||||
@@ -711,10 +696,10 @@ PyObject * InterpreterSingleton::getValue(const char * key, const char * result_
|
||||
|
||||
PyGILStateLocker locker;
|
||||
module = PP_Load_Module("__main__"); /* get module, init python */
|
||||
if (module == NULL)
|
||||
if (module == nullptr)
|
||||
throw PyException(); /* not incref'd */
|
||||
dict = PyModule_GetDict(module); /* get dict namespace */
|
||||
if (dict == NULL)
|
||||
if (dict == nullptr)
|
||||
throw PyException(); /* not incref'd */
|
||||
|
||||
|
||||
@@ -745,7 +730,7 @@ void InterpreterSingleton::dbgUnsetBreakPoint(unsigned int /*uiLineNumber*/)
|
||||
|
||||
}
|
||||
|
||||
void InterpreterSingleton::dbgStep(void)
|
||||
void InterpreterSingleton::dbgStep()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -832,7 +817,7 @@ namespace Swig_python { extern int createSWIGPointerObj_T(const char* TypeName,
|
||||
PyObject* InterpreterSingleton::createSWIGPointerObj(const char* Module, const char* TypeName, void* Pointer, int own)
|
||||
{
|
||||
int result = 0;
|
||||
PyObject* proxy=0;
|
||||
PyObject* proxy=nullptr;
|
||||
PyGILStateLocker locker;
|
||||
(void)Module;
|
||||
#if (defined(HAVE_SWIG) && (HAVE_SWIG == 1))
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
using namespace Base;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string MatrixPy::representation(void) const
|
||||
std::string MatrixPy::representation() const
|
||||
{
|
||||
const Base::Matrix4D& m = *(this->getMatrixPtr());
|
||||
std::stringstream str;
|
||||
@@ -95,11 +95,11 @@ PyObject* MatrixPy::number_add_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
if (!PyObject_TypeCheck(self, &(MatrixPy::Type))) {
|
||||
PyErr_SetString(PyExc_NotImplementedError, "");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (!PyObject_TypeCheck(other, &(MatrixPy::Type))) {
|
||||
PyErr_SetString(PyExc_TypeError, "Second arg must be Matrix");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
|
||||
Base::Matrix4D b = static_cast<MatrixPy*>(other)->value();
|
||||
@@ -110,11 +110,11 @@ PyObject* MatrixPy::number_subtract_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
if (!PyObject_TypeCheck(self, &(MatrixPy::Type))) {
|
||||
PyErr_SetString(PyExc_NotImplementedError, "");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (!PyObject_TypeCheck(other, &(MatrixPy::Type))) {
|
||||
PyErr_SetString(PyExc_TypeError, "Second arg must be Matrix");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
|
||||
Base::Matrix4D b = static_cast<MatrixPy*>(other)->value();
|
||||
@@ -156,7 +156,7 @@ PyObject* MatrixPy::number_multiply_handler(PyObject *self, PyObject *other)
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_power_handler (PyObject* self, PyObject* other, PyObject* arg)
|
||||
@@ -168,7 +168,7 @@ PyObject * MatrixPy::number_power_handler (PyObject* self, PyObject* other, PyOb
|
||||
)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
|
||||
@@ -182,7 +182,7 @@ PyObject * MatrixPy::number_power_handler (PyObject* self, PyObject* other, PyOb
|
||||
a.inverseGauss();
|
||||
else {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot invert singular matrix");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
b = -b;
|
||||
}
|
||||
@@ -200,11 +200,11 @@ PyObject* MatrixPy::richCompare(PyObject *v, PyObject *w, int op)
|
||||
Matrix4D m1 = static_cast<MatrixPy*>(v)->value();
|
||||
Matrix4D m2 = static_cast<MatrixPy*>(w)->value();
|
||||
|
||||
PyObject *res=0;
|
||||
PyObject *res=nullptr;
|
||||
if (op != Py_EQ && op != Py_NE) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"no ordering relation is defined for Matrix");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
else if (op == Py_EQ) {
|
||||
res = (m1 == m2) ? Py_True : Py_False;
|
||||
@@ -250,7 +250,7 @@ PyObject* MatrixPy::move(PyObject * args)
|
||||
PyErr_Clear();
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->move(vec);
|
||||
@@ -286,7 +286,7 @@ PyObject* MatrixPy::scale(PyObject * args)
|
||||
PyErr_Clear();
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->scale(vec);
|
||||
@@ -300,14 +300,14 @@ PyObject* MatrixPy::hasScale(PyObject * args)
|
||||
{
|
||||
double tol=0;
|
||||
if (!PyArg_ParseTuple(args, "|d", &tol))
|
||||
return 0;
|
||||
return nullptr;
|
||||
return Py::new_reference_to(Py::Int(getMatrixPtr()->hasScale(tol)));
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::unity(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
return nullptr; // NULL triggers exception
|
||||
PY_TRY {
|
||||
getMatrixPtr()->setToUnity();
|
||||
}
|
||||
@@ -332,7 +332,7 @@ PyObject* MatrixPy::transform(PyObject * args)
|
||||
PyErr_Clear();
|
||||
}
|
||||
else
|
||||
return NULL; // NULL triggers exception
|
||||
return nullptr; // NULL triggers exception
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->transform(vec,mat);
|
||||
@@ -361,7 +361,7 @@ PyObject* MatrixPy::rotateX(PyObject * args)
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "For angle either float or Quantity expected");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
while (false);
|
||||
|
||||
@@ -392,7 +392,7 @@ PyObject* MatrixPy::rotateY(PyObject * args)
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "For angle either float or Quantity expected");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
while (false);
|
||||
|
||||
@@ -423,7 +423,7 @@ PyObject* MatrixPy::rotateZ(PyObject * args)
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "For angle either float or Quantity expected");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
while (false);
|
||||
|
||||
@@ -450,14 +450,14 @@ PyObject* MatrixPy::multiply(PyObject * args)
|
||||
}
|
||||
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "either vector or matrix expected");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::multVec(PyObject * args)
|
||||
{
|
||||
PyObject *obj;
|
||||
if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &obj))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
Base::Vector3d vec(static_cast<VectorPy*>(obj)->value());
|
||||
getMatrixPtr()->multVec(vec, vec);
|
||||
return new VectorPy(new Vector3d(vec));
|
||||
@@ -466,14 +466,14 @@ PyObject* MatrixPy::multVec(PyObject * args)
|
||||
PyObject* MatrixPy::invert(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
if (fabs(getMatrixPtr()->determinant()) > DBL_EPSILON)
|
||||
getMatrixPtr()->inverseGauss();
|
||||
else {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot invert singular matrix");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
PY_CATCH;
|
||||
@@ -484,7 +484,7 @@ PyObject* MatrixPy::invert(PyObject * args)
|
||||
PyObject* MatrixPy::inverse(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
if (fabs(getMatrixPtr()->determinant()) > DBL_EPSILON) {
|
||||
@@ -494,7 +494,7 @@ PyObject* MatrixPy::inverse(PyObject * args)
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot invert singular matrix");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
PY_CATCH;
|
||||
@@ -505,7 +505,7 @@ PyObject* MatrixPy::inverse(PyObject * args)
|
||||
PyObject* MatrixPy::determinant(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return PyFloat_FromDouble(getMatrixPtr()->determinant());
|
||||
}
|
||||
|
||||
@@ -513,10 +513,10 @@ PyObject* MatrixPy::submatrix(PyObject * args)
|
||||
{
|
||||
int dim;
|
||||
if (!PyArg_ParseTuple(args, "i", &dim))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if (dim < 1 || dim > 4) {
|
||||
PyErr_SetString(PyExc_IndexError, "Dimension out of range");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Base::Matrix4D& mat = *getMatrixPtr();
|
||||
@@ -547,7 +547,7 @@ PyObject* MatrixPy::isOrthogonal(PyObject * args)
|
||||
{
|
||||
double eps=1.0e-06;
|
||||
if (!PyArg_ParseTuple(args, "|d",&eps))
|
||||
return 0;
|
||||
return nullptr;
|
||||
const Base::Matrix4D& mat = *getMatrixPtr();
|
||||
Base::Matrix4D trp = mat;
|
||||
trp.transpose();
|
||||
@@ -578,7 +578,7 @@ PyObject* MatrixPy::isOrthogonal(PyObject * args)
|
||||
PyObject* MatrixPy::transposed(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
Base::Matrix4D m = *getMatrixPtr();
|
||||
@@ -593,7 +593,7 @@ PyObject* MatrixPy::transposed(PyObject * args)
|
||||
PyObject* MatrixPy::transpose(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->transpose();
|
||||
@@ -605,7 +605,7 @@ PyObject* MatrixPy::transpose(PyObject * args)
|
||||
PyObject* MatrixPy::analyze(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
std::string type = getMatrixPtr()->analyse();
|
||||
@@ -614,7 +614,7 @@ PyObject* MatrixPy::analyze(PyObject * args)
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA11(void) const
|
||||
Py::Float MatrixPy::getA11() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[0][0];
|
||||
return Py::Float(val);
|
||||
@@ -625,7 +625,7 @@ void MatrixPy::setA11(Py::Float arg)
|
||||
(*this->getMatrixPtr())[0][0] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA12(void) const
|
||||
Py::Float MatrixPy::getA12() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[0][1];
|
||||
return Py::Float(val);
|
||||
@@ -636,7 +636,7 @@ void MatrixPy::setA12(Py::Float arg)
|
||||
(*this->getMatrixPtr())[0][1] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA13(void) const
|
||||
Py::Float MatrixPy::getA13() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[0][2];
|
||||
return Py::Float(val);
|
||||
@@ -647,7 +647,7 @@ void MatrixPy::setA13(Py::Float arg)
|
||||
(*this->getMatrixPtr())[0][2] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA14(void) const
|
||||
Py::Float MatrixPy::getA14() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[0][3];
|
||||
return Py::Float(val);
|
||||
@@ -658,7 +658,7 @@ void MatrixPy::setA14(Py::Float arg)
|
||||
(*this->getMatrixPtr())[0][3] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA21(void) const
|
||||
Py::Float MatrixPy::getA21() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[1][0];
|
||||
return Py::Float(val);
|
||||
@@ -669,7 +669,7 @@ void MatrixPy::setA21(Py::Float arg)
|
||||
(*this->getMatrixPtr())[1][0] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA22(void) const
|
||||
Py::Float MatrixPy::getA22() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[1][1];
|
||||
return Py::Float(val);
|
||||
@@ -680,7 +680,7 @@ void MatrixPy::setA22(Py::Float arg)
|
||||
(*this->getMatrixPtr())[1][1] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA23(void) const
|
||||
Py::Float MatrixPy::getA23() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[1][2];
|
||||
return Py::Float(val);
|
||||
@@ -691,7 +691,7 @@ void MatrixPy::setA23(Py::Float arg)
|
||||
(*this->getMatrixPtr())[1][2] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA24(void) const
|
||||
Py::Float MatrixPy::getA24() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[1][3];
|
||||
return Py::Float(val);
|
||||
@@ -702,7 +702,7 @@ void MatrixPy::setA24(Py::Float arg)
|
||||
(*this->getMatrixPtr())[1][3] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA31(void) const
|
||||
Py::Float MatrixPy::getA31() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[2][0];
|
||||
return Py::Float(val);
|
||||
@@ -713,7 +713,7 @@ void MatrixPy::setA31(Py::Float arg)
|
||||
(*this->getMatrixPtr())[2][0] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA32(void) const
|
||||
Py::Float MatrixPy::getA32() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[2][1];
|
||||
return Py::Float(val);
|
||||
@@ -724,7 +724,7 @@ void MatrixPy::setA32(Py::Float arg)
|
||||
(*this->getMatrixPtr())[2][1] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA33(void) const
|
||||
Py::Float MatrixPy::getA33() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[2][2];
|
||||
return Py::Float(val);
|
||||
@@ -735,7 +735,7 @@ void MatrixPy::setA33(Py::Float arg)
|
||||
(*this->getMatrixPtr())[2][2] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA34(void) const
|
||||
Py::Float MatrixPy::getA34() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[2][3];
|
||||
return Py::Float(val);
|
||||
@@ -746,7 +746,7 @@ void MatrixPy::setA34(Py::Float arg)
|
||||
(*this->getMatrixPtr())[2][3] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA41(void) const
|
||||
Py::Float MatrixPy::getA41() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[3][0];
|
||||
return Py::Float(val);
|
||||
@@ -757,7 +757,7 @@ void MatrixPy::setA41(Py::Float arg)
|
||||
(*this->getMatrixPtr())[3][0] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA42(void) const
|
||||
Py::Float MatrixPy::getA42() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[3][1];
|
||||
return Py::Float(val);
|
||||
@@ -768,7 +768,7 @@ void MatrixPy::setA42(Py::Float arg)
|
||||
(*this->getMatrixPtr())[3][1] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA43(void) const
|
||||
Py::Float MatrixPy::getA43() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[3][2];
|
||||
return Py::Float(val);
|
||||
@@ -779,7 +779,7 @@ void MatrixPy::setA43(Py::Float arg)
|
||||
(*this->getMatrixPtr())[3][2] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Float MatrixPy::getA44(void) const
|
||||
Py::Float MatrixPy::getA44() const
|
||||
{
|
||||
double val = (*this->getMatrixPtr())[3][3];
|
||||
return Py::Float(val);
|
||||
@@ -790,7 +790,7 @@ void MatrixPy::setA44(Py::Float arg)
|
||||
(*this->getMatrixPtr())[3][3] = (double)arg;
|
||||
}
|
||||
|
||||
Py::Sequence MatrixPy::getA(void) const
|
||||
Py::Sequence MatrixPy::getA() const
|
||||
{
|
||||
double mat[16];
|
||||
this->getMatrixPtr()->getMatrix(mat);
|
||||
@@ -816,7 +816,7 @@ void MatrixPy::setA(Py::Sequence arg)
|
||||
|
||||
PyObject *MatrixPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int MatrixPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
@@ -827,37 +827,37 @@ int MatrixPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
PyObject * MatrixPy::number_divide_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_remainder_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_divmod_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_negative_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_positive_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_absolute_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int MatrixPy::number_nonzero_handler (PyObject* /*self*/)
|
||||
@@ -868,47 +868,47 @@ int MatrixPy::number_nonzero_handler (PyObject* /*self*/)
|
||||
PyObject * MatrixPy::number_invert_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_lshift_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_rshift_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_and_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_xor_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_or_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_int_handler (PyObject * /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * MatrixPy::number_float_handler (PyObject * /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <assert.h>
|
||||
# include <cassert>
|
||||
# include <fcntl.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
@@ -33,7 +33,7 @@
|
||||
# include <io.h>
|
||||
# include <xercesc/sax/SAXParseException.hpp>
|
||||
# endif
|
||||
# include <stdio.h>
|
||||
# include <cstdio>
|
||||
# include <sstream>
|
||||
# include <list>
|
||||
#endif
|
||||
@@ -99,7 +99,7 @@ typedef std::list<ParameterGrpObserver*> ParameterGrpObserverList;
|
||||
class ParameterGrpPy : public Py::PythonExtension<ParameterGrpPy>
|
||||
{
|
||||
public:
|
||||
static void init_type(void); // announce properties and methods
|
||||
static void init_type(); // announce properties and methods
|
||||
|
||||
ParameterGrpPy(const Base::Reference<ParameterGrp> &rcParamGrp);
|
||||
~ParameterGrpPy();
|
||||
@@ -320,7 +320,7 @@ Py::Object ParameterGrpPy::getBool(const Py::Tuple& args)
|
||||
|
||||
Py::Object ParameterGrpPy::getBools(const Py::Tuple& args)
|
||||
{
|
||||
char *filter=0;
|
||||
char *filter=nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "|s", &filter))
|
||||
throw Py::Exception();
|
||||
|
||||
@@ -355,7 +355,7 @@ Py::Object ParameterGrpPy::getInt(const Py::Tuple& args)
|
||||
|
||||
Py::Object ParameterGrpPy::getInts(const Py::Tuple& args)
|
||||
{
|
||||
char *filter=0;
|
||||
char *filter=nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "|s", &filter))
|
||||
throw Py::Exception();
|
||||
|
||||
@@ -390,7 +390,7 @@ Py::Object ParameterGrpPy::getUnsigned(const Py::Tuple& args)
|
||||
|
||||
Py::Object ParameterGrpPy::getUnsigneds(const Py::Tuple& args)
|
||||
{
|
||||
char *filter=0;
|
||||
char *filter=nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "|s", &filter))
|
||||
throw Py::Exception();
|
||||
|
||||
@@ -426,7 +426,7 @@ Py::Object ParameterGrpPy::getFloat(const Py::Tuple& args)
|
||||
|
||||
Py::Object ParameterGrpPy::getFloats(const Py::Tuple& args)
|
||||
{
|
||||
char *filter=0;
|
||||
char *filter=nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "|s", &filter))
|
||||
throw Py::Exception();
|
||||
|
||||
@@ -462,7 +462,7 @@ Py::Object ParameterGrpPy::getString(const Py::Tuple& args)
|
||||
|
||||
Py::Object ParameterGrpPy::getStrings(const Py::Tuple& args)
|
||||
{
|
||||
char *filter=0;
|
||||
char *filter=nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "|s", &filter))
|
||||
throw Py::Exception();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <sstream>
|
||||
# include <stdlib.h>
|
||||
# include <cstdlib>
|
||||
#endif
|
||||
|
||||
#include "PyObjectBase.h"
|
||||
@@ -36,8 +36,8 @@
|
||||
|
||||
using namespace Base;
|
||||
|
||||
PyObject* Base::BaseExceptionFreeCADError = 0;
|
||||
PyObject* Base::BaseExceptionFreeCADAbort = 0;
|
||||
PyObject* Base::BaseExceptionFreeCADError = nullptr;
|
||||
PyObject* Base::BaseExceptionFreeCADAbort = nullptr;
|
||||
|
||||
#ifdef ATTR_TRACKING
|
||||
typedef struct {
|
||||
@@ -107,49 +107,49 @@ static PyTypeObject PyBaseProxyType = {
|
||||
sizeof(PyBaseProxy), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
PyBaseProxy_dealloc, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
0, /*tp_getattr*/
|
||||
0, /*tp_setattr*/
|
||||
0, /*tp_compare*/
|
||||
0, /*tp_repr*/
|
||||
0, /*tp_as_number*/
|
||||
0, /*tp_as_sequence*/
|
||||
0, /*tp_as_mapping*/
|
||||
0, /*tp_hash*/
|
||||
0, /*tp_call */
|
||||
0, /*tp_str */
|
||||
0, /*tp_getattro*/
|
||||
0, /*tp_setattro*/
|
||||
0, /* tp_as_buffer */
|
||||
nullptr, /*tp_print*/
|
||||
nullptr, /*tp_getattr*/
|
||||
nullptr, /*tp_setattr*/
|
||||
nullptr, /*tp_compare*/
|
||||
nullptr, /*tp_repr*/
|
||||
nullptr, /*tp_as_number*/
|
||||
nullptr, /*tp_as_sequence*/
|
||||
nullptr, /*tp_as_mapping*/
|
||||
nullptr, /*tp_hash*/
|
||||
nullptr, /*tp_call */
|
||||
nullptr, /*tp_str */
|
||||
nullptr, /*tp_getattro*/
|
||||
nullptr, /*tp_setattro*/
|
||||
nullptr, /*tp_as_buffer*/
|
||||
Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DEFAULT, /*tp_flags */
|
||||
"Proxy class", /*tp_doc */
|
||||
0, /*tp_traverse */
|
||||
0, /*tp_clear */
|
||||
0, /*tp_richcompare */
|
||||
nullptr, /*tp_traverse */
|
||||
nullptr, /*tp_clear */
|
||||
nullptr, /*tp_richcompare */
|
||||
offsetof(PyBaseProxy, weakreflist), /*tp_weaklistoffset */
|
||||
0, /*tp_iter */
|
||||
0, /*tp_iternext */
|
||||
0, /*tp_methods */
|
||||
0, /*tp_members */
|
||||
0, /*tp_getset */
|
||||
0, /*tp_base */
|
||||
0, /*tp_dict */
|
||||
0, /*tp_descr_get */
|
||||
0, /*tp_descr_set */
|
||||
nullptr, /*tp_iter */
|
||||
nullptr, /*tp_iternext */
|
||||
nullptr, /*tp_methods */
|
||||
nullptr, /*tp_members */
|
||||
nullptr, /*tp_getset */
|
||||
nullptr, /*tp_base */
|
||||
nullptr, /*tp_dict */
|
||||
nullptr, /*tp_descr_get */
|
||||
nullptr, /*tp_descr_set */
|
||||
0, /*tp_dictoffset */
|
||||
0, /*tp_init */
|
||||
0, /*tp_alloc */
|
||||
0, /*tp_new */
|
||||
0, /*tp_free Low-level free-memory routine */
|
||||
0, /*tp_is_gc For PyObject_IS_GC */
|
||||
0, /*tp_bases */
|
||||
0, /*tp_mro method resolution order */
|
||||
0, /*tp_cache */
|
||||
0, /*tp_subclasses */
|
||||
0, /*tp_weaklist */
|
||||
0, /*tp_del */
|
||||
nullptr, /*tp_init */
|
||||
nullptr, /*tp_alloc */
|
||||
nullptr, /*tp_new */
|
||||
nullptr, /*tp_free Low-level free-memory routine */
|
||||
nullptr, /*tp_is_gc For PyObject_IS_GC */
|
||||
nullptr, /*tp_bases */
|
||||
nullptr, /*tp_mro method resolution order */
|
||||
nullptr, /*tp_cache */
|
||||
nullptr, /*tp_subclasses */
|
||||
nullptr, /*tp_weaklist */
|
||||
nullptr, /*tp_del */
|
||||
0, /*tp_version_tag */
|
||||
0 /*tp_finalize */
|
||||
nullptr /*tp_finalize */
|
||||
#if PY_VERSION_HEX >= 0x03090000
|
||||
,0 /*tp_vectorcall */
|
||||
#elif PY_VERSION_HEX >= 0x03080000
|
||||
@@ -166,51 +166,51 @@ PyTypeObject PyObjectBase::Type = {
|
||||
0, /*tp_itemsize*/
|
||||
/* --- methods ---------------------------------------------- */
|
||||
PyDestructor, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
0, /*tp_getattr*/
|
||||
0, /*tp_setattr*/
|
||||
0, /*tp_compare*/
|
||||
nullptr, /*tp_print*/
|
||||
nullptr, /*tp_getattr*/
|
||||
nullptr, /*tp_setattr*/
|
||||
nullptr, /*tp_compare*/
|
||||
__repr, /*tp_repr*/
|
||||
0, /*tp_as_number*/
|
||||
0, /*tp_as_sequence*/
|
||||
0, /*tp_as_mapping*/
|
||||
0, /*tp_hash*/
|
||||
0, /*tp_call */
|
||||
0, /*tp_str */
|
||||
nullptr, /*tp_as_number*/
|
||||
nullptr, /*tp_as_sequence*/
|
||||
nullptr, /*tp_as_mapping*/
|
||||
nullptr, /*tp_hash*/
|
||||
nullptr, /*tp_call */
|
||||
nullptr, /*tp_str */
|
||||
__getattro, /*tp_getattro*/
|
||||
__setattro, /*tp_setattro*/
|
||||
/* --- Functions to access object as input/output buffer ---------*/
|
||||
0, /* tp_as_buffer */
|
||||
nullptr, /* tp_as_buffer */
|
||||
/* --- Flags to define presence of optional/expanded features */
|
||||
Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT, /*tp_flags */
|
||||
"The most base class for Python binding", /*tp_doc */
|
||||
0, /*tp_traverse */
|
||||
0, /*tp_clear */
|
||||
0, /*tp_richcompare */
|
||||
nullptr, /*tp_traverse */
|
||||
nullptr, /*tp_clear */
|
||||
nullptr, /*tp_richcompare */
|
||||
0, /*tp_weaklistoffset */
|
||||
0, /*tp_iter */
|
||||
0, /*tp_iternext */
|
||||
0, /*tp_methods */
|
||||
0, /*tp_members */
|
||||
0, /*tp_getset */
|
||||
0, /*tp_base */
|
||||
0, /*tp_dict */
|
||||
0, /*tp_descr_get */
|
||||
0, /*tp_descr_set */
|
||||
nullptr, /*tp_iter */
|
||||
nullptr, /*tp_iternext */
|
||||
nullptr, /*tp_methods */
|
||||
nullptr, /*tp_members */
|
||||
nullptr, /*tp_getset */
|
||||
nullptr, /*tp_base */
|
||||
nullptr, /*tp_dict */
|
||||
nullptr, /*tp_descr_get */
|
||||
nullptr, /*tp_descr_set */
|
||||
0, /*tp_dictoffset */
|
||||
0, /*tp_init */
|
||||
0, /*tp_alloc */
|
||||
0, /*tp_new */
|
||||
0, /*tp_free Low-level free-memory routine */
|
||||
0, /*tp_is_gc For PyObject_IS_GC */
|
||||
0, /*tp_bases */
|
||||
0, /*tp_mro method resolution order */
|
||||
0, /*tp_cache */
|
||||
0, /*tp_subclasses */
|
||||
0, /*tp_weaklist */
|
||||
0, /*tp_del */
|
||||
0, /*tp_version_tag */
|
||||
0 /*tp_finalize */
|
||||
nullptr, /*tp_init */
|
||||
nullptr, /*tp_alloc */
|
||||
nullptr, /*tp_new */
|
||||
nullptr, /*tp_free Low-level free-memory routine */
|
||||
nullptr, /*tp_is_gc For PyObject_IS_GC */
|
||||
nullptr, /*tp_bases */
|
||||
nullptr, /*tp_mro method resolution order */
|
||||
nullptr, /*tp_cache */
|
||||
nullptr, /*tp_subclasses */
|
||||
nullptr, /*tp_weaklist */
|
||||
nullptr, /*tp_del */
|
||||
0, /*tp_version_tag */
|
||||
nullptr /*tp_finalize */
|
||||
#if PY_VERSION_HEX >= 0x03090000
|
||||
,0 /*tp_vectorcall */
|
||||
#elif PY_VERSION_HEX >= 0x03080000
|
||||
@@ -261,7 +261,7 @@ PyObjectBase* getFromWeakRef(PyObject* ref)
|
||||
* PyObjectBase Methods -- Every class, even the abstract one should have a Methods
|
||||
------------------------------*/
|
||||
PyMethodDef PyObjectBase::Methods[] = {
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
{nullptr, nullptr, 0, nullptr} /* Sentinel */
|
||||
};
|
||||
|
||||
PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro)
|
||||
@@ -282,7 +282,7 @@ PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro)
|
||||
PyObjectBase* pyObj = static_cast<PyObjectBase*>(obj);
|
||||
if (!pyObj->isValid()){
|
||||
PyErr_Format(PyExc_ReferenceError, "Cannot access attribute '%s' of deleted object", attr);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef ATTR_TRACKING
|
||||
@@ -320,7 +320,7 @@ PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro)
|
||||
PyCFunctionObject* cfunc = reinterpret_cast<PyCFunctionObject*>(value);
|
||||
if (!cfunc->m_self) {
|
||||
Py_DECREF(cfunc);
|
||||
value = 0;
|
||||
value = nullptr;
|
||||
PyErr_Format(PyExc_AttributeError, "<no object bound to built-in method %s>", attr);
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ int PyObjectBase::__setattro(PyObject *obj, PyObject *attro, PyObject *value)
|
||||
|
||||
//FIXME: In general we don't allow to delete attributes (i.e. value=0). However, if we want to allow
|
||||
//we must check then in _setattr() of all subclasses whether value is 0.
|
||||
if ( value==0 ) {
|
||||
if ( value==nullptr ) {
|
||||
PyErr_Format(PyExc_AttributeError, "Cannot delete attribute: '%s'", attr);
|
||||
return -1;
|
||||
}
|
||||
@@ -379,7 +379,7 @@ PyObject *PyObjectBase::_getattr(const char *attr)
|
||||
}
|
||||
else if (streq(attr, "__members__")) {
|
||||
// Use __dict__ instead as __members__ is deprecated
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if (streq(attr,"__dict__")) {
|
||||
// Return the default dict
|
||||
@@ -389,13 +389,13 @@ PyObject *PyObjectBase::_getattr(const char *attr)
|
||||
}
|
||||
else if (streq(attr,"softspace")) {
|
||||
// Internal Python stuff
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
// As fallback solution use Python's default method to get generic attributes
|
||||
PyObject *w, *res;
|
||||
w = PyUnicode_InternFromString(attr);
|
||||
if (w != NULL) {
|
||||
if (w != nullptr) {
|
||||
res = PyObject_GenericGetAttr(this, w);
|
||||
Py_XDECREF(w);
|
||||
return res;
|
||||
@@ -403,7 +403,7 @@ PyObject *PyObjectBase::_getattr(const char *attr)
|
||||
// Throw an exception for unknown attributes
|
||||
PyTypeObject *tp = Py_TYPE(this);
|
||||
PyErr_Format(PyExc_AttributeError, "%.50s instance has no attribute '%.400s'", tp->tp_name, attr);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -415,7 +415,7 @@ int PyObjectBase::_setattr(const char *attr, PyObject *value)
|
||||
PyObject *w;
|
||||
// As fallback solution use Python's default method to get generic attributes
|
||||
w = PyUnicode_InternFromString(attr); // new reference
|
||||
if (w != NULL) {
|
||||
if (w != nullptr) {
|
||||
// call methods from tp_getset if defined
|
||||
int res = PyObject_GenericSetAttr(this, w, value);
|
||||
Py_DECREF(w);
|
||||
@@ -431,7 +431,7 @@ int PyObjectBase::_setattr(const char *attr, PyObject *value)
|
||||
/*------------------------------
|
||||
* PyObjectBase repr representations
|
||||
------------------------------*/
|
||||
PyObject *PyObjectBase::_repr(void)
|
||||
PyObject *PyObjectBase::_repr()
|
||||
{
|
||||
std::stringstream a;
|
||||
a << "<base object at " << _pcTwinPointer << ">";
|
||||
@@ -478,6 +478,7 @@ void PyObjectBase::setAttributeOf(const char* attr, PyObject* par)
|
||||
Py_DECREF(key1);
|
||||
Py_DECREF(key2);
|
||||
}
|
||||
|
||||
void PyObjectBase::startNotify()
|
||||
{
|
||||
if (!shouldNotify())
|
||||
@@ -512,6 +513,7 @@ void PyObjectBase::startNotify()
|
||||
Py_DECREF(key2);
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* PyObjectBase::getTrackedAttribute(const char* attr)
|
||||
{
|
||||
PyObject* obj = nullptr;
|
||||
|
||||
@@ -50,10 +50,8 @@
|
||||
|
||||
#include <typeinfo>
|
||||
#include "Exception.h"
|
||||
#if PY_MAJOR_VERSION > 2
|
||||
# ifndef PYCXX_PYTHON_2TO3
|
||||
# define PYCXX_PYTHON_2TO3
|
||||
# endif
|
||||
#ifndef PYCXX_PYTHON_2TO3
|
||||
#define PYCXX_PYTHON_2TO3
|
||||
#endif
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
@@ -91,8 +89,8 @@
|
||||
|
||||
/** Macro for initialization function of Python modules.
|
||||
*/
|
||||
# define PyMOD_INIT_FUNC(name) PyMODINIT_FUNC PyInit_##name(void)
|
||||
# define PyMOD_Return(name) return name
|
||||
#define PyMOD_INIT_FUNC(name) PyMODINIT_FUNC PyInit_##name(void)
|
||||
#define PyMOD_Return(name) return name
|
||||
|
||||
/**
|
||||
* Union to convert from PyTypeObject to PyObject pointer.
|
||||
@@ -218,9 +216,9 @@ public:
|
||||
static void PyDestructor(PyObject *P) // python wrapper
|
||||
{ delete ((PyObjectBase *) P); }
|
||||
/// incref method wrapper (see python extending manual)
|
||||
PyObjectBase* IncRef(void) {Py_INCREF(this);return this;}
|
||||
PyObjectBase* IncRef() {Py_INCREF(this);return this;}
|
||||
/// decref method wrapper (see python extending manual)
|
||||
PyObjectBase* DecRef(void) {Py_DECREF(this);return this;}
|
||||
PyObjectBase* DecRef() {Py_DECREF(this);return this;}
|
||||
|
||||
/** GetAttribute implementation
|
||||
* This method implements the retrieval of object attributes.
|
||||
@@ -259,12 +257,12 @@ public:
|
||||
* }
|
||||
* \endcode
|
||||
*/
|
||||
virtual PyObject *_repr(void);
|
||||
virtual PyObject *_repr();
|
||||
/// python wrapper for the _repr() function
|
||||
static PyObject *__repr(PyObject *PyObj) {
|
||||
if (!((PyObjectBase*) PyObj)->isValid()){
|
||||
PyErr_Format(PyExc_ReferenceError, "Cannot print representation of deleted object");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return ((PyObjectBase*) PyObj)->_repr();
|
||||
}
|
||||
@@ -287,7 +285,7 @@ public:
|
||||
// first bit is not set, i.e. invalid
|
||||
StatusBits.reset(Valid);
|
||||
clearAttributes();
|
||||
_pcTwinPointer = 0;
|
||||
_pcTwinPointer = nullptr;
|
||||
}
|
||||
|
||||
bool isValid() {
|
||||
|
||||
@@ -18,10 +18,6 @@ is provided on an as is basis, without warranties of any kind.
|
||||
#include <eval.h>
|
||||
#include <frameobject.h>
|
||||
|
||||
#if PY_VERSION_HEX <= 0x02050000
|
||||
#error "Use Python2.5.x or higher"
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* RUN EMBEDDED OBJECT METHODS, ACCESS OBJECT ATTRIBUTES
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
# include <cstdio>
|
||||
# include <cstring>
|
||||
#ifdef __GNUC__
|
||||
# include <stdint.h>
|
||||
# include <cstdint>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -582,6 +582,7 @@ PyStreambuf::int_type PyStreambuf::underflow()
|
||||
// wrong type
|
||||
return traits_type::eof();
|
||||
}
|
||||
|
||||
n = c.size();
|
||||
if (n == 0) {
|
||||
return traits_type::eof();
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
using namespace Base;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string UnitPy::representation(void) const
|
||||
std::string UnitPy::representation() const
|
||||
{
|
||||
const UnitSignature & Sig = getUnitPtr()->getSignature();
|
||||
std::stringstream ret;
|
||||
@@ -125,18 +125,18 @@ PyObject* UnitPy::number_add_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
if (!PyObject_TypeCheck(self, &(UnitPy::Type))) {
|
||||
PyErr_SetString(PyExc_TypeError, "First arg must be Unit");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (!PyObject_TypeCheck(other, &(UnitPy::Type))) {
|
||||
PyErr_SetString(PyExc_TypeError, "Second arg must be Unit");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
Base::Unit *a = static_cast<UnitPy*>(self)->getUnitPtr();
|
||||
Base::Unit *b = static_cast<UnitPy*>(other)->getUnitPtr();
|
||||
|
||||
if (*a != *b) {
|
||||
PyErr_SetString(PyExc_TypeError, "Units not matching!");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new UnitPy(new Unit(*a));
|
||||
@@ -146,18 +146,18 @@ PyObject* UnitPy::number_subtract_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
if (!PyObject_TypeCheck(self, &(UnitPy::Type))) {
|
||||
PyErr_SetString(PyExc_TypeError, "First arg must be Unit");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (!PyObject_TypeCheck(other, &(UnitPy::Type))) {
|
||||
PyErr_SetString(PyExc_TypeError, "Second arg must be Unit");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
Base::Unit *a = static_cast<UnitPy*>(self)->getUnitPtr();
|
||||
Base::Unit *b = static_cast<UnitPy*>(other)->getUnitPtr();
|
||||
|
||||
if (*a != *b) {
|
||||
PyErr_SetString(PyExc_TypeError, "Units not matching!");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new UnitPy(new Unit(*a));
|
||||
@@ -167,7 +167,7 @@ PyObject* UnitPy::number_multiply_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
if (!PyObject_TypeCheck(self, &(UnitPy::Type))) {
|
||||
PyErr_SetString(PyExc_TypeError, "First arg must be Unit");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (PyObject_TypeCheck(other, &(UnitPy::Type))) {
|
||||
@@ -178,7 +178,7 @@ PyObject* UnitPy::number_multiply_handler(PyObject *self, PyObject *other)
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "A Unit can only be multiplied by a Unit");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,11 +189,11 @@ PyObject* UnitPy::richCompare(PyObject *v, PyObject *w, int op)
|
||||
const Unit * u1 = static_cast<UnitPy*>(v)->getUnitPtr();
|
||||
const Unit * u2 = static_cast<UnitPy*>(w)->getUnitPtr();
|
||||
|
||||
PyObject *res=0;
|
||||
PyObject *res=nullptr;
|
||||
if (op != Py_EQ && op != Py_NE) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"no ordering relation is defined for Units");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
else if (op == Py_EQ) {
|
||||
res = (*u1 == *u2) ? Py_True : Py_False;
|
||||
@@ -213,12 +213,12 @@ PyObject* UnitPy::richCompare(PyObject *v, PyObject *w, int op)
|
||||
}
|
||||
}
|
||||
|
||||
Py::String UnitPy::getType(void) const
|
||||
Py::String UnitPy::getType() const
|
||||
{
|
||||
return Py::String(getUnitPtr()->getTypeString().toUtf8(),"utf-8");
|
||||
}
|
||||
|
||||
Py::Tuple UnitPy::getSignature(void) const
|
||||
Py::Tuple UnitPy::getSignature() const
|
||||
{
|
||||
const UnitSignature & Sig = getUnitPtr()->getSignature();
|
||||
Py::Tuple tuple(8);
|
||||
@@ -237,7 +237,7 @@ Py::Tuple UnitPy::getSignature(void) const
|
||||
|
||||
PyObject *UnitPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int UnitPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
@@ -248,43 +248,43 @@ int UnitPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
PyObject * UnitPy::number_divide_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_remainder_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_divmod_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_power_handler (PyObject* /*self*/, PyObject* /*other*/, PyObject* /*modulo*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_negative_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_positive_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_absolute_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int UnitPy::number_nonzero_handler (PyObject* /*self*/)
|
||||
@@ -295,47 +295,47 @@ int UnitPy::number_nonzero_handler (PyObject* /*self*/)
|
||||
PyObject * UnitPy::number_invert_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_lshift_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_rshift_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_and_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_xor_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_or_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_int_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * UnitPy::number_float_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
static PyObject * richCompare(PyObject *v, PyObject *w, int op);
|
||||
-
|
||||
static PyGetSetDef GetterSetter[];
|
||||
virtual PyTypeObject *GetType(void) {return &Type;}
|
||||
virtual PyTypeObject *GetType() {return &Type;}
|
||||
|
||||
public:
|
||||
@self.export.Name@(@self.export.TwinPointer@ *pcObject, PyTypeObject *T = &Type);
|
||||
@@ -92,8 +92,8 @@ public:
|
||||
|
||||
typedef @self.export.TwinPointer@* PointerType ;
|
||||
|
||||
virtual PyObject *_repr(void); // the representation
|
||||
std::string representation(void) const;
|
||||
virtual PyObject *_repr(); // the representation
|
||||
std::string representation() const;
|
||||
|
||||
/** @name callbacks and implementers for the python object methods */
|
||||
//@{
|
||||
@@ -165,24 +165,10 @@ public:
|
||||
static PyObject * number_xor_handler (PyObject *self, PyObject *other);
|
||||
/// callback for the number_or_handler
|
||||
static PyObject * number_or_handler (PyObject *self, PyObject *other);
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
/// callback for the number_coerce_handler
|
||||
static int number_coerce_handler (PyObject **self, PyObject **other);
|
||||
#endif
|
||||
/// callback for the number_int_handler
|
||||
static PyObject * number_int_handler (PyObject *self);
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
/// callback for the number_long_handler
|
||||
static PyObject * number_long_handler (PyObject *self);
|
||||
#endif
|
||||
/// callback for the number_float_handler
|
||||
static PyObject * number_float_handler (PyObject *self);
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
/// callback for the number_oct_handler
|
||||
static PyObject * number_oct_handler (PyObject *self);
|
||||
/// callback for the number_hex_handler
|
||||
static PyObject * number_hex_handler (PyObject *self);
|
||||
#endif
|
||||
//@}
|
||||
-
|
||||
+ if (self.export.Sequence):
|
||||
@@ -227,7 +213,7 @@ public:
|
||||
///getter callback for the @i.Name@ attribute
|
||||
static PyObject * staticCallback_get@i.Name@ (PyObject *self, void *closure);
|
||||
/// getter for the @i.Name@ attribute
|
||||
Py::@i.Parameter.Type@ get@i.Name@(void) const;
|
||||
Py::@i.Parameter.Type@ get@i.Name@() const;
|
||||
/// setter callback for the @i.Name@ attribute
|
||||
static int staticCallback_set@i.Name@ (PyObject *self, PyObject *value, void *closure);
|
||||
+ if (i.ReadOnly):
|
||||
@@ -250,7 +236,7 @@ public:
|
||||
-
|
||||
|
||||
/// getter for the object handled by this class
|
||||
@self.export.TwinPointer@ *get@self.export.Twin@Ptr(void) const;
|
||||
@self.export.TwinPointer@ *get@self.export.Twin@Ptr() const;
|
||||
|
||||
+ if(self.export.ClassDeclarations != ""):
|
||||
/** @name additional declarations and methods for the wrapper class */
|
||||
@@ -299,30 +285,30 @@ PyTypeObject @self.export.Name@::Type = {
|
||||
0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
PyDestructor, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
0, /*tp_getattr*/
|
||||
0, /*tp_setattr*/
|
||||
0, /*tp_compare*/
|
||||
nullptr, /*tp_print*/
|
||||
nullptr, /*tp_getattr*/
|
||||
nullptr, /*tp_setattr*/
|
||||
nullptr, /*tp_compare*/
|
||||
__repr, /*tp_repr*/
|
||||
+ if (self.export.NumberProtocol):
|
||||
@self.export.Namespace@::@self.export.Name@::Number, /*tp_as_number*/
|
||||
= else:
|
||||
0, /*tp_as_number*/
|
||||
nullptr, /*tp_as_number*/
|
||||
-
|
||||
+ if (self.export.Sequence):
|
||||
@self.export.Namespace@::@self.export.Name@::Sequence, /*tp_as_sequence*/
|
||||
@self.export.Namespace@::@self.export.Name@::Mapping, /*tp_as_mapping*/
|
||||
= else:
|
||||
0, /*tp_as_sequence*/
|
||||
0, /*tp_as_mapping*/
|
||||
nullptr, /*tp_as_sequence*/
|
||||
nullptr, /*tp_as_mapping*/
|
||||
-
|
||||
0, /*tp_hash*/
|
||||
0, /*tp_call */
|
||||
0, /*tp_str */
|
||||
nullptr, /*tp_hash*/
|
||||
nullptr, /*tp_call */
|
||||
nullptr, /*tp_str */
|
||||
__getattro, /*tp_getattro*/
|
||||
__setattro, /*tp_setattro*/
|
||||
/* --- Functions to access object as input/output buffer ---------*/
|
||||
0, /* tp_as_buffer */
|
||||
nullptr, /* tp_as_buffer */
|
||||
/* --- Flags to define presence of optional/expanded features */
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT, /*tp_flags */
|
||||
@@ -338,45 +324,43 @@ PyTypeObject @self.export.Name@::Type = {
|
||||
-
|
||||
#endif
|
||||
"@self.export.Documentation.UserDocu.replace('\\n','\\\\n\\"\\n \\"')@", /*tp_doc */
|
||||
0, /*tp_traverse */
|
||||
0, /*tp_clear */
|
||||
nullptr, /*tp_traverse */
|
||||
nullptr, /*tp_clear */
|
||||
+ if (self.export.RichCompare):
|
||||
@self.export.Namespace@::@self.export.Name@::richCompare, /*tp_richcompare*/
|
||||
= else:
|
||||
0, /*tp_richcompare */
|
||||
nullptr, /*tp_richcompare */
|
||||
-
|
||||
0, /*tp_weaklistoffset */
|
||||
0, /*tp_iter */
|
||||
0, /*tp_iternext */
|
||||
nullptr, /*tp_iter */
|
||||
nullptr, /*tp_iternext */
|
||||
@self.export.Namespace@::@self.export.Name@::Methods, /*tp_methods */
|
||||
0, /*tp_members */
|
||||
nullptr, /*tp_members */
|
||||
@self.export.Namespace@::@self.export.Name@::GetterSetter, /*tp_getset */
|
||||
&@self.export.FatherNamespace@::@self.export.Father@::Type, /*tp_base */
|
||||
0, /*tp_dict */
|
||||
0, /*tp_descr_get */
|
||||
0, /*tp_descr_set */
|
||||
nullptr, /*tp_dict */
|
||||
nullptr, /*tp_descr_get */
|
||||
nullptr, /*tp_descr_set */
|
||||
0, /*tp_dictoffset */
|
||||
__PyInit, /*tp_init */
|
||||
0, /*tp_alloc */
|
||||
nullptr, /*tp_alloc */
|
||||
@self.export.Namespace@::@self.export.Name@::PyMake,/*tp_new */
|
||||
0, /*tp_free Low-level free-memory routine */
|
||||
0, /*tp_is_gc For PyObject_IS_GC */
|
||||
0, /*tp_bases */
|
||||
0, /*tp_mro method resolution order */
|
||||
0, /*tp_cache */
|
||||
0, /*tp_subclasses */
|
||||
0, /*tp_weaklist */
|
||||
0, /*tp_del */
|
||||
0 /*tp_version_tag */
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
,0 /*tp_finalize */
|
||||
#endif
|
||||
nullptr, /*tp_free Low-level free-memory routine */
|
||||
nullptr, /*tp_is_gc For PyObject_IS_GC */
|
||||
nullptr, /*tp_bases */
|
||||
nullptr, /*tp_mro method resolution order */
|
||||
nullptr, /*tp_cache */
|
||||
nullptr, /*tp_subclasses */
|
||||
nullptr, /*tp_weaklist */
|
||||
nullptr, /*tp_del */
|
||||
0, /*tp_version_tag */
|
||||
nullptr /*tp_finalize */
|
||||
#if PY_VERSION_HEX >= 0x03090000
|
||||
,0 /*tp_vectorcall */
|
||||
,nullptr /*tp_vectorcall */
|
||||
#elif PY_VERSION_HEX >= 0x03080000
|
||||
,0 /*tp_vectorcall */
|
||||
,nullptr /*tp_vectorcall */
|
||||
/* bpo-37250: kept for backwards compatibility in CPython 3.8 only */
|
||||
,0 /*tp_print */
|
||||
,nullptr /*tp_print */
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -408,7 +392,7 @@ PyMethodDef @self.export.Name@::Methods[] = {
|
||||
"@i.Documentation.UserDocu.replace('\\n','\\\\n')@"
|
||||
},
|
||||
-
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
{nullptr, nullptr, 0, nullptr} /* Sentinel */
|
||||
};
|
||||
|
||||
+ if (self.export.NumberProtocol):
|
||||
@@ -416,9 +400,6 @@ PyNumberMethods @self.export.Name@::Number[] = { {
|
||||
number_add_handler,
|
||||
number_subtract_handler,
|
||||
number_multiply_handler,
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
number_divide_handler,
|
||||
#endif
|
||||
number_remainder_handler,
|
||||
number_divmod_handler,
|
||||
number_power_handler,
|
||||
@@ -432,45 +413,27 @@ PyNumberMethods @self.export.Name@::Number[] = { {
|
||||
number_and_handler,
|
||||
number_xor_handler,
|
||||
number_or_handler,
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
number_coerce_handler,
|
||||
#endif
|
||||
number_int_handler,
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
number_long_handler,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
nullptr,
|
||||
number_float_handler,
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
number_oct_handler,
|
||||
number_hex_handler,
|
||||
#endif
|
||||
NULL, /*nb_inplace_add*/
|
||||
NULL, /*nb_inplace_subtract*/
|
||||
NULL, /*nb_inplace_multiply*/
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
NULL, /*nb_inplace_divide*/
|
||||
#endif
|
||||
NULL, /*nb_inplace_remainder*/
|
||||
NULL, /*nb_inplace_power*/
|
||||
NULL, /*nb_inplace_lshift*/
|
||||
NULL, /*nb_inplace_rshift*/
|
||||
NULL, /*nb_inplace_and*/
|
||||
NULL, /*nb_inplace_xor*/
|
||||
NULL, /*nb_inplace_or*/
|
||||
NULL, /*nb_floor_divide*/
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
NULL, /*nb_true_divide*/
|
||||
#else
|
||||
nullptr, /*nb_inplace_add*/
|
||||
nullptr, /*nb_inplace_subtract*/
|
||||
nullptr, /*nb_inplace_multiply*/
|
||||
nullptr, /*nb_inplace_remainder*/
|
||||
nullptr, /*nb_inplace_power*/
|
||||
nullptr, /*nb_inplace_lshift*/
|
||||
nullptr, /*nb_inplace_rshift*/
|
||||
nullptr, /*nb_inplace_and*/
|
||||
nullptr, /*nb_inplace_xor*/
|
||||
nullptr, /*nb_inplace_or*/
|
||||
nullptr, /*nb_floor_divide*/
|
||||
number_divide_handler, /*nb_true_divide*/
|
||||
#endif
|
||||
NULL, /*nb_inplace_floor_divide*/
|
||||
NULL, /*nb_inplace_true_divide*/
|
||||
NULL /*nb_index*/
|
||||
nullptr, /*nb_inplace_floor_divide*/
|
||||
nullptr, /*nb_inplace_true_divide*/
|
||||
nullptr /*nb_index*/
|
||||
#if PY_VERSION_HEX >= 0x03050000
|
||||
,NULL /*nb_matrix_multiply*/
|
||||
,NULL /*nb_inplace_matrix_multiply*/
|
||||
,nullptr /*nb_matrix_multiply*/
|
||||
,nullptr /*nb_inplace_matrix_multiply*/
|
||||
#endif
|
||||
} };
|
||||
-
|
||||
@@ -480,44 +443,44 @@ PySequenceMethods @self.export.Name@::Sequence[] = { {
|
||||
+ if (self.export.Sequence.sq_length):
|
||||
sequence_length,
|
||||
= else:
|
||||
0,
|
||||
nullptr,
|
||||
-
|
||||
+ if (self.export.Sequence.sq_concat):
|
||||
sequence_concat,
|
||||
= else:
|
||||
0,
|
||||
nullptr,
|
||||
-
|
||||
+ if (self.export.Sequence.sq_repeat):
|
||||
sequence_repeat,
|
||||
= else:
|
||||
0,
|
||||
nullptr,
|
||||
-
|
||||
+ if (self.export.Sequence.sq_item):
|
||||
sequence_item,
|
||||
= else:
|
||||
0,
|
||||
nullptr,
|
||||
-
|
||||
0,
|
||||
nullptr,
|
||||
+ if (self.export.Sequence.sq_ass_item):
|
||||
sequence_ass_item,
|
||||
= else:
|
||||
0,
|
||||
nullptr,
|
||||
-
|
||||
0,
|
||||
nullptr,
|
||||
+ if (self.export.Sequence.sq_contains):
|
||||
sequence_contains,
|
||||
= else:
|
||||
0,
|
||||
nullptr,
|
||||
-
|
||||
+ if (self.export.Sequence.sq_inplace_concat):
|
||||
sequence_inplace_concat,
|
||||
= else:
|
||||
0,
|
||||
nullptr,
|
||||
-
|
||||
+ if (self.export.Sequence.sq_inplace_repeat):
|
||||
sequence_inplace_repeat,
|
||||
= else:
|
||||
0
|
||||
nullptr
|
||||
-
|
||||
} };
|
||||
|
||||
@@ -525,17 +488,17 @@ PyMappingMethods @self.export.Name@::Mapping[] = { {
|
||||
+ if (self.export.Sequence.sq_length):
|
||||
sequence_length,
|
||||
= else:
|
||||
0,
|
||||
nullptr,
|
||||
-
|
||||
+ if (self.export.Sequence.mp_subscript):
|
||||
mapping_subscript,
|
||||
= else:
|
||||
0,
|
||||
nullptr,
|
||||
-
|
||||
+ if (self.export.Sequence.mp_ass_subscript):
|
||||
mapping_ass_subscript,
|
||||
= else:
|
||||
0,
|
||||
nullptr,
|
||||
-
|
||||
} };
|
||||
-
|
||||
@@ -547,10 +510,10 @@ PyGetSetDef @self.export.Name@::GetterSetter[] = {
|
||||
(getter) staticCallback_get@i.Name@,
|
||||
(setter) staticCallback_set@i.Name@,
|
||||
"@i.Documentation.UserDocu.replace('\\n','\\\\n')@",
|
||||
NULL
|
||||
nullptr
|
||||
},
|
||||
-
|
||||
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||
{nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
|
||||
};
|
||||
|
||||
+ for i in self.export.Methode:
|
||||
@@ -567,20 +530,20 @@ PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject
|
||||
// make sure that not a null pointer is passed
|
||||
if (!self) {
|
||||
PyErr_SetString(PyExc_TypeError, "descriptor '@i.Name@' of '@self.export.Namespace@.@self.export.Twin@' object needs an argument");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// test if twin object isn't already deleted
|
||||
if (!static_cast<PyObjectBase*>(self)->isValid()) {
|
||||
PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
+ if (not i.Const):
|
||||
// test if object is set Const
|
||||
if (static_cast<PyObjectBase*>(self)->isConst()) {
|
||||
PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
|
||||
@@ -616,7 +579,7 @@ PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject
|
||||
catch(Base::AbortException &e)
|
||||
{
|
||||
PyErr_SetObject(Base::BaseExceptionFreeCADAbort,e.getPyObject());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
catch(Base::Exception &e)
|
||||
{
|
||||
@@ -624,28 +587,28 @@ PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject
|
||||
if(!pye)
|
||||
pye = Base::BaseExceptionFreeCADError;
|
||||
PyErr_SetObject(pye,e.getPyObject());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError,e.what());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
catch(const Py::Exception&)
|
||||
{
|
||||
// The exception text is already set
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
catch(const char *e)
|
||||
{
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError,e);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#ifndef DONT_CATCH_CXX_EXCEPTIONS
|
||||
catch(...)
|
||||
{
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError,"Unknown C++ exception");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -659,17 +622,17 @@ PyObject * @self.export.Name@::staticCallback_get@i.Name@ (PyObject *self, void
|
||||
{
|
||||
if (!static_cast<PyObjectBase*>(self)->isValid()){
|
||||
PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
try {
|
||||
return Py::new_reference_to(static_cast<@self.export.Name@*>(self)->get@i.Name@());
|
||||
} catch (const Py::Exception&) {
|
||||
// The exception text is already set
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} catch (...) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Unknown exception while reading attribute '@i.Name@' of object '@self.export.Twin@'");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -740,7 +703,7 @@ PyObject *@self.export.Name@::PyMake(struct _typeobject *, PyObject *, PyObject
|
||||
// never create such objects with the constructor
|
||||
PyErr_SetString(PyExc_RuntimeError, "You cannot create directly an instance of '@self.export.Name@'.");
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int @self.export.Name@::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
|
||||
@@ -770,7 +733,7 @@ int @self.export.Name@::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
|
||||
//--------------------------------------------------------------------------
|
||||
// @self.export.Name@ representation
|
||||
//--------------------------------------------------------------------------
|
||||
PyObject *@self.export.Name@::_repr(void)
|
||||
PyObject *@self.export.Name@::_repr()
|
||||
{
|
||||
return Py_BuildValue("s", representation().c_str());
|
||||
}
|
||||
@@ -789,7 +752,7 @@ PyObject *@self.export.Name@::_getattr(const char *attr) // __getattr__ functi
|
||||
catch(Base::AbortException &e)
|
||||
{
|
||||
PyErr_SetObject(Base::BaseExceptionFreeCADAbort,e.getPyObject());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
catch(Base::Exception &e)
|
||||
{
|
||||
@@ -797,33 +760,33 @@ PyObject *@self.export.Name@::_getattr(const char *attr) // __getattr__ functi
|
||||
if(!pye)
|
||||
pye = Base::BaseExceptionFreeCADError;
|
||||
PyErr_SetObject(pye,e.getPyObject());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError,e.what());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
catch(const Py::Exception&)
|
||||
{
|
||||
// The exception text is already set
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
catch(const char *e)
|
||||
{
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError,e);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#ifndef DONT_CATCH_CXX_EXCEPTIONS
|
||||
catch(...)
|
||||
{
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError,"Unknown C++ exception");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
PyMethodDef *ml = Methods;
|
||||
for (; ml->ml_name != NULL; ml++) {
|
||||
for (; ml->ml_name != nullptr; ml++) {
|
||||
if (attr[0] == ml->ml_name[0] &&
|
||||
strcmp(attr+1, ml->ml_name+1) == 0)
|
||||
return PyCFunction_New(ml, this);
|
||||
@@ -886,7 +849,7 @@ int @self.export.Name@::_setattr(const char *attr, PyObject *value) // __setattr
|
||||
}
|
||||
-
|
||||
|
||||
@self.export.TwinPointer@ *@self.export.Name@::get@self.export.Twin@Ptr(void) const
|
||||
@self.export.TwinPointer@ *@self.export.Name@::get@self.export.Twin@Ptr() const
|
||||
{
|
||||
return static_cast<@self.export.TwinPointer@ *>(_pcTwinPointer);
|
||||
}
|
||||
@@ -926,7 +889,7 @@ int @self.export.Name@::finalization()
|
||||
-
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string @self.export.Name@::representation(void) const
|
||||
std::string @self.export.Name@::representation() const
|
||||
{
|
||||
return std::string("<@self.export.Twin@ object>");
|
||||
}
|
||||
@@ -947,7 +910,7 @@ PyObject* @self.export.Name@::@i.Name@(PyObject *args)
|
||||
-
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
|
||||
@@ -955,61 +918,61 @@ PyObject* @self.export.Name@::@i.Name@(PyObject *args)
|
||||
PyObject* @self.export.Name@::number_add_handler(PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* @self.export.Name@::number_subtract_handler(PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* @self.export.Name@::number_multiply_handler(PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_divide_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_remainder_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_divmod_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_power_handler (PyObject* /*self*/, PyObject* /*other*/, PyObject* /*modulo*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_negative_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_positive_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_absolute_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int @self.export.Name@::number_nonzero_handler (PyObject* /*self*/)
|
||||
@@ -1020,37 +983,37 @@ int @self.export.Name@::number_nonzero_handler (PyObject* /*self*/)
|
||||
PyObject * @self.export.Name@::number_invert_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_lshift_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_rshift_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_and_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_xor_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_or_handler (PyObject* /*self*/, PyObject* /*other*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int @self.export.Name@::number_coerce_handler (PyObject** /*self*/, PyObject** /*other*/)
|
||||
@@ -1061,31 +1024,31 @@ int @self.export.Name@::number_coerce_handler (PyObject** /*self*/, PyObject** /
|
||||
PyObject * @self.export.Name@::number_int_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_long_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_float_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_oct_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_hex_handler (PyObject* /*self*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence):
|
||||
@@ -1102,7 +1065,7 @@ Py_ssize_t @self.export.Name@::sequence_length(PyObject *)
|
||||
PyObject* @self.export.Name@::sequence_concat(PyObject *, PyObject *)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence.sq_repeat):
|
||||
@@ -1110,7 +1073,7 @@ PyObject* @self.export.Name@::sequence_concat(PyObject *, PyObject *)
|
||||
PyObject * @self.export.Name@::sequence_repeat(PyObject *, Py_ssize_t)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence.sq_item):
|
||||
@@ -1118,7 +1081,7 @@ PyObject * @self.export.Name@::sequence_repeat(PyObject *, Py_ssize_t)
|
||||
PyObject * @self.export.Name@::sequence_item(PyObject *, Py_ssize_t)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence.mp_subscript):
|
||||
@@ -1126,7 +1089,7 @@ PyObject * @self.export.Name@::sequence_item(PyObject *, Py_ssize_t)
|
||||
PyObject * @self.export.Name@::mapping_subscript(PyObject *, PyObject *)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence.sq_ass_item):
|
||||
@@ -1158,7 +1121,7 @@ int @self.export.Name@::sequence_contains(PyObject *, PyObject *)
|
||||
PyObject* @self.export.Name@::sequence_inplace_concat(PyObject *, PyObject *)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence.sq_inplace_repeat):
|
||||
@@ -1166,7 +1129,7 @@ PyObject* @self.export.Name@::sequence_inplace_concat(PyObject *, PyObject *)
|
||||
PyObject * @self.export.Name@::sequence_inplace_repeat(PyObject *, Py_ssize_t)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
-
|
||||
@@ -1175,12 +1138,12 @@ PyObject * @self.export.Name@::sequence_inplace_repeat(PyObject *, Py_ssize_t)
|
||||
PyObject* @self.export.Name@::richCompare(PyObject *v, PyObject *w, int op)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ for i in self.export.Attribute:
|
||||
|
||||
Py::@i.Parameter.Type@ @self.export.Name@::get@i.Name@(void) const
|
||||
Py::@i.Parameter.Type@ @self.export.Name@::get@i.Name@() const
|
||||
{
|
||||
//return Py::@i.Parameter.Type@();
|
||||
throw Py::AttributeError("Not yet implemented");
|
||||
@@ -1198,7 +1161,7 @@ void @self.export.Name@::set@i.Name@(Py::@i.Parameter.Type@ arg)
|
||||
|
||||
PyObject *@self.export.Name@::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int @self.export.Name@::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
@@ -1224,7 +1187,7 @@ int @self.export.Name@::setCustomAttributes(const char* /*attr*/, PyObject* /*ob
|
||||
using namespace @self.export.Namespace@;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string @self.export.Name@::representation(void) const
|
||||
std::string @self.export.Name@::representation() const
|
||||
{
|
||||
return std::string("<@self.export.Twin@ object>");
|
||||
}
|
||||
@@ -1272,7 +1235,7 @@ PyObject* @self.export.Name@::@i.Name@(PyObject * /*args*/)
|
||||
-
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
|
||||
@@ -1280,61 +1243,61 @@ PyObject* @self.export.Name@::@i.Name@(PyObject * /*args*/)
|
||||
PyObject* @self.export.Name@::number_add_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* @self.export.Name@::number_subtract_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* @self.export.Name@::number_multiply_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_divide_handler (PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_remainder_handler (PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_divmod_handler (PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_power_handler (PyObject *self, PyObject *other, PyObject *modulo)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_negative_handler (PyObject *self)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_positive_handler (PyObject *self)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_absolute_handler (PyObject *self)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int @self.export.Name@::number_nonzero_handler (PyObject *self)
|
||||
@@ -1345,37 +1308,37 @@ int @self.export.Name@::number_nonzero_handler (PyObject *self)
|
||||
PyObject * @self.export.Name@::number_invert_handler (PyObject *self)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_lshift_handler (PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_rshift_handler (PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_and_handler (PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_xor_handler (PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_or_handler (PyObject *self, PyObject *other)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int @self.export.Name@::number_coerce_handler (PyObject **self, PyObject **other)
|
||||
@@ -1386,31 +1349,31 @@ int @self.export.Name@::number_coerce_handler (PyObject **self, PyObject **other
|
||||
PyObject * @self.export.Name@::number_int_handler (PyObject *self)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_long_handler (PyObject *self)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_float_handler (PyObject *self)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_oct_handler (PyObject *self)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject * @self.export.Name@::number_hex_handler (PyObject *self)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
|
||||
@@ -1428,7 +1391,7 @@ Py_ssize_t @self.export.Name@::sequence_length(PyObject *)
|
||||
PyObject* @self.export.Name@::sequence_concat(PyObject *, PyObject *)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence.sq_repeat):
|
||||
@@ -1436,7 +1399,7 @@ PyObject* @self.export.Name@::sequence_concat(PyObject *, PyObject *)
|
||||
PyObject * @self.export.Name@::sequence_repeat(PyObject *, Py_ssize_t)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence.sq_item):
|
||||
@@ -1444,7 +1407,7 @@ PyObject * @self.export.Name@::sequence_repeat(PyObject *, Py_ssize_t)
|
||||
PyObject * @self.export.Name@::sequence_item(PyObject *, Py_ssize_t)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence.mp_subscript):
|
||||
@@ -1452,7 +1415,7 @@ PyObject * @self.export.Name@::sequence_item(PyObject *, Py_ssize_t)
|
||||
PyObject * @self.export.Name@::mapping_subscript(PyObject *, PyObject *)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence.sq_ass_item):
|
||||
@@ -1484,7 +1447,7 @@ int @self.export.Name@::sequence_contains(PyObject *, PyObject *)
|
||||
PyObject* @self.export.Name@::sequence_inplace_concat(PyObject *, PyObject *)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
+ if (self.export.Sequence.sq_inplace_repeat):
|
||||
@@ -1492,7 +1455,7 @@ PyObject* @self.export.Name@::sequence_inplace_concat(PyObject *, PyObject *)
|
||||
PyObject * @self.export.Name@::sequence_inplace_repeat(PyObject *, Py_ssize_t)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
-
|
||||
@@ -1501,13 +1464,13 @@ PyObject * @self.export.Name@::sequence_inplace_repeat(PyObject *, Py_ssize_t)
|
||||
PyObject* @self.export.Name@::richCompare(PyObject *v, PyObject *w, int op)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
-
|
||||
|
||||
+ for i in self.export.Attribute:
|
||||
|
||||
Py::@i.Parameter.Type@ @self.export.Name@::get@i.Name@(void) const
|
||||
Py::@i.Parameter.Type@ @self.export.Name@::get@i.Name@() const
|
||||
{
|
||||
//return Py::@i.Parameter.Type@();
|
||||
throw Py::AttributeError("Not yet implemented");
|
||||
@@ -1525,7 +1488,7 @@ void @self.export.Name@::set@i.Name@(Py::@i.Parameter.Type@ /*arg*/)
|
||||
|
||||
PyObject *@self.export.Name@::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int @self.export.Name@::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
Reference in New Issue
Block a user