SystemPlugins/Videomode: show HDMI on DM500HD instead of DVI
[enigma2.git] / lib / python / python.h
index d0fe92a878c40dc560f5a46f0c080c4ead3b88de..52ec6c1eaba64b86ad37e2a5137c1669063f4746 100644 (file)
@@ -4,9 +4,9 @@
        #define __lib_python_python_class_h
 #endif
 
        #define __lib_python_python_class_h
 #endif
 
+#include <Python.h>
 #include <string>
 #include <lib/base/object.h>
 #include <string>
 #include <lib/base/object.h>
-#include <Python.h>
 
 #if !defined(SKIP_PART1) && !defined(SWIG)
 class ePyObject
 
 #if !defined(SKIP_PART1) && !defined(SWIG)
 class ePyObject
@@ -24,6 +24,7 @@ public:
 #ifdef PYTHON_REFCOUNT_DEBUG
        inline ePyObject(PyObject *ob, const char *file, int line);
 #endif
 #ifdef PYTHON_REFCOUNT_DEBUG
        inline ePyObject(PyObject *ob, const char *file, int line);
 #endif
+       inline ePyObject(PyVarObject *ob);
        inline ePyObject(PyDictObject *ob);
        inline ePyObject(PyTupleObject *ob);
        inline ePyObject(PyListObject *ob);
        inline ePyObject(PyDictObject *ob);
        inline ePyObject(PyTupleObject *ob);
        inline ePyObject(PyListObject *ob);
@@ -32,11 +33,13 @@ public:
        operator bool() { return !!m_ob; }
        ePyObject &operator=(const ePyObject &);
        ePyObject &operator=(PyObject *);
        operator bool() { return !!m_ob; }
        ePyObject &operator=(const ePyObject &);
        ePyObject &operator=(PyObject *);
+       ePyObject &operator=(PyVarObject *ob) { return operator=((PyObject*)ob); }
        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*();
        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 PyVarObject*() { return (PyVarObject*)operator PyVarObject*(); }
        operator PyTupleObject*() { return (PyTupleObject*)operator PyObject*(); }
        operator PyListObject*() { return (PyListObject*)operator PyObject*(); }
        operator PyStringObject*() { return (PyStringObject*)operator PyObject*(); }
        operator PyTupleObject*() { return (PyTupleObject*)operator PyObject*(); }
        operator PyListObject*() { return (PyListObject*)operator PyObject*(); }
        operator PyStringObject*() { return (PyStringObject*)operator PyObject*(); }
@@ -84,6 +87,14 @@ inline ePyObject::ePyObject(PyObject *ob, const char* file, int line)
 }
 #endif
 
 }
 #endif
 
