python object refcount debugging code second try
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 25 Nov 2006 17:18:48 +0000 (17:18 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 25 Nov 2006 17:18:48 +0000 (17:18 +0000)
32 files changed:
lib/actions/action.cpp
lib/actions/action.h
lib/base/ebase.cpp
lib/base/ebase.h
lib/base/nconfig.cpp
lib/base/nconfig.h
lib/dvb/epgcache.cpp
lib/dvb/epgcache.h
lib/dvb/frontend.cpp
lib/dvb/pmt.cpp
lib/dvb/sec.cpp
lib/dvb_ci/dvbci_ui.cpp
lib/dvb_ci/dvbci_ui.h
lib/gdi/picload.cpp
lib/gui/elistboxcontent.cpp
lib/gui/elistboxcontent.h
lib/gui/epositiongauge.cpp
lib/gui/epositiongauge.h
lib/nav/core.cpp
lib/python/connections.cpp
lib/python/connections.h
lib/python/python.cpp
lib/python/python.h
lib/python/swig.h
lib/service/iservice.h
lib/service/service.cpp
lib/service/servicedvb.cpp
lib/service/servicedvb.h
lib/service/servicedvbrecord.cpp
lib/service/servicefs.cpp
lib/service/servicefs.h
main/bsod.cpp

index 8b298ea..56ad89a 100644 (file)
@@ -54,12 +54,11 @@ void eActionMap::bindAction(const std::string &context, int priority, int id, eW
        
        bnd.m_context = context;
        bnd.m_widget = widget;
        
        bnd.m_context = context;
        bnd.m_widget = widget;
-       bnd.m_fnc = 0;
        bnd.m_id = id;
        m_bindings.insert(std::pair<int,eActionBinding>(priority, bnd));
 }
 
        bnd.m_id = id;
        m_bindings.insert(std::pair<int,eActionBinding>(priority, bnd));
 }
 
-void eActionMap::bindAction(const std::string &context, int priority, PyObject *function)
+void eActionMap::bindAction(const std::string &context, int priority, ePyObject function)
 {
        eActionBinding bnd;
        
 {
        eActionBinding bnd;
        
@@ -80,7 +79,7 @@ void eActionMap::unbindAction(eWidget *widget, int id)
                }
 }
 
                }
 }
 
