diff options
Diffstat (limited to 'lib/python')
| -rw-r--r-- | lib/python/enigma_python.i | 7 | ||||
| -rw-r--r-- | lib/python/python.cpp | 12 | ||||
| -rw-r--r-- | lib/python/python.h | 20 |
3 files changed, 37 insertions, 2 deletions
diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 16ca40cf..5a6f126e 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -79,6 +79,7 @@ is usually caused by not marking PSignals as immutable. #include <lib/driver/etimezone.h> #include <lib/gdi/lcd.h> #include <lib/dvb_ci/dvbci_ui.h> +#include <lib/python/python.h> extern void runMainloop(); extern void quitMainloop(int exit_code); @@ -182,6 +183,7 @@ typedef long time_t; %include <lib/gdi/lcd.h> %include <lib/dvb_ci/dvbci_ui.h> %include <lib/dvb/db.h> +%include <lib/python/python.h> /************** eptr **************/ %template(eActionMapPtr) ePtr<eActionMap>; @@ -243,4 +245,9 @@ RESULT SwigFromPython(ePtr<gPixmap> &result, PyObject *obj) result = *res; return 0; } +PyObject *New_TestObj() +{ + TestObj *result = (TestObj *)new TestObj(); + return SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_TestObj, 1); +} %} diff --git a/lib/python/python.cpp b/lib/python/python.cpp index 642d70ba..f467bc86 100644 --- a/lib/python/python.cpp +++ b/lib/python/python.cpp @@ -4,6 +4,18 @@ extern "C" void init_enigma(); +DEFINE_REF(TestObj); + +TestObj::TestObj() +{ + eDebug("create %p", this); +} + +TestObj::~TestObj() +{ + eDebug("destroy %p", this); +} + #if 0 ePyObject::ePyObject(void *ptr): m_object(ptr) { diff --git a/lib/python/python.h b/lib/python/python.h index e9a2b8db..46e1a03d 100644 --- a/lib/python/python.h +++ b/lib/python/python.h @@ -2,7 +2,24 @@ #define __lib_python_python_h #include <string> +#include <lib/base/object.h> +typedef struct _object PyObject; + +// useable for debugging python refcounting + +extern PyObject *New_TestObj(); + +class TestObj +{ +DECLARE_REF(TestObj); +public: + TestObj(); + ~TestObj(); +}; +TEMPLATE_TYPEDEF(ePtr<TestObj>, TestObjPtr); + +#ifndef SWIG /* class ePyObject { void *m_object; @@ -16,8 +33,6 @@ public: void *get() { return m_object; } }; */ -typedef struct _object PyObject; - class ePython { public: @@ -28,5 +43,6 @@ public: static PyObject *resolve(const std::string &pythonfile, const std::string &funcname); private: }; +#endif // SWIG #endif |