+inline ePyObject::ePyObject(PyVarObject *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(PyDictObject *ob)
        :m_ob((PyObject*)ob)
 #ifdef PYTHON_REFCOUNT_DEBUG
 inline ePyObject::ePyObject(PyDictObject *ob)
        :m_ob((PyObject*)ob)
 #ifdef PYTHON_REFCOUNT_DEBUG
@@ -149,18 +160,7 @@ inline void ePyObject::decref()
 #endif  // !SWIG && !SKIP_PART1
 
 #ifndef SKIP_PART2
 #endif  // !SWIG && !SKIP_PART1
 
 #ifndef SKIP_PART2
-
-class TestObj
-{
-DECLARE_REF(TestObj);
-public:
-       TestObj();
-       ~TestObj();
-};
-TEMPLATE_TYPEDEF(ePtr<TestObj>, TestObjPtr);
-
 #ifndef SWIG
 #ifndef SWIG
-extern PyObject *New_TestObj();
 #ifdef PYTHON_REFCOUNT_DEBUG
 inline void Impl_Py_DECREF(const char* file, int line, const ePyObject &obj)
 {
 #ifdef PYTHON_REFCOUNT_DEBUG
 inline void Impl_Py_DECREF(const char* file, int line, const ePyObject &obj)
 {
@@ -233,11 +233,6 @@ inline ePyObject Impl_PyLong_FromLongLong(const char* file, int line, long long
        return ePyObject(PyLong_FromLongLong(val), file, line);
 }
 
        return ePyObject(PyLong_FromLongLong(val), file, line);
 }
 
-inline ePyObject Impl_New_TestObj(const char* file, int line)
-{
-       return ePyObject(New_TestObj(), file, line);
-}
-
 inline ePyObject Impl_PyList_GET_ITEM(const char *file, int line, ePyObject list, unsigned int pos)
 {
        return ePyObject(PyList_GET_ITEM(list, pos), file, line);
 inline ePyObject Impl_PyList_GET_ITEM(const char *file, int line, ePyObject list, unsigned int pos)
 {
        return ePyObject(PyList_GET_ITEM(list, pos), file, line);
@@ -319,11 +314,6 @@ inline ePyObject Impl_PyLong_FromLongLong(long long val)
        return PyLong_FromLongLong(val);
 }
 
        return PyLong_FromLongLong(val);
 }
 
-inline ePyObject Impl_New_TestObj()
-{
-       return New_TestObj();
-}
-
 inline ePyObject Impl_PyList_GET_ITEM(ePyObject list, unsigned int pos)
 {
        return PyList_GET_ITEM(list, pos);
 inline ePyObject Impl_PyList_GET_ITEM(ePyObject list, unsigned int pos)
 {
        return PyList_GET_ITEM(list, pos);
@@ -335,10 +325,16 @@ inline ePyObject Impl_PyTuple_GET_ITEM(ePyObject list, unsigned int pos)
 }
 #endif
 
 }
 #endif
 
+inline void Impl_INCREF(PyObject *ob)
+{
+       Py_INCREF(ob);
+}
+
 inline void Impl_DECREF(PyObject *ob)
 {
        Py_DECREF(ob);
 }
 inline void Impl_DECREF(PyObject *ob)
 {
        Py_DECREF(ob);
 }
+#define Org_Py_INCREF(obj) Impl_INCREF(obj)
 #define Org_Py_DECREF(obj) Impl_DECREF(obj)
 #undef Py_DECREF
 #undef Py_XDECREF
 #define Org_Py_DECREF(obj) Impl_DECREF(obj)
 #undef Py_DECREF
 #undef Py_XDECREF
@@ -360,7 +356,6 @@ inline void Impl_DECREF(PyObject *ob)
 #define PyLong_FromLong(val) Impl_PyLong_FromLong(__FILE__, __LINE__, val)
 #define PyLong_FromUnsignedLong(val) Impl_PyLong_FromUnsignedLong(__FILE__, __LINE__, val)
 #define PyLong_FromLongLong(val) Impl_PyLong_FromLongLong(__FILE__, __LINE__, val)
 #define PyLong_FromLong(val) Impl_PyLong_FromLong(__FILE__, __LINE__, val)
 #define PyLong_FromUnsignedLong(val) Impl_PyLong_FromUnsignedLong(__FILE__, __LINE__, val)
 #define PyLong_FromLongLong(val) Impl_PyLong_FromLongLong(__FILE__, __LINE__, val)
-#define NEW_TestObj(...) Impl_New_TestObj(__FILE__, __LINE__)
 #define PyList_GET_ITEM(list, pos) Impl_PyList_GET_ITEM(__FILE__, __LINE__, list, pos)
 #define PyTuple_GET_ITEM(list, pos) Impl_PyTuple_GET_ITEM(__FILE__, __LINE__, list, pos)
 #else
 #define PyList_GET_ITEM(list, pos) Impl_PyList_GET_ITEM(__FILE__, __LINE__, list, pos)
 #define PyTuple_GET_ITEM(list, pos) Impl_PyTuple_GET_ITEM(__FILE__, __LINE__, list, pos)
 #else
@@ -377,7 +372,6 @@ inline void Impl_DECREF(PyObject *ob)
 #define PyLong_FromLong(val) Impl_PyLong_FromLong(val)
 #define PyLong_FromUnsignedLong(val) Impl_PyLong_FromUnsignedLong(val)
 #define PyLong_FromLongLong(val) Impl_PyLong_FromLongLong(val)
 #define PyLong_FromLong(val) Impl_PyLong_FromLong(val)
 #define PyLong_FromUnsignedLong(val) Impl_PyLong_FromUnsignedLong(val)
 #define PyLong_FromLongLong(val) Impl_PyLong_FromLongLong(val)
-#define NEW_TestObj(...) Impl_New_TestObj()
 #define PyList_GET_ITEM(list, pos) Impl_PyList_GET_ITEM(list, pos)
 #define PyTuple_GET_ITEM(list, pos) Impl_PyTuple_GET_ITEM(list, pos)
 #endif
 #define PyList_GET_ITEM(list, pos) Impl_PyList_GET_ITEM(list, pos)
 #define PyTuple_GET_ITEM(list, pos) Impl_PyTuple_GET_ITEM(list, pos)
 #endif
@@ -387,6 +381,7 @@ class ePython
 public:
        ePython();
        ~ePython();
 public:
        ePython();
        ~ePython();
+       int execFile(const char *file);
        int execute(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);
        int execute(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);