-void eActionMap::unbindAction(const std::string &context, PyObject *function)
+void eActionMap::unbindAction(const std::string &context, ePyObject function)
 {
        for (std::multimap<int, eActionBinding>::iterator i(m_bindings.begin()); i != m_bindings.end(); ++i)
        {
 {
        for (std::multimap<int, eActionBinding>::iterator i(m_bindings.begin()); i != m_bindings.end(); ++i)
        {
@@ -126,11 +125,11 @@ void eActionMap::bindKey(const std::string &device, int key, int flags, const st
 
 struct call_entry
 {
 
 struct call_entry
 {
-       PyObject *m_fnc, *m_arg;
+       ePyObject m_fnc, m_arg;
        eWidget *m_widget;
        void *m_widget_arg, *m_widget_arg2;
        eWidget *m_widget;
        void *m_widget_arg, *m_widget_arg2;
-       call_entry(PyObject *fnc, PyObject *arg): m_fnc(fnc), m_arg(arg), m_widget(0), m_widget_arg(0) { }
-       call_entry(eWidget *widget, void *arg, void *arg2): m_fnc(0), m_arg(0), m_widget(widget), m_widget_arg(arg), m_widget_arg2(arg2) { }
+       call_entry(ePyObject fnc, ePyObject arg): m_fnc(fnc), m_arg(arg), m_widget(0), m_widget_arg(0) { }
+       call_entry(eWidget *widget, void *arg, void *arg2): m_widget(widget), m_widget_arg(arg), m_widget_arg2(arg2) { }
 };
 
 void eActionMap::keyPressed(const std::string &device, int key, int flags)
 };
 
 void eActionMap::keyPressed(const std::string &device, int key, int flags)
@@ -183,7 +182,7 @@ void eActionMap::keyPressed(const std::string &device, int key, int flags)
                                                ((k->second.m_device == device) || (k->second.m_device == "generic"))
                                                )
                                        {
                                                ((k->second.m_device == device) || (k->second.m_device == "generic"))
                                                )
                                        {
-                                               PyObject *pArgs = PyTuple_New(2);
+                                               ePyObject pArgs = PyTuple_New(2);
                                                PyTuple_SET_ITEM(pArgs, 0, PyString_FromString(k->first.c_str()));
                                                PyTuple_SET_ITEM(pArgs, 1, PyString_FromString(k->second.m_action.c_str()));
                                                ++k;
                                                PyTuple_SET_ITEM(pArgs, 0, PyString_FromString(k->first.c_str()));
                                                PyTuple_SET_ITEM(pArgs, 1, PyString_FromString(k->second.m_action.c_str()));
                                                ++k;
@@ -195,7 +194,7 @@ void eActionMap::keyPressed(const std::string &device, int key, int flags)
                        } else
                        {
                                eDebug("wildcard.");
                        } else
                        {
                                eDebug("wildcard.");
-                               PyObject *pArgs = PyTuple_New(2);
+                               ePyObject pArgs = PyTuple_New(2);
                                PyTuple_SET_ITEM(pArgs, 0, PyInt_FromLong(key));
                                PyTuple_SET_ITEM(pArgs, 1, PyInt_FromLong(flags));
                                Py_INCREF(i->second.m_fnc);
                                PyTuple_SET_ITEM(pArgs, 0, PyInt_FromLong(key));
                                PyTuple_SET_ITEM(pArgs, 1, PyInt_FromLong(flags));
                                Py_INCREF(i->second.m_fnc);
index 560fdbb..f2e0d8f 100644 (file)
@@ -7,7 +7,6 @@
 #include <features.h>
 #undef _POSIX_C_SOURCE
 #define _POSIX_C_SOURCE 200112L
 #include <features.h>
 #undef _POSIX_C_SOURCE
 #define _POSIX_C_SOURCE 200112L
-#include <Python.h>
 #include <lib/python/python.h>
 #include <string>
 #include <map>
 #include <lib/python/python.h>
 #include <string>
 #include <map>
@@ -29,8 +28,8 @@ public:
        void unbindAction(eWidget *widget, int id);
 #endif
 
        void unbindAction(eWidget *widget, int id);
 #endif
 
-       void bindAction(const std::string &context, int priority, PyObject *function);
-       void unbindAction(const std::string &context, PyObject *function);
+       void bindAction(const std::string &context, int priority, SWIG_PYOBJECT(ePyObject) function);
+       void unbindAction(const std::string &context, SWIG_PYOBJECT(ePyObject) function);
        
        void bindKey(const std::string &device, int key, int flags, const std::string &context, const std::string &action);
        
        
        void bindKey(const std::string &device, int key, int flags, const std::string &context, const std::string &action);
        
@@ -45,7 +44,7 @@ private:
 //             eActionContext *m_context;
                std::string m_context; // FIXME
                
 //             eActionContext *m_context;
                std::string m_context; // FIXME
                
-               PyObject *m_fnc;
+               ePyObject m_fnc;
                
                eWidget *m_widget;
                int m_id;
                
                eWidget *m_widget;
                int m_id;
index 67e0234..480c8ea 100644 (file)
@@ -131,7 +131,7 @@ void eMainloop::removeSocketNotifier(eSocketNotifier *sn)
        eFatal("removed socket notifier which is not present");
 }
 
        eFatal("removed socket notifier which is not present");
 }
 
-int eMainloop::processOneEvent(unsigned int user_timeout, PyObject **res, PyObject *additional)
+int eMainloop::processOneEvent(unsigned int user_timeout, PyObject **res, ePyObject additional)
 {
        int return_reason = 0;
                /* get current time */
 {
        int return_reason = 0;
                /* get current time */
@@ -222,7 +222,7 @@ int eMainloop::processOneEvent(unsigned int user_timeout, PyObject **res, PyObje
                        {
                                if (!*res)
                                        *res = PyList_New(0);
                        {
                                if (!*res)
                                        *res = PyList_New(0);
-                               PyObject *it = PyTuple_New(2);
+                               ePyObject it = PyTuple_New(2);
                                PyTuple_SET_ITEM(it, 0, PyInt_FromLong(pfd[i].fd));
                                PyTuple_SET_ITEM(it, 1, PyInt_FromLong(pfd[i].revents));
                                PyList_Append(*res, it);
                                PyTuple_SET_ITEM(it, 0, PyInt_FromLong(pfd[i].fd));
                                PyTuple_SET_ITEM(it, 1, PyInt_FromLong(pfd[i].revents));
                                PyList_Append(*res, it);
@@ -272,7 +272,7 @@ void eMainloop::removeTimer(eTimer* e)
        m_timer_list.remove(e);
 }
 
        m_timer_list.remove(e);
 }
 
-int eMainloop::iterate(unsigned int user_timeout, PyObject **res, PyObject *dict)
+int eMainloop::iterate(unsigned int user_timeout, PyObject **res, ePyObject dict)
 {
        int ret = 0;
        
 {
        int ret = 0;
        
@@ -320,9 +320,9 @@ void eMainloop::reset()
        app_quit_now=false;
 }
 
        app_quit_now=false;
 }
 
-PyObject *eMainloop::poll(PyObject *timeout, PyObject *dict)
+PyObject *eMainloop::poll(ePyObject timeout, ePyObject dict)
 {
 {
-       PyObject *res = 0;
+       PyObject *res=0;
        
        if (app_quit_now)
        {
        
        if (app_quit_now)
        {
@@ -333,11 +333,12 @@ PyObject *eMainloop::poll(PyObject *timeout, PyObject *dict)
        int user_timeout = (timeout == Py_None) ? 0 : PyInt_AsLong(timeout);
 
        iterate(user_timeout, &res, dict);
        int user_timeout = (timeout == Py_None) ? 0 : PyInt_AsLong(timeout);
 
        iterate(user_timeout, &res, dict);
+       ePyObject ret(res);
        
        
-       if (!res) /* return empty list on timeout */
-               res = PyList_New(0);
+       if (!ret) /* return empty list on timeout */
+               return PyList_New(0);
        
        
-       return res;
+       return ret;
 }
 
 void eMainloop::interruptPoll()
 }
 
 void eMainloop::interruptPoll()
index cf973c8..a399667 100644 (file)
@@ -179,7 +179,7 @@ class eMainloop
        ePtrList<eTimer> m_timer_list;
        bool app_quit_now;
        int loop_level;
        ePtrList<eTimer> m_timer_list;
        bool app_quit_now;
        int loop_level;
-       int processOneEvent(unsigned int user_timeout, PyObject **res=0, PyObject *additional=0);
+       int processOneEvent(unsigned int user_timeout, PyObject **res=0, ePyObject additional=ePyObject());
        int retval;
        pthread_mutex_t recalcLock;
        
        int retval;
        pthread_mutex_t recalcLock;
        
@@ -219,14 +219,14 @@ public:
                  1 - timeout
                  2 - signal
                */
                  1 - timeout
                  2 - signal
                */
-       int iterate(unsigned int timeout=0, PyObject **res=0, PyObject *additional=0);
-               
+       int iterate(unsigned int timeout=0, PyObject **res=0, SWIG_PYOBJECT(ePyObject) additional=(PyObject*)0);
+
                /* run will iterate endlessly until the app is quit, and return
                   the exit code */
        int runLoop();
        
                /* our new shared polling interface. */
                /* run will iterate endlessly until the app is quit, and return
                   the exit code */
        int runLoop();
        
                /* our new shared polling interface. */
-       PyObject *poll(PyObject *dict, PyObject *timeout);
+       PyObject *poll(SWIG_PYOBJECT(ePyObject) dict, SWIG_PYOBJECT(ePyObject) timeout);
        void interruptPoll();
        void reset();
 };
        void interruptPoll();
        void reset();
 };
index 562b350..31b0a36 100644 (file)
@@ -1,9 +1,9 @@
 #include <lib/base/nconfig.h>
 #include <lib/base/nconfig.h>
-#include <Python.h>
+#include <lib/python/python.h>
 
 
-PyObject *ePythonConfigQuery::m_queryFunc;
+ePyObject ePythonConfigQuery::m_queryFunc;
 
 
-void ePythonConfigQuery::setQueryFunc(PyObject *queryFunc)
+void ePythonConfigQuery::setQueryFunc(ePyObject queryFunc)
 {
        if (m_queryFunc)
                Py_DECREF(m_queryFunc);
 {
        if (m_queryFunc)
                Py_DECREF(m_queryFunc);
@@ -16,9 +16,9 @@ RESULT ePythonConfigQuery::getConfigValue(const char *key, std::string &value)
 {
        if (key && PyCallable_Check(m_queryFunc))
        {
 {
        if (key && PyCallable_Check(m_queryFunc))
        {
-               PyObject *pArgs = PyTuple_New(1);
+               ePyObject pArgs = PyTuple_New(1);
                PyTuple_SET_ITEM(pArgs, 0, PyString_FromString(key));
                PyTuple_SET_ITEM(pArgs, 0, PyString_FromString(key));
-               PyObject *pRet = PyObject_CallObject(m_queryFunc, pArgs);
+               ePyObject pRet = PyObject_CallObject(m_queryFunc, pArgs);
                Py_DECREF(pArgs);
                if (pRet)
                {
                Py_DECREF(pArgs);
                if (pRet)
                {
index 2c87491..3667439 100644 (file)
@@ -5,11 +5,11 @@
 
 class ePythonConfigQuery
 {
 
 class ePythonConfigQuery
 {
-       static PyObject *m_queryFunc;
+       static ePyObject m_queryFunc;
        ePythonConfigQuery() {}
        ~ePythonConfigQuery() {}
 public:
        ePythonConfigQuery() {}
        ~ePythonConfigQuery() {}
 public:
-       static void setQueryFunc(PyObject *func);
+       static void setQueryFunc(SWIG_PYOBJECT(ePyObject) func);
 #ifndef SWIG
        static RESULT getConfigValue(const char *key, std::string &value);
 #endif
 #ifndef SWIG
        static RESULT getConfigValue(const char *key, std::string &value);
 #endif
index e8394c4..7cd56b9 100644 (file)
@@ -14,7 +14,7 @@
 #include <lib/base/eerror.h>
 #include <lib/dvb/pmt.h>
 #include <lib/dvb/db.h>
 #include <lib/base/eerror.h>
 #include <lib/dvb/pmt.h>
 #include <lib/dvb/db.h>
-#include <Python.h>
+#include <lib/python/python.h>
 
 int eventData::CacheSize=0;
 descriptorMap eventData::descriptors;
 
 int eventData::CacheSize=0;
 descriptorMap eventData::descriptors;
@@ -1522,9 +1522,9 @@ RESULT eEPGCache::getNextTimeEntry(ePtr<eServiceEvent> &result)
        return -1;
 }
 
        return -1;
 }
 
-void fillTuple(PyObject *tuple, char *argstring, int argcount, PyObject *service, ePtr<eServiceEvent> &ptr, PyObject *nowTime, PyObject *service_name )
+void fillTuple(ePyObject tuple, char *argstring, int argcount, ePyObject service, ePtr<eServiceEvent> &ptr, ePyObject nowTime, ePyObject service_name )
 {
 {
-       PyObject *tmp=NULL;
+       ePyObject tmp;
        int pos=0;
        while(pos < argcount)
        {
        int pos=0;
        while(pos < argcount)
        {
@@ -1575,12 +1575,12 @@ void fillTuple(PyObject *tuple, char *argstring, int argcount, PyObject *service
        }
 }
 
        }
 }
 
-int handleEvent(ePtr<eServiceEvent> &ptr, PyObject *dest_list, char* argstring, int argcount, PyObject *service, PyObject *nowTime, PyObject *service_name, PyObject *convertFunc, PyObject *convertFuncArgs)
+int handleEvent(ePtr<eServiceEvent> &ptr, ePyObject dest_list, char* argstring, int argcount, ePyObject service, ePyObject nowTime, ePyObject service_name, ePyObject convertFunc, ePyObject convertFuncArgs)
 {
        if (convertFunc)
        {
                fillTuple(convertFuncArgs, argstring, argcount, service, ptr, nowTime, service_name);
 {
        if (convertFunc)
        {
                fillTuple(convertFuncArgs, argstring, argcount, service, ptr, nowTime, service_name);
-               PyObject *result = PyObject_CallObject(convertFunc, convertFuncArgs);
+               ePyObject result = PyObject_CallObject(convertFunc, convertFuncArgs);
                if (result == NULL)
                {
                        if (service_name)
                if (result == NULL)
                {
                        if (service_name)
@@ -1599,7 +1599,7 @@ int handleEvent(ePtr<eServiceEvent> &ptr, PyObject *dest_list, char* argstring,
        }
        else
        {
        }
        else
        {
-               PyObject *tuple = PyTuple_New(argcount);
+               ePyObject tuple = PyTuple_New(argcount);
                fillTuple(tuple, argstring, argcount, service, ptr, nowTime, service_name);
                PyList_Append(dest_list, tuple);
                Py_DECREF(tuple);
                fillTuple(tuple, argstring, argcount, service, ptr, nowTime, service_name);
                PyList_Append(dest_list, tuple);
                Py_DECREF(tuple);
@@ -1631,9 +1631,9 @@ int handleEvent(ePtr<eServiceEvent> &ptr, PyObject *dest_list, char* argstring,
 //      when type is time then it is the start_time ( 0 for now_time )
 //   the fourth is the end_time .. ( optional .. for query all events in time range)
 
 //      when type is time then it is the start_time ( 0 for now_time )
 //   the fourth is the end_time .. ( optional .. for query all events in time range)
 
-PyObject *eEPGCache::lookupEvent(PyObject *list, PyObject *convertFunc)
+PyObject *eEPGCache::lookupEvent(ePyObject list, ePyObject convertFunc)
 {
 {
-       PyObject *convertFuncArgs=NULL;
+       ePyObject convertFuncArgs;
        int argcount=0;
        char *argstring=NULL;
        if (!PyList_Check(list))
        int argcount=0;
        char *argstring=NULL;
        if (!PyList_Check(list))
@@ -1654,7 +1654,7 @@ PyObject *eEPGCache::lookupEvent(PyObject *list, PyObject *convertFunc)
        }
        else 
        {
        }
        else 
        {
-               PyObject *argv=PyList_GET_ITEM(list, 0); // borrowed reference!
+               ePyObject argv=PyList_GET_ITEM(list, 0); // borrowed reference!
                if (PyString_Check(argv))
                {
                        argstring = PyString_AS_STRING(argv);
                if (PyString_Check(argv))
                {
                        argstring = PyString_AS_STRING(argv);
@@ -1677,17 +1677,17 @@ PyObject *eEPGCache::lookupEvent(PyObject *list, PyObject *convertFunc)
                convertFuncArgs = PyTuple_New(argcount);
        }
 
                convertFuncArgs = PyTuple_New(argcount);
        }
 
-       PyObject *nowTime = strchr(argstring, 'C') ?
+       ePyObject nowTime = strchr(argstring, 'C') ?
                PyLong_FromLong(eDVBLocalTimeHandler::getInstance()->nowTime()) :
                NULL;
 
        bool must_get_service_name = strchr(argstring, 'N') ? true : false;
 
        // create dest list
                PyLong_FromLong(eDVBLocalTimeHandler::getInstance()->nowTime()) :
                NULL;
 
        bool must_get_service_name = strchr(argstring, 'N') ? true : false;
 
        // create dest list
-       PyObject *dest_list=PyList_New(0);
+       ePyObject dest_list=PyList_New(0);
        while(listSize > listIt)
        {
        while(listSize > listIt)
        {
-               PyObject *item=PyList_GET_ITEM(list, listIt++); // borrowed reference!
+               ePyObject item=PyList_GET_ITEM(list, listIt++); // borrowed reference!
                if (PyTuple_Check(item))
                {
                        bool service_changed=false;
                if (PyTuple_Check(item))
                {
                        bool service_changed=false;
@@ -1697,10 +1697,10 @@ PyObject *eEPGCache::lookupEvent(PyObject *list, PyObject *convertFunc)
                        int minutes=0;
                        int tupleSize=PyTuple_Size(item);
                        int tupleIt=0;
                        int minutes=0;
                        int tupleSize=PyTuple_Size(item);
                        int tupleIt=0;
-                       PyObject *service=NULL;
+                       ePyObject service;
                        while(tupleSize > tupleIt)  // parse query args
                        {
                        while(tupleSize > tupleIt)  // parse query args
                        {
-                               PyObject *entry=PyTuple_GET_ITEM(item, tupleIt); // borrowed reference!
+                               ePyObject entry=PyTuple_GET_ITEM(item, tupleIt); // borrowed reference!
                                switch(tupleIt++)
                                {
                                        case 0:
                                switch(tupleIt++)
                                {
                                        case 0:
@@ -1756,7 +1756,7 @@ PyObject *eEPGCache::lookupEvent(PyObject *list, PyObject *convertFunc)
                                }
                        }
 
                                }
                        }
 
-                       PyObject *service_name=NULL;
+                       ePyObject service_name;
                        if (must_get_service_name)
                        {
                                ePtr<iStaticServiceInformation> sptr;
                        if (must_get_service_name)
                        {
                                ePtr<iStaticServiceInformation> sptr;
@@ -1821,9 +1821,9 @@ skip_entry:
        return dest_list;
 }
 
        return dest_list;
 }
 
-void fillTuple2(PyObject *tuple, const char *argstring, int argcount, eventData *evData, ePtr<eServiceEvent> &ptr, PyObject *service_name, PyObject *service_reference)
+void fillTuple2(ePyObject tuple, const char *argstring, int argcount, eventData *evData, ePtr<eServiceEvent> &ptr, ePyObject service_name, ePyObject service_reference)
 {
 {
-       PyObject *tmp=NULL;
+       ePyObject tmp;
        int pos=0;
        while(pos < argcount)
        {
        int pos=0;
        while(pos < argcount)
        {
@@ -1901,9 +1901,9 @@ void fillTuple2(PyObject *tuple, const char *argstring, int argcount, eventData
 //     0 = case sensitive (CASE_CHECK)
 //     1 = case insensitive (NO_CASECHECK)
 
 //     0 = case sensitive (CASE_CHECK)
 //     1 = case insensitive (NO_CASECHECK)
 
-PyObject *eEPGCache::search(PyObject *arg)
+PyObject *eEPGCache::search(ePyObject arg)
 {
 {
-       PyObject *ret = 0;
+       ePyObject ret;
        int descridx = -1;
        __u32 descr[512];
        int eventid = -1;
        int descridx = -1;
        __u32 descr[512];
        int eventid = -1;
@@ -1919,7 +1919,7 @@ PyObject *eEPGCache::search(PyObject *arg)
                int tuplesize=PyTuple_Size(arg);
                if (tuplesize > 0)
                {
                int tuplesize=PyTuple_Size(arg);
                if (tuplesize > 0)
                {
-                       PyObject *obj = PyTuple_GET_ITEM(arg,0);
+                       ePyObject obj = PyTuple_GET_ITEM(arg,0);
                        if (PyString_Check(obj))
                        {
                                argcount = PyString_GET_SIZE(obj);
                        if (PyString_Check(obj))
                        {
                                argcount = PyString_GET_SIZE(obj);
@@ -1950,7 +1950,7 @@ PyObject *eEPGCache::search(PyObject *arg)
                        querytype = PyLong_AsLong(PyTuple_GET_ITEM(arg, 2));
                        if (tuplesize > 4 && querytype == 0)
                        {
                        querytype = PyLong_AsLong(PyTuple_GET_ITEM(arg, 2));
                        if (tuplesize > 4 && querytype == 0)
                        {
-                               PyObject *obj = PyTuple_GET_ITEM(arg, 3);
+                               ePyObject obj = PyTuple_GET_ITEM(arg, 3);
                                if (PyString_Check(obj))
                                {
                                        refstr = PyString_AS_STRING(obj);
                                if (PyString_Check(obj))
                                {
                                        refstr = PyString_AS_STRING(obj);
@@ -2007,7 +2007,7 @@ PyObject *eEPGCache::search(PyObject *arg)
                        }
                        else if (tuplesize > 4 && (querytype == 1 || querytype == 2) )
                        {
                        }
                        else if (tuplesize > 4 && (querytype == 1 || querytype == 2) )
                        {
-                               PyObject *obj = PyTuple_GET_ITEM(arg, 3);
+                               ePyObject obj = PyTuple_GET_ITEM(arg, 3);
                                if (PyString_Check(obj))
                                {
                                        int casetype = PyLong_AsLong(PyTuple_GET_ITEM(arg, 4));
                                if (PyString_Check(obj))
                                {
                                        int casetype = PyLong_AsLong(PyTuple_GET_ITEM(arg, 4));
@@ -2124,8 +2124,8 @@ PyObject *eEPGCache::search(PyObject *arg)
                                ++cit;
                                continue;
                        }
                                ++cit;
                                continue;
                        }
-                       PyObject *service_name=0;
-                       PyObject *service_reference=0;
+                       ePyObject service_name;
+                       ePyObject service_reference;
                        timeMap &evmap = cit->second.second;
                        // check all events
                        for (timeMap::iterator evit(evmap.begin()); evit != evmap.end() && maxcount; ++evit)
                        timeMap &evmap = cit->second.second;
                        // check all events
                        for (timeMap::iterator evit(evmap.begin()); evit != evmap.end() && maxcount; ++evit)
@@ -2191,7 +2191,7 @@ PyObject *eEPGCache::search(PyObject *arg)
                                                if (!ret)
                                                        ret = PyList_New(0);
                                        // create tuple
                                                if (!ret)
                                                        ret = PyList_New(0);
                                        // create tuple
-                                               PyObject *tuple = PyTuple_New(argcount);
+                                               ePyObject tuple = PyTuple_New(argcount);
                                        // fill tuple
                                                fillTuple2(tuple, argstring, argcount, evit->second, ptr, service_name, service_reference);
                                                PyList_Append(ret, tuple);
                                        // fill tuple
                                                fillTuple2(tuple, argstring, argcount, evit->second, ptr, service_name, service_reference);
                                                PyList_Append(ret, tuple);
index fe768ae..1627496 100644 (file)
@@ -338,8 +338,8 @@ public:
                CASE_CHECK,
                NO_CASE_CHECK
        };
                CASE_CHECK,
                NO_CASE_CHECK
        };
-       PyObject *lookupEvent(PyObject *list, PyObject *convertFunc=NULL);
-       PyObject *search(PyObject *);
+       PyObject *lookupEvent(SWIG_PYOBJECT(ePyObject) list, SWIG_PYOBJECT(ePyObject) convertFunc=(PyObject*)0);
+       PyObject *search(SWIG_PYOBJECT(ePyObject));
 
        // eServiceEvent are parsed epg events.. it's safe to use them after cache unlock
        // for use from python ( members: m_start_time, m_duration, m_short_description, m_extended_description )
 
        // eServiceEvent are parsed epg events.. it's safe to use them after cache unlock
        // for use from python ( members: m_start_time, m_duration, m_short_description, m_extended_description )
index 2712134..133aa0f 100644 (file)
@@ -660,9 +660,9 @@ int eDVBFrontend::readFrontendData(int type)
        return 0;
 }
 
        return 0;
 }
 
-void PutToDict(PyObject *dict, const char*key, long value)
+void PutToDict(ePyObject &dict, const char*key, long value)
 {
 {
-       PyObject *item = PyInt_FromLong(value);
+       ePyObject item = PyInt_FromLong(value);
        if (item)
        {
                if (PyDict_SetItemString(dict, key, item))
        if (item)
        {
                if (PyDict_SetItemString(dict, key, item))
@@ -673,9 +673,9 @@ void PutToDict(PyObject *dict, const char*key, long value)
                eDebug("could not create PyObject for %s", key);
 }
 
                eDebug("could not create PyObject for %s", key);
 }
 
-void PutToDict(PyObject *dict, const char*key, const char *value)
+void PutToDict(ePyObject &dict, const char*key, const char *value)
 {
 {
-       PyObject *item = PyString_FromString(value);
+       ePyObject item = PyString_FromString(value);
        if (item)
        {
                if (PyDict_SetItemString(dict, key, item))
        if (item)
        {
                if (PyDict_SetItemString(dict, key, item))
@@ -686,7 +686,7 @@ void PutToDict(PyObject *dict, const char*key, const char *value)
                eDebug("could not create PyObject for %s", key);
 }
 
                eDebug("could not create PyObject for %s", key);
 }
 
-void fillDictWithSatelliteData(PyObject *dict, const FRONTENDPARAMETERS &parm, eDVBFrontend *fe)
+void fillDictWithSatelliteData(ePyObject dict, const FRONTENDPARAMETERS &parm, eDVBFrontend *fe)
 {
        int freq_offset=0;
        int csw=0;
 {
        int freq_offset=0;
        int csw=0;
@@ -770,7 +770,7 @@ void fillDictWithSatelliteData(PyObject *dict, const FRONTENDPARAMETERS &parm, e
        PutToDict(dict, "system", tmp);
 }
 
        PutToDict(dict, "system", tmp);
 }
 
-void fillDictWithCableData(PyObject *dict, const FRONTENDPARAMETERS &parm)
+void fillDictWithCableData(ePyObject dict, const FRONTENDPARAMETERS &parm)
 {
        const char *tmp=0;
        PutToDict(dict, "frequency", parm_frequency/1000);
 {
        const char *tmp=0;
        PutToDict(dict, "frequency", parm_frequency/1000);
@@ -831,7 +831,7 @@ void fillDictWithCableData(PyObject *dict, const FRONTENDPARAMETERS &parm)
        PutToDict(dict, "modulation", tmp);
 }
 
        PutToDict(dict, "modulation", tmp);
 }
 
-void fillDictWithTerrestrialData(PyObject *dict, const FRONTENDPARAMETERS &parm)
+void fillDictWithTerrestrialData(ePyObject dict, const FRONTENDPARAMETERS &parm)
 {
        const char *tmp=0;
        PutToDict(dict, "frequency", parm_frequency);
 {
        const char *tmp=0;
        PutToDict(dict, "frequency", parm_frequency);
@@ -973,7 +973,7 @@ void fillDictWithTerrestrialData(PyObject *dict, const FRONTENDPARAMETERS &parm)
 
 PyObject *eDVBFrontend::readTransponderData(bool original)
 {
 
 PyObject *eDVBFrontend::readTransponderData(bool original)
 {
-       PyObject *ret=PyDict_New();
+       ePyObject ret=PyDict_New();
 
        if (ret)
        {
 
        if (ret)
        {
index bdb10b1..4b0acdf 100644 (file)
@@ -141,7 +141,7 @@ void eDVBServicePMTHandler::PATready(int)
 
 PyObject *eDVBServicePMTHandler::getCaIds()
 {
 
 PyObject *eDVBServicePMTHandler::getCaIds()
 {
-       PyObject *ret=0;
+       ePyObject ret;
 
        program prog;
 
 
        program prog;
 
@@ -157,7 +157,7 @@ PyObject *eDVBServicePMTHandler::getCaIds()
                }
        }
 
                }
        }
 
-       return ret ? ret : PyList_New(0);
+       return ret ? (PyObject*)ret : (PyObject*)PyList_New(0);
 }
 
 int eDVBServicePMTHandler::getProgramInfo(struct program &program)
 }
 
 int eDVBServicePMTHandler::getProgramInfo(struct program &program)
index 86f549c..7342a4b 100644 (file)
@@ -1102,7 +1102,7 @@ struct sat_compare
 
 PyObject *eDVBSatelliteEquipmentControl::get_exclusive_satellites(int tu1, int tu2)
 {
 
 PyObject *eDVBSatelliteEquipmentControl::get_exclusive_satellites(int tu1, int tu2)
 {
-       PyObject *ret=0;
+       ePyObject ret;
 
        if (tu1 != tu2)
        {
 
        if (tu1 != tu2)
        {
index 1ff0c32..9fb89b3 100644 (file)
@@ -19,7 +19,6 @@ eDVBCI_UI::eDVBCI_UI()
        instance = this;
        for(int i=0;i<MAX_SLOTS;++i)
        {
        instance = this;
        for(int i=0;i<MAX_SLOTS;++i)
        {
-               slotdata[i].mmiScreen=NULL;
                slotdata[i].mmiScreenReady=0;
                slotdata[i].mmiTuplePos=0;
                slotdata[i].state=-1;
                slotdata[i].mmiScreenReady=0;
                slotdata[i].mmiTuplePos=0;
                slotdata[i].state=-1;
@@ -129,7 +128,7 @@ int eDVBCI_UI::mmiScreenClose(int slot, int timeout)
                Py_DECREF(data.mmiScreen);
        data.mmiScreen = PyList_New(1);
 
                Py_DECREF(data.mmiScreen);
        data.mmiScreen = PyList_New(1);
 
-       PyObject *tuple = PyTuple_New(2);
+       ePyObject tuple = PyTuple_New(2);
        PyTuple_SET_ITEM(tuple, 0, PyString_FromString("CLOSE"));
        PyTuple_SET_ITEM(tuple, 1, PyLong_FromLong(timeout));
        PyList_SET_ITEM(data.mmiScreen, 0, tuple);
        PyTuple_SET_ITEM(tuple, 0, PyString_FromString("CLOSE"));
        PyTuple_SET_ITEM(tuple, 1, PyLong_FromLong(timeout));
        PyList_SET_ITEM(data.mmiScreen, 0, tuple);
@@ -151,7 +150,7 @@ int eDVBCI_UI::mmiScreenEnq(int slot, int blind, int answerLen, char *text)
                Py_DECREF(data.mmiScreen);
        data.mmiScreen = PyList_New(2);
 
                Py_DECREF(data.mmiScreen);
        data.mmiScreen = PyList_New(2);
 
-       PyObject *tuple = PyTuple_New(1);
+       ePyObject tuple = PyTuple_New(1);
        PyTuple_SET_ITEM(tuple, 0, PyString_FromString("ENQ"));
        PyList_SET_ITEM(data.mmiScreen, 0, tuple);
 
        PyTuple_SET_ITEM(tuple, 0, PyString_FromString("ENQ"));
        PyList_SET_ITEM(data.mmiScreen, 0, tuple);
 
@@ -186,7 +185,7 @@ int eDVBCI_UI::mmiScreenBegin(int slot, int listmenu)
 
        data.mmiScreen = PyList_New(1);
 
 
        data.mmiScreen = PyList_New(1);
 
-       PyObject *tuple = PyTuple_New(1);
+       ePyObject tuple = PyTuple_New(1);
        if (listmenu == 0)                              //menu
                PyTuple_SET_ITEM(tuple, 0, PyString_FromString("MENU"));
        else    //list
        if (listmenu == 0)                              //menu
                PyTuple_SET_ITEM(tuple, 0, PyString_FromString("MENU"));
        else    //list
@@ -208,7 +207,7 @@ int eDVBCI_UI::mmiScreenAddText(int slot, int type, char *value)
 
        slot_ui_data &data = slotdata[slot];
 
 
        slot_ui_data &data = slotdata[slot];
 
-       PyObject *tuple = PyTuple_New(3);
+       ePyObject tuple = PyTuple_New(3);
 
        if (type == 0)                                  //title
                PyTuple_SET_ITEM(tuple, 0, PyString_FromString("TITLE"));
 
        if (type == 0)                                  //title
                PyTuple_SET_ITEM(tuple, 0, PyString_FromString("TITLE"));
index b06eb45..8018e89 100644 (file)
@@ -5,7 +5,7 @@
                 /* avoid warnigs :) */
 #undef _POSIX_C_SOURCE
 #define _POSIX_C_SOURCE 200112L
                 /* avoid warnigs :) */
 #undef _POSIX_C_SOURCE
 #define _POSIX_C_SOURCE 200112L
-#include <Python.h>
+#include <lib/python/python.h>
 #include <lib/python/connections.h>
 
 #define MAX_SLOTS 4
 #include <lib/python/connections.h>
 
 #define MAX_SLOTS 4
@@ -15,7 +15,7 @@ struct slot_ui_data
 {
        std::string appName;
        int state;
 {
        std::string appName;
        int state;
-       PyObject *mmiScreen;
+       ePyObject mmiScreen;
        int mmiTuplePos;
        int mmiScreenReady;
 };
        int mmiTuplePos;
        int mmiScreenReady;
 };
index b3ffe2a..43dfe3a 100644 (file)
@@ -1,5 +1,6 @@
-#include "picload.h"
+#include <lib/gdi/picload.h>
 #include "picexif.h"
 #include "picexif.h"
+#include <lib/python/python.h>
 
 #include <png.h>
 
 
 #include <png.h>
 
@@ -335,7 +336,7 @@ static int png_load(const char *filename,  int *x, int *y)
 
 PyObject *getExif(const char *filename)
 {
 
 PyObject *getExif(const char *filename)
 {
-       PyObject *list = 0;
+       ePyObject list;
        Cexif exif;
        if(exif.DecodeExif(filename))
        {
        Cexif exif;
        if(exif.DecodeExif(filename))
        {
@@ -388,7 +389,7 @@ PyObject *getExif(const char *filename)
                PyList_SET_ITEM(list, 0, PyString_FromString(exif.m_szLastError));
        }
 
                PyList_SET_ITEM(list, 0, PyString_FromString(exif.m_szLastError));
        }
 
-       return list ? list : PyList_New(0);
+       return list ? (PyObject*)list : (PyObject*)PyList_New(0);
 }
 
 //---------------------------------------------------------------------------------------------
 }
 
 //---------------------------------------------------------------------------------------------
index 261c548..d4272a0 100644 (file)
@@ -1,7 +1,7 @@
 #include <lib/gui/elistbox.h>
 #include <lib/gui/elistboxcontent.h>
 #include <lib/gdi/font.h>
 #include <lib/gui/elistbox.h>
 #include <lib/gui/elistboxcontent.h>
 #include <lib/gdi/font.h>
-#include <Python.h>
+#include <lib/python/python.h>
 
 /*
     The basic idea is to have an interface which gives all relevant list
 
 /*
     The basic idea is to have an interface which gives all relevant list
@@ -50,7 +50,6 @@ DEFINE_REF(eListboxPythonStringContent);
 
 eListboxPythonStringContent::eListboxPythonStringContent()
 {
 
 eListboxPythonStringContent::eListboxPythonStringContent()
 {
-       m_list = 0;
 }
 
 eListboxPythonStringContent::~eListboxPythonStringContent()
 }
 
 eListboxPythonStringContent::~eListboxPythonStringContent()
@@ -104,7 +103,7 @@ int eListboxPythonStringContent::currentCursorSelectable()
 {
        if (m_list && cursorValid())
        {
 {
        if (m_list && cursorValid())
        {
-               PyObject *item = PyList_GET_ITEM(m_list, m_cursor);
+               ePyObject item = PyList_GET_ITEM(m_list, m_cursor);
                if (!PyTuple_Check(item))
                        return 1;
                if (PyTuple_Size(item) >= 2)
                if (!PyTuple_Check(item))
                        return 1;
                if (PyTuple_Size(item) >= 2)
@@ -145,7 +144,7 @@ void eListboxPythonStringContent::paint(gPainter &painter, eWindowStyle &style,
        if (m_list && cursorValid())
        {
                int gray = 0;
        if (m_list && cursorValid())
        {
                int gray = 0;
-               PyObject *item = PyList_GET_ITEM(m_list, m_cursor); // borrowed reference!
+               ePyObject item = PyList_GET_ITEM(m_list, m_cursor); // borrowed reference!
                painter.setFont(fnt);
 
                        /* the user can supply tuples, in this case the first one will be displayed. */         
                painter.setFont(fnt);
 
                        /* the user can supply tuples, in this case the first one will be displayed. */         
@@ -177,12 +176,12 @@ void eListboxPythonStringContent::paint(gPainter &painter, eWindowStyle &style,
        painter.clippop();
 }
 
        painter.clippop();
 }
 
-void eListboxPythonStringContent::setList(PyObject *list)
+void eListboxPythonStringContent::setList(ePyObject list)
 {
        Py_XDECREF(m_list);
        if (!PyList_Check(list))
        {
 {
        Py_XDECREF(m_list);
        if (!PyList_Check(list))
        {
-               m_list = 0;
+               m_list = ePyObject();
        } else
        {
                m_list = list;
        } else
        {
                m_list = list;
@@ -200,7 +199,7 @@ PyObject *eListboxPythonStringContent::getCurrentSelection()
                Py_INCREF(Py_None);
                return Py_None;
        }
                Py_INCREF(Py_None);
                return Py_None;
        }
-       PyObject *r = PyList_GET_ITEM(m_list, m_cursor);
+       ePyObject r = PyList_GET_ITEM(m_list, m_cursor);
        Py_XINCREF(r);
        return r;
 }
        Py_XINCREF(r);
        return r;
 }
@@ -236,8 +235,8 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style,
        if (m_list && cursorValid())
        {
                        /* get current list item */
        if (m_list && cursorValid())
        {
                        /* get current list item */
-               PyObject *item = PyList_GET_ITEM(m_list, m_cursor); // borrowed reference!
-               PyObject *text = 0, *value = 0;
+               ePyObject item = PyList_GET_ITEM(m_list, m_cursor); // borrowed reference!
+               ePyObject text, value;
                painter.setFont(fnt);
 
                        /* the first tuple element is a string for the left side.
                painter.setFont(fnt);
 
                        /* the first tuple element is a string for the left side.
@@ -266,7 +265,7 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style,
                        value = PyTuple_GET_ITEM(item, 1);
                        if (value)
                        {
                        value = PyTuple_GET_ITEM(item, 1);
                        if (value)
                        {
-                               PyObject *args = PyTuple_New(1);
+                               ePyObject args = PyTuple_New(1);
                                PyTuple_SET_ITEM(args, 0, PyInt_FromLong(selected));
                                
                                        /* CallObject will call __call__ which should return the value tuple */
                                PyTuple_SET_ITEM(args, 0, PyInt_FromLong(selected));
                                
                                        /* CallObject will call __call__ which should return the value tuple */
@@ -283,14 +282,14 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style,
                        if (value && PyTuple_Check(value))
                        {
                                        /* convert type to string */
                        if (value && PyTuple_Check(value))
                        {
                                        /* convert type to string */
-                               PyObject *type = PyTuple_GET_ITEM(value, 0);
+                               ePyObject type = PyTuple_GET_ITEM(value, 0);
                                const char *atype = (type && PyString_Check(type)) ? PyString_AsString(type) : 0;
                                
                                if (atype)
                                {
                                        if (!strcmp(atype, "text"))
                                        {
                                const char *atype = (type && PyString_Check(type)) ? PyString_AsString(type) : 0;
                                
                                if (atype)
                                {
                                        if (!strcmp(atype, "text"))
                                        {
-                                               PyObject *pvalue = PyTuple_GET_ITEM(value, 1);
+                                               ePyObject pvalue = PyTuple_GET_ITEM(value, 1);
                                                const char *value = (pvalue && PyString_Check(pvalue)) ? PyString_AsString(pvalue) : "<not-a-string>";
                                                painter.setFont(fnt2);
                                                if (value_alignment_left)
                                                const char *value = (pvalue && PyString_Check(pvalue)) ? PyString_AsString(pvalue) : "<not-a-string>";
                                                painter.setFont(fnt2);
                                                if (value_alignment_left)
@@ -301,8 +300,8 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style,
                                                        /* pvalue is borrowed */
                                        } else if (!strcmp(atype, "slider"))
                                        {
                                                        /* pvalue is borrowed */
                                        } else if (!strcmp(atype, "slider"))
                                        {
-                                               PyObject *pvalue = PyTuple_GET_ITEM(value, 1);
-                                               PyObject *psize = PyTuple_GET_ITEM(value, 2);
+                                               ePyObject pvalue = PyTuple_GET_ITEM(value, 1);
+                                               ePyObject psize = PyTuple_GET_ITEM(value, 2);
                                                
                                                        /* convert value to Long. fallback to -1 on error. */
                                                int value = (pvalue && PyInt_Check(pvalue)) ? PyInt_AsLong(pvalue) : -1;
                                                
                                                        /* convert value to Long. fallback to -1 on error. */
                                                int value = (pvalue && PyInt_Check(pvalue)) ? PyInt_AsLong(pvalue) : -1;
@@ -321,7 +320,7 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style,
                                                        /* pvalue is borrowed */
                                        } else if (!strcmp(atype, "mtext"))
                                        {
                                                        /* pvalue is borrowed */
                                        } else if (!strcmp(atype, "mtext"))
                                        {
-                                               PyObject *pvalue = PyTuple_GET_ITEM(value, 1);
+                                               ePyObject pvalue = PyTuple_GET_ITEM(value, 1);
                                                const char *text = (pvalue && PyString_Check(pvalue)) ? PyString_AsString(pvalue) : "<not-a-string>";
                                                int xoffs = value_alignment_left ? 0 : m_seperation;
                                                ePtr<eTextPara> para = new eTextPara(eRect(offset + eSize(xoffs, 0), item_right));
                                                const char *text = (pvalue && PyString_Check(pvalue)) ? PyString_AsString(pvalue) : "<not-a-string>";
                                                int xoffs = value_alignment_left ? 0 : m_seperation;
                                                ePtr<eTextPara> para = new eTextPara(eRect(offset + eSize(xoffs, 0), item_right));
@@ -330,7 +329,7 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style,
                                                para->realign(value_alignment_left ? eTextPara::dirLeft : eTextPara::dirRight);
                                                int glyphs = para->size();
                                                
                                                para->realign(value_alignment_left ? eTextPara::dirLeft : eTextPara::dirRight);
                                                int glyphs = para->size();
                                                
-                                               PyObject *plist = 0;
+                                               ePyObject plist;
                                                
                                                if (PyTuple_Size(value) >= 3)
                                                        plist = PyTuple_GET_ITEM(value, 2);
                                                
                                                if (PyTuple_Size(value) >= 3)
                                                        plist = PyTuple_GET_ITEM(value, 2);
@@ -342,7 +341,7 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style,
                                                
                                                for (int i = 0; i < entries; ++i)
                                                {
                                                
                                                for (int i = 0; i < entries; ++i)
                                                {
-                                                       PyObject *entry = PyList_GET_ITEM(plist, i);
+                                                       ePyObject entry = PyList_GET_ITEM(plist, i);
                                                        int num = PyInt_Check(entry) ? PyInt_AsLong(entry) : -1;
                                                        
                                                        if ((num < 0) || (num >= glyphs))
                                                        int num = PyInt_Check(entry) ? PyInt_AsLong(entry) : -1;
                                                        
                                                        if ((num < 0) || (num >= glyphs))
@@ -387,7 +386,6 @@ int eListboxPythonConfigContent::currentCursorSelectable()
 RESULT SwigFromPython(ePtr<gPixmap> &res, PyObject *obj);
 
 eListboxPythonMultiContent::eListboxPythonMultiContent()
 RESULT SwigFromPython(ePtr<gPixmap> &res, PyObject *obj);
 
 eListboxPythonMultiContent::eListboxPythonMultiContent()
-       :m_buildFunc(0)
 {
 }
 
 {
 }
 
@@ -404,7 +402,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
        style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);
        painter.clear();
 
        style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);
        painter.clear();
 
-       PyObject *items=0;
+       ePyObject items;
 
        if (m_list && cursorValid())
        {
 
        if (m_list && cursorValid())
        {
@@ -438,7 +436,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
                int size = PyList_Size(items);
                for (int i = 1; i < size; ++i)
                {
                int size = PyList_Size(items);
                for (int i = 1; i < size; ++i)
                {
-                       PyObject *item = PyList_GET_ITEM(items, i); // borrowed reference!
+                       ePyObject item = PyList_GET_ITEM(items, i); // borrowed reference!
                        
                        if (!item)
                        {
                        
                        if (!item)
                        {
@@ -446,7 +444,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
                                goto error_out;
                        }
                        
                                goto error_out;
                        }
                        
-                       PyObject *px = 0, *py = 0, *pwidth = 0, *pheight = 0, *pfnt = 0, *pstring = 0, *pflags = 0, *pcolor = 0;
+                       ePyObject px, py, pwidth, pheight, pfnt, pstring, pflags, pcolor;
                
                        /*
                                we have a list of tuples:
                
                        /*
                                we have a list of tuples:
@@ -630,7 +628,7 @@ error_out:
        painter.clippop();
 }
 
        painter.clippop();
 }
 
-void eListboxPythonMultiContent::setBuildFunc(PyObject *cb)
+void eListboxPythonMultiContent::setBuildFunc(ePyObject cb)
 {
        if (m_buildFunc)
                Py_DECREF(m_buildFunc);
 {
        if (m_buildFunc)
                Py_DECREF(m_buildFunc);
@@ -644,7 +642,7 @@ int eListboxPythonMultiContent::currentCursorSelectable()
        /* each list-entry is a list of tuples. if the first of these is none, it's not selectable */
        if (m_list && cursorValid())
        {
        /* each list-entry is a list of tuples. if the first of these is none, it's not selectable */
        if (m_list && cursorValid())
        {
-               PyObject *item = PyList_GET_ITEM(m_list, m_cursor);
+               ePyObject item = PyList_GET_ITEM(m_list, m_cursor);
                if (PyList_Check(item))
                {
                        item = PyList_GET_ITEM(item, 0);
                if (PyList_Check(item))
                {
                        item = PyList_GET_ITEM(item, 0);
index f7e5d2b..d86d592 100644 (file)
@@ -11,7 +11,7 @@ public:
        eListboxPythonStringContent();
        ~eListboxPythonStringContent();
 
        eListboxPythonStringContent();
        ~eListboxPythonStringContent();
 
-       void setList(PyObject *list);
+       void setList(SWIG_PYOBJECT(ePyObject) list);
        PyObject *getCurrentSelection();
        int getCurrentSelectionIndex() { return m_cursor; }
        void invalidateEntry(int index);
        PyObject *getCurrentSelection();
        int getCurrentSelectionIndex() { return m_cursor; }
        void invalidateEntry(int index);
@@ -40,7 +40,7 @@ protected:
        virtual void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
 
 protected:
        virtual void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
 
 protected:
-       PyObject *m_list;
+       ePyObject m_list;
        int m_cursor, m_saved_cursor;
        eSize m_itemsize;
 #endif
        int m_cursor, m_saved_cursor;
        eSize m_itemsize;
 #endif
@@ -58,7 +58,7 @@ private:
 
 class eListboxPythonMultiContent: public eListboxPythonStringContent
 {
 
 class eListboxPythonMultiContent: public eListboxPythonStringContent
 {
-       PyObject *m_buildFunc;
+       ePyObject m_buildFunc;
 public:
        eListboxPythonMultiContent();
        ~eListboxPythonMultiContent();
 public:
        eListboxPythonMultiContent();
        ~eListboxPythonMultiContent();
@@ -67,7 +67,7 @@ public:
        int currentCursorSelectable();
        
        void setFont(int fnt, gFont *fnt);
        int currentCursorSelectable();
        
        void setFont(int fnt, gFont *fnt);
-       void setBuildFunc(PyObject *func);
+       void setBuildFunc(SWIG_PYOBJECT(ePyObject) func);
 private:
        std::map<int, ePtr<gFont> > m_font;
 };
 private:
        std::map<int, ePtr<gFont> > m_font;
 };
index 68a4b46..fbb2457 100644 (file)
@@ -59,7 +59,7 @@ void ePositionGauge::setPointer(int which, gPixmap *pixmap, const ePoint &center
        updatePosition();
 }
 
        updatePosition();
 }
 
-void ePositionGauge::setInOutList(PyObject *list)
+void ePositionGauge::setInOutList(ePyObject list)
 {
        if (!PyList_Check(list))
                return;
 {
        if (!PyList_Check(list))
                return;
@@ -70,14 +70,14 @@ void ePositionGauge::setInOutList(PyObject *list)
        
        for (i=0; i<size; ++i)
        {
        
        for (i=0; i<size; ++i)
        {
-               PyObject *tuple = PyList_GetItem(list, i);
+               ePyObject tuple = PyList_GetItem(list, i);
                if (!PyTuple_Check(tuple))
                        continue;
 
                if (PyTuple_Size(tuple) != 2)
                        continue;
 
                if (!PyTuple_Check(tuple))
                        continue;
 
                if (PyTuple_Size(tuple) != 2)
                        continue;
 
-               PyObject *ppts = PyTuple_GetItem(tuple, 0), *ptype = PyTuple_GetItem(tuple, 1);
+               ePyObject ppts = PyTuple_GetItem(tuple, 0), ptype = PyTuple_GetItem(tuple, 1);
                if (!(PyLong_Check(ppts) && PyInt_Check(ptype)))
                        continue;
 
                if (!(PyLong_Check(ppts) && PyInt_Check(ptype)))
                        continue;
 
index 4b20209..36da1ef 100644 (file)
@@ -19,7 +19,7 @@ public:
        void setInColor(const gRGB &color); /* foreground? */
        void setPointer(int which, gPixmap *pixmap, const ePoint &center);
        
        void setInColor(const gRGB &color); /* foreground? */
        void setPointer(int which, gPixmap *pixmap, const ePoint &center);
        
-       void setInOutList(PyObject *list);
+       void setInOutList(SWIG_PYOBJECT(ePyObject) list);
        void setForegroundColor(const gRGB &col);
        
        void enableSeekPointer(int enable);
        void setForegroundColor(const gRGB &col);
        
        void enableSeekPointer(int enable);
index 7f76fa3..a687eab 100644 (file)
@@ -1,6 +1,6 @@
 #include <lib/nav/core.h>
 #include <lib/base/eerror.h>
 #include <lib/nav/core.h>
 #include <lib/base/eerror.h>
-#include <Python.h>
+#include <lib/python/python.h>
 
 void eNavigation::serviceEvent(iPlayableService* service, int event)
 {
 
 void eNavigation::serviceEvent(iPlayableService* service, int event)
 {
@@ -99,11 +99,9 @@ RESULT eNavigation::stopRecordService(ePtr<iRecordableService> &service)
        return -1;
 }
 
        return -1;
 }
 
-extern PyObject *New_iRecordableServicePtr(const ePtr<iRecordableService> &ref); // defined in enigma_python.i
-
 PyObject *eNavigation::getRecordings(void)
 {
 PyObject *eNavigation::getRecordings(void)
 {
-       PyObject *result = PyList_New(m_recordings.size());
+       ePyObject result = PyList_New(m_recordings.size());
        int pos=0;
        for (std::map<ePtr<iRecordableService>, ePtr<eConnection> >::iterator it(m_recordings.begin()); it != m_recordings.end(); ++it)
                PyList_SET_ITEM(result, pos++, New_iRecordableServicePtr(it->first)); 
        int pos=0;
        for (std::map<ePtr<iRecordableService>, ePtr<eConnection> >::iterator it(m_recordings.begin()); it != m_recordings.end(); ++it)
                PyList_SET_ITEM(result, pos++, New_iRecordableServicePtr(it->first)); 
index c24c939..fd3e2a4 100644 (file)
@@ -1,9 +1,29 @@
 #include <lib/python/connections.h>
 
 #include <lib/python/connections.h>
 
-PSignal1<void,int> testsignal;
+PSignal::PSignal()
+{
+       m_list = PyList_New(0);
+       Py_INCREF(m_list);
+}
 
 
-void connect(Slot1<void, int> &slot, PyObject *fnc)
+PSignal::~PSignal()
 {
 {
-       printf("CONNECT !\n");
+       Py_DECREF(m_list);
 }
 
 }
 
+void PSignal::callPython(ePyObject tuple)
+{
+       int size = PyList_Size(m_list);
+       int i;
+       for (i=0; i<size; ++i)
+       {
+               ePyObject b = PyList_GET_ITEM(m_list, i);
+               ePython::call(b, tuple);
+       }
+}
+
+PyObject *PSignal::get()
+{
+       Py_INCREF(m_list);
+       return m_list;
+}
index 8a06f7f..d24bb42 100644 (file)
@@ -7,37 +7,17 @@
 #include <features.h>
 #undef _POSIX_C_SOURCE
 #define _POSIX_C_SOURCE 200112L
 #include <features.h>
 #undef _POSIX_C_SOURCE
 #define _POSIX_C_SOURCE 200112L
-#include <Python.h>
+
 #include <lib/python/python.h>
 
 class PSignal
 {
 #include <lib/python/python.h>
 
 class PSignal
 {
+       ePyObject m_list;
 public:
 public:
-       PyObject *m_list;
-public:
-       PSignal()
-       {
-               m_list = PyList_New(0);
-               Py_INCREF(m_list);
-       }
-       ~PSignal()
-       {
-               Py_DECREF(m_list);
-       }
-       
-       void callPython(PyObject *tuple)
-       {
-               int size = PyList_Size(m_list);
-               int i;
-               for (i=0; i<size; ++i)
-               {
-                       PyObject *b = PyList_GET_ITEM(m_list, i);
-                       ePython::call(b, tuple);
-               }
-       }
-       
-       
-       PyObject *get() { Py_INCREF(m_list); return m_list; }
+       PSignal();
+       ~PSignal();
+       void callPython(SWIG_PYOBJECT(ePyObject) tuple);
+       PyObject *get();
 };
 
 inline PyObject *PyFrom(int v)
 };
 
 inline PyObject *PyFrom(int v)
@@ -58,7 +38,7 @@ public:
        {
                PyObject *pArgs = PyTuple_New(0);
                callPython(pArgs);
        {
                PyObject *pArgs = PyTuple_New(0);
                callPython(pArgs);
-               Py_DECREF(pArgs);
+               Org_Py_DECREF(pArgs);
                return Signal0<R>::operator()();
        }
 };
                return Signal0<R>::operator()();
        }
 };
@@ -72,7 +52,7 @@ public:
                PyObject *pArgs = PyTuple_New(1);
                PyTuple_SET_ITEM(pArgs, 0, PyFrom(a0));
                callPython(pArgs);
                PyObject *pArgs = PyTuple_New(1);
                PyTuple_SET_ITEM(pArgs, 0, PyFrom(a0));
                callPython(pArgs);
-               Py_DECREF(pArgs);
+               Org_Py_DECREF(pArgs);
                return Signal1<R,V0>::operator()(a0);
        }
 };
                return Signal1<R,V0>::operator()(a0);
        }
 };
@@ -87,7 +67,7 @@ public:
                PyTuple_SET_ITEM(pArgs, 0, PyFrom(a0));
                PyTuple_SET_ITEM(pArgs, 1, PyFrom(a1));
                callPython(pArgs);
                PyTuple_SET_ITEM(pArgs, 0, PyFrom(a0));
                PyTuple_SET_ITEM(pArgs, 1, PyFrom(a1));
                callPython(pArgs);
-               Py_DECREF(pArgs);
+               Org_Py_DECREF(pArgs);
                return Signal2<R,V0,V1>::operator()(a0, a1);
        }
 };
                return Signal2<R,V0,V1>::operator()(a0, a1);
        }
 };
index 119bff1..8947bb3 100644 (file)
-#include <lib/python/python.h>
 #include <lib/base/eerror.h>
                 /* avoid warnigs :) */
 #undef _POSIX_C_SOURCE
 #define _POSIX_C_SOURCE 200112L
 #include <lib/base/eerror.h>
                 /* avoid warnigs :) */
 #undef _POSIX_C_SOURCE
 #define _POSIX_C_SOURCE 200112L
-#include <Python.h>
-
 extern "C" void init_enigma();
 extern void bsodFatal();
 
 extern "C" void init_enigma();
 extern void bsodFatal();
 
-DEFINE_REF(TestObj);
+#define SKIP_PART2
+#include <lib/python/python.h>
+#undef SKIP_PART2
 
 
-TestObj::TestObj()
+#ifdef PYTHON_REFCOUNT_DEBUG
+ePyObject &ePyObject::operator=(PyObject *ob)
 {
 {
-       eDebug("create %p", this);
+       m_ob=ob;
+       m_file=0;
+       m_line=0;
+       m_from=m_to=0;
+       m_erased=false;
+       return *this;
 }
 
 }
 
-TestObj::~TestObj()
+ePyObject &ePyObject::operator=(const ePyObject &ob)
 {
 {
-       eDebug("destroy %p", this);
+       m_ob=ob.m_ob;
+       m_file=ob.m_file;
+       m_line=ob.m_line;
+       m_from=ob.m_from;
+       m_to=ob.m_to;
+       m_erased=ob.m_erased;
+       return *this;
 }
 
 }
 
-#if 0
-ePyObject::ePyObject(void *ptr): m_object(ptr)
+ePyObject::operator PyObject*()
 {
 {
-       Py_XINCREF((PyObject*)ptr);
+       if (m_ob)
+       {
+               if (!m_erased && m_ob->ob_refcnt > 0)
+                       return m_ob;
+               eDebug("invalid access PyObject %s with refcount <= 0 %d",
+                       m_erased ? "deleted" : "undeleted", m_ob->ob_refcnt);
+               if (m_file)
+                       eDebug("last modified in file %s line %d from %d to %d",
+                               m_file, m_line, m_from, m_to);
+               bsodFatal();
+       }
+       return 0;
 }
 
 }
 
-ePyObject::ePyObject(ePyObject &p)
+void ePyObject::incref(const char *file, int line)
 {
 {
-       m_object = p.m_object;
-       Py_XINCREF((PyObject*)m_object);
+       if (!m_ob)
+       {
+               eDebug("invalid incref python object with null pointer %s %d!!!", file, line);
+               if (m_file)
+                       eDebug("last modified in file %s line %d from %d to %d",
+                               m_file, m_line, m_from, m_to);
+               bsodFatal();
+       }
+       if (m_erased || m_ob->ob_refcnt <= 0)
+       {
+               eDebug("invalid incref %s python object with refcounting value %d in file %s line %d!!!",
+                       m_erased ? "deleted" : "undeleted", m_ob->ob_refcnt, file, line);
+               if (m_file)
+                       eDebug("last modified in file %s line %d from %d to %d",
+                               m_file, m_line, m_from, m_to);
+               bsodFatal();
+       }
+       if (m_ob->ob_refcnt == 0x7FFFFFFF)
+       {
+               eDebug("invalid incref %s python object with refcounting value %d (MAX_INT!!!) in file %s line %d!!!",
+                       m_erased ? "deleted" : "undeleted", m_ob->ob_refcnt, file, line);
+               if (m_file)
+                       eDebug("last modified in file %s line %d from %d to %d",
+                               m_file, m_line, m_from, m_to);
+               bsodFatal();
+       }
+       m_file = file;
+       m_line = line;
+       m_from = m_ob->ob_refcnt;
+       m_to = m_from+1;
+       Py_INCREF(m_ob);
 }
 
 }
 
-ePyObject::ePyObject(): m_object(0)
+void ePyObject::decref(const char *file, int line)
 {
 {
+       if (!m_ob)
+       {
+               eDebug("invalid decref python object with null pointer %s %d!!!", file, line);
+               if (m_file)
+                       eDebug("last modified in file %s line %d from %d to %d",
+                               m_file, m_line, m_from, m_to);
+               bsodFatal();
+       }
+       if (m_erased || m_ob->ob_refcnt <= 0)
+       {
+               eDebug("invalid decref %s python object with refcounting value %d in file %s line %d!!!",
+                       m_erased ? "deleted" : "undeleted", m_ob->ob_refcnt, file, line);
+               if (m_file)
+                       eDebug("last modified in file %s line %d from %d to %d",
+                               m_file, m_line, m_from, m_to);
+               bsodFatal();
+       }
+       m_file = file;
+       m_line = line;
+       m_from = m_ob->ob_refcnt;
+       m_to = m_from-1;
+       m_erased = !m_to;
+       Py_DECREF(m_ob);
 }
 }
+#endif  // PYTHON_REFCOUNT_DEBUG
 
 
-ePyObject::~ePyObject()
-{
-       Py_XDECREF((PyObject*)m_object);
-}
+#define SKIP_PART1
+#include <lib/python/python.h>
+#undef SKIP_PART1
+
+DEFINE_REF(TestObj);
 
 
-ePyObject &ePyObject::operator=(ePyObject &p)
+TestObj::TestObj()
 {
 {
-       Py_XDECREF((PyObject*)m_object);
-       m_object = p.m_object;
-       Py_XINCREF((PyObject*)m_object);
-       return *this;
+       eDebug("create %p", this);
 }
 
 }
 
-ePyObject &ePyObject::operator=(void *object)
+TestObj::~TestObj()
 {
 {
-       Py_XDECREF((PyObject*)m_object);
-       m_object = object;
-       Py_XINCREF((PyObject*)m_object);
-       return *this;
+       eDebug("destroy %p", this);
 }
 }
-#endif
 
 ePython::ePython()
 {
 
 ePython::ePython()
 {
@@ -76,13 +144,13 @@ ePython::~ePython()
 
 int ePython::execute(const std::string &pythonfile, const std::string &funcname)
 {
 
 int ePython::execute(const std::string &pythonfile, const std::string &funcname)
 {
-       PyObject *pName, *pModule, *pDict, *pFunc, *pArgs, *pValue;
+       ePyObject pName, pModule, pDict, pFunc, pArgs, pValue;
        pName = PyString_FromString(pythonfile.c_str());
 
        pModule = PyImport_Import(pName);
        Py_DECREF(pName);
        
        pName = PyString_FromString(pythonfile.c_str());
 
        pModule = PyImport_Import(pName);
        Py_DECREF(pName);
        
-       if (pModule != NULL)
+       if (pModule)
        {
                pDict = PyModule_GetDict(pModule);
                
        {
                pDict = PyModule_GetDict(pModule);
                
@@ -94,7 +162,7 @@ int ePython::execute(const std::string &pythonfile, const std::string &funcname)
                                // implement arguments..
                        pValue = PyObject_CallObject(pFunc, pArgs);
                        Py_DECREF(pArgs);
                                // implement arguments..
                        pValue = PyObject_CallObject(pFunc, pArgs);
                        Py_DECREF(pArgs);
-                       if (pValue != NULL)
+                       if (pValue)
                        {
                                printf("Result of call: %ld\n", PyInt_AsLong(pValue));
                                Py_DECREF(pValue);
                        {
                                printf("Result of call: %ld\n", PyInt_AsLong(pValue));
                                Py_DECREF(pValue);
@@ -114,14 +182,14 @@ int ePython::execute(const std::string &pythonfile, const std::string &funcname)
        return 0;
 }
 
        return 0;
 }
 
-int ePython::call(PyObject *pFunc, PyObject *pArgs)
+int ePython::call(ePyObject pFunc, ePyObject pArgs)
 {
        int res = -1;
 {
        int res = -1;
-       PyObject *pValue;
+       ePyObject pValue;
        if (pFunc && PyCallable_Check(pFunc))
        {
                pValue = PyObject_CallObject(pFunc, pArgs);
        if (pFunc && PyCallable_Check(pFunc))
        {
                pValue = PyObject_CallObject(pFunc, pArgs);
-               if (pValue != NULL)
+               if (pValue)
                {
                        if (PyInt_Check(pValue))
                                res = PyInt_AsLong(pValue);
                {
                        if (PyInt_Check(pValue))
                                res = PyInt_AsLong(pValue);
@@ -137,26 +205,22 @@ int ePython::call(PyObject *pFunc, PyObject *pArgs)
        return res;
 }
 
        return res;
 }
 
-PyObject *ePython::resolve(const std::string &pythonfile, const std::string &funcname)
+ePyObject ePython::resolve(const std::string &pythonfile, const std::string &funcname)
 {
 {
-       PyObject *pName, *pModule, *pDict, *pFunc;
+       ePyObject pName, pModule, pDict, pFunc;
 
        pName = PyString_FromString(pythonfile.c_str());
 
        pModule = PyImport_Import(pName);
        Py_DECREF(pName);
        
 
        pName = PyString_FromString(pythonfile.c_str());
 
        pModule = PyImport_Import(pName);
        Py_DECREF(pName);
        
-       if (pModule != NULL)
+       if (pModule)
        {
                pDict = PyModule_GetDict(pModule);
                pFunc = PyDict_GetItemString(pDict, funcname.c_str());
                Py_XINCREF(pFunc);
                Py_DECREF(pModule);
        {
                pDict = PyModule_GetDict(pModule);
                pFunc = PyDict_GetItemString(pDict, funcname.c_str());
                Py_XINCREF(pFunc);
                Py_DECREF(pModule);
-               return pFunc;
-       } else
-       {
-               if (PyErr_Occurred())
-                       PyErr_Print();
-               return 0;
-       }
+       } else if (PyErr_Occurred())
+               PyErr_Print();
+       return pFunc;
 }
 }
index 46e1a03..bcea49c 100644 (file)
-#ifndef __lib_python_python_h
-#define __lib_python_python_h
+#ifndef __lib_python_python_class_h
+
+#ifndef SKIP_PART2
+       #define __lib_python_python_class_h
+#endif
 
 #include <string>
 #include <lib/base/object.h>
 
 #include <string>
 #include <lib/base/object.h>
+#include <Python.h>
 
 
-typedef struct _object PyObject;
+#define PYTHON_REFCOUNT_DEBUG
 
 
-// useable for debugging python refcounting
+#if !defined(SKIP_PART1) && !defined(SWIG)
+class ePyObject
+{
+       PyObject *m_ob;
+#ifdef PYTHON_REFCOUNT_DEBUG
+       const char *m_file;
+       int m_line, m_from, m_to;
+       bool m_erased;
+#endif
+public:
+       inline ePyObject();
+       inline ePyObject(const ePyObject &ob);
+       inline ePyObject(PyObject *ob);
+       inline ePyObject(PyDictObject *ob);
+       inline ePyObject(PyTupleObject *ob);
+       inline ePyObject(PyListObject *ob);
+       inline ePyObject(PyStringObject *ob);
+       operator bool() { return !!m_ob; }
+       ePyObject &operator=(const ePyObject &);
+       ePyObject &operator=(PyObject *);
+       ePyObject &operator=(PyDictObject *ob) { return operator=((PyObject*)ob); }
+       ePyObject &operator=(PyTupleObject *ob) { return operator=((PyObject*)ob); }
+       ePyObject &operator=(PyListObject *ob) { return operator=((PyObject*)ob); }
+       ePyObject &operator=(PyStringObject *ob) { return operator=((PyObject*)ob); }
+       operator PyObject*();
+       operator PyTupleObject*() { return (PyTupleObject*)operator PyObject*(); }
+       operator PyListObject*() { return (PyListObject*)operator PyObject*(); }
+       operator PyStringObject*() { return (PyStringObject*)operator PyObject*(); }
+       operator PyDictObject*() { return (PyDictObject*)operator PyObject*(); }
+       PyObject *operator->() { return operator PyObject*(); }
+#ifdef PYTHON_REFCOUNT_DEBUG
+       void incref(const char *file, int line);
+       void decref(const char *file, int line);
+#else
+       void incref();
+       void decref();
+#endif
+};
 
 
-extern PyObject *New_TestObj();
+inline ePyObject::ePyObject()
+       :m_ob(0)
+#ifdef PYTHON_REFCOUNT_DEBUG
+       ,m_file(0), m_line(0), m_from(0), m_to(0), m_erased(false)
+#endif
+{
+}
+
+inline ePyObject::ePyObject(const ePyObject &ob)
+       :m_ob(ob.m_ob)
+#ifdef PYTHON_REFCOUNT_DEBUG
+       ,m_file(ob.m_file), m_line(ob.m_line)
+       ,m_from(ob.m_from), m_to(ob.m_to), m_erased(ob.m_erased)
+#endif
+{
+}
+
+inline ePyObject::ePyObject(PyObject *ob)
+       :m_ob(ob)
+#ifdef PYTHON_REFCOUNT_DEBUG
+       ,m_file(0), m_line(0), m_from(0), m_to(0), m_erased(false)
+#endif
+{
+}
+
+inline ePyObject::ePyObject(PyDictObject *ob)
+       :m_ob((PyObject*)ob)
+#ifdef PYTHON_REFCOUNT_DEBUG
+       ,m_file(0), m_line(0), m_from(0), m_to(0), m_erased(false)
+#endif
+{
+}
+
+inline ePyObject::ePyObject(PyTupleObject *ob)
+       :m_ob((PyObject*)ob)
+#ifdef PYTHON_REFCOUNT_DEBUG
+       ,m_file(0), m_line(0), m_from(0), m_to(0), m_erased(false)
+#endif
+{
+}
+
+inline ePyObject::ePyObject(PyListObject *ob)
+       :m_ob((PyObject*)ob)
+#ifdef PYTHON_REFCOUNT_DEBUG
+       ,m_file(0), m_line(0), m_from(0), m_to(0), m_erased(false)
+#endif
+{
+}
+
+inline ePyObject::ePyObject(PyStringObject *ob)
+       :m_ob((PyObject*)ob)
+#ifdef PYTHON_REFCOUNT_DEBUG
+       ,m_file(0), m_line(0), m_from(0), m_to(0), m_erased(false)
+#endif
+{
+}
+
+#ifndef PYTHON_REFCOUNT_DEBUG
+inline ePyObject &ePyObject::operator=(PyObject *ob)
+{
+       m_ob=ob;
+       return *this;
+}
+
+inline ePyObject &ePyObject::operator=(const ePyObject &ob)
+{
+       m_ob=ob.m_ob;
+       return *this;
+}
+
+inline ePyObject::operator PyObject*()
+{
+       return m_ob;
+}
+
+inline void ePyObject::incref()
+{
+       Py_INCREF(m_ob);
+}
+
+inline void ePyObject::decref()
+{
+       Py_DECREF(m_ob);
+}
+
+#endif // ! PYTHON_REFCOUNT_DEBUG
+
+#endif  // !SWIG && !SKIP_PART1
+
+#ifndef SKIP_PART2
 
 class TestObj
 {
 
 class TestObj
 {
@@ -19,19 +149,76 @@ public:
 };
 TEMPLATE_TYPEDEF(ePtr<TestObj>, TestObjPtr);
 
 };
 TEMPLATE_TYPEDEF(ePtr<TestObj>, TestObjPtr);
 
+extern PyObject *New_TestObj();
+
 #ifndef SWIG
 #ifndef SWIG
-/* class ePyObject
+
+#ifdef PYTHON_REFCOUNT_DEBUG
+inline void Impl_Py_DECREF(const char* file, int line, const ePyObject &obj)
 {
 {
-       void *m_object;
-public:
-       ePyObject(void *ptr);
-       ePyObject(ePyObject &p);
-       ePyObject();
-       ePyObject &operator=(ePyObject &p);
-       ePyObject &operator=(void *p);
-       ~ePyObject();
-       void *get() { return m_object; }
-}; */
+       ((ePyObject*)(&obj))->decref(file, line);
+}
+
+inline void Impl_Py_INCREF(const char* file, int line, const ePyObject &obj)
+{
+       ((ePyObject*)(&obj))->incref(file, line);
+}
+
+inline void Impl_Py_XDECREF(const char* file, int line, const ePyObject &obj)
+{
+       if (obj)
+               ((ePyObject*)(&obj))->decref(file, line);
+}
+
+inline void Impl_Py_XINCREF(const char* file, int line, const ePyObject &obj)
+{
+       if (obj)
+               ((ePyObject*)(&obj))->incref(file, line);
+}
+#else
+inline void Impl_Py_DECREF(const ePyObject &obj)
+{
+       ((ePyObject*)(&obj))->decref();
+}
+
+inline void Impl_Py_INCREF(const ePyObject &obj)
+{
+       ((ePyObject*)(&obj))->incref();
+}
+
+inline void Impl_Py_XDECREF(const ePyObject &obj)
+{
+       if (obj)
+               ((ePyObject*)(&obj))->decref();
+}
+
+inline void Impl_Py_XINCREF(const ePyObject &obj)
+{
+       if (obj)
+               ((ePyObject*)(&obj))->incref();
+}
+#endif
+
+inline void Impl_DECREF(PyObject *ob)
+{
+       Py_DECREF(ob);
+}
+#define Org_Py_DECREF(obj) Impl_DECREF(obj)
+#undef Py_DECREF
+#undef Py_XDECREF
+#undef Py_INCREF
+#undef Py_XINCREF
+#ifdef PYTHON_REFCOUNT_DEBUG
+#define Py_DECREF(obj) Impl_Py_DECREF(__FILE__, __LINE__, obj)
+#define Py_XDECREF(obj) Impl_Py_XDECREF(__FILE__, __LINE__, obj)
+#define Py_INCREF(obj) Impl_Py_INCREF(__FILE__, __LINE__, obj)
+#define Py_XINCREF(obj) Impl_Py_XINCREF(__FILE__, __LINE__, obj)
+#else
+#define Py_DECREF(obj) Impl_Py_DECREF(obj)
+#define Py_XDECREF(obj) Impl_Py_XDECREF(obj)
+#define Py_INCREF(obj) Impl_Py_INCREF(obj)
+#define Py_XINCREF(obj) Impl_Py_XINCREF(obj)
+#endif
 
 class ePython
 {
 
 class ePython
 {
@@ -39,10 +226,12 @@ public:
        ePython();
        ~ePython();
        int execute(const std::string &pythonfile, const std::string &funcname);
        ePython();
        ~ePython();
        int execute(const std::string &pythonfile, const std::string &funcname);
-       static int call(PyObject *pFunc, PyObject *args);
-       static PyObject *resolve(const std::string &pythonfile, const std::string &funcname);
+       static int call(ePyObject pFunc, ePyObject args);
+       static ePyObject resolve(const std::string &pythonfile, const std::string &funcname);
 private:
 };
 private:
 };
+
 #endif // SWIG
 #endif // SWIG
+#endif // SKIP_PART2
 
 
-#endif
+#endif // __lib_python_python_class_h
index c9be969..c094b64 100644 (file)
@@ -18,11 +18,13 @@ typedef x y; \
 #define SWIG_OUTPUT OUTPUT
 #define SWIG_NAMED_OUTPUT(x) OUTPUT
 #define SWIG_VOID(x) void
 #define SWIG_OUTPUT OUTPUT
 #define SWIG_NAMED_OUTPUT(x) OUTPUT
 #define SWIG_VOID(x) void
+#define SWIG_PYOBJECT(x) PyObject*
 #else
 #define SWIG_INPUT
 #define SWIG_OUTPUT
 #define SWIG_NAMED_OUTPUT(x) x
 #define SWIG_VOID(x) x
 #else
 #define SWIG_INPUT
 #define SWIG_OUTPUT
 #define SWIG_NAMED_OUTPUT(x) x
 #define SWIG_VOID(x) x
+#define SWIG_PYOBJECT(x) x
 #endif
 
 #endif
 #endif
 
 #endif
index 1dd419c..25935b2 100644 (file)
@@ -460,7 +460,7 @@ class iCueSheet: public iObject
 public:
                        /* returns a list of (pts, what)-tuples */
        virtual PyObject *getCutList() = 0;
 public:
                        /* returns a list of (pts, what)-tuples */
        virtual PyObject *getCutList() = 0;
-       virtual void setCutList(PyObject *list) = 0;
+       virtual void setCutList(SWIG_PYOBJECT(ePyObject) list) = 0;
        virtual void setCutListEnable(int enable) = 0;
        enum { cutIn = 0, cutOut = 1, cutMark = 2 };
 };
        virtual void setCutListEnable(int enable) = 0;
        enum { cutIn = 0, cutOut = 1, cutMark = 2 };
 };
@@ -473,7 +473,7 @@ class PyList;
 class iSubtitleOutput: public iObject
 {
 public:
 class iSubtitleOutput: public iObject
 {
 public:
-       virtual RESULT enableSubtitles(eWidget *parent, PyObject *entry)=0;
+       virtual RESULT enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) entry)=0;
        virtual RESULT disableSubtitles(eWidget *parent)=0;
        virtual PyObject *getSubtitleList()=0;
        virtual PyObject *getCachedSubtitle()=0;
        virtual RESULT disableSubtitles(eWidget *parent)=0;
        virtual PyObject *getSubtitleList()=0;
        virtual PyObject *getCachedSubtitle()=0;
@@ -575,7 +575,12 @@ public:
 
 TEMPLATE_TYPEDEF(ePtr<iRecordableService>, iRecordableServicePtr);
 
 
 TEMPLATE_TYPEDEF(ePtr<iRecordableService>, iRecordableServicePtr);
 
-PyObject *PyFrom(ePtr<iRecordableService>&);  // implemented in servicedvbrecord.cpp
+extern PyObject *New_iRecordableServicePtr(const ePtr<iRecordableService> &ref); // defined in enigma_python.i
+
+inline PyObject *PyFrom(ePtr<iRecordableService> &c)
+{
+       return New_iRecordableServicePtr(c);
+}
 
 // TEMPLATE_TYPEDEF(std::list<eServiceReference>, eServiceReferenceList);
 
 
 // TEMPLATE_TYPEDEF(std::list<eServiceReference>, eServiceReferenceList);
 
index 8ac7ebd..181ec22 100644 (file)
@@ -4,7 +4,7 @@
 #include <lib/service/service.h>
 #include <lib/base/init_num.h>
 #include <lib/base/init.h>
 #include <lib/service/service.h>
 #include <lib/base/init_num.h>
 #include <lib/base/init.h>
-#include <Python.h>
+#include <lib/python/python.h>
 
 eServiceReference::eServiceReference(const std::string &string)
 {
 
 eServiceReference::eServiceReference(const std::string &string)
 {
index 71c2ae6..627ccec 100644 (file)
@@ -406,7 +406,7 @@ RESULT eDVBServiceList::getContent(std::list<eServiceReference> &list, bool sort
 //   unknown format string chars are returned as python None values !
 PyObject *eDVBServiceList::getContent(const char* format, bool sorted)
 {
 //   unknown format string chars are returned as python None values !
 PyObject *eDVBServiceList::getContent(const char* format, bool sorted)
 {
-       PyObject *ret=0;
+       ePyObject ret;
        std::list<eServiceReference> tmplist;
        int retcount=1;
 
        std::list<eServiceReference> tmplist;
        int retcount=1;
 
@@ -428,10 +428,10 @@ PyObject *eDVBServiceList::getContent(const char* format, bool sorted)
                for (int cnt=0; cnt < services; ++cnt)
                {
                        eServiceReference &ref=*it++;
                for (int cnt=0; cnt < services; ++cnt)
                {
                        eServiceReference &ref=*it++;
-                       PyObject *tuple = retcount > 1 ? PyTuple_New(retcount) : 0;
+                       ePyObject tuple = retcount > 1 ? PyTuple_New(retcount) : 0;
                        for (int i=0; i < retcount; ++i)
                        {
                        for (int i=0; i < retcount; ++i)
                        {
-                               PyObject *tmp=0;
+                               ePyObject tmp;
                                switch(format[i])
                                {
                                case 'R':  // service reference (swig)object
                                switch(format[i])
                                {
                                case 'R':  // service reference (swig)object
@@ -478,7 +478,7 @@ PyObject *eDVBServiceList::getContent(const char* format, bool sorted)
                                PyList_SET_ITEM(ret, cnt, tuple);
                }
        }
                                PyList_SET_ITEM(ret, cnt, tuple);
                }
        }
-       return ret ? ret : PyList_New(0);
+       return ret ? (PyObject*)ret : (PyObject*)PyList_New(0);
 }
 
 RESULT eDVBServiceList::getNext(eServiceReference &ref)
 }
 
 RESULT eDVBServiceList::getNext(eServiceReference &ref)
@@ -1383,7 +1383,7 @@ int eDVBServiceBase::getFrontendInfo(int w)
 
 PyObject *eDVBServiceBase::getFrontendData(bool original)
 {
 
 PyObject *eDVBServiceBase::getFrontendData(bool original)
 {
-       PyObject *ret=0;
+       ePyObject ret;
 
        eUsePtr<iDVBChannel> channel;
        if(!m_service_handler.getChannel(channel))
 
        eUsePtr<iDVBChannel> channel;
        if(!m_service_handler.getChannel(channel))
@@ -1401,8 +1401,8 @@ PyObject *eDVBServiceBase::getFrontendData(bool original)
                                        eDVBFrontendParametersSatellite osat;
                                        if (!feparm->getDVBS(osat))
                                        {
                                        eDVBFrontendParametersSatellite osat;
                                        if (!feparm->getDVBS(osat))
                                        {
-                                               void PutToDict(PyObject *, const char*, long);
-                                               void PutToDict(PyObject *, const char*, const char*);
+                                               void PutToDict(ePyObject &, const char*, long);
+                                               void PutToDict(ePyObject &, const char*, const char*);
                                                PutToDict(ret, "orbital_position", osat.orbital_position);
                                                const char *tmp = "UNKNOWN";
                                                switch(osat.polarisation)
                                                PutToDict(ret, "orbital_position", osat.orbital_position);
                                                const char *tmp = "UNKNOWN";
                                                switch(osat.polarisation)
@@ -1526,11 +1526,11 @@ RESULT eDVBServicePlay::activateTimeshift()
 
 PyObject *eDVBServicePlay::getCutList()
 {
 
 PyObject *eDVBServicePlay::getCutList()
 {
-       PyObject *list = PyList_New(0);
+       ePyObject list = PyList_New(0);
        
        for (std::multiset<struct cueEntry>::iterator i(m_cue_entries.begin()); i != m_cue_entries.end(); ++i)
        {
        
        for (std::multiset<struct cueEntry>::iterator i(m_cue_entries.begin()); i != m_cue_entries.end(); ++i)
        {
-               PyObject *tuple = PyTuple_New(2);
+               ePyObject tuple = PyTuple_New(2);
                PyTuple_SetItem(tuple, 0, PyLong_FromLongLong(i->where));
                PyTuple_SetItem(tuple, 1, PyInt_FromLong(i->what));
                PyList_Append(list, tuple);
                PyTuple_SetItem(tuple, 0, PyLong_FromLongLong(i->where));
                PyTuple_SetItem(tuple, 1, PyInt_FromLong(i->what));
                PyList_Append(list, tuple);
@@ -1540,7 +1540,7 @@ PyObject *eDVBServicePlay::getCutList()
        return list;
 }
 
        return list;
 }
 
-void eDVBServicePlay::setCutList(PyObject *list)
+void eDVBServicePlay::setCutList(ePyObject list)
 {
        if (!PyList_Check(list))
                return;
 {
        if (!PyList_Check(list))
                return;
@@ -1551,7 +1551,7 @@ void eDVBServicePlay::setCutList(PyObject *list)
        
        for (i=0; i<size; ++i)
        {
        
        for (i=0; i<size; ++i)
        {
-               PyObject *tuple = PyList_GetItem(list, i);
+               ePyObject tuple = PyList_GetItem(list, i);
                if (!PyTuple_Check(tuple))
                {
                        eDebug("non-tuple in cutlist");
                if (!PyTuple_Check(tuple))
                {
                        eDebug("non-tuple in cutlist");
@@ -1562,7 +1562,7 @@ void eDVBServicePlay::setCutList(PyObject *list)
                        eDebug("cutlist entries need to be a 2-tuple");
                        continue;
                }
                        eDebug("cutlist entries need to be a 2-tuple");
                        continue;
                }
-               PyObject *ppts = PyTuple_GetItem(tuple, 0), *ptype = PyTuple_GetItem(tuple, 1);
+               ePyObject ppts = PyTuple_GetItem(tuple, 0), ptype = PyTuple_GetItem(tuple, 1);
                if (!(PyLong_Check(ppts) && PyInt_Check(ptype)))
                {
                        eDebug("cutlist entries need to be (pts, type)-tuples (%d %d)", PyLong_Check(ppts), PyInt_Check(ptype));
                if (!(PyLong_Check(ppts) && PyInt_Check(ptype)))
                {
                        eDebug("cutlist entries need to be (pts, type)-tuples (%d %d)", PyLong_Check(ppts), PyInt_Check(ptype));
@@ -1984,12 +1984,12 @@ void eDVBServicePlay::cutlistToCuesheet()
        m_cue->commitSpans();
 }
 
        m_cue->commitSpans();
 }
 
-RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, PyObject *tuple)
+RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, ePyObject tuple)
 {
        if (m_subtitle_widget)
                disableSubtitles(parent);
 
 {
        if (m_subtitle_widget)
                disableSubtitles(parent);
 
-       PyObject *entry = 0;
+       ePyObject entry;
        int tuplesize = PyTuple_Size(tuple);
        int type = 0;
 
        int tuplesize = PyTuple_Size(tuple);
        int type = 0;
 
@@ -2109,7 +2109,7 @@ PyObject *eDVBServicePlay::getCachedSubtitle()
                {
                        unsigned int data = (unsigned int)tmp;
                        int pid = (data&0xFFFF0000)>>16;
                {
                        unsigned int data = (unsigned int)tmp;
                        int pid = (data&0xFFFF0000)>>16;
-                       PyObject *tuple = PyTuple_New(4);
+                       ePyObject tuple = PyTuple_New(4);
                        eDVBServicePMTHandler::program program;
                        eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler;
                        if (!h.getProgramInfo(program))
                        eDVBServicePMTHandler::program program;
                        eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler;
                        if (!h.getProgramInfo(program))
@@ -2137,7 +2137,7 @@ PyObject *eDVBServicePlay::getSubtitleList()
                return Py_None;
        }
        
                return Py_None;
        }
        
-       PyObject *l = PyList_New(0);
+       ePyObject l = PyList_New(0);
        std::set<int> added_ttx_pages;
 
        std::set<eDVBServicePMTHandler::subtitleStream> &subs =
        std::set<int> added_ttx_pages;
 
        std::set<eDVBServicePMTHandler::subtitleStream> &subs =
@@ -2161,7 +2161,7 @@ PyObject *eDVBServicePlay::getSubtitleList()
                                        int hash = magazine_number << 8 | page_number;
                                        if (added_ttx_pages.find(hash) == added_ttx_pages.end())
                                        {
                                        int hash = magazine_number << 8 | page_number;
                                        if (added_ttx_pages.find(hash) == added_ttx_pages.end())
                                        {
-                                               PyObject *tuple = PyTuple_New(5);
+                                               ePyObject tuple = PyTuple_New(5);
                                                PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(1));
                                                PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid));
                                                PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(page_number));
                                                PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(1));
                                                PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid));
                                                PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(page_number));
@@ -2176,7 +2176,7 @@ PyObject *eDVBServicePlay::getSubtitleList()
                                case 0x10 ... 0x13:
                                case 0x20 ... 0x23: // dvb subtitles
                                {
                                case 0x10 ... 0x13:
                                case 0x20 ... 0x23: // dvb subtitles
                                {
-                                       PyObject *tuple = PyTuple_New(5);
+                                       ePyObject tuple = PyTuple_New(5);
                                        PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(0));
                                        PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid));
                                        PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(it->composition_page_id));
                                        PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(0));
                                        PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid));
                                        PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(it->composition_page_id));
@@ -2198,7 +2198,7 @@ PyObject *eDVBServicePlay::getSubtitleList()
                int hash = magazine_number << 8 | page_number;
                if (added_ttx_pages.find(hash) == added_ttx_pages.end())
                {
                int hash = magazine_number << 8 | page_number;
                if (added_ttx_pages.find(hash) == added_ttx_pages.end())
                {
-                       PyObject *tuple = PyTuple_New(5);
+                       ePyObject tuple = PyTuple_New(5);
                        PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(1));
                        PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid));
                        PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(page_number));
                        PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(1));
                        PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid));
                        PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(page_number));
index 27f48b5..979a9ca 100644 (file)
@@ -156,11 +156,11 @@ public:
 
                // iCueSheet
        PyObject *getCutList();
 
                // iCueSheet
        PyObject *getCutList();
-       void setCutList(PyObject *);
+       void setCutList(SWIG_PYOBJECT(ePyObject));
        void setCutListEnable(int enable);
        
                // iSubtitleOutput
        void setCutListEnable(int enable);
        
                // iSubtitleOutput
-       RESULT enableSubtitles(eWidget *parent, PyObject *entry);
+       RESULT enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) entry);
        RESULT disableSubtitles(eWidget *parent);
        PyObject *getSubtitleList();
        PyObject *getCachedSubtitle();
        RESULT disableSubtitles(eWidget *parent);
        PyObject *getSubtitleList();
        PyObject *getCachedSubtitle();
index 6164ca1..d3c3704 100644 (file)
@@ -5,13 +5,6 @@
 
 DEFINE_REF(eDVBServiceRecord);
 
 
 DEFINE_REF(eDVBServiceRecord);
 
-extern PyObject *New_iRecordableServicePtr(const ePtr<iRecordableService> &ref); // defined in enigma_python.i
-
-PyObject *PyFrom(ePtr<iRecordableService> &c)
-{
-       return New_iRecordableServicePtr(c);
-}
-
 eDVBServiceRecord::eDVBServiceRecord(const eServiceReferenceDVB &ref): m_ref(ref)
 {
        CONNECT(m_service_handler.serviceEvent, eDVBServiceRecord::serviceEvent);
 eDVBServiceRecord::eDVBServiceRecord(const eServiceReferenceDVB &ref): m_ref(ref)
 {
        CONNECT(m_service_handler.serviceEvent, eDVBServiceRecord::serviceEvent);
index 1694885..b002321 100644 (file)
@@ -186,7 +186,7 @@ RESULT eServiceFS::getContent(std::list<eServiceReference> &list, bool sorted)
 //   unknown format string chars are returned as python None values !
 PyObject *eServiceFS::getContent(const char* format, bool sorted)
 {
 //   unknown format string chars are returned as python None values !
 PyObject *eServiceFS::getContent(const char* format, bool sorted)
 {
-       PyObject *ret=0;
+       ePyObject ret;
        std::list<eServiceReference> tmplist;
        int retcount=1;
 
        std::list<eServiceReference> tmplist;
        int retcount=1;
 
@@ -208,10 +208,10 @@ PyObject *eServiceFS::getContent(const char* format, bool sorted)
                for (int cnt=0; cnt < services; ++cnt)
                {
                        eServiceReference &ref=*it++;
                for (int cnt=0; cnt < services; ++cnt)
                {
                        eServiceReference &ref=*it++;
-                       PyObject *tuple = retcount > 1 ? PyTuple_New(retcount) : 0;
+                       ePyObject tuple = retcount > 1 ? PyTuple_New(retcount) : 0;
                        for (int i=0; i < retcount; ++i)
                        {
                        for (int i=0; i < retcount; ++i)
                        {
-                               PyObject *tmp=0;
+                               ePyObject tmp;
                                switch(format[i])
                                {
                                case 'R':  // service reference (swig)object
                                switch(format[i])
                                {
                                case 'R':  // service reference (swig)object
@@ -258,7 +258,7 @@ PyObject *eServiceFS::getContent(const char* format, bool sorted)
                                PyList_SET_ITEM(ret, cnt, tuple);
                }
        }
                                PyList_SET_ITEM(ret, cnt, tuple);
                }
        }
-       return ret ? ret : PyList_New(0);
+       return ret ? (PyObject*)ret : (PyObject*)PyList_New(0);
 }
 
 RESULT eServiceFS::getNext(eServiceReference &ptr)
 }
 
 RESULT eServiceFS::getNext(eServiceReference &ptr)
index abd10f3..479718d 100644 (file)
@@ -35,7 +35,7 @@ public:
        virtual ~eServiceFS();
        
        RESULT getContent(std::list<eServiceReference> &list, bool sorted=false);
        virtual ~eServiceFS();
        
        RESULT getContent(std::list<eServiceReference> &list, bool sorted=false);
-       RESULT getContent(PyObject *list, bool sorted=false);
+       RESULT getContent(SWIG_PYOBJECT(ePyObject) list, bool sorted=false);
        PyObject *getContent(const char *format, bool sorted=false);
        RESULT getNext(eServiceReference &ptr);
        int compareLessEqual(const eServiceReference &, const eServiceReference &);
        PyObject *getContent(const char *format, bool sorted=false);
        RESULT getNext(eServiceReference &ptr);
        int compareLessEqual(const eServiceReference &, const eServiceReference &);
index 938ddd2..b646394 100644 (file)
@@ -172,7 +172,7 @@ void handleFatalSignal(int signum, siginfo_t *si, void *ctx)
        ucontext_t *uc = (ucontext_t*)ctx;
        eDebug("KILLED BY signal %d", signum);
 #ifndef NO_OOPS_SUPPORT
        ucontext_t *uc = (ucontext_t*)ctx;
        eDebug("KILLED BY signal %d", signum);
 #ifndef NO_OOPS_SUPPORT
-       oops(uc->uc_mcontext, signum == SIGSEGV);
+       oops(uc->uc_mcontext, signum == SIGSEGV || signum == SIGABRT);
 #endif
        eDebug("-------");
        bsodFatal();
 #endif
        eDebug("-------");
        bsodFatal();
@@ -191,6 +191,7 @@ void bsodCatchSignals()
        sigaction(SIGSEGV, &act, 0);
        sigaction(SIGILL, &act, 0);
        sigaction(SIGBUS, &act, 0);
        sigaction(SIGSEGV, &act, 0);
        sigaction(SIGILL, &act, 0);
        sigaction(SIGBUS, &act, 0);
+       sigaction(SIGABRT, &act, 0);
 }
 
 void bsodLogInit()
 }
 
 void bsodLogInit()