X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/54bd4123728628a6f77bad2584b70d1353a91666..d1ba8203832c54b4a98978c6033296183a24b4d0:/lib/python/enigma_python.i diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 270dd7f4..79f9296e 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -29,18 +29,12 @@ Oh, things like "operator= is private in this context" etc. -is usually caused by not marking PSignals as immutable. - +is usually caused by not marking PSignals as immutable. */ -%define RefCount(...) -%typemap(newfree) __VA_ARGS__ * { eDebug("adding ref"); $1->AddRef(); } -%extend __VA_ARGS__ { ~__VA_ARGS__() { eDebug("removing ref!"); self->Release(); } } -%ignore __VA_ARGS__::~__VA_ARGS__(); -%enddef - %module enigma %{ + #define SWIG_COMPILE #include #include @@ -48,43 +42,81 @@ is usually caused by not marking PSignals as immutable. #include #include #include +#include + +#include #include #include +#include +#include +#include +#include #include #include #include +#include +#include +#include #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include extern void runMainloop(); extern void quitMainloop(); +extern void setLCD(const char *c); +extern void setLCDClock(const char *c); extern PSignal1 &keyPressedSignal(); %} -RefCount(eListboxPythonStringContent) -RefCount(eListboxServiceContent) -RefCount(eComponentScan) +%feature("ref") iObject "$this->AddRef(); eDebug(\"AddRef (%s:%d)!\", __FILE__, __LINE__); " +%feature("unref") iObject "$this->Release(); eDebug(\"Release! %s:%d\", __FILE__, __LINE__); " + +/* this magic allows smartpointer to be used as OUTPUT arguments, i.e. call-by-reference-styled return value. */ + +%define %typemap_output_ptr(Type) + %typemap(in,numinputs=0) Type *OUTPUT ($*1_ltype temp), + Type &OUTPUT ($*1_ltype temp) + "$1 = new Type;"; + %fragment("t_out_helper"{Type},"header", + fragment="t_output_helper") {} + %typemap(argout,fragment="t_out_helper"{Type}) Type *OUTPUT, Type &OUTPUT + "$result = t_output_helper($result, (SWIG_NewPointerObj((void*)($1), $1_descriptor, 1)));" +%enddef + +%newobject eDebugClassPtr::operator->; #define DEBUG +%include "typemaps.i" %include "stl.i" +%include %include %include %include %include %include %include + %template(eServiceCenterPtr) ePtr; +%include // TODO: embed these... %immutable eButton::selected; +%immutable eInput::changed; %immutable eComponentScan::statusChanged; +%immutable pNavigation::m_event; %include %include @@ -92,14 +124,37 @@ RefCount(eComponentScan) %include %include %include +%include +%include +%include +%include %include %include %include %include %include %include +%include +%include +%include %include %include +%include +%include +%include +%include +%include +%include +%include + +%include +/************** eptr **************/ + +%template(eActionMapPtr) ePtr; +%apply eActionMapPtr OUTPUT { eActionMapPtr &ptr } +%apply eActionMap* *OUTPUT { eActionMap **ptr } + +/************** signals **************/ template class PSignal0 { @@ -131,7 +186,6 @@ public: $1 = $input->get(); } - /************** base **************/ %immutable eTimer::timeout; @@ -151,5 +205,8 @@ public: void runMainloop(); void quitMainloop(); +void setLCD(const char*); +void setLCDClock(const char*); %immutable keyPressed; PSignal1 &keyPressedSignal(); +