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));
}
-void eActionMap::bindAction(const std::string &context, int priority, PyObject *function)
+void eActionMap::bindAction(const std::string &context, int priority, ePyObject function)
{
eActionBinding bnd;
}
}
-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)
{
struct call_entry
{
- PyObject *m_fnc, *m_arg;
+ ePyObject m_fnc, m_arg;
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)
((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;
} 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);
#include <features.h>
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112L
-#include <Python.h>
#include <lib/python/python.h>
#include <string>
#include <map>
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);
// eActionContext *m_context;
std::string m_context; // FIXME
- PyObject *m_fnc;
+ ePyObject m_fnc;
eWidget *m_widget;
int m_id;
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 */
{
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);
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;
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)
{
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()
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;
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. */
- PyObject *poll(PyObject *dict, PyObject *timeout);
+ PyObject *poll(SWIG_PYOBJECT(ePyObject) dict, SWIG_PYOBJECT(ePyObject) timeout);
void interruptPoll();
void reset();
};
#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 (key && PyCallable_Check(m_queryFunc))
{
- PyObject *pArgs = PyTuple_New(1);
+ ePyObject pArgs = PyTuple_New(1);
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)
{
class ePythonConfigQuery
{
- static PyObject *m_queryFunc;
+ static ePyObject m_queryFunc;
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
#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;
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 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);
- PyObject *result = PyObject_CallObject(convertFunc, convertFuncArgs);
+ ePyObject result = PyObject_CallObject(convertFunc, convertFuncArgs);
if (result == NULL)
{
if (service_name)
}
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);
// 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))
}
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);
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
- PyObject *dest_list=PyList_New(0);
+ ePyObject dest_list=PyList_New(0);
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;
int minutes=0;
int tupleSize=PyTuple_Size(item);
int tupleIt=0;
- PyObject *service=NULL;
+ ePyObject service;
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:
}
}
- PyObject *service_name=NULL;
+ ePyObject service_name;
if (must_get_service_name)
{
ePtr<iStaticServiceInformation> sptr;
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)
{
// 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 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);
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);
}
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));
++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)
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);
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 )
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))
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))
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;
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);
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);
PyObject *eDVBFrontend::readTransponderData(bool original)
{
- PyObject *ret=PyDict_New();
+ ePyObject ret=PyDict_New();
if (ret)
{
PyObject *eDVBServicePMTHandler::getCaIds()
{
- PyObject *ret=0;
+ ePyObject ret;
program prog;
}
}
- return ret ? ret : PyList_New(0);
+ return ret ? (PyObject*)ret : (PyObject*)PyList_New(0);
}
int eDVBServicePMTHandler::getProgramInfo(struct program &program)
PyObject *eDVBSatelliteEquipmentControl::get_exclusive_satellites(int tu1, int tu2)
{
- PyObject *ret=0;
+ ePyObject ret;
if (tu1 != tu2)
{
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;
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);
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);
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
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"));
/* 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
{
std::string appName;
int state;
- PyObject *mmiScreen;
+ ePyObject mmiScreen;
int mmiTuplePos;
int mmiScreenReady;
};
-#include "picload.h"
+#include <lib/gdi/picload.h>
#include "picexif.h"
+#include <lib/python/python.h>
#include <png.h>
PyObject *getExif(const char *filename)
{
- PyObject *list = 0;
+ ePyObject list;
Cexif exif;
if(exif.DecodeExif(filename))
{
PyList_SET_ITEM(list, 0, PyString_FromString(exif.m_szLastError));
}
- return list ? list : PyList_New(0);
+ return list ? (PyObject*)list : (PyObject*)PyList_New(0);
}
//---------------------------------------------------------------------------------------------
#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
eListboxPythonStringContent::eListboxPythonStringContent()
{
- m_list = 0;
}
eListboxPythonStringContent::~eListboxPythonStringContent()
{
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 (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.clippop();
}
-void eListboxPythonStringContent::setList(PyObject *list)
+void eListboxPythonStringContent::setList(ePyObject list)
{
Py_XDECREF(m_list);
if (!PyList_Check(list))
{
- m_list = 0;
+ m_list = ePyObject();
} else
{
m_list = list;
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;
}
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.
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 */
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"))
{
- 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)
/* 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;
/* 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));
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);
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))
RESULT SwigFromPython(ePtr<gPixmap> &res, PyObject *obj);
eListboxPythonMultiContent::eListboxPythonMultiContent()
- :m_buildFunc(0)
{
}
style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);
painter.clear();
- PyObject *items=0;
+ ePyObject items;
if (m_list && cursorValid())
{
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)
{
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:
painter.clippop();
}
-void eListboxPythonMultiContent::setBuildFunc(PyObject *cb)
+void eListboxPythonMultiContent::setBuildFunc(ePyObject cb)
{
if (m_buildFunc)
Py_DECREF(m_buildFunc);
/* 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);
eListboxPythonStringContent();
~eListboxPythonStringContent();
- void setList(PyObject *list);
+ void setList(SWIG_PYOBJECT(ePyObject) list);
PyObject *getCurrentSelection();
int getCurrentSelectionIndex() { return m_cursor; }
void invalidateEntry(int index);
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
class eListboxPythonMultiContent: public eListboxPythonStringContent
{
- PyObject *m_buildFunc;
+ ePyObject m_buildFunc;
public:
eListboxPythonMultiContent();
~eListboxPythonMultiContent();
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;
};
updatePosition();
}
-void ePositionGauge::setInOutList(PyObject *list)
+void ePositionGauge::setInOutList(ePyObject list)
{
if (!PyList_Check(list))
return;
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;
- 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;
void setInColor(const gRGB &color); /* foreground? */
void setPointer(int which, gPixmap *pixmap, const ePoint ¢er);
- void setInOutList(PyObject *list);
+ void setInOutList(SWIG_PYOBJECT(ePyObject) list);
void setForegroundColor(const gRGB &col);
void enableSeekPointer(int enable);
#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)
{
return -1;
}
-extern PyObject *New_iRecordableServicePtr(const ePtr<iRecordableService> &ref); // defined in enigma_python.i
-
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));
#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;
+}
#include <features.h>
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112L
-#include <Python.h>
+
#include <lib/python/python.h>
class PSignal
{
+ ePyObject m_list;
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)
{
PyObject *pArgs = PyTuple_New(0);
callPython(pArgs);
- Py_DECREF(pArgs);
+ Org_Py_DECREF(pArgs);
return Signal0<R>::operator()();
}
};
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);
}
};
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);
}
};
-#include <lib/python/python.h>
#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();
-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()
{
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);
- if (pModule != NULL)
+ if (pModule)
{
pDict = PyModule_GetDict(pModule);
// 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);
return 0;
}
-int ePython::call(PyObject *pFunc, PyObject *pArgs)
+int ePython::call(ePyObject pFunc, ePyObject pArgs)
{
int res = -1;
- PyObject *pValue;
+ ePyObject pValue;
if (pFunc && PyCallable_Check(pFunc))
{
pValue = PyObject_CallObject(pFunc, pArgs);
- if (pValue != NULL)
+ if (pValue)
{
if (PyInt_Check(pValue))
res = PyInt_AsLong(pValue);
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);
- if (pModule != NULL)
+ if (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;
}
-#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 <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
{
};
TEMPLATE_TYPEDEF(ePtr<TestObj>, TestObjPtr);
+extern PyObject *New_TestObj();
+
#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
{
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:
};
+
#endif // SWIG
+#endif // SKIP_PART2
-#endif
+#endif // __lib_python_python_class_h
#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
+#define SWIG_PYOBJECT(x) x
#endif
#endif
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 };
};
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;
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);
#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)
{
// 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;
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)
{
- PyObject *tmp=0;
+ ePyObject tmp;
switch(format[i])
{
case 'R': // service reference (swig)object
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)
PyObject *eDVBServiceBase::getFrontendData(bool original)
{
- PyObject *ret=0;
+ ePyObject ret;
eUsePtr<iDVBChannel> channel;
if(!m_service_handler.getChannel(channel))
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)
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)
{
- 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);
return list;
}
-void eDVBServicePlay::setCutList(PyObject *list)
+void eDVBServicePlay::setCutList(ePyObject list)
{
if (!PyList_Check(list))
return;
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");
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));
m_cue->commitSpans();
}
-RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, PyObject *tuple)
+RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, ePyObject tuple)
{
if (m_subtitle_widget)
disableSubtitles(parent);
- PyObject *entry = 0;
+ ePyObject entry;
int tuplesize = PyTuple_Size(tuple);
int type = 0;
{
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))
return Py_None;
}
- PyObject *l = PyList_New(0);
+ ePyObject l = PyList_New(0);
std::set<int> added_ttx_pages;
std::set<eDVBServicePMTHandler::subtitleStream> &subs =
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));
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));
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));
// iCueSheet
PyObject *getCutList();
- void setCutList(PyObject *);
+ void setCutList(SWIG_PYOBJECT(ePyObject));
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();
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);
// 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;
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)
{
- PyObject *tmp=0;
+ ePyObject tmp;
switch(format[i])
{
case 'R': // service reference (swig)object
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)
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 &);
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();
sigaction(SIGSEGV, &act, 0);
sigaction(SIGILL, &act, 0);
sigaction(SIGBUS, &act, 0);
+ sigaction(SIGABRT, &act, 0);
}
void bsodLogInit()