aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--PySide/QtCore/typesystem_core.xml62
-rw-r--r--PySide/QtNetwork/typesystem_network.xml3
-rw-r--r--libpyside/dynamicqmetaobject.cpp146
-rw-r--r--libpyside/dynamicqmetaobject.h59
-rw-r--r--libpyside/dynamicqmetaobject_p.h69
-rw-r--r--libpyside/pyside.cpp23
-rw-r--r--libpyside/qproperty.cpp161
-rw-r--r--libpyside/qproperty.h114
-rw-r--r--libpyside/qproperty_p.h144
-rw-r--r--libpyside/qsignal.cpp683
-rw-r--r--libpyside/qsignal.h32
-rw-r--r--libpyside/qsignal_p.h40
-rw-r--r--libpyside/qslot.cpp53
-rw-r--r--libpyside/qslot_p.h32
-rw-r--r--libpyside/signalmanager.cpp20
-rw-r--r--libpyside/signalmanager.h2
-rw-r--r--tests/CMakeLists.txt11
-rw-r--r--tests/pysidetest/CMakeLists.txt71
-rw-r--r--tests/pysidetest/global.h2
-rw-r--r--tests/pysidetest/homonymoussignalandmethod_test.py53
-rw-r--r--tests/pysidetest/pyside_global.h1507
-rw-r--r--tests/pysidetest/symbols.filter7
-rw-r--r--tests/pysidetest/testobject.cpp14
-rw-r--r--tests/pysidetest/testobject.h28
-rw-r--r--tests/pysidetest/typesystem_pysidetest.xml6
26 files changed, 2616 insertions, 732 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc8f23467..58f7a523b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,9 +68,9 @@ if(AVOID_PROTECTED_HACK OR WIN32)
endif()
set(BINDING_NAME PySide)
-set(BINDING_API_MAJOR_VERSION "0")
-set(BINDING_API_MINOR_VERSION "4")
-set(BINDING_API_MICRO_VERSION "2")
+set(BINDING_API_MAJOR_VERSION "1")
+set(BINDING_API_MINOR_VERSION "0")
+set(BINDING_API_MICRO_VERSION "0")
set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE)
set(PYSIDE_QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" CACHE STRING "Qt version used to compile PySide" FORCE)
if(ENABLE_VERSION_SUFFIX)
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index 6f9524be0..9b95f6d7b 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -1962,42 +1962,28 @@
timer->setSingleShot(true);
timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()));
- Shiboken::AutoDecRef result(
- PyObject_CallMethod(pyTimer,
- const_cast<char*>("connect"),
- const_cast<char*>("OsO"),
- pyTimer,
- SIGNAL(timeout()),
- pyargs[1])
- );
- Shiboken::BindingManager::instance().destroyWrapper((Shiboken::SbkBaseWrapper *)pyTimer);
- timer->start(%1);
- </inject-code>
- </add-function>
- <!-- Second argument is a PySide.QtCore.Signal. See bug #362. -->
- <add-function signature="singleShot(int, PyObject*)" static="yes">
- <inject-code class="target" position="beginning">
- if (!PyObject_TypeCheck(%2, &amp;PySide::SignalInstance_Type))
- goto Sbk%TYPEFunc_%FUNCTION_NAME_TypeError;
-
- // %FUNCTION_NAME() - disable generation of c++ function call
- Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
- PyObject* pyTimer = Shiboken::SbkType&lt;QTimer>()->tp_new(Shiboken::SbkType&lt;QTimer>(), emptyTuple, 0);
- Shiboken::SbkType&lt;QTimer>()->tp_init(pyTimer, emptyTuple, 0);
- QTimer* timer = Converter&lt;QTimer*>::toCpp(pyTimer);
- timer->setSingleShot(true);
- timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()));
- PySide::SignalInstanceData* signalInstance = reinterpret_cast&lt;PySide::SignalInstanceData*&gt;(%2);
- Shiboken::AutoDecRef signalSignature(PyString_FromFormat("2%s", signalInstance->signature));
- Shiboken::AutoDecRef result(
- PyObject_CallMethod(pyTimer,
- const_cast&lt;char*>("connect"),
- const_cast&lt;char*>("OsOO"),
- pyTimer,
- SIGNAL(timeout()),
- signalInstance->source,
- signalSignature.object())
- );
+ if (PyObject_TypeCheck(%2, &amp;PySideSignalInstanceType)) {
+ PySideSignalInstanceData* signalInstance = reinterpret_cast&lt;PySideSignalInstanceData*&gt;(%2);
+ Shiboken::AutoDecRef signalSignature(PyString_FromFormat("2%s", signalInstance->signature));
+ Shiboken::AutoDecRef result(
+ PyObject_CallMethod(pyTimer,
+ const_cast&lt;char*>("connect"),
+ const_cast&lt;char*>("OsOO"),
+ pyTimer,
+ SIGNAL(timeout()),
+ signalInstance->source,
+ signalSignature.object())
+ );
+ } else {
+ Shiboken::AutoDecRef result(
+ PyObject_CallMethod(pyTimer,
+ const_cast&lt;char*>("connect"),
+ const_cast&lt;char*>("OsO"),
+ pyTimer,
+ SIGNAL(timeout()),
+ pyargs[1])
+ );
+ }
Shiboken::BindingManager::instance().destroyWrapper((Shiboken::SbkBaseWrapper *)pyTimer);
timer->start(%1);
</inject-code>
@@ -2698,9 +2684,9 @@
// since it refers to a name very tied to the generator implementation.
// Check bug #362 for more information on this
// http://bugs.openbossa.org/show_bug.cgi?id=362
- if (!PyObject_TypeCheck(%1, &amp;PySide::SignalInstance_Type))
+ if (!PyObject_TypeCheck(%1, &amp;PySideSignalInstanceType))
goto Sbk%TYPEFunc_%FUNCTION_NAME_TypeError;
- PySide::SignalInstanceData* signalInstance = reinterpret_cast&lt;PySide::SignalInstanceData*&gt;(%1);
+ PySideSignalInstanceData* signalInstance = reinterpret_cast&lt;PySideSignalInstanceData*&gt;(%1);
QObject* sender = %CONVERTTOCPP[QObject*](signalInstance->source);
%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%CPPSELF->%FUNCTION_NAME(sender, signalInstance->signature, %2));
</inject-code>
diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml
index 0321a6514..e60878665 100644
--- a/PySide/QtNetwork/typesystem_network.xml
+++ b/PySide/QtNetwork/typesystem_network.xml
@@ -200,9 +200,6 @@
<object-type name="QNetworkCookieJar"/>
<object-type name="QNetworkReply">
<enum-type name="NetworkError"/>
- <modify-function signature="error()const">
- <rename to="errorCode" />
- </modify-function>
</object-type>
<value-type name="QHostAddress" hash-function="qHash">
diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp
index 6c7710f19..8bb1a6eab 100644
--- a/libpyside/dynamicqmetaobject.cpp
+++ b/libpyside/dynamicqmetaobject.cpp
@@ -21,17 +21,21 @@
*/
#include "dynamicqmetaobject.h"
+#include "dynamicqmetaobject_p.h"
#include <QByteArray>
#include <QString>
#include <QStringList>
#include <QList>
+#include <QLinkedList>
#include <QObject>
#include <cstring>
#include <QDebug>
#include <QMetaMethod>
#include "qsignal.h"
+#include "qsignal_p.h"
#include "qproperty.h"
+#include "qproperty_p.h"
#define MAX_SIGNALS_COUNT 50
#define MAX_SLOTS_COUNT 50
@@ -66,6 +70,18 @@ enum PropertyFlags {
Notify = 0x00400000
};
+class DynamicQMetaObject::DynamicQMetaObjectPrivate
+{
+public:
+ QLinkedList<MethodData> m_signals;
+ QLinkedList<MethodData> m_slots;
+ QLinkedList<PropertyData> m_properties;
+ QByteArray m_className;
+
+ void updateMetaObject(QMetaObject* metaObj);
+ void writeMethodsData(QLinkedList<MethodData>& methods, unsigned int** data, QList<QByteArray>* strings, int* prtIndex, int maxCount, int nullIndex, int flags);
+};
+
static int registerString(const QByteArray& s, QList<QByteArray>* strings)
{
int idx = 0;
@@ -145,39 +161,39 @@ uint PropertyData::flags() const
else if (!isQRealType(typeName))
flags |= qvariant_nameToType(typeName) << 24;
- if (qproperty_is_readble(m_data))
+ if (qpropertyIsReadable(m_data))
flags |= Readable;
- if (qproperty_is_writable(m_data))
+ if (qpropertyIsWritable(m_data))
flags |= Writable;
- if (qproperty_has_reset(m_data))
+ if (qpropertyHasReset(m_data))
flags |= Resettable;
- if (!qproperty_is_designable(m_data))
+ if (!qpropertyIsDesignable(m_data))
flags |= ResolveDesignable;
else
flags |= Designable;
- if (!qproperty_is_scriptable(m_data))
+ if (!qpropertyIsScriptable(m_data))
flags |= ResolveScriptable;
else
flags |= Scriptable;
- if (!qproperty_is_stored(m_data))
+ if (!qpropertyIsStored(m_data))
flags |= ResolveStored;
else
flags |= Stored;
- if (!qproperty_is_user(m_data))
+ if (!qpropertyIsUser(m_data))
flags |= ResolveUser;
else
flags |= User;
- if (qproperty_is_constant(m_data))
+ if (qpropertyIsConstant(m_data))
flags |= Constant;
- if (qproperty_is_final(m_data))
+ if (qpropertyIsFinal(m_data))
flags |= Final;
return flags;
@@ -241,7 +257,7 @@ PropertyData::PropertyData(const char* name, PyObject* data)
QByteArray PropertyData::type() const
{
- return QByteArray(qproperty_get_type(m_data));
+ return QByteArray(qpropertyGetType(m_data));
}
@@ -266,76 +282,77 @@ bool PropertyData::operator==(const char* name) const
}
-DynamicQMetaObject::DynamicQMetaObject(const char* className, const QMetaObject* metaObject)
+DynamicQMetaObject::DynamicQMetaObject(const char* className, const QMetaObject* metaObject) : m_d(new DynamicQMetaObjectPrivate)
{
d.superdata = metaObject;
d.stringdata = 0;
d.data = 0;
d.extradata = 0;
- m_className = QByteArray(className);
- updateMetaObject();
+ m_d->m_className = QByteArray(className);
+ m_d->updateMetaObject(this);
}
DynamicQMetaObject::~DynamicQMetaObject()
{
delete[] d.stringdata;
delete[] d.data;
+ delete m_d;
}
void DynamicQMetaObject::addSignal(const char* signal, const char* type)
{
- QLinkedList<MethodData>::iterator i = qFind(m_signals.begin(), m_signals.end(), signal);
- if (i != m_signals.end())
+ QLinkedList<MethodData>::iterator i = qFind(m_d->m_signals.begin(), m_d->m_signals.end(), signal);
+ if (i != m_d->m_signals.end())
return;
//search for a empty space
MethodData blank;
- i = qFind(m_signals.begin(), m_signals.end(), blank);
- if (i != m_signals.end()) {
+ i = qFind(m_d->m_signals.begin(), m_d->m_signals.end(), blank);
+ if (i != m_d->m_signals.end()) {
*i = MethodData(signal, type);
- updateMetaObject();
+ m_d->updateMetaObject(this);
return;
}
- int maxSignals = maxSignalsCount(m_className);
- if (m_signals.size() >= maxSignals) {
+ int maxSignals = maxSignalsCount(m_d->m_className);
+ if (m_d->m_signals.size() >= maxSignals) {
qWarning() << "Fail to add dynamic signal to QObject. PySide support at most" << maxSignals << "dynamic signals.";
return;
}
- m_signals << MethodData(signal, type);
- updateMetaObject();
+ m_d->m_signals << MethodData(signal, type);
+ m_d->updateMetaObject(this);
}
void DynamicQMetaObject::addSlot(const char* slot, const char* type)
{
- QLinkedList<MethodData>::iterator i = qFind(m_slots.begin(), m_slots.end(), slot);
- if (i != m_slots.end())
+ QLinkedList<MethodData>::iterator i = qFind(m_d->m_slots.begin(), m_d->m_slots.end(), slot);
+ if (i != m_d->m_slots.end())
return;
- int maxSlots = maxSlotsCount(m_className);
- if (m_slots.size() >= maxSlots) {
+ int maxSlots = maxSlotsCount(m_d->m_className);
+ if (m_d->m_slots.size() >= maxSlots) {
qWarning() << "Fail to add dynamic slot to QObject. PySide support at most" << maxSlots << "dynamic slots.";
return;
}
//search for a empty space
MethodData blank;
- i = qFind(m_slots.begin(), m_slots.end(), blank);
- if (i != m_slots.end())
+ i = qFind(m_d->m_slots.begin(), m_d->m_slots.end(), blank);
+ if (i != m_d->m_slots.end())
*i = MethodData(slot, type);
else
- m_slots << MethodData(slot, type);
- updateMetaObject();
+ m_d->m_slots << MethodData(slot, type);
+ m_d->updateMetaObject(this);
}
void DynamicQMetaObject::removeSlot(uint index)
{
QMetaMethod m = method(index);
- foreach(MethodData md, m_slots) {
+ foreach(MethodData md, m_d->m_slots) {
if (md.signature() == m.signature()) {
md.clear();
- updateMetaObject();
+ m_d->updateMetaObject(this);
break;
}
}
@@ -343,19 +360,19 @@ void DynamicQMetaObject::removeSlot(uint index)
void DynamicQMetaObject::addProperty(const char* property, PyObject* data)
{
- QLinkedList<PropertyData>::iterator i = qFind(m_properties.begin(), m_properties.end(), property);
- if (i != m_properties.end())
+ QLinkedList<PropertyData>::iterator i = qFind(m_d->m_properties.begin(), m_d->m_properties.end(), property);
+ if (i != m_d->m_properties.end())
return;
//search for a empty space
PropertyData blank;
- i = qFind(m_properties.begin(), m_properties.end(), blank);
- if (i != m_properties.end()) {
+ i = qFind(m_d->m_properties.begin(), m_d->m_properties.end(), blank);
+ if (i != m_d->m_properties.end()) {
*i = PropertyData(property, data);
} else {
- m_properties << PropertyData(property, data);
+ m_d->m_properties << PropertyData(property, data);
}
- updateMetaObject();
+ m_d->updateMetaObject(this);
}
@@ -372,19 +389,19 @@ DynamicQMetaObject* DynamicQMetaObject::createBasedOn(PyObject* pyObj, PyTypeObj
while (PyDict_Next(type->tp_dict, &pos, &key, &value)) {
//Register properties
- if (value->ob_type == &QProperty_Type) {
+ if (value->ob_type == &PySideQPropertyType) {
mo->addProperty(PyString_AsString(key), value);
}
//Register signals
- if (value->ob_type == &Signal_Type) {
+ if (value->ob_type == &PySideSignalType) {
PyObject *attr = PyObject_GetAttr(pyObj, key);
- SignalInstanceData *data = reinterpret_cast<SignalInstanceData*>(attr);
+ PySideSignalInstanceData *data = reinterpret_cast<PySideSignalInstanceData*>(attr);
while(data) {
int index = base->indexOfSignal(data->signature);
if (index == -1)
mo->addSignal(data->signature);
- data = reinterpret_cast<SignalInstanceData*>(data->next);
+ data = reinterpret_cast<PySideSignalInstanceData*>(data->next);
}
}
@@ -412,46 +429,46 @@ void DynamicQMetaObject::removeSignal(uint index)
{
//Current Qt implementation does not support runtime remove signal
QMetaMethod m = method(index);
- foreach(MethodData md, m_signals) {
+ foreach(MethodData md, m_d->m_signals) {
if (md.signature() == m.signature()) {
md.clear();
- updateMetaObject();
+ m_d->updateMetaObject(this);
break;
}
}
}
-void DynamicQMetaObject::writeMethodsData(QLinkedList<MethodData>& methods,
- unsigned int **data,
- QList<QByteArray> *strings,
- int *prtIndex,
- int max_count,
- int null_index,
- int flags)
+void DynamicQMetaObject::DynamicQMetaObjectPrivate::writeMethodsData(QLinkedList<MethodData>& methods,
+ unsigned int** data,
+ QList<QByteArray>* strings,
+ int* prtIndex,
+ int maxCount,
+ int nullIndex,
+ int flags)
{
int index = *prtIndex;
QLinkedList<MethodData>::iterator iMethod = methods.begin();
- for(int i=0; i < max_count; i++) {
+ for(int i=0; i < maxCount; i++) {
QByteArray mType;
if (iMethod != methods.end() && ((*iMethod).signature().size() > 0) ) {
(*data)[index++] = registerString((*iMethod).signature(), strings); // func name
mType = (*iMethod).type();
} else {
- (*data)[index++] = null_index; // func name
+ (*data)[index++] = nullIndex; // func name
}
- (*data)[index++] = null_index; // arguments
- (*data)[index++] = (mType.size() > 0 ? registerString(mType, strings) : null_index); // normalized type
- (*data)[index++] = null_index; // tags
+ (*data)[index++] = nullIndex; // arguments
+ (*data)[index++] = (mType.size() > 0 ? registerString(mType, strings) : nullIndex); // normalized type
+ (*data)[index++] = nullIndex; // tags
(*data)[index++] = flags;
- if (iMethod != methods.end())
+ if (iMethod != methods.end())
iMethod++;
}
*prtIndex = index;
}
-void DynamicQMetaObject::updateMetaObject()
+void DynamicQMetaObject::DynamicQMetaObjectPrivate::updateMetaObject(QMetaObject* metaObj)
{
// these values are from moc source code, generator.cpp:66
enum MethodFlags {
@@ -485,7 +502,7 @@ void DynamicQMetaObject::updateMetaObject()
const int HEADER_LENGHT = sizeof(header)/sizeof(int);
header[5] = HEADER_LENGHT;
// header size + 5 indexes per method + an ending zero
- delete[] d.data;
+ delete[] metaObj->d.data;
unsigned int* data;
data = new unsigned int[HEADER_LENGHT + n_methods*5 + n_properties*3 + 1];
std::memcpy(data, header, sizeof(header));
@@ -524,9 +541,14 @@ void DynamicQMetaObject::updateMetaObject()
str.append(char(0));
}
- delete[] d.stringdata;
+ delete[] metaObj->d.stringdata;
char* stringData = new char[str.count()];
std::copy(str.begin(), str.end(), stringData);
- d.data = data;
- d.stringdata = stringData;
+ metaObj->d.data = data;
+ metaObj->d.stringdata = stringData;
+}
+
+void PySide::deleteDynamicQMetaObject(void* data)
+{
+ delete reinterpret_cast<DynamicQMetaObject*>(data);
}
diff --git a/libpyside/dynamicqmetaobject.h b/libpyside/dynamicqmetaobject.h
index 22387a6e3..d61ecadcd 100644
--- a/libpyside/dynamicqmetaobject.h
+++ b/libpyside/dynamicqmetaobject.h
@@ -26,59 +26,18 @@
#include "pysidemacros.h"
#include <Python.h>
#include <QMetaObject>
-#include <QLinkedList>
-#include <QByteArray>
-#include <QSharedPointer>
-
-#define PYSIDE_SLOT_LIST_ATTR "_slots"
-
-class QObject;
namespace PySide
{
-class MethodData
-{
-public:
- MethodData(){}
- MethodData(const char* signature, const char* type);
- void clear();
- bool isValid() const;
- QByteArray signature() const;
- QByteArray type() const;
- bool operator==(const MethodData& other) const;
- bool operator==(const char* other) const;
-
-private:
- QSharedPointer<QByteArray> m_signature;
- QSharedPointer<QByteArray> m_type;
-};
-
-class PropertyData
-{
-public:
- PropertyData();
- PropertyData(const char*name, PyObject *data);
- QByteArray name() const;
- QByteArray type() const;
- uint flags() const;
- bool isValid() const;
- bool operator==(const PropertyData& other) const;
- bool operator==(const char* name) const;
-
-private:
- QByteArray m_name;
- PyObject* m_data;
-};
-
class PYSIDE_API DynamicQMetaObject : public QMetaObject
{
public:
DynamicQMetaObject(const char* className, const QMetaObject* metaObject);
~DynamicQMetaObject();
- void addSignal(const char* signal, const char* type=0);
- void addSlot(const char* slot, const char* type=0);
+ void addSignal(const char* signal, const char* type = 0);
+ void addSlot(const char* slot, const char* type = 0);
void addProperty(const char* property, PyObject* data);
void removeSignal(uint idex);
@@ -89,19 +48,11 @@ public:
static DynamicQMetaObject* createBasedOn(PyObject* obj, PyTypeObject* type, const QMetaObject* base);
private:
- QLinkedList<MethodData> m_signals;
- QLinkedList<MethodData> m_slots;
- QLinkedList<PropertyData> m_properties;
- QByteArray m_className;
-
- void updateMetaObject();
- void writeMethodsData(QLinkedList<MethodData>& methods, unsigned int **data, QList<QByteArray> *strings, int *index, int max_count, int null_index, int flags);
+ class DynamicQMetaObjectPrivate;
+ DynamicQMetaObjectPrivate* m_d;
};
-PYSIDE_API inline void deleteDynamicQMetaObject(void* data)
-{
- delete reinterpret_cast<DynamicQMetaObject*>(data);
-}
+PYSIDE_API void deleteDynamicQMetaObject(void* data);
}
#endif
diff --git a/libpyside/dynamicqmetaobject_p.h b/libpyside/dynamicqmetaobject_p.h
new file mode 100644
index 000000000..4488f07da
--- /dev/null
+++ b/libpyside/dynamicqmetaobject_p.h
@@ -0,0 +1,69 @@
+/*
+ * This file is part of the PySide project.
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef DYNAMICMETAPROPERTY_P_H
+#define DYNAMICMETAPROPERTY_P_H
+
+#include <Python.h>
+#include <QByteArray>
+#include <QSharedPointer>
+
+#define PYSIDE_SLOT_LIST_ATTR "_slots"
+
+namespace PySide
+{
+ class MethodData
+ {
+ public:
+ MethodData(){}
+ MethodData(const char* signature, const char* type);
+ void clear();
+ bool isValid() const;
+ QByteArray signature() const;
+ QByteArray type() const;
+ bool operator==(const MethodData& other) const;
+ bool operator==(const char* other) const;
+
+ private:
+ QSharedPointer<QByteArray> m_signature;
+ QSharedPointer<QByteArray> m_type;
+ };
+
+ class PropertyData
+ {
+ public:
+ PropertyData();
+ PropertyData(const char* name, PyObject* data);
+ QByteArray name() const;
+ QByteArray type() const;
+ uint flags() const;
+ bool isValid() const;
+ bool operator==(const PropertyData& other) const;
+ bool operator==(const char* name) const;
+
+ private:
+ QByteArray m_name;
+ PyObject* m_data;
+ };
+}
+
+#endif
diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp
index 9b8c4ccfe..30a5e2663 100644
--- a/libpyside/pyside.cpp
+++ b/libpyside/pyside.cpp
@@ -22,18 +22,17 @@
#include "pyside.h"
-#include "signalmanager.h"
-#include "qproperty.h"
-#include "qsignal.h"
#include <basewrapper.h>
#include <conversions.h>
#include <algorithm>
#include <cctype>
#include <QStack>
-
-extern "C" void init_signal(PyObject* module);
-extern "C" void init_slot(PyObject* module);
-extern "C" void init_qproperty(PyObject* module);
+#include "signalmanager.h"
+#include "qproperty_p.h"
+#include "qproperty.h"
+#include "qsignal.h"
+#include "qsignal_p.h"
+#include "qslot_p.h"
static QStack<PySide::CleanupFunction> cleanupFunctionList;
@@ -42,9 +41,9 @@ namespace PySide
void init(PyObject *module)
{
- init_signal(module);
- init_slot(module);
- init_qproperty(module);
+ initSignalSupport(module);
+ initSlotSupport(module);
+ initQProperty(module);
// Init signal manager, so it will register some meta types used by QVariant.
SignalManager::instance();
}
@@ -69,13 +68,13 @@ bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds
} else {
PyObject* attr = PyObject_GenericGetAttr(qObj, key);
if (isQPropertyType(attr))
- PySide::qproperty_set(attr, qObj, value);
+ PySide::qpropertySet(attr, qObj, value);
}
} else {
propName.append("()");
if (metaObj->indexOfSignal(propName) != -1) {
propName.prepend('2');
- PySide::signal_connect(qObj, propName, value);
+ PySide::signalConnect(qObj, propName, value);
} else {
PyErr_Format(PyExc_AttributeError, "'%s' is not a Qt property or a signal", propName.constData());
return false;
diff --git a/libpyside/qproperty.cpp b/libpyside/qproperty.cpp
index 745387654..2c5393231 100644
--- a/libpyside/qproperty.cpp
+++ b/libpyside/qproperty.cpp
@@ -25,17 +25,39 @@
#include <QDebug>
#include "qproperty.h"
-
+#include "qproperty_p.h"
+#include "dynamicqmetaobject_p.h"
#define QPROPERTY_CLASS_NAME "Property"
-namespace PySide
+char* translateTypeName(PyObject* type)
{
+ if (PyType_Check(type)) {
+ char* typeName = 0;
+ if (type->ob_type == &Shiboken::SbkBaseWrapperType_Type) {
+ Shiboken::SbkBaseWrapperType* objType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(type);
+ typeName = strdup(objType->original_name);
+ } else {
+ //tp_name return the full name
+ Shiboken::AutoDecRef otypeName(PyObject_GetAttrString(type, "__name__"));
+ typeName = strdup(PyString_AS_STRING(otypeName.object()));
+ }
+ if (Shiboken::TypeResolver::getType(typeName) == Shiboken::TypeResolver::ObjectType) {
+ typeName = reinterpret_cast<char*>(realloc(typeName, strlen(typeName) + 1));
+ typeName = strcat(typeName, "*");
+ }
+ return typeName;
+ } else if (PyString_Check(type)) {
+ return strdup(PyString_AS_STRING(type));
+ }
+ return 0;
+}
+
extern "C"
{
-typedef struct {
+struct PySideQPropertyData {
PyObject_HEAD
char* typeName;
PyObject* type;
@@ -50,19 +72,16 @@ typedef struct {
bool user;
bool constant;
bool final;
-} QPropertyData;
-
-static int qproperty_init(PyObject*, PyObject*, PyObject*);
-static void qproperty_free(void*);
+};
-//aux
-static char* translate_type_name(PyObject*);
+static int qpropertyTpInit(PyObject*, PyObject*, PyObject*);
+static void qpropertyFree(void*);
-PyTypeObject QProperty_Type = {
+PyTypeObject PySideQPropertyType = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
QPROPERTY_CLASS_NAME, /*tp_name*/
- sizeof(QPropertyData), /*tp_basicsize*/
+ sizeof(PySideQPropertyData), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
0, /*tp_print*/
@@ -95,10 +114,10 @@ PyTypeObject QProperty_Type = {
0, /*tp_descr_get */
0, /*tp_descr_set */
0, /*tp_dictoffset */
- (initproc)qproperty_init, /*tp_init */
+ qpropertyTpInit, /*tp_init */
0, /*tp_alloc */
PyType_GenericNew, /*tp_new */
- qproperty_free, /*tp_free */
+ qpropertyFree, /*tp_free */
0, /*tp_is_gc */
0, /*tp_bases */
0, /*tp_mro */
@@ -108,21 +127,10 @@ PyTypeObject QProperty_Type = {
0, /*tp_del */
};
-void init_qproperty(PyObject* module)
-{
- if (PyType_Ready(&QProperty_Type) < 0)
- return;
-
- Py_INCREF(&QProperty_Type);
- PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&QProperty_Type));
-}
-
-} // extern "C"
-
-int qproperty_init(PyObject* self, PyObject* args, PyObject* kwds)
+int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
{
PyObject* type = 0;
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
data->designable = true;
data->scriptable = true;
data->stored = true;
@@ -141,14 +149,14 @@ int qproperty_init(PyObject* self, PyObject* args, PyObject* kwds)
if (!data->fset && data->fget)
data->constant = true;
- data->typeName = translate_type_name(type);
+ data->typeName = translateTypeName(type);
return 1;
}
-void qproperty_free(void *self)
+void qpropertyFree(void *self)
{
PyObject *pySelf = reinterpret_cast<PyObject*>(self);
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
free(data->typeName);
free(data->doc);
@@ -156,17 +164,33 @@ void qproperty_free(void *self)
pySelf->ob_type->tp_base->tp_free(self);
}
+
+} // extern "C"
+
+
+namespace PySide
+{
+
+void initQProperty(PyObject* module)
+{
+ if (PyType_Ready(&PySideQPropertyType) < 0)
+ return;
+
+ Py_INCREF(&PySideQPropertyType);
+ PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&PySideQPropertyType));
+}
+
bool isQPropertyType(PyObject* pyObj)
{
if (pyObj) {
- return pyObj->ob_type == &QProperty_Type;
+ return pyObj->ob_type == &PySideQPropertyType;
}
return false;
}
-int qproperty_set(PyObject* self, PyObject* source, PyObject* value)
+int qpropertySet(PyObject* self, PyObject* source, PyObject* value)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
if (data->fset) {
Shiboken::AutoDecRef args(PyTuple_New(2));
PyTuple_SET_ITEM(args, 0, source);
@@ -181,9 +205,9 @@ int qproperty_set(PyObject* self, PyObject* source, PyObject* value)
return -1;
}
-PyObject* qproperty_get(PyObject* self, PyObject* source)
+PyObject* qpropertyGet(PyObject* self, PyObject* source)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
if (data->fget) {
Shiboken::AutoDecRef args(PyTuple_New(1));
Py_INCREF(source);
@@ -193,9 +217,9 @@ PyObject* qproperty_get(PyObject* self, PyObject* source)
return 0;
}
-int qproperty_reset(PyObject* self, PyObject* source)
+int qpropertyReset(PyObject* self, PyObject* source)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
if (data->freset) {
Shiboken::AutoDecRef args(PyTuple_New(1));
Py_INCREF(source);
@@ -207,13 +231,13 @@ int qproperty_reset(PyObject* self, PyObject* source)
}
-const char* qproperty_get_type(PyObject* self)
+const char* qpropertyGetType(PyObject* self)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
return data->typeName;
}
-PyObject* qproperty_get_object(PyObject* source, PyObject* name)
+PyObject* qpropertyGetObject(PyObject* source, PyObject* name)
{
PyObject* attr = PyObject_GenericGetAttr(source, name);
if (attr && isQPropertyType(attr))
@@ -226,80 +250,57 @@ PyObject* qproperty_get_object(PyObject* source, PyObject* name)
return 0;
}
-char* translate_type_name(PyObject* type)
-{
- if (PyType_Check(type)) {
- char *typeName = NULL;
- if (type->ob_type == &Shiboken::SbkBaseWrapperType_Type) {
- Shiboken::SbkBaseWrapperType *objType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(type);
- typeName = strdup(objType->original_name);
- } else {
- //tp_name return the full name
- Shiboken::AutoDecRef otypeName(PyObject_GetAttrString(type, "__name__"));
- typeName = strdup(PyString_AS_STRING(otypeName.object()));
- }
- if (Shiboken::TypeResolver::getType(typeName) == Shiboken::TypeResolver::ObjectType) {
- typeName = reinterpret_cast<char*>(realloc(typeName, strlen(typeName) + 1));
- typeName = strcat(typeName, "*");
- }
- return typeName;
- } else if (PyString_Check(type)) {
- return strdup(PyString_AS_STRING(type));
- }
- return 0;
-}
-
-bool qproperty_is_readble(PyObject* self)
+bool qpropertyIsReadable(PyObject* self)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
return (data->fget != 0);
}
-bool qproperty_is_writable(PyObject* self)
+bool qpropertyIsWritable(PyObject* self)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
return (data->fset != 0);
}
-bool qproperty_has_reset(PyObject* self)
+bool qpropertyHasReset(PyObject* self)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
return (data->freset != 0);
}
-bool qproperty_is_designable(PyObject* self)
+bool qpropertyIsDesignable(PyObject* self)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
return data->designable;
}
-bool qproperty_is_scriptable(PyObject* self)
+bool qpropertyIsScriptable(PyObject* self)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
return data->scriptable;
}
-bool qproperty_is_stored(PyObject* self)
+bool qpropertyIsStored(PyObject* self)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
return data->stored;
}
-bool qproperty_is_user(PyObject* self)
+bool qpropertyIsUser(PyObject* self)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
return data->user;
}
-bool qproperty_is_constant(PyObject* self)
+bool qpropertyIsConstant(PyObject* self)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
return data->constant;
}
-bool qproperty_is_final(PyObject* self)
+bool qpropertyIsFinal(PyObject* self)
{
- QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
+ PySideQPropertyData *data = reinterpret_cast<PySideQPropertyData*>(self);
return data->final;
}
diff --git a/libpyside/qproperty.h b/libpyside/qproperty.h
index 56ed32f51..da031db5e 100644
--- a/libpyside/qproperty.h
+++ b/libpyside/qproperty.h
@@ -30,11 +30,6 @@
namespace PySide
{
-extern "C"
-{
- extern PYSIDE_API PyTypeObject QProperty_Type;
-}; //extern "C"
-
PYSIDE_API bool isQPropertyType(PyObject* pyObj);
/**
@@ -46,7 +41,7 @@ PYSIDE_API bool isQPropertyType(PyObject* pyObj);
* @param value The value to set in property
* @return Return 0 if ok or -1 if this function fail
**/
-PYSIDE_API int qproperty_set(PyObject* self, PyObject* source, PyObject* value);
+PYSIDE_API int qpropertySet(PyObject* self, PyObject* source, PyObject* value);
/**
* This function call get property function
@@ -56,27 +51,7 @@ PYSIDE_API int qproperty_set(PyObject* self, PyObject* source, PyObject* value);
* @param source The QObject witch has the property
* @return Return the result of property get function or 0 if this fail
**/
-PYSIDE_API PyObject* qproperty_get(PyObject* self, PyObject* source);
-
-/**
- * This function call reset property function
- * This function does not check the property object type
- *
- * @param self The property object
- * @param source The QObject witch has the property
- * @return Return 0 if ok or -1 if this function fail
- **/
-PYSIDE_API int qproperty_reset(PyObject* self, PyObject* source);
-
-
-/**
- * This function return the property type
- * This function does not check the property object type
- *
- * @param self The property object
- * @return Return the property type name
- **/
-PYSIDE_API const char* qproperty_get_type(PyObject* self);
+PYSIDE_API PyObject* qpropertyGet(PyObject* self, PyObject* source);
/**
* This function search in the source object for desired property
@@ -85,90 +60,7 @@ PYSIDE_API const char* qproperty_get_type(PyObject* self);
* @param name The property name
* @return Return a new reference to property object
**/
-PYSIDE_API PyObject* qproperty_get_object(PyObject* source, PyObject* name);
-
-
-/**
- * This function check if property has read function
- * This function does not check the property object type
- *
- * @param self The property object
- * @return Return a boolean value
- **/
-PYSIDE_API bool qproperty_is_readble(PyObject* self);
-
-/**
- * This function check if property has write function
- * This function does not check the property object type
- *
- * @param self The property object
- * @return Return a boolean value
- **/
-PYSIDE_API bool qproperty_is_writable(PyObject* self);
-
-/**
- * This function check if property has reset function
- * This function does not check the property object type
- *
- * @param self The property object
- * @return Return a boolean value
- **/
-PYSIDE_API bool qproperty_has_reset(PyObject* self);
-
-/**
- * This function check if property has the flag DESIGNABLE setted
- * This function does not check the property object type
- *
- * @param self The property object
- * @return Return a boolean value
- **/
-PYSIDE_API bool qproperty_is_designable(PyObject* self);
-
-/**
- * This function check if property has the flag SCRIPTABLE setted
- * This function does not check the property object type
- *
- * @param self The property object
- * @return Return a boolean value
- **/
-PYSIDE_API bool qproperty_is_scriptable(PyObject* self);
-
-/**
- * This function check if property has the flag STORED setted
- * This function does not check the property object type
- *
- * @param self The property object
- * @return Return a boolean value
- **/
-PYSIDE_API bool qproperty_is_stored(PyObject* self);
-
-/**
- * This function check if property has the flag USER setted
- * This function does not check the property object type
- *
- * @param self The property object
- * @return Return a boolean value
- **/
-PYSIDE_API bool qproperty_is_user(PyObject* self);
-
-/**
- * This function check if property has the flag CONSTANT setted
- * This function does not check the property object type
- *
- * @param self The property object
- * @return Return a boolean value
- **/
-PYSIDE_API bool qproperty_is_constant(PyObject* self);
-
-/**
- * This function check if property has the flag FINAL setted
- * This function does not check the property object type
- *
- * @param self The property object
- * @return Return a boolean value
- **/
-PYSIDE_API bool qproperty_is_final(PyObject* self);
-
+PYSIDE_API PyObject* qpropertyGetObject(PyObject* source, PyObject* name);
} //namespace PySide
diff --git a/libpyside/qproperty_p.h b/libpyside/qproperty_p.h
new file mode 100644
index 000000000..85380f687
--- /dev/null
+++ b/libpyside/qproperty_p.h
@@ -0,0 +1,144 @@
+/*
+ * This file is part of the PySide project.
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef PYSIDE_QPROPERTY_P_H
+#define PYSIDE_QPROPERTY_P_H
+
+#include <Python.h>
+
+extern "C"
+{
+ extern PyTypeObject PySideQPropertyType;
+}; //extern "C"
+
+namespace PySide
+{
+
+/**
+ * Init PySide QProperty support system
+ */
+void initQProperty(PyObject* module);
+
+/**
+ * This function call reset property function
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @param source The QObject witch has the property
+ * @return Return 0 if ok or -1 if this function fail
+ **/
+int qpropertyReset(PyObject* self, PyObject* source);
+
+
+/**
+ * This function return the property type
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @return Return the property type name
+ **/
+const char* qpropertyGetType(PyObject* self);
+
+/**
+ * This function check if property has read function
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @return Return a boolean value
+ **/
+bool qpropertyIsReadable(PyObject* self);
+
+/**
+ * This function check if property has write function
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @return Return a boolean value
+ **/
+bool qpropertyIsWritable(PyObject* self);
+
+/**
+ * This function check if property has reset function
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @return Return a boolean value
+ **/
+bool qpropertyHasReset(PyObject* self);
+
+/**
+ * This function check if property has the flag DESIGNABLE setted
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @return Return a boolean value
+ **/
+bool qpropertyIsDesignable(PyObject* self);
+
+/**
+ * This function check if property has the flag SCRIPTABLE setted
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @return Return a boolean value
+ **/
+bool qpropertyIsScriptable(PyObject* self);
+
+/**
+ * This function check if property has the flag STORED setted
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @return Return a boolean value
+ **/
+bool qpropertyIsStored(PyObject* self);
+
+/**
+ * This function check if property has the flag USER setted
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @return Return a boolean value
+ **/
+bool qpropertyIsUser(PyObject* self);
+
+/**
+ * This function check if property has the flag CONSTANT setted
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @return Return a boolean value
+ **/
+bool qpropertyIsConstant(PyObject* self);
+
+/**
+ * This function check if property has the flag FINAL setted
+ * This function does not check the property object type
+ *
+ * @param self The property object
+ * @return Return a boolean value
+ **/
+bool qpropertyIsFinal(PyObject* self);
+
+} // namespace PySide
+
+#endif
diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp
index 76fc45046..a3e1c94fb 100644
--- a/libpyside/qsignal.cpp
+++ b/libpyside/qsignal.cpp
@@ -25,288 +25,163 @@
#include <QDebug>
#include "qsignal.h"
+#include "qsignal_p.h"
#include "signalmanager.h"
#define SIGNAL_CLASS_NAME "Signal"
#define QT_SIGNAL_SENTINEL "2"
+struct SignalData;
+
namespace PySide
{
+ //aux
+ static char* signalBuildSignature(const char*, const char*);
+ static void signalAppendSignature(SignalData*, char*);
+ static void signalInstanceInitialize(PyObject*, PyObject*, SignalData*, PyObject *, int);
+ static char* signalParseSignature(PyObject*);
+ static PyObject* signalBuildQtCompatible(const char*);
+}
extern "C"
{
-char* get_type_name(PyObject*);
-
-typedef struct {
+struct SignalData {
PyObject_HEAD
bool initialized;
char* signalName;
char** signatures;
int signaturesSize;
-} SignalData;
+ PyObject* homonymousMethod;
+};
-static int signal_init(PyObject*, PyObject*, PyObject*);
-static void signal_free(void*);
-static void signal_instance_free(void*);
+static int signalTpInit(PyObject*, PyObject*, PyObject*);
+static void signalFree(void*);
+static void signalInstanceFree(void*);
//methods
-static PyObject* signal_instance_connect(PyObject*, PyObject*, PyObject*);
-static PyObject* signal_instance_disconnect(PyObject*, PyObject*);
-static PyObject* signal_instance_emit(PyObject*, PyObject*);
-static PyObject* signal_instance_get_item(PyObject*, PyObject*);
-
-//aux
-static char* signal_build_signature(const char*, const char*);
-static void signal_append_signature(SignalData*, char*);
-static void signal_instance_initialize(PyObject*, PyObject*, SignalData*, PyObject *, int);
-static char* signal_parse_signature(PyObject*);
-static PyObject* signal_build_qt_compatible(const char*);
-
-PyTypeObject Signal_Type = {
+static PyObject* signalInstanceConnect(PyObject*, PyObject*, PyObject*);
+static PyObject* signalInstanceDisconnect(PyObject*, PyObject*);
+static PyObject* signalInstanceEmit(PyObject*, PyObject*);
+static PyObject* signalInstanceGetItem(PyObject*, PyObject*);
+
+static PyObject* signalInstanceCall(PyObject* self, PyObject* args, PyObject* kw);
+static PyObject* signalCall(PyObject*, PyObject*, PyObject*);
+
+PyTypeObject PySideSignalType = {
PyObject_HEAD_INIT(0)
- 0, /*ob_size*/
- "PySide.QtCore."SIGNAL_CLASS_NAME, /*tp_name*/
- sizeof(SignalData), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- SIGNAL_CLASS_NAME, /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- 0, /*tp_iter */
- 0, /*tp_iternext */
- 0, /*tp_methods */
- 0, /*tp_members */
- 0, /*tp_getset */
- 0, /*tp_base */
- 0, /*tp_dict */
- 0, /*tp_descr_get */
- 0, /*tp_descr_set */
- 0, /*tp_dictoffset */
- signal_init, /*tp_init */
- 0, /*tp_alloc */
- PyType_GenericNew, /*tp_new */
- signal_free, /*tp_free */
- 0, /*tp_is_gc */
- 0, /*tp_bases */
- 0, /*tp_mro */
- 0, /*tp_cache */
- 0, /*tp_subclasses */
- 0, /*tp_weaklist */
- 0, /*tp_del */
+ /*ob_size*/ 0,
+ /*tp_name*/ "PySide.QtCore."SIGNAL_CLASS_NAME,
+ /*tp_basicsize*/ sizeof(SignalData),
+ /*tp_itemsize*/ 0,
+ /*tp_dealloc*/ &Shiboken::deallocWrapper,
+ /*tp_print*/ 0,
+ /*tp_getattr*/ 0,
+ /*tp_setattr*/ 0,
+ /*tp_compare*/ 0,
+ /*tp_repr*/ 0,
+ /*tp_as_number*/ 0,
+ /*tp_as_sequence*/ 0,
+ /*tp_as_mapping*/ 0,
+ /*tp_hash*/ 0,
+ /*tp_call*/ signalCall,
+ /*tp_str*/ 0,
+ /*tp_getattro*/ 0,
+ /*tp_setattro*/ 0,
+ /*tp_as_buffer*/ 0,
+ /*tp_flags*/ Py_TPFLAGS_DEFAULT,
+ /*tp_doc*/ SIGNAL_CLASS_NAME,
+ /*tp_traverse*/ 0,
+ /*tp_clear*/ 0,
+ /*tp_richcompare*/ 0,
+ /*tp_weaklistoffset*/ 0,
+ /*tp_iter*/ 0,
+ /*tp_iternext*/ 0,
+ /*tp_methods*/ 0,
+ /*tp_members*/ 0,
+ /*tp_getset*/ 0,
+ /*tp_base*/ 0,
+ /*tp_dict*/ 0,
+ /*tp_descr_get*/ 0,
+ /*tp_descr_set*/ 0,
+ /*tp_dictoffset*/ 0,
+ /*tp_init*/ signalTpInit,
+ /*tp_alloc*/ 0,
+ /*tp_new*/ PyType_GenericNew,
+ /*tp_free*/ signalFree,
+ /*tp_is_gc*/ 0,
+ /*tp_bases*/ 0,
+ /*tp_mro*/ 0,
+ /*tp_cache*/ 0,
+ /*tp_subclasses*/ 0,
+ /*tp_weaklist*/ 0,
+ /*tp_del*/ 0,
};
static PyMethodDef SignalInstance_methods[] = {
- {"connect", (PyCFunction)signal_instance_connect, METH_VARARGS|METH_KEYWORDS, 0},
- {"disconnect", signal_instance_disconnect, METH_VARARGS, 0},
- {"emit", signal_instance_emit, METH_VARARGS, 0},
+ {"connect", (PyCFunction)signalInstanceConnect, METH_VARARGS|METH_KEYWORDS, 0},
+ {"disconnect", signalInstanceDisconnect, METH_VARARGS, 0},
+ {"emit", signalInstanceEmit, METH_VARARGS, 0},
{0} /* Sentinel */
};
static PyMappingMethods SignalInstance_as_mapping = {
0,
- signal_instance_get_item,
+ signalInstanceGetItem,
0
};
-PyTypeObject SignalInstance_Type = {
+PyTypeObject PySideSignalInstanceType = {
PyObject_HEAD_INIT(0)
- 0, /*ob_size*/
- "PySide.QtCore."SIGNAL_CLASS_NAME, /*tp_name*/
- sizeof(SignalInstanceData),/*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- &SignalInstance_as_mapping,/*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- SIGNAL_CLASS_NAME, /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- 0, /*tp_iter */
- 0, /*tp_iternext */
- SignalInstance_methods, /*tp_methods */
- 0, /*tp_members */
- 0, /*tp_getset */
- 0, /*tp_base */
- 0, /*tp_dict */
- 0, /*tp_descr_get */
- 0, /*tp_descr_set */
- 0, /*tp_dictoffset */
- 0, /*tp_init */
- 0, /*tp_alloc */
- PyType_GenericNew, /*tp_new */
- signal_instance_free, /*tp_free */
- 0, /*tp_is_gc */
- 0, /*tp_bases */
- 0, /*tp_mro */
- 0, /*tp_cache */
- 0, /*tp_subclasses */
- 0, /*tp_weaklist */
- 0, /*tp_del */
+ /*ob_size*/ 0,
+ /*tp_name*/ "PySide.QtCore."SIGNAL_CLASS_NAME,
+ /*tp_basicsize*/ sizeof(PySideSignalInstanceData),
+ /*tp_itemsize*/ 0,
+ /*tp_dealloc*/ 0,
+ /*tp_print*/ 0,
+ /*tp_getattr*/ 0,
+ /*tp_setattr*/ 0,
+ /*tp_compare*/ 0,
+ /*tp_repr*/ 0,
+ /*tp_as_number*/ 0,
+ /*tp_as_sequence*/ 0,
+ /*tp_as_mapping*/ &SignalInstance_as_mapping,
+ /*tp_hash*/ 0,
+ /*tp_call*/ signalInstanceCall,
+ /*tp_str*/ 0,
+ /*tp_getattro*/ 0,
+ /*tp_setattro*/ 0,
+ /*tp_as_buffer*/ 0,
+ /*tp_flags*/ Py_TPFLAGS_DEFAULT,
+ /*tp_doc*/ SIGNAL_CLASS_NAME,
+ /*tp_traverse*/ 0,
+ /*tp_clear*/ 0,
+ /*tp_richcompare*/ 0,
+ /*tp_weaklistoffset*/ 0,
+ /*tp_iter*/ 0,
+ /*tp_iternext*/ 0,
+ /*tp_methods*/ SignalInstance_methods,
+ /*tp_members*/ 0,
+ /*tp_getset*/ 0,
+ /*tp_base*/ 0,
+ /*tp_dict*/ 0,
+ /*tp_descr_get*/ 0,
+ /*tp_descr_set*/ 0,
+ /*tp_dictoffset*/ 0,
+ /*tp_init*/ 0,
+ /*tp_alloc*/ 0,
+ /*tp_new*/ PyType_GenericNew,
+ /*tp_free*/ signalInstanceFree,
+ /*tp_is_gc*/ 0,
+ /*tp_bases*/ 0,
+ /*tp_mro*/ 0,
+ /*tp_cache*/ 0,
+ /*tp_subclasses*/ 0,
+ /*tp_weaklist*/ 0,
+ /*tp_del*/ 0,
};
-
-void init_signal(PyObject* module)
-{
- if (PyType_Ready(&Signal_Type) < 0)
- return;
-
- Py_INCREF(&Signal_Type);
- PyModule_AddObject(module, SIGNAL_CLASS_NAME, ((PyObject*)&Signal_Type));
-
- if (PyType_Ready(&SignalInstance_Type) < 0)
- return;
-
- Py_INCREF(&SignalInstance_Type);
-}
-
-
-} // extern "C"
-
-
-PyObject* signal_instance_get_item(PyObject* self, PyObject* key)
-{
- SignalInstanceData* data = reinterpret_cast<SignalInstanceData*>(self);
- char* sigKey = signal_parse_signature(key);
- char* sig = signal_build_signature(data->signalName, sigKey);
- free(sigKey);
- const char* sigName = data->signalName;
-
- while(data) {
- if (strcmp(data->signature, sig) == 0) {
- free(sig);
- PyObject *result = reinterpret_cast<PyObject*>(data);
- Py_INCREF(result);
- return result;
- }
- data = reinterpret_cast<SignalInstanceData*>(data->next);
- }
- PyErr_Format(PyExc_IndexError, "Signature %s not found for signal: %s", sig, sigName);
- free(sig);
-
- return 0;
-}
-
-void signalUpdateSource(PyObject* source)
-{
- Shiboken::AutoDecRef attrs(PyObject_Dir(source));
-
- for(int i = 0, iMax = PyList_GET_SIZE(attrs.object()); i < iMax; ++i) {
- PyObject *attrName = PyList_GET_ITEM(attrs.object(), i);
- Shiboken::AutoDecRef attr(PyObject_GetAttr(reinterpret_cast<PyObject*>(source->ob_type), attrName));
- if (!attr.isNull() && attr->ob_type == &Signal_Type) {
- Shiboken::AutoDecRef signalInstance((PyObject*)PyObject_New(SignalInstanceData, &SignalInstance_Type));
- signal_instance_initialize(signalInstance, attrName, reinterpret_cast<SignalData*>(attr.object()), source, 0);
- PyObject_SetAttr(source, attrName, signalInstance);
- }
- }
-}
-
-char* get_type_name(PyObject* type)
-{
- if (PyType_Check(type)) {
- char *typeName = NULL;
- if (type->ob_type == &Shiboken::SbkBaseWrapperType_Type) {
- Shiboken::SbkBaseWrapperType *objType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(type);
- Q_ASSERT(objType->original_name);
- typeName = strdup(objType->original_name);
- } else {
- // Translate python types to Qt names
- PyTypeObject *objType = reinterpret_cast<PyTypeObject*>(type);
- if ((objType == &PyString_Type) || (objType == &PyUnicode_Type))
- typeName = strdup("QString");
- else if (objType == &PyInt_Type)
- typeName = strdup("int");
- else if (objType == &PyLong_Type)
- typeName = strdup("long");
- else if (objType == &PyFloat_Type)
- typeName = strdup("qreal");
- else if (objType == &PyBool_Type)
- typeName = strdup("bool");
- else
- typeName = strdup("PyObject");
- }
- return typeName;
- } else if (PyString_Check(type)) {
- return strdup(PyString_AS_STRING(type));
- }
- return 0;
-}
-
-char* signal_build_signature(const char *name, const char *signature)
-{
- QString signal;
- signal.sprintf("%s(%s)", name, signature);
- return strdup(QMetaObject::normalizedSignature(signal.toAscii()));
-}
-
-char* signal_parse_signature(PyObject *args)
-{
- char *signature = 0;
- if (args && (PyString_Check(args) || (!PySequence_Check(args) && (args != Py_None))))
- return get_type_name(args);
-
- for(Py_ssize_t i = 0, i_max = PySequence_Size(args); i < i_max; i++) {
- Shiboken::AutoDecRef arg(PySequence_ITEM(args, i));
- char* typeName = get_type_name(arg);
- if (typeName) {
- if (signature) {
- signature = reinterpret_cast<char*>(realloc(signature, (strlen(signature) + 1 + strlen(typeName)) * sizeof(char*)));
- signature = strcat(signature, ",");
- signature = strcat(signature, typeName);
- free(typeName);
- } else {
- signature = typeName;
- }
- }
- }
- return signature;
-}
-
-void signal_append_signature(SignalData* self, char* signature)
-{
- self->signaturesSize++;
-
- if (self->signaturesSize > 1) {
- self->signatures = (char**) realloc(self->signatures, sizeof(char**) * self->signaturesSize);
- } else {
- self->signatures = (char**) malloc(sizeof(char**));
- }
- self->signatures[self->signaturesSize-1] = signature;
-}
-
-int signal_init(PyObject* self, PyObject* args, PyObject* kwds)
+int signalTpInit(PyObject* self, PyObject* args, PyObject* kwds)
{
static PyObject *emptyTuple = 0;
static const char *kwlist[] = {"name", 0};
@@ -316,7 +191,7 @@ int signal_init(PyObject* self, PyObject* args, PyObject* kwds)
emptyTuple = PyTuple_New(0);
if (!PyArg_ParseTupleAndKeywords(emptyTuple, kwds,
- "|s:QtCore."SIGNAL_CLASS_NAME, (char**) kwlist, &argName))
+ "|s:QtCore."SIGNAL_CLASS_NAME, (char**) kwlist, &argName))
return 0;
bool tupledArgs = false;
@@ -329,17 +204,17 @@ int signal_init(PyObject* self, PyObject* args, PyObject* kwds)
PyObject *arg = PyTuple_GET_ITEM(args, i);
if (PySequence_Check(arg) && !PyString_Check(arg)) {
tupledArgs = true;
- signal_append_signature(data, signal_parse_signature(arg));
+ PySide::signalAppendSignature(data, PySide::signalParseSignature(arg));
}
}
if (!tupledArgs)
- signal_append_signature(data, signal_parse_signature(args));
+ PySide::signalAppendSignature(data, PySide::signalParseSignature(args));
return 1;
}
-void signal_free(void *self)
+void signalFree(void *self)
{
PyObject *pySelf = reinterpret_cast<PyObject*>(self);
SignalData *data = reinterpret_cast<SignalData*>(self);
@@ -353,85 +228,70 @@ void signal_free(void *self)
free(data->signalName);
data->initialized = 0;
data->signaturesSize = 0;
+ Py_XDECREF(data->homonymousMethod);
+ data->homonymousMethod = 0;
pySelf->ob_type->tp_base->tp_free(self);
}
-void signal_instance_free(void* self)
+void signalInstanceFree(void* self)
{
PyObject *pySelf = reinterpret_cast<PyObject*>(self);
- SignalInstanceData *data = reinterpret_cast<SignalInstanceData*>(self);
+ PySideSignalInstanceData *data = reinterpret_cast<PySideSignalInstanceData*>(self);
free(data->signalName);
free(data->signature);
+ Py_XDECREF(data->homonymousMethod);
+
if (data->next) {
- Py_XDECREF(data->next);
+ Py_DECREF(data->next);
data->next = 0;
}
pySelf->ob_type->tp_base->tp_free(self);
}
-void signal_instance_initialize(PyObject* instance, PyObject* name, SignalData* data, PyObject* source, int index)
-{
- SignalInstanceData *self = reinterpret_cast<SignalInstanceData*>(instance);
- self->next = 0;
- if (data->signalName)
- self->signalName = strdup(data->signalName);
- else
- self->signalName = strdup(PyString_AsString(name));
-
- self->source = source;
- self->signature = signal_build_signature(self->signalName, data->signatures[index]);
- index++;
-
- if (index < data->signaturesSize) {
- self->next = reinterpret_cast<PyObject*>(PyObject_New(SignalInstanceData, &SignalInstance_Type));
- signal_instance_initialize(self->next, name, data, source, index);
- }
-}
-
-PyObject* signal_instance_connect(PyObject* self, PyObject* args, PyObject* kwds)
+PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds)
{
PyObject *slot = 0;
PyObject *type = 0;
static const char *kwlist[] = {"slot", "type", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds,
- "O|O:"SIGNAL_CLASS_NAME, (char**) kwlist, &slot, &type))
+ "O|O:"SIGNAL_CLASS_NAME, (char**) kwlist, &slot, &type))
return 0;
- SignalInstanceData *source = reinterpret_cast<SignalInstanceData*>(self);
+ PySideSignalInstanceData *source = reinterpret_cast<PySideSignalInstanceData*>(self);
Shiboken::AutoDecRef pyArgs(PyList_New(0));
bool match = false;
- if (slot->ob_type == &SignalInstance_Type) {
- SignalInstanceData *sourceWalk = source;
- SignalInstanceData *targetWalk;
+ if (slot->ob_type == &PySideSignalInstanceType) {
+ PySideSignalInstanceData *sourceWalk = source;
+ PySideSignalInstanceData *targetWalk;
//find best match
while(sourceWalk && !match) {
- targetWalk = reinterpret_cast<SignalInstanceData*>(slot);
+ targetWalk = reinterpret_cast<PySideSignalInstanceData*>(slot);
while(targetWalk && !match) {
if (QMetaObject::checkConnectArgs(sourceWalk->signature, targetWalk->signature)) {
PyList_Append(pyArgs, sourceWalk->source);
- Shiboken::AutoDecRef sourceSignature(signal_build_qt_compatible(sourceWalk->signature));
+ Shiboken::AutoDecRef sourceSignature(PySide::signalBuildQtCompatible(sourceWalk->signature));
PyList_Append(pyArgs, sourceSignature);
PyList_Append(pyArgs, targetWalk->source);
- Shiboken::AutoDecRef targetSignature(signal_build_qt_compatible(targetWalk->signature));
+ Shiboken::AutoDecRef targetSignature(PySide::signalBuildQtCompatible(targetWalk->signature));
PyList_Append(pyArgs, targetSignature);
match = true;
}
- targetWalk = reinterpret_cast<SignalInstanceData*>(targetWalk->next);
+ targetWalk = reinterpret_cast<PySideSignalInstanceData*>(targetWalk->next);
}
- sourceWalk = reinterpret_cast<SignalInstanceData*>(sourceWalk->next);
+ sourceWalk = reinterpret_cast<PySideSignalInstanceData*>(sourceWalk->next);
}
} else {
//try the first signature
PyList_Append(pyArgs, source->source);
- Shiboken::AutoDecRef signature(signal_build_qt_compatible(source->signature));
+ Shiboken::AutoDecRef signature(PySide::signalBuildQtCompatible(source->signature));
PyList_Append(pyArgs, signature);
PyList_Append(pyArgs, slot);
@@ -450,20 +310,49 @@ PyObject* signal_instance_connect(PyObject* self, PyObject* args, PyObject* kwds
return 0;
}
-bool signal_connect(PyObject* source, const char* signal, PyObject* callback)
+PyObject* signalInstanceEmit(PyObject* self, PyObject* args)
{
- Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source, "connect"));
- if (pyMethod.isNull())
- return false;
+ PySideSignalInstanceData *source = reinterpret_cast<PySideSignalInstanceData*>(self);
- Shiboken::AutoDecRef pySignature(PyString_FromString(signal));
- Shiboken::AutoDecRef pyArgs(PyTuple_Pack(3, source, pySignature.object(), callback));
- return PyObject_CallObject(pyMethod, pyArgs);
+ Shiboken::AutoDecRef pyArgs(PyList_New(0));
+ Shiboken::AutoDecRef sourceSignature(PySide::signalBuildQtCompatible(source->signature));
+
+ PyList_Append(pyArgs, sourceSignature);
+ for(Py_ssize_t i = 0, max = PyTuple_Size(args); i < max; i++)
+ PyList_Append(pyArgs, PyTuple_GetItem(args, i));
+
+ Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source->source, "emit"));
+
+ Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs));
+ return PyObject_CallObject(pyMethod, tupleArgs);
+}
+
+PyObject* signalInstanceGetItem(PyObject* self, PyObject* key)
+{
+ PySideSignalInstanceData* data = reinterpret_cast<PySideSignalInstanceData*>(self);
+ char* sigKey = PySide::signalParseSignature(key);
+ char* sig = PySide::signalBuildSignature(data->signalName, sigKey);
+ free(sigKey);
+ const char* sigName = data->signalName;
+
+ while(data) {
+ if (strcmp(data->signature, sig) == 0) {
+ free(sig);
+ PyObject *result = reinterpret_cast<PyObject*>(data);
+ Py_INCREF(result);
+ return result;
+ }
+ data = reinterpret_cast<PySideSignalInstanceData*>(data->next);
+ }
+ PyErr_Format(PyExc_IndexError, "Signature %s not found for signal: %s", sig, sigName);
+ free(sig);
+
+ return 0;
}
-PyObject* signal_instance_disconnect(PyObject* self, PyObject* args)
+PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
{
- SignalInstanceData *source = reinterpret_cast<SignalInstanceData*>(self);
+ PySideSignalInstanceData *source = reinterpret_cast<PySideSignalInstanceData*>(self);
Shiboken::AutoDecRef pyArgs(PyList_New(0));
PyObject *slot;
@@ -473,22 +362,22 @@ PyObject* signal_instance_disconnect(PyObject* self, PyObject* args)
slot = args;
bool match = false;
- if (slot->ob_type == &SignalInstance_Type) {
- SignalInstanceData *target = reinterpret_cast<SignalInstanceData*>(slot);
+ if (slot->ob_type == &PySideSignalInstanceType) {
+ PySideSignalInstanceData *target = reinterpret_cast<PySideSignalInstanceData*>(slot);
if (QMetaObject::checkConnectArgs(source->signature, target->signature)) {
PyList_Append(pyArgs, source->source);
- Shiboken::AutoDecRef source_signature(signal_build_qt_compatible(source->signature));
+ Shiboken::AutoDecRef source_signature(PySide::signalBuildQtCompatible(source->signature));
PyList_Append(pyArgs, source_signature);
PyList_Append(pyArgs, target->source);
- Shiboken::AutoDecRef target_signature(signal_build_qt_compatible(target->signature));
+ Shiboken::AutoDecRef target_signature(PySide::signalBuildQtCompatible(target->signature));
PyList_Append(pyArgs, target_signature);
match = true;
}
} else {
//try the first signature
PyList_Append(pyArgs, source->source);
- Shiboken::AutoDecRef signature(signal_build_qt_compatible(source->signature));
+ Shiboken::AutoDecRef signature(PySide::signalBuildQtCompatible(source->signature));
PyList_Append(pyArgs, signature);
PyList_Append(pyArgs, slot);
@@ -504,38 +393,196 @@ PyObject* signal_instance_disconnect(PyObject* self, PyObject* args)
return 0;
}
-PyObject* signal_instance_emit(PyObject* self, PyObject* args)
+PyObject* signalCall(PyObject* self, PyObject* args, PyObject* kw)
{
- SignalInstanceData *source = reinterpret_cast<SignalInstanceData*>(self);
+ SignalData* signalData = reinterpret_cast<SignalData*>(self);
- Shiboken::AutoDecRef pyArgs(PyList_New(0));
- Shiboken::AutoDecRef source_signature(signal_build_qt_compatible(source->signature));
+ if (!signalData->homonymousMethod) {
+ PyErr_SetString(PyExc_TypeError, "native Qt signal is not callable");
+ return 0;
+ }
- PyList_Append(pyArgs, source_signature);
- for(Py_ssize_t i=0, i_max=PyTuple_Size(args); i < i_max; i++)
- PyList_Append(pyArgs, PyTuple_GetItem(args, i));
+ descrgetfunc getDescriptor = signalData->homonymousMethod->ob_type->tp_descr_get;
+ Shiboken::AutoDecRef homonymousMethod(getDescriptor(signalData->homonymousMethod, 0, 0));
- Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source->source, "emit"));
+ if (PyCFunction_GET_FLAGS(homonymousMethod.object()) & METH_STATIC)
+ return PyCFunction_Call(homonymousMethod, args, kw);
- Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs));
- return PyObject_CallObject(pyMethod, tupleArgs);
+ ternaryfunc callFunc = signalData->homonymousMethod->ob_type->tp_call;
+ return callFunc(homonymousMethod, args, kw);
+}
+
+PyObject* signalInstanceCall(PyObject* self, PyObject* args, PyObject* kw)
+{
+ PySideSignalInstanceData* signalData = reinterpret_cast<PySideSignalInstanceData*>(self);
+ if (!signalData->homonymousMethod) {
+ PyErr_SetString(PyExc_TypeError, "native Qt signal is not callable");
+ return 0;
+ }
+
+ descrgetfunc getDescriptor = signalData->homonymousMethod->ob_type->tp_descr_get;
+ Shiboken::AutoDecRef homonymousMethod(getDescriptor(signalData->homonymousMethod, signalData->source, 0));
+ return PyCFunction_Call(homonymousMethod, args, kw);
+}
+
+} // extern "C"
+
+namespace PySide
+{
+
+void initSignalSupport(PyObject* module)
+{
+ if (PyType_Ready(&PySideSignalType) < 0)
+ return;
+
+ Py_INCREF(&PySideSignalType);
+ PyModule_AddObject(module, SIGNAL_CLASS_NAME, ((PyObject*)&PySideSignalType));
+
+ if (PyType_Ready(&PySideSignalInstanceType) < 0)
+ return;
+
+ Py_INCREF(&PySideSignalInstanceType);
+}
+
+void signalUpdateSource(PyObject* source)
+{
+ Shiboken::AutoDecRef attrs(PyObject_Dir(source));
+
+ for(int i = 0, iMax = PyList_GET_SIZE(attrs.object()); i < iMax; ++i) {
+ PyObject *attrName = PyList_GET_ITEM(attrs.object(), i);
+ Shiboken::AutoDecRef attr(PyObject_GetAttr(reinterpret_cast<PyObject*>(source->ob_type), attrName));
+ if (!attr.isNull() && attr->ob_type == &PySideSignalType) {
+ Shiboken::AutoDecRef signalInstance((PyObject*)PyObject_New(PySideSignalInstanceData, &PySideSignalInstanceType));
+ signalInstanceInitialize(signalInstance, attrName, reinterpret_cast<SignalData*>(attr.object()), source, 0);
+ PyObject_SetAttr(source, attrName, signalInstance);
+ }
+ }
+}
+
+char* getTypeName(PyObject* type)
+{
+ if (PyType_Check(type)) {
+ char *typeName = NULL;
+ if (type->ob_type == &Shiboken::SbkBaseWrapperType_Type) {
+ Shiboken::SbkBaseWrapperType *objType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(type);
+ Q_ASSERT(objType->original_name);
+ typeName = strdup(objType->original_name);
+ } else {
+ // Translate python types to Qt names
+ PyTypeObject *objType = reinterpret_cast<PyTypeObject*>(type);
+ if ((objType == &PyString_Type) || (objType == &PyUnicode_Type))
+ typeName = strdup("QString");
+ else if (objType == &PyInt_Type)
+ typeName = strdup("int");
+ else if (objType == &PyLong_Type)
+ typeName = strdup("long");
+ else if (objType == &PyFloat_Type)
+ typeName = strdup("qreal");
+ else if (objType == &PyBool_Type)
+ typeName = strdup("bool");
+ else
+ typeName = strdup("PyObject");
+ }
+ return typeName;
+ } else if (PyString_Check(type)) {
+ return strdup(PyString_AS_STRING(type));
+ }
+ return 0;
+}
+
+char* signalBuildSignature(const char *name, const char *signature)
+{
+ QString signal;
+ signal.sprintf("%s(%s)", name, signature);
+ return strdup(QMetaObject::normalizedSignature(signal.toAscii()));
+}
+
+char* signalParseSignature(PyObject *args)
+{
+ char *signature = 0;
+ if (args && (PyString_Check(args) || (!PySequence_Check(args) && (args != Py_None))))
+ return getTypeName(args);
+
+ for(Py_ssize_t i = 0, i_max = PySequence_Size(args); i < i_max; i++) {
+ Shiboken::AutoDecRef arg(PySequence_ITEM(args, i));
+ char* typeName = getTypeName(arg);
+ if (typeName) {
+ if (signature) {
+ signature = reinterpret_cast<char*>(realloc(signature, (strlen(signature) + 1 + strlen(typeName)) * sizeof(char*)));
+ signature = strcat(signature, ",");
+ signature = strcat(signature, typeName);
+ free(typeName);
+ } else {
+ signature = typeName;
+ }
+ }
+ }
+ return signature;
+}
+
+void signalAppendSignature(SignalData* self, char* signature)
+{
+ self->signaturesSize++;
+
+ if (self->signaturesSize > 1) {
+ self->signatures = (char**) realloc(self->signatures, sizeof(char**) * self->signaturesSize);
+ } else {
+ self->signatures = (char**) malloc(sizeof(char**));
+ }
+ self->signatures[self->signaturesSize-1] = signature;
+}
+
+void signalInstanceInitialize(PyObject* instance, PyObject* name, SignalData* data, PyObject* source, int index)
+{
+ PySideSignalInstanceData *self = reinterpret_cast<PySideSignalInstanceData*>(instance);
+ self->next = 0;
+ if (data->signalName)
+ self->signalName = strdup(data->signalName);
+ else
+ self->signalName = strdup(PyString_AsString(name));
+
+ self->source = source;
+ self->signature = signalBuildSignature(self->signalName, data->signatures[index]);
+ self->homonymousMethod = 0;
+ if (data->homonymousMethod) {
+ self->homonymousMethod = data->homonymousMethod;
+ Py_INCREF(self->homonymousMethod);
+ }
+ index++;
+
+ if (index < data->signaturesSize) {
+ self->next = reinterpret_cast<PyObject*>(PyObject_New(PySideSignalInstanceData, &PySideSignalInstanceType));
+ signalInstanceInitialize(self->next, name, data, source, index);
+ }
+}
+
+bool signalConnect(PyObject* source, const char* signal, PyObject* callback)
+{
+ Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source, "connect"));
+ if (pyMethod.isNull())
+ return false;
+
+ Shiboken::AutoDecRef pySignature(PyString_FromString(signal));
+ Shiboken::AutoDecRef pyArgs(PyTuple_Pack(3, source, pySignature.object(), callback));
+ return PyObject_CallObject(pyMethod, pyArgs);
}
PyObject* signalNew(const char* name, ...)
{
va_list listSignatures;
char* sig = 0;
- SignalData* self = PyObject_New(SignalData, &Signal_Type);
+ SignalData* self = PyObject_New(SignalData, &PySideSignalType);
self->signalName = strdup(name);
self->signaturesSize = 0;
self->signatures = 0;
self->initialized = 0;
+ self->homonymousMethod = 0;
va_start(listSignatures, name);
sig = va_arg(listSignatures, char*);
while(sig != NULL) {
- signal_append_signature(self, strdup(sig));
+ signalAppendSignature(self, strdup(sig));
sig = va_arg(listSignatures, char*);
}
@@ -545,7 +592,7 @@ PyObject* signalNew(const char* name, ...)
}
-PyObject* signal_build_qt_compatible(const char* signature)
+PyObject* signalBuildQtCompatible(const char* signature)
{
char* qtSignature;
qtSignature = reinterpret_cast<char*>(malloc(strlen(signature)+2));
@@ -555,5 +602,15 @@ PyObject* signal_build_qt_compatible(const char* signature)
return ret;
}
+void addSignalToWrapper(Shiboken::SbkBaseWrapperType* wrapperType, const char* signalName, PyObject* signal)
+{
+ PyObject* typeDict = wrapperType->super.ht_type.tp_dict;
+ PyObject* homonymousMethod;
+ if ((homonymousMethod = PyDict_GetItemString(typeDict, signalName))) {
+ Py_INCREF(homonymousMethod);
+ reinterpret_cast<SignalData*>(signal)->homonymousMethod = homonymousMethod;
+ }
+ PyDict_SetItemString(typeDict, signalName, signal);
+}
} //namespace PySide
diff --git a/libpyside/qsignal.h b/libpyside/qsignal.h
index 54fa8f03a..7a8a34900 100644
--- a/libpyside/qsignal.h
+++ b/libpyside/qsignal.h
@@ -27,28 +27,32 @@
#include <Python.h>
#include <QObject>
-namespace PySide
-{
-
-struct SignalInstanceData
+namespace Shiboken
{
- PyObject_HEAD
- char* signalName;
- char* signature;
- PyObject* source;
- PyObject* next;
-};
-
+ struct SbkBaseWrapperType;
+}
extern "C"
{
- extern PYSIDE_API PyTypeObject Signal_Type;
- extern PYSIDE_API PyTypeObject SignalInstance_Type;
+ extern PYSIDE_API PyTypeObject PySideSignalInstanceType;
+
+ struct PySideSignalInstanceData
+ {
+ PyObject_HEAD
+ char* signalName;
+ char* signature;
+ PyObject* source;
+ PyObject* homonymousMethod;
+ PyObject* next;
+ };
}; //extern "C"
+namespace PySide
+{
+
PYSIDE_API PyObject* signalNew(const char* name, ...);
PYSIDE_API void signalUpdateSource(PyObject* source);
-PYSIDE_API bool signal_connect(PyObject* source, const char* signal, PyObject* callback);
+PYSIDE_API void addSignalToWrapper(Shiboken::SbkBaseWrapperType* wrapperType, const char* signalName, PyObject* signal);
} //namespace PySide
diff --git a/libpyside/qsignal_p.h b/libpyside/qsignal_p.h
new file mode 100644
index 000000000..7858011e8
--- /dev/null
+++ b/libpyside/qsignal_p.h
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the PySide project.
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef PYSIDE_QSIGNAL_P_H
+#define PYSIDE_QSIGNAL_P_H
+
+#include <Python.h>
+
+extern "C"
+{
+ extern PyTypeObject PySideSignalType;
+}; //extern "C"
+
+namespace PySide
+{
+ bool signalConnect(PyObject* source, const char* signal, PyObject* callback);
+ char* getTypeName(PyObject*);
+ void initSignalSupport(PyObject* module);
+} //namespace PySide
+
+#endif
diff --git a/libpyside/qslot.cpp b/libpyside/qslot.cpp
index 3c7f4fc74..5aab65490 100644
--- a/libpyside/qslot.cpp
+++ b/libpyside/qslot.cpp
@@ -21,9 +21,9 @@
*/
#include <shiboken.h>
-#include <dynamicqmetaobject.h>
-
#include <QString>
+#include "dynamicqmetaobject_p.h"
+#include "qsignal_p.h"
#define SLOT_DEC_NAME "Slot"
@@ -38,15 +38,11 @@ typedef struct
extern "C"
{
-static int slot_init(PyObject*, PyObject*, PyObject*);
-static PyObject* slot_call(PyObject*, PyObject*, PyObject*);
-
-//external qsignal.cpp
-extern char* get_type_name(PyObject*);
-
+static int slotTpInit(PyObject*, PyObject*, PyObject*);
+static PyObject* slotCall(PyObject*, PyObject*, PyObject*);
// Class Definition -----------------------------------------------
-static PyTypeObject Slot_Type = {
+static PyTypeObject PySideSlotType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
"PySide.QtCore."SLOT_DEC_NAME, /*tp_name*/
@@ -62,7 +58,7 @@ static PyTypeObject Slot_Type = {
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
- slot_call, /*tp_call*/
+ slotCall, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
@@ -83,7 +79,7 @@ static PyTypeObject Slot_Type = {
0, /*tp_descr_get */
0, /*tp_descr_set */
0, /*tp_dictoffset */
- (initproc)slot_init, /*tp_init */
+ slotTpInit, /*tp_init */
0, /*tp_alloc */
PyType_GenericNew, /*tp_new */
0, /*tp_free */
@@ -96,19 +92,7 @@ static PyTypeObject Slot_Type = {
0, /*tp_del */
};
-void init_slot(PyObject *module)
-{
- if (PyType_Ready(&Slot_Type) < 0)
- return;
-
- Py_INCREF(&Slot_Type);
- PyModule_AddObject(module, SLOT_DEC_NAME, ((PyObject*)&Slot_Type));
-}
-
-
-} // extern "C"
-
-int slot_init(PyObject *self, PyObject *args, PyObject *kw)
+int slotTpInit(PyObject *self, PyObject *args, PyObject *kw)
{
static PyObject *emptyTuple = 0;
static const char *kwlist[] = {"name", "result", 0};
@@ -124,7 +108,7 @@ int slot_init(PyObject *self, PyObject *args, PyObject *kw)
SlotData *data = reinterpret_cast<SlotData*>(self);
for(Py_ssize_t i = 0, i_max = PyTuple_Size(args); i < i_max; i++) {
PyObject *argType = PyTuple_GET_ITEM(args, i);
- char *typeName = get_type_name(argType);
+ char *typeName = PySide::getTypeName(argType);
if (typeName) {
if (data->args) {
data->args = reinterpret_cast<char*>(realloc(data->args, (strlen(data->args) + 1 + strlen(typeName)) * sizeof(char*)));
@@ -141,14 +125,14 @@ int slot_init(PyObject *self, PyObject *args, PyObject *kw)
data->slotName = strdup(argName);
if (argResult)
- data->resultType = get_type_name(argResult);
+ data->resultType = PySide::getTypeName(argResult);
else
data->resultType = strdup("void");
return 1;
}
-PyObject* slot_call(PyObject* self, PyObject* args, PyObject* kw)
+PyObject* slotCall(PyObject* self, PyObject* args, PyObject* kw)
{
static PyObject* pySlotName = 0;
PyObject* callback;
@@ -194,3 +178,18 @@ PyObject* slot_call(PyObject* self, PyObject* args, PyObject* kw)
return callback;
}
+} // extern "C"
+
+namespace PySide
+{
+
+void initSlotSupport(PyObject* module)
+{
+ if (PyType_Ready(&PySideSlotType) < 0)
+ return;
+
+ Py_INCREF(&PySideSlotType);
+ PyModule_AddObject(module, SLOT_DEC_NAME, ((PyObject*)&PySideSlotType));
+}
+
+} // namespace PySide
diff --git a/libpyside/qslot_p.h b/libpyside/qslot_p.h
new file mode 100644
index 000000000..56152a1b8
--- /dev/null
+++ b/libpyside/qslot_p.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the PySide project.
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#ifndef PYSIDE_SLOT_P_H
+#define PYSIDE_SLOT_P_H
+
+#include <Python.h>
+
+namespace PySide
+{
+ void initSlotSupport(PyObject* module);
+}
+
+#endif
diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp
index b8e97f922..c0ce568a9 100644
--- a/libpyside/signalmanager.cpp
+++ b/libpyside/signalmanager.cpp
@@ -21,8 +21,6 @@
*/
#include "signalmanager.h"
-#include "qproperty.h"
-#include "pyside.h"
#include <QHash>
#include <QStringList>
@@ -35,6 +33,10 @@
#include <basewrapper.h>
#include <conversions.h>
+#include "qproperty.h"
+#include "qproperty_p.h"
+#include "pyside.h"
+
#if QSLOT_CODE != 1 || QSIGNAL_CODE != 2
#error QSLOT_CODE and/or QSIGNAL_CODE changed! change the hardcoded stuff to the correct value!
#endif
@@ -46,6 +48,8 @@
namespace PySide {
+static int callMethod(QObject* object, int id, void** args);
+
PyObjectWrapper::PyObjectWrapper()
:m_me(Py_None)
{
@@ -363,7 +367,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
return id - metaObject->methodCount();
pp_name = PyString_FromString(mp.name());
- pp = qproperty_get_object(pySelf, pp_name);
+ pp = qpropertyGetObject(pySelf, pp_name);
if (!pp) {
qWarning("Invalid property.");
Py_XDECREF(pp_name);
@@ -376,7 +380,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
#ifndef QT_NO_PROPERTIES
case QMetaObject::ReadProperty:
{
- PyObject* value = qproperty_get(pp, pySelf);
+ PyObject* value = qpropertyGet(pp, pySelf);
if (value) {
void *data = typeResolver->toCpp(value);
if (Shiboken::TypeResolver::getType(mp.typeName()) == Shiboken::TypeResolver::ObjectType)
@@ -394,12 +398,12 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
case QMetaObject::WriteProperty:
{
Shiboken::AutoDecRef value(typeResolver->toPython(args[0]));
- qproperty_set(pp, pySelf, value);
+ qpropertySet(pp, pySelf, value);
break;
}
case QMetaObject::ResetProperty:
- qproperty_reset(pp, pp_name);
+ qpropertyReset(pp, pp_name);
break;
case QMetaObject::QueryPropertyDesignable:
@@ -410,7 +414,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
break;
#endif
case QMetaObject::InvokeMetaMethod:
- id = call_method(object, id, args);
+ id = callMethod(object, id, args);
break;
default:
@@ -427,7 +431,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
return id;
}
-int SignalManager::call_method(QObject* object, int id, void** args)
+static int PySide::callMethod(QObject* object, int id, void** args)
{
const QMetaObject* metaObject = object->metaObject();
QMetaMethod method = metaObject->method(id);
diff --git a/libpyside/signalmanager.h b/libpyside/signalmanager.h
index 53e5f6e2d..2fda00833 100644
--- a/libpyside/signalmanager.h
+++ b/libpyside/signalmanager.h
@@ -82,8 +82,6 @@ private:
// disable copy
SignalManager(const SignalManager&);
SignalManager operator=(const SignalManager&);
-
- static int call_method(QObject* object, int id, void** args);
};
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 4cacd140a..83a5d212b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -6,8 +6,8 @@ else()
endif()
if(WIN32)
- set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR};${CMAKE_SOURCE_DIR}/tests/util")
- set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR};$ENV{PATH}")
+ set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR};${CMAKE_SOURCE_DIR}/tests/util;${testbinding_BINARY_DIR}")
+ set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR};${pysidetest_BINARY_DIR};$ENV{PATH}")
set(LIBRARY_PATH_VAR "PATH")
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE "\\" "/" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}")
@@ -15,8 +15,8 @@ else()
string(REPLACE ";" "\\;" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE ";" "\\;" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}")
else()
- set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR}:${CMAKE_SOURCE_DIR}/tests/util")
- set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR}:$ENV{LD_LIBRARY_PATH}")
+ set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR}:${CMAKE_SOURCE_DIR}/tests/util:${testbinding_BINARY_DIR}")
+ set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR}:${pysidetest_BINARY_DIR}:$ENV{LD_LIBRARY_PATH}")
set(LIBRARY_PATH_VAR "LD_LIBRARY_PATH")
endif()
@@ -35,7 +35,7 @@ else()
elseif(${ARGC} EQUAL 2)
set(EXPECT_TO_FAIL ${ARGV1})
else()
- message(WARNING "Ivalid call of macro PYSIDE_TEST")
+ message(WARNING "Invalid call of macro PYSIDE_TEST")
endif()
set(TEST_CMD ${XVFB_EXEC} ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}")
add_test(${TEST_NAME} ${TEST_CMD})
@@ -59,6 +59,7 @@ else()
endif ()
add_subdirectory(signals)
+ add_subdirectory(pysidetest)
TEST_QT_MODULE(QT_QTCORE_FOUND QtCore)
TEST_QT_MODULE(QT_QTGUI_FOUND QtGui)
TEST_QT_MODULE(QT_QTNETWORK_FOUND QtNetwork)
diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt
new file mode 100644
index 000000000..887a2d57f
--- /dev/null
+++ b/tests/pysidetest/CMakeLists.txt
@@ -0,0 +1,71 @@
+project(pysidetest)
+project(testbinding)
+
+cmake_minimum_required(VERSION 2.6)
+find_package(Qt4 4.5.0 REQUIRED)
+find_package(PythonLibs REQUIRED)
+find_package(PythonInterpWithDebug REQUIRED)
+find_package(GeneratorRunner 0.6 REQUIRED)
+find_package(Shiboken 0.5 REQUIRED)
+
+
+set(QT_USE_QTCORE 1)
+include(${QT_USE_FILE})
+add_definitions(${QT_DEFINITIONS})
+add_definitions(-DQT_SHARED)
+add_definitions(-DRXX_ALLOCATOR_INIT_0)
+
+set(pysidetest_SRC
+testobject.cpp
+)
+
+set(pysidetest_MOC_HEADERS
+testobject.h
+)
+
+qt4_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS})
+
+set(testbinding_SRC
+${CMAKE_CURRENT_BINARY_DIR}/testbinding/testobject_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/testbinding/testbinding_module_wrapper.cpp
+)
+
+set(GENERATOR_EXTRA_FLAGS --generatorSet=shiboken --enable-parent-ctor-heuristic --enable-pyside-extensions --enable-return-value-heuristic)
+add_custom_command(OUTPUT ${testbinding_SRC}
+COMMAND ${GENERATORRUNNER_BINARY} ${GENERATOR_EXTRA_FLAGS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/global.h
+ --include-paths=${CMAKE_CURRENT_SOURCE_DIR}:${QT_INCLUDE_DIR}:${QT_QTCORE_INCLUDE_DIR}
+ --typesystem-paths=${CMAKE_CURRENT_SOURCE_DIR}:${pyside_SOURCE_DIR}:${QtCore_SOURCE_DIR}
+ --output-directory=${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pysidetest.xml
+WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+COMMENT "Running generator for test binding..."
+)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${QT_INCLUDE_DIR}
+ ${QT_QTCORE_INCLUDE_DIR}
+ ${SHIBOKEN_INCLUDE_DIR}
+ ${QtCore_BINARY_DIR}/PySide/QtCore
+ ${libpyside_SOURCE_DIR}
+ ${PYTHON_INCLUDE_PATH})
+
+add_library(pysidetest SHARED ${pysidetest_SRC} ${pysidetest_MOC_SRC})
+target_link_libraries(pysidetest ${QT_QTCORE_LIBRARY})
+
+add_library(testbinding MODULE ${testbinding_SRC})
+set_property(TARGET testbinding PROPERTY PREFIX "")
+target_link_libraries(testbinding
+ pysidetest
+ pyside
+ ${PYTHON_LIBRARIES}
+ ${SHIBOKEN_LIBRARY}
+ ${QT_QTCORE_LIBRARY}
+ ${SBK_PYTHON_LIBRARIES})
+
+add_dependencies(testbinding pyside QtCore libpyside pysidetest)
+
+
+PYSIDE_TEST(homonymoussignalandmethod_test.py)
+
diff --git a/tests/pysidetest/global.h b/tests/pysidetest/global.h
new file mode 100644
index 000000000..22d337542
--- /dev/null
+++ b/tests/pysidetest/global.h
@@ -0,0 +1,2 @@
+#include "pyside_global.h"
+#include "testobject.h"
diff --git a/tests/pysidetest/homonymoussignalandmethod_test.py b/tests/pysidetest/homonymoussignalandmethod_test.py
new file mode 100644
index 000000000..4850c5bc3
--- /dev/null
+++ b/tests/pysidetest/homonymoussignalandmethod_test.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+import unittest
+from testbinding import TestObject
+
+'''Tests the behaviour of homonymous signals and slots.'''
+
+class HomonymousSignalAndMethodTest(unittest.TestCase):
+
+ def setUp(self):
+ self.value = 123
+ self.called = False
+ self.obj = TestObject(self.value)
+
+ def tearDown(self):
+ del self.value
+ del self.called
+ del self.obj
+
+ def testIdValueSignalEmission(self):
+ def callback(idValue):
+ self.assertEqual(idValue, self.value)
+ self.obj.idValue.connect(callback)
+ self.obj.emitIdValueSignal()
+
+ def testStaticMethodDoubleSignalEmission(self):
+ def callback():
+ self.called = True
+ self.obj.staticMethodDouble.connect(callback)
+ self.obj.emitStaticMethodDoubleSignal()
+ self.assert_(self.called)
+
+ def testSignalNotCallable(self):
+ self.assertRaises(TypeError, self.obj.justASignal)
+
+ def testCallingInstanceMethodWithArguments(self):
+ self.assertRaises(TypeError, TestObject.idValue, 1)
+
+ def testCallingInstanceMethodWithoutArguments(self):
+ self.assertRaises(TypeError, TestObject.idValue)
+
+ def testHomonymousSignalAndMethod(self):
+ self.assertEqual(self.obj.idValue(), self.value)
+
+ def testHomonymousSignalAndStaticMethod(self):
+ self.assertEqual(TestObject.staticMethodDouble(3), 6)
+
+ def testHomonymousSignalAndStaticMethodFromInstance(self):
+ self.assertEqual(self.obj.staticMethodDouble(4), 8)
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/tests/pysidetest/pyside_global.h b/tests/pysidetest/pyside_global.h
new file mode 100644
index 000000000..660d9fb05
--- /dev/null
+++ b/tests/pysidetest/pyside_global.h
@@ -0,0 +1,1507 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** This file is part of the QtCore module of the Qt Toolkit, plus some
+** modifications by PySide team.
+**
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+**
+****************************************************************************/
+
+#undef QT_NO_STL
+#undef QT_NO_STL_WCHAR
+
+#include <QtCore/qnamespace.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Core)
+
+class QByteArray;
+
+class QString;
+
+#ifndef Q_MOC_OUTPUT_REVISION
+#define Q_MOC_OUTPUT_REVISION 61
+#endif
+
+// macro for onaming members
+#ifdef METHOD
+#undef METHOD
+#endif
+#ifdef SLOT
+#undef SLOT
+#endif
+#ifdef SIGNAL
+#undef SIGNAL
+#endif
+
+Q_CORE_EXPORT const char *qFlagLocation(const char *method);
+
+#define QTOSTRING_HELPER(s) #s
+#define QTOSTRING(s) QTOSTRING_HELPER(s)
+#ifndef QT_NO_DEBUG
+# define QLOCATION "\0"__FILE__":"QTOSTRING(__LINE__)
+# define METHOD(a) qFlagLocation("0"#a QLOCATION)
+# define SLOT(a) qFlagLocation("1"#a QLOCATION)
+# define SIGNAL(a) qFlagLocation("2"#a QLOCATION)
+#else
+# define METHOD(a) "0"#a
+# define SLOT(a) "1"#a
+# define SIGNAL(a) "2"#a
+#endif
+
+#ifdef QT3_SUPPORT
+#define METHOD_CODE 0 // member type codes
+#define SLOT_CODE 1
+#define SIGNAL_CODE 2
+#endif
+
+#define QMETHOD_CODE 0 // member type codes
+#define QSLOT_CODE 1
+#define QSIGNAL_CODE 2
+
+#define Q_ARG(type, data) QArgument<type >(#type, data)
+#define Q_RETURN_ARG(type, data) QReturnArgument<type >(#type, data)
+
+class QObject;
+class QMetaMethod;
+class QMetaEnum;
+class QMetaProperty;
+class QMetaClassInfo;
+
+
+class Q_CORE_EXPORT QGenericArgument
+{
+public:
+ inline QGenericArgument(const char *aName = 0, const void *aData = 0)
+ : _data(aData), _name(aName) {}
+ inline void *data() const { return const_cast<void *>(_data); }
+ inline const char *name() const { return _name; }
+
+private:
+ const void *_data;
+ const char *_name;
+};
+
+class Q_CORE_EXPORT QGenericReturnArgument: public QGenericArgument
+{
+public:
+ inline QGenericReturnArgument(const char *aName = 0, void *aData = 0)
+ : QGenericArgument(aName, aData)
+ {}
+};
+
+template <class T>
+class QArgument: public QGenericArgument
+{
+public:
+ inline QArgument(const char *aName, const T &aData)
+ : QGenericArgument(aName, static_cast<const void *>(&aData))
+ {}
+};
+
+
+template <typename T>
+class QReturnArgument: public QGenericReturnArgument
+{
+public:
+ inline QReturnArgument(const char *aName, T &aData)
+ : QGenericReturnArgument(aName, static_cast<void *>(&aData))
+ {}
+};
+
+struct Q_CORE_EXPORT QMetaObject
+{
+ const char *className() const;
+ const QMetaObject *superClass() const;
+
+ QObject *cast(QObject *obj) const;
+
+#ifndef QT_NO_TRANSLATION
+ // ### Qt 4: Merge overloads
+ QString tr(const char *s, const char *c) const;
+ QString trUtf8(const char *s, const char *c) const;
+ QString tr(const char *s, const char *c, int n) const;
+ QString trUtf8(const char *s, const char *c, int n) const;
+#endif // QT_NO_TRANSLATION
+
+ int methodOffset() const;
+ int enumeratorOffset() const;
+ int propertyOffset() const;
+ int classInfoOffset() const;
+
+ int constructorCount() const;
+ int methodCount() const;
+ int enumeratorCount() const;
+ int propertyCount() const;
+ int classInfoCount() const;
+
+ int indexOfConstructor(const char *constructor) const;
+ int indexOfMethod(const char *method) const;
+ int indexOfSignal(const char *signal) const;
+ int indexOfSlot(const char *slot) const;
+ int indexOfEnumerator(const char *name) const;
+ int indexOfProperty(const char *name) const;
+ int indexOfClassInfo(const char *name) const;
+
+ QMetaMethod constructor(int index) const;
+ QMetaMethod method(int index) const;
+ QMetaEnum enumerator(int index) const;
+ QMetaProperty property(int index) const;
+ QMetaClassInfo classInfo(int index) const;
+ QMetaProperty userProperty() const;
+
+ static bool checkConnectArgs(const char *signal, const char *method);
+ static QByteArray normalizedSignature(const char *method);
+ static QByteArray normalizedType(const char *type);
+
+ // internal index-based connect
+ static bool connect(const QObject *sender, int signal_index,
+ const QObject *receiver, int method_index,
+ int type = 0, int *types = 0);
+ // internal index-based disconnect
+ static bool disconnect(const QObject *sender, int signal_index,
+ const QObject *receiver, int method_index);
+ // internal slot-name based connect
+ static void connectSlotsByName(QObject *o);
+
+ // internal index-based signal activation
+ static void activate(QObject *sender, int signal_index, void **argv);
+ static void activate(QObject *sender, int from_signal_index, int to_signal_index, void **argv);
+ static void activate(QObject *sender, const QMetaObject *, int local_signal_index, void **argv);
+ static void activate(QObject *sender, const QMetaObject *, int from_local_signal_index, int to_local_signal_index, void **argv);
+ // internal guarded pointers
+ static void addGuard(QObject **ptr);
+ static void removeGuard(QObject **ptr);
+ static void changeGuard(QObject **ptr, QObject *o);
+
+ static bool invokeMethod(QObject *obj, const char *member,
+ Qt::ConnectionType,
+ QGenericReturnArgument ret,
+ QGenericArgument val0 = QGenericArgument(0),
+ QGenericArgument val1 = QGenericArgument(),
+ QGenericArgument val2 = QGenericArgument(),
+ QGenericArgument val3 = QGenericArgument(),
+ QGenericArgument val4 = QGenericArgument(),
+ QGenericArgument val5 = QGenericArgument(),
+ QGenericArgument val6 = QGenericArgument(),
+ QGenericArgument val7 = QGenericArgument(),
+ QGenericArgument val8 = QGenericArgument(),
+ QGenericArgument val9 = QGenericArgument());
+
+ static inline bool invokeMethod(QObject *obj, const char *member,
+ QGenericReturnArgument ret,
+ QGenericArgument val0 = QGenericArgument(0),
+ QGenericArgument val1 = QGenericArgument(),
+ QGenericArgument val2 = QGenericArgument(),
+ QGenericArgument val3 = QGenericArgument(),
+ QGenericArgument val4 = QGenericArgument(),
+ QGenericArgument val5 = QGenericArgument(),
+ QGenericArgument val6 = QGenericArgument(),
+ QGenericArgument val7 = QGenericArgument(),
+ QGenericArgument val8 = QGenericArgument(),
+ QGenericArgument val9 = QGenericArgument())
+ {
+ return invokeMethod(obj, member, Qt::AutoConnection, ret, val0, val1, val2, val3,
+ val4, val5, val6, val7, val8, val9);
+ }
+
+ static inline bool invokeMethod(QObject *obj, const char *member,
+ Qt::ConnectionType type,
+ QGenericArgument val0 = QGenericArgument(0),
+ QGenericArgument val1 = QGenericArgument(),
+ QGenericArgument val2 = QGenericArgument(),
+ QGenericArgument val3 = QGenericArgument(),
+ QGenericArgument val4 = QGenericArgument(),
+ QGenericArgument val5 = QGenericArgument(),
+ QGenericArgument val6 = QGenericArgument(),
+ QGenericArgument val7 = QGenericArgument(),
+ QGenericArgument val8 = QGenericArgument(),
+ QGenericArgument val9 = QGenericArgument())
+ {
+ return invokeMethod(obj, member, type, QGenericReturnArgument(), val0, val1, val2,
+ val3, val4, val5, val6, val7, val8, val9);
+ }
+
+ static inline bool invokeMethod(QObject *obj, const char *member,
+ QGenericArgument val0 = QGenericArgument(0),
+ QGenericArgument val1 = QGenericArgument(),
+ QGenericArgument val2 = QGenericArgument(),
+ QGenericArgument val3 = QGenericArgument(),
+ QGenericArgument val4 = QGenericArgument(),
+ QGenericArgument val5 = QGenericArgument(),
+ QGenericArgument val6 = QGenericArgument(),
+ QGenericArgument val7 = QGenericArgument(),
+ QGenericArgument val8 = QGenericArgument(),
+ QGenericArgument val9 = QGenericArgument())
+ {
+ return invokeMethod(obj, member, Qt::AutoConnection, QGenericReturnArgument(), val0,
+ val1, val2, val3, val4, val5, val6, val7, val8, val9);
+ }
+
+ QObject *newInstance(QGenericArgument val0 = QGenericArgument(0),
+ QGenericArgument val1 = QGenericArgument(),
+ QGenericArgument val2 = QGenericArgument(),
+ QGenericArgument val3 = QGenericArgument(),
+ QGenericArgument val4 = QGenericArgument(),
+ QGenericArgument val5 = QGenericArgument(),
+ QGenericArgument val6 = QGenericArgument(),
+ QGenericArgument val7 = QGenericArgument(),
+ QGenericArgument val8 = QGenericArgument(),
+ QGenericArgument val9 = QGenericArgument()) const;
+
+ enum Call {
+ InvokeMetaMethod,
+ ReadProperty,
+ WriteProperty,
+ ResetProperty,
+ QueryPropertyDesignable,
+ QueryPropertyScriptable,
+ QueryPropertyStored,
+ QueryPropertyEditable,
+ QueryPropertyUser,
+ CreateInstance
+ };
+
+ int static_metacall(Call, int, void **) const;
+
+#ifdef QT3_SUPPORT
+ QT3_SUPPORT const char *superClassName() const;
+#endif
+
+ struct { // private data
+ const QMetaObject *superdata;
+ const char *stringdata;
+ const uint *data;
+ const void *extradata;
+ } d;
+};
+
+struct QMetaObjectExtraData
+{
+ const QMetaObject **objects;
+ int (*static_metacall)(QMetaObject::Call, int, void **);
+};
+
+inline const char *QMetaObject::className() const
+{ return d.stringdata; }
+
+inline const QMetaObject *QMetaObject::superClass() const
+{ return d.superdata; }
+
+#ifdef QT3_SUPPORT
+inline const char *QMetaObject::superClassName() const
+{ return d.superdata ? d.superdata->className() : 0; }
+#endif
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#define qdoc
+
+#if 1
+ #define Q_WS_X11
+#elif 0
+ #define Q_WS_MAC
+#elif 0
+ #define Q_WS_WIN
+#endif
+
+// There are symbols in Qt that exist in Debug but
+// not in release
+#define QT_NO_DEBUG
+
+#include <QtCore/QtCore>
+#if 0
+ #undef qdoc
+#endif
+#include <QtGui/QtGui>
+#if 1
+ #include <QtGui/QX11Info>
+#endif
+#include <QtXml/QtXml>
+#include <QtUiTools/QtUiTools>
+#include <QtNetwork/QtNetwork>
+#include <QtScript/QtScript>
+#include <QtScriptTools/QtScriptTools>
+#include <QtMultimedia/QtMultimedia>
+#include <QtMaemo5/QtMaemo5>
+#include <QtDeclarative/QtDeclarative>
+
+// QT_GUI_LIB must be defined to QSqlRelationalDelegate become visible
+#define QT_GUI_LIB
+#undef Q_DECLARE_INTERFACE
+#include <QtSql/QtSql>
+#include <QtSvg/QtSvg>
+
+#ifndef QT_NO_XMLPATTERNS
+# include <QtXmlPatterns/QtXmlPatterns>
+#endif
+
+#ifndef QT_NO_WEBKIT
+# include <QtWebKit/QtWebKit>
+#endif
+
+#ifndef QT_NO_TEST
+# include <QtTest/QtTest>
+#endif
+
+// Phonon
+#include "phonon/pyside_phonon.h"
+#include<phonon/abstractaudiooutput.h>
+#include<phonon/abstractmediastream.h>
+#include<phonon/abstractvideooutput.h>
+#include<phonon/addoninterface.h>
+#include<phonon/audiooutput.h>
+#include<phonon/audiooutputinterface.h>
+#include<phonon/backendcapabilities.h>
+#include<phonon/backendinterface.h>
+#include<phonon/effect.h>
+#include<phonon/effectinterface.h>
+#include<phonon/effectparameter.h>
+#include<phonon/effectwidget.h>
+#include<phonon/mediacontroller.h>
+#include<phonon/medianode.h>
+#include<phonon/mediaobject.h>
+#include<phonon/mediaobjectinterface.h>
+#include<phonon/mediasource.h>
+#include<phonon/objectdescription.h>
+#include<phonon/objectdescriptionmodel.h>
+#include<phonon/path.h>
+#include<phonon/phonon_export.h>
+#include<phonon/phonondefs.h>
+#include<phonon/phononnamespace.h>
+#include<phonon/platformplugin.h>
+#include<phonon/seekslider.h>
+#include<phonon/streaminterface.h>
+#include<phonon/videoplayer.h>
+#include<phonon/videowidget.h>
+#include<phonon/videowidgetinterface.h>
+#include<phonon/volumefadereffect.h>
+#include<phonon/volumefaderinterface.h>
+#include<phonon/volumeslider.h>
+
+//QtHelp need be included after QtSql
+#include <QtHelp/QtHelp>
+
+#ifndef QT_NO_OPENGL
+#define GL_ACCUM 0x0100
+#define GL_LOAD 0x0101
+#define GL_RETURN 0x0102
+#define GL_MULT 0x0103
+#define GL_ADD 0x0104
+
+/* AlphaFunction */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+
+/* AttribMask */
+#define GL_CURRENT_BIT 0x00000001
+#define GL_POINT_BIT 0x00000002
+#define GL_LINE_BIT 0x00000004
+#define GL_POLYGON_BIT 0x00000008
+#define GL_POLYGON_STIPPLE_BIT 0x00000010
+#define GL_PIXEL_MODE_BIT 0x00000020
+#define GL_LIGHTING_BIT 0x00000040
+#define GL_FOG_BIT 0x00000080
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_ACCUM_BUFFER_BIT 0x00000200
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_VIEWPORT_BIT 0x00000800
+#define GL_TRANSFORM_BIT 0x00001000
+#define GL_ENABLE_BIT 0x00002000
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_HINT_BIT 0x00008000
+#define GL_EVAL_BIT 0x00010000
+#define GL_LIST_BIT 0x00020000
+#define GL_TEXTURE_BIT 0x00040000
+#define GL_SCISSOR_BIT 0x00080000
+#define GL_ALL_ATTRIB_BITS 0x000fffff
+
+/* BeginMode */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+#define GL_QUADS 0x0007
+#define GL_QUAD_STRIP 0x0008
+#define GL_POLYGON 0x0009
+
+/* BlendingFactorDest */
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+
+/* BlendingFactorSrc */
+/* GL_ZERO */
+/* GL_ONE */
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+/* Boolean */
+#define GL_TRUE 1
+#define GL_FALSE 0
+
+/* ClearBufferMask */
+/* GL_COLOR_BUFFER_BIT */
+/* GL_ACCUM_BUFFER_BIT */
+/* GL_STENCIL_BUFFER_BIT */
+/* GL_DEPTH_BUFFER_BIT */
+
+/* ClientArrayType */
+/* GL_VERTEX_ARRAY */
+/* GL_NORMAL_ARRAY */
+/* GL_COLOR_ARRAY */
+/* GL_INDEX_ARRAY */
+/* GL_TEXTURE_COORD_ARRAY */
+/* GL_EDGE_FLAG_ARRAY */
+
+/* ClipPlaneName */
+#define GL_CLIP_PLANE0 0x3000
+#define GL_CLIP_PLANE1 0x3001
+#define GL_CLIP_PLANE2 0x3002
+#define GL_CLIP_PLANE3 0x3003
+#define GL_CLIP_PLANE4 0x3004
+#define GL_CLIP_PLANE5 0x3005
+
+/* ColorMaterialFace */
+/* GL_FRONT */
+/* GL_BACK */
+/* GL_FRONT_AND_BACK */
+
+/* ColorMaterialParameter */
+/* GL_AMBIENT */
+/* GL_DIFFUSE */
+/* GL_SPECULAR */
+/* GL_EMISSION */
+/* GL_AMBIENT_AND_DIFFUSE */
+
+/* ColorPointerType */
+/* GL_BYTE */
+/* GL_UNSIGNED_BYTE */
+/* GL_SHORT */
+/* GL_UNSIGNED_SHORT */
+/* GL_INT */
+/* GL_UNSIGNED_INT */
+/* GL_FLOAT */
+/* GL_DOUBLE */
+
+/* CullFaceMode */
+/* GL_FRONT */
+/* GL_BACK */
+/* GL_FRONT_AND_BACK */
+
+/* DataType */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_2_BYTES 0x1407
+#define GL_3_BYTES 0x1408
+#define GL_4_BYTES 0x1409
+#define GL_DOUBLE 0x140A
+
+/* DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* DrawBufferMode */
+#define GL_NONE 0
+#define GL_FRONT_LEFT 0x0400
+#define GL_FRONT_RIGHT 0x0401
+#define GL_BACK_LEFT 0x0402
+#define GL_BACK_RIGHT 0x0403
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_LEFT 0x0406
+#define GL_RIGHT 0x0407
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_AUX0 0x0409
+#define GL_AUX1 0x040A
+#define GL_AUX2 0x040B
+#define GL_AUX3 0x040C
+
+/* Enable */
+/* GL_FOG */
+/* GL_LIGHTING */
+/* GL_TEXTURE_1D */
+/* GL_TEXTURE_2D */
+/* GL_LINE_STIPPLE */
+/* GL_POLYGON_STIPPLE */
+/* GL_CULL_FACE */
+/* GL_ALPHA_TEST */
+/* GL_BLEND */
+/* GL_INDEX_LOGIC_OP */
+/* GL_COLOR_LOGIC_OP */
+/* GL_DITHER */
+/* GL_STENCIL_TEST */
+/* GL_DEPTH_TEST */
+/* GL_CLIP_PLANE0 */
+/* GL_CLIP_PLANE1 */
+/* GL_CLIP_PLANE2 */
+/* GL_CLIP_PLANE3 */
+/* GL_CLIP_PLANE4 */
+/* GL_CLIP_PLANE5 */
+/* GL_LIGHT0 */
+/* GL_LIGHT1 */
+/* GL_LIGHT2 */
+/* GL_LIGHT3 */
+/* GL_LIGHT4 */
+/* GL_LIGHT5 */
+/* GL_LIGHT6 */
+/* GL_LIGHT7 */
+/* GL_TEXTURE_GEN_S */
+/* GL_TEXTURE_GEN_T */
+/* GL_TEXTURE_GEN_R */
+/* GL_TEXTURE_GEN_Q */
+/* GL_MAP1_VERTEX_3 */
+/* GL_MAP1_VERTEX_4 */
+/* GL_MAP1_COLOR_4 */
+/* GL_MAP1_INDEX */
+/* GL_MAP1_NORMAL */
+/* GL_MAP1_TEXTURE_COORD_1 */
+/* GL_MAP1_TEXTURE_COORD_2 */
+/* GL_MAP1_TEXTURE_COORD_3 */
+/* GL_MAP1_TEXTURE_COORD_4 */
+/* GL_MAP2_VERTEX_3 */
+/* GL_MAP2_VERTEX_4 */
+/* GL_MAP2_COLOR_4 */
+/* GL_MAP2_INDEX */
+/* GL_MAP2_NORMAL */
+/* GL_MAP2_TEXTURE_COORD_1 */
+/* GL_MAP2_TEXTURE_COORD_2 */
+/* GL_MAP2_TEXTURE_COORD_3 */
+/* GL_MAP2_TEXTURE_COORD_4 */
+/* GL_POINT_SMOOTH */
+/* GL_LINE_SMOOTH */
+/* GL_POLYGON_SMOOTH */
+/* GL_SCISSOR_TEST */
+/* GL_COLOR_MATERIAL */
+/* GL_NORMALIZE */
+/* GL_AUTO_NORMAL */
+/* GL_VERTEX_ARRAY */
+/* GL_NORMAL_ARRAY */
+/* GL_COLOR_ARRAY */
+/* GL_INDEX_ARRAY */
+/* GL_TEXTURE_COORD_ARRAY */
+/* GL_EDGE_FLAG_ARRAY */
+/* GL_POLYGON_OFFSET_POINT */
+/* GL_POLYGON_OFFSET_LINE */
+/* GL_POLYGON_OFFSET_FILL */
+
+/* ErrorCode */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_STACK_OVERFLOW 0x0503
+#define GL_STACK_UNDERFLOW 0x0504
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* FeedBackMode */
+#define GL_2D 0x0600
+#define GL_3D 0x0601
+#define GL_3D_COLOR 0x0602
+#define GL_3D_COLOR_TEXTURE 0x0603
+#define GL_4D_COLOR_TEXTURE 0x0604
+
+/* FeedBackToken */
+#define GL_PASS_THROUGH_TOKEN 0x0700
+#define GL_POINT_TOKEN 0x0701
+#define GL_LINE_TOKEN 0x0702
+#define GL_POLYGON_TOKEN 0x0703
+#define GL_BITMAP_TOKEN 0x0704
+#define GL_DRAW_PIXEL_TOKEN 0x0705
+#define GL_COPY_PIXEL_TOKEN 0x0706
+#define GL_LINE_RESET_TOKEN 0x0707
+
+/* FogMode */
+/* GL_LINEAR */
+#define GL_EXP 0x0800
+#define GL_EXP2 0x0801
+
+
+/* FogParameter */
+/* GL_FOG_COLOR */
+/* GL_FOG_DENSITY */
+/* GL_FOG_END */
+/* GL_FOG_INDEX */
+/* GL_FOG_MODE */
+/* GL_FOG_START */
+
+/* FrontFaceDirection */
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+
+/* GetMapTarget */
+#define GL_COEFF 0x0A00
+#define GL_ORDER 0x0A01
+#define GL_DOMAIN 0x0A02
+
+/* GetPixelMap */
+/* GL_PIXEL_MAP_I_TO_I */
+/* GL_PIXEL_MAP_S_TO_S */
+/* GL_PIXEL_MAP_I_TO_R */
+/* GL_PIXEL_MAP_I_TO_G */
+/* GL_PIXEL_MAP_I_TO_B */
+/* GL_PIXEL_MAP_I_TO_A */
+/* GL_PIXEL_MAP_R_TO_R */
+/* GL_PIXEL_MAP_G_TO_G */
+/* GL_PIXEL_MAP_B_TO_B */
+/* GL_PIXEL_MAP_A_TO_A */
+
+/* GetPointerTarget */
+/* GL_VERTEX_ARRAY_POINTER */
+/* GL_NORMAL_ARRAY_POINTER */
+/* GL_COLOR_ARRAY_POINTER */
+/* GL_INDEX_ARRAY_POINTER */
+/* GL_TEXTURE_COORD_ARRAY_POINTER */
+/* GL_EDGE_FLAG_ARRAY_POINTER */
+
+/* GetTarget */
+#define GL_CURRENT_COLOR 0x0B00
+#define GL_CURRENT_INDEX 0x0B01
+#define GL_CURRENT_NORMAL 0x0B02
+#define GL_CURRENT_TEXTURE_COORDS 0x0B03
+#define GL_CURRENT_RASTER_COLOR 0x0B04
+#define GL_CURRENT_RASTER_INDEX 0x0B05
+#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06
+#define GL_CURRENT_RASTER_POSITION 0x0B07
+#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08
+#define GL_CURRENT_RASTER_DISTANCE 0x0B09
+#define GL_POINT_SMOOTH 0x0B10
+#define GL_POINT_SIZE 0x0B11
+#define GL_POINT_SIZE_RANGE 0x0B12
+#define GL_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_LINE_SMOOTH 0x0B20
+#define GL_LINE_WIDTH 0x0B21
+#define GL_LINE_WIDTH_RANGE 0x0B22
+#define GL_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_LINE_STIPPLE 0x0B24
+#define GL_LINE_STIPPLE_PATTERN 0x0B25
+#define GL_LINE_STIPPLE_REPEAT 0x0B26
+#define GL_LIST_MODE 0x0B30
+#define GL_MAX_LIST_NESTING 0x0B31
+#define GL_LIST_BASE 0x0B32
+#define GL_LIST_INDEX 0x0B33
+#define GL_POLYGON_MODE 0x0B40
+#define GL_POLYGON_SMOOTH 0x0B41
+#define GL_POLYGON_STIPPLE 0x0B42
+#define GL_EDGE_FLAG 0x0B43
+#define GL_CULL_FACE 0x0B44
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_LIGHTING 0x0B50
+#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51
+#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
+#define GL_LIGHT_MODEL_AMBIENT 0x0B53
+#define GL_SHADE_MODEL 0x0B54
+#define GL_COLOR_MATERIAL_FACE 0x0B55
+#define GL_COLOR_MATERIAL_PARAMETER 0x0B56
+#define GL_COLOR_MATERIAL 0x0B57
+#define GL_FOG 0x0B60
+#define GL_FOG_INDEX 0x0B61
+#define GL_FOG_DENSITY 0x0B62
+#define GL_FOG_START 0x0B63
+#define GL_FOG_END 0x0B64
+#define GL_FOG_MODE 0x0B65
+#define GL_FOG_COLOR 0x0B66
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_TEST 0x0B71
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_ACCUM_CLEAR_VALUE 0x0B80
+#define GL_STENCIL_TEST 0x0B90
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_MATRIX_MODE 0x0BA0
+#define GL_NORMALIZE 0x0BA1
+#define GL_VIEWPORT 0x0BA2
+#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
+#define GL_PROJECTION_STACK_DEPTH 0x0BA4
+#define GL_TEXTURE_STACK_DEPTH 0x0BA5
+#define GL_MODELVIEW_MATRIX 0x0BA6
+#define GL_PROJECTION_MATRIX 0x0BA7
+#define GL_TEXTURE_MATRIX 0x0BA8
+#define GL_ATTRIB_STACK_DEPTH 0x0BB0
+#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
+#define GL_ALPHA_TEST 0x0BC0
+#define GL_ALPHA_TEST_FUNC 0x0BC1
+#define GL_ALPHA_TEST_REF 0x0BC2
+#define GL_DITHER 0x0BD0
+#define GL_BLEND_DST 0x0BE0
+#define GL_BLEND_SRC 0x0BE1
+#define GL_BLEND 0x0BE2
+#define GL_LOGIC_OP_MODE 0x0BF0
+#define GL_INDEX_LOGIC_OP 0x0BF1
+#define GL_COLOR_LOGIC_OP 0x0BF2
+#define GL_AUX_BUFFERS 0x0C00
+#define GL_DRAW_BUFFER 0x0C01
+#define GL_READ_BUFFER 0x0C02
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_INDEX_CLEAR_VALUE 0x0C20
+#define GL_INDEX_WRITEMASK 0x0C21
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_INDEX_MODE 0x0C30
+#define GL_RGBA_MODE 0x0C31
+#define GL_DOUBLEBUFFER 0x0C32
+#define GL_STEREO 0x0C33
+#define GL_RENDER_MODE 0x0C40
+#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
+#define GL_POINT_SMOOTH_HINT 0x0C51
+#define GL_LINE_SMOOTH_HINT 0x0C52
+#define GL_POLYGON_SMOOTH_HINT 0x0C53
+#define GL_FOG_HINT 0x0C54
+#define GL_TEXTURE_GEN_S 0x0C60
+#define GL_TEXTURE_GEN_T 0x0C61
+#define GL_TEXTURE_GEN_R 0x0C62
+#define GL_TEXTURE_GEN_Q 0x0C63
+#define GL_PIXEL_MAP_I_TO_I 0x0C70
+#define GL_PIXEL_MAP_S_TO_S 0x0C71
+#define GL_PIXEL_MAP_I_TO_R 0x0C72
+#define GL_PIXEL_MAP_I_TO_G 0x0C73
+#define GL_PIXEL_MAP_I_TO_B 0x0C74
+#define GL_PIXEL_MAP_I_TO_A 0x0C75
+#define GL_PIXEL_MAP_R_TO_R 0x0C76
+#define GL_PIXEL_MAP_G_TO_G 0x0C77
+#define GL_PIXEL_MAP_B_TO_B 0x0C78
+#define GL_PIXEL_MAP_A_TO_A 0x0C79
+#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0
+#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1
+#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2
+#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3
+#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4
+#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5
+#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6
+#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7
+#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8
+#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9
+#define GL_UNPACK_SWAP_BYTES 0x0CF0
+#define GL_UNPACK_LSB_FIRST 0x0CF1
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_SWAP_BYTES 0x0D00
+#define GL_PACK_LSB_FIRST 0x0D01
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAP_COLOR 0x0D10
+#define GL_MAP_STENCIL 0x0D11
+#define GL_INDEX_SHIFT 0x0D12
+#define GL_INDEX_OFFSET 0x0D13
+#define GL_RED_SCALE 0x0D14
+#define GL_RED_BIAS 0x0D15
+#define GL_ZOOM_X 0x0D16
+#define GL_ZOOM_Y 0x0D17
+#define GL_GREEN_SCALE 0x0D18
+#define GL_GREEN_BIAS 0x0D19
+#define GL_BLUE_SCALE 0x0D1A
+#define GL_BLUE_BIAS 0x0D1B
+#define GL_ALPHA_SCALE 0x0D1C
+#define GL_ALPHA_BIAS 0x0D1D
+#define GL_DEPTH_SCALE 0x0D1E
+#define GL_DEPTH_BIAS 0x0D1F
+#define GL_MAX_EVAL_ORDER 0x0D30
+#define GL_MAX_LIGHTS 0x0D31
+#define GL_MAX_CLIP_PLANES 0x0D32
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_PIXEL_MAP_TABLE 0x0D34
+#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35
+#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
+#define GL_MAX_NAME_STACK_DEPTH 0x0D37
+#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
+#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_INDEX_BITS 0x0D51
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_ACCUM_RED_BITS 0x0D58
+#define GL_ACCUM_GREEN_BITS 0x0D59
+#define GL_ACCUM_BLUE_BITS 0x0D5A
+#define GL_ACCUM_ALPHA_BITS 0x0D5B
+#define GL_NAME_STACK_DEPTH 0x0D70
+#define GL_AUTO_NORMAL 0x0D80
+#define GL_MAP1_COLOR_4 0x0D90
+#define GL_MAP1_INDEX 0x0D91
+#define GL_MAP1_NORMAL 0x0D92
+#define GL_MAP1_TEXTURE_COORD_1 0x0D93
+#define GL_MAP1_TEXTURE_COORD_2 0x0D94
+#define GL_MAP1_TEXTURE_COORD_3 0x0D95
+#define GL_MAP1_TEXTURE_COORD_4 0x0D96
+#define GL_MAP1_VERTEX_3 0x0D97
+#define GL_MAP1_VERTEX_4 0x0D98
+#define GL_MAP2_COLOR_4 0x0DB0
+#define GL_MAP2_INDEX 0x0DB1
+#define GL_MAP2_NORMAL 0x0DB2
+#define GL_MAP2_TEXTURE_COORD_1 0x0DB3
+#define GL_MAP2_TEXTURE_COORD_2 0x0DB4
+#define GL_MAP2_TEXTURE_COORD_3 0x0DB5
+#define GL_MAP2_TEXTURE_COORD_4 0x0DB6
+#define GL_MAP2_VERTEX_3 0x0DB7
+#define GL_MAP2_VERTEX_4 0x0DB8
+#define GL_MAP1_GRID_DOMAIN 0x0DD0
+#define GL_MAP1_GRID_SEGMENTS 0x0DD1
+#define GL_MAP2_GRID_DOMAIN 0x0DD2
+#define GL_MAP2_GRID_SEGMENTS 0x0DD3
+#define GL_TEXTURE_1D 0x0DE0
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0
+#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1
+#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2
+#define GL_SELECTION_BUFFER_POINTER 0x0DF3
+#define GL_SELECTION_BUFFER_SIZE 0x0DF4
+/* GL_TEXTURE_BINDING_1D */
+/* GL_TEXTURE_BINDING_2D */
+/* GL_VERTEX_ARRAY */
+/* GL_NORMAL_ARRAY */
+/* GL_COLOR_ARRAY */
+/* GL_INDEX_ARRAY */
+/* GL_TEXTURE_COORD_ARRAY */
+/* GL_EDGE_FLAG_ARRAY */
+/* GL_VERTEX_ARRAY_SIZE */
+/* GL_VERTEX_ARRAY_TYPE */
+/* GL_VERTEX_ARRAY_STRIDE */
+/* GL_NORMAL_ARRAY_TYPE */
+/* GL_NORMAL_ARRAY_STRIDE */
+/* GL_COLOR_ARRAY_SIZE */
+/* GL_COLOR_ARRAY_TYPE */
+/* GL_COLOR_ARRAY_STRIDE */
+/* GL_INDEX_ARRAY_TYPE */
+/* GL_INDEX_ARRAY_STRIDE */
+/* GL_TEXTURE_COORD_ARRAY_SIZE */
+/* GL_TEXTURE_COORD_ARRAY_TYPE */
+/* GL_TEXTURE_COORD_ARRAY_STRIDE */
+/* GL_EDGE_FLAG_ARRAY_STRIDE */
+/* GL_POLYGON_OFFSET_FACTOR */
+/* GL_POLYGON_OFFSET_UNITS */
+
+/* GetTextureParameter */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+#define GL_TEXTURE_WIDTH 0x1000
+#define GL_TEXTURE_HEIGHT 0x1001
+#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
+#define GL_TEXTURE_BORDER_COLOR 0x1004
+#define GL_TEXTURE_BORDER 0x1005
+/* GL_TEXTURE_RED_SIZE */
+/* GL_TEXTURE_GREEN_SIZE */
+/* GL_TEXTURE_BLUE_SIZE */
+/* GL_TEXTURE_ALPHA_SIZE */
+/* GL_TEXTURE_LUMINANCE_SIZE */
+/* GL_TEXTURE_INTENSITY_SIZE */
+/* GL_TEXTURE_PRIORITY */
+/* GL_TEXTURE_RESIDENT */
+
+/* HintMode */
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* HintTarget */
+/* GL_PERSPECTIVE_CORRECTION_HINT */
+/* GL_POINT_SMOOTH_HINT */
+/* GL_LINE_SMOOTH_HINT */
+/* GL_POLYGON_SMOOTH_HINT */
+/* GL_FOG_HINT */
+/* GL_PHONG_HINT */
+
+/* IndexPointerType */
+/* GL_SHORT */
+/* GL_INT */
+/* GL_FLOAT */
+/* GL_DOUBLE */
+
+/* LightModelParameter */
+/* GL_LIGHT_MODEL_AMBIENT */
+/* GL_LIGHT_MODEL_LOCAL_VIEWER */
+/* GL_LIGHT_MODEL_TWO_SIDE */
+
+/* LightName */
+#define GL_LIGHT0 0x4000
+#define GL_LIGHT1 0x4001
+#define GL_LIGHT2 0x4002
+#define GL_LIGHT3 0x4003
+#define GL_LIGHT4 0x4004
+#define GL_LIGHT5 0x4005
+#define GL_LIGHT6 0x4006
+#define GL_LIGHT7 0x4007
+
+/* LightParameter */
+#define GL_AMBIENT 0x1200
+#define GL_DIFFUSE 0x1201
+#define GL_SPECULAR 0x1202
+#define GL_POSITION 0x1203
+#define GL_SPOT_DIRECTION 0x1204
+#define GL_SPOT_EXPONENT 0x1205
+#define GL_SPOT_CUTOFF 0x1206
+#define GL_CONSTANT_ATTENUATION 0x1207
+#define GL_LINEAR_ATTENUATION 0x1208
+#define GL_QUADRATIC_ATTENUATION 0x1209
+
+/* InterleavedArrays */
+/* GL_V2F */
+/* GL_V3F */
+/* GL_C4UB_V2F */
+/* GL_C4UB_V3F */
+/* GL_C3F_V3F */
+/* GL_N3F_V3F */
+/* GL_C4F_N3F_V3F */
+/* GL_T2F_V3F */
+/* GL_T4F_V4F */
+/* GL_T2F_C4UB_V3F */
+/* GL_T2F_C3F_V3F */
+/* GL_T2F_N3F_V3F */
+/* GL_T2F_C4F_N3F_V3F */
+/* GL_T4F_C4F_N3F_V4F */
+
+/* ListMode */
+#define GL_COMPILE 0x1300
+#define GL_COMPILE_AND_EXECUTE 0x1301
+
+/* ListNameType */
+/* GL_BYTE */
+/* GL_UNSIGNED_BYTE */
+/* GL_SHORT */
+/* GL_UNSIGNED_SHORT */
+/* GL_INT */
+/* GL_UNSIGNED_INT */
+/* GL_FLOAT */
+/* GL_2_BYTES */
+/* GL_3_BYTES */
+/* GL_4_BYTES */
+
+/* LogicOp */
+#define GL_CLEAR 0x1500
+#define GL_AND 0x1501
+#define GL_AND_REVERSE 0x1502
+#define GL_COPY 0x1503
+#define GL_AND_INVERTED 0x1504
+#define GL_NOOP 0x1505
+#define GL_XOR 0x1506
+#define GL_OR 0x1507
+#define GL_NOR 0x1508
+#define GL_EQUIV 0x1509
+#define GL_INVERT 0x150A
+#define GL_OR_REVERSE 0x150B
+#define GL_COPY_INVERTED 0x150C
+#define GL_OR_INVERTED 0x150D
+#define GL_NAND 0x150E
+#define GL_SET 0x150F
+
+/* MapTarget */
+/* GL_MAP1_COLOR_4 */
+/* GL_MAP1_INDEX */
+/* GL_MAP1_NORMAL */
+/* GL_MAP1_TEXTURE_COORD_1 */
+/* GL_MAP1_TEXTURE_COORD_2 */
+/* GL_MAP1_TEXTURE_COORD_3 */
+/* GL_MAP1_TEXTURE_COORD_4 */
+/* GL_MAP1_VERTEX_3 */
+/* GL_MAP1_VERTEX_4 */
+/* GL_MAP2_COLOR_4 */
+/* GL_MAP2_INDEX */
+/* GL_MAP2_NORMAL */
+/* GL_MAP2_TEXTURE_COORD_1 */
+/* GL_MAP2_TEXTURE_COORD_2 */
+/* GL_MAP2_TEXTURE_COORD_3 */
+/* GL_MAP2_TEXTURE_COORD_4 */
+/* GL_MAP2_VERTEX_3 */
+/* GL_MAP2_VERTEX_4 */
+
+/* MaterialFace */
+/* GL_FRONT */
+/* GL_BACK */
+/* GL_FRONT_AND_BACK */
+
+/* MaterialParameter */
+#define GL_EMISSION 0x1600
+#define GL_SHININESS 0x1601
+#define GL_AMBIENT_AND_DIFFUSE 0x1602
+#define GL_COLOR_INDEXES 0x1603
+/* GL_AMBIENT */
+/* GL_DIFFUSE */
+/* GL_SPECULAR */
+
+/* MatrixMode */
+#define GL_MODELVIEW 0x1700
+#define GL_PROJECTION 0x1701
+#define GL_TEXTURE 0x1702
+
+/* MeshMode1 */
+/* GL_POINT */
+/* GL_LINE */
+
+/* MeshMode2 */
+/* GL_POINT */
+/* GL_LINE */
+/* GL_FILL */
+
+/* NormalPointerType */
+/* GL_BYTE */
+/* GL_SHORT */
+/* GL_INT */
+/* GL_FLOAT */
+/* GL_DOUBLE */
+
+/* PixelCopyType */
+#define GL_COLOR 0x1800
+#define GL_DEPTH 0x1801
+#define GL_STENCIL 0x1802
+
+/* PixelFormat */
+#define GL_COLOR_INDEX 0x1900
+#define GL_STENCIL_INDEX 0x1901
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_RED 0x1903
+#define GL_GREEN 0x1904
+#define GL_BLUE 0x1905
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+
+/* PixelMap */
+/* GL_PIXEL_MAP_I_TO_I */
+/* GL_PIXEL_MAP_S_TO_S */
+/* GL_PIXEL_MAP_I_TO_R */
+/* GL_PIXEL_MAP_I_TO_G */
+/* GL_PIXEL_MAP_I_TO_B */
+/* GL_PIXEL_MAP_I_TO_A */
+/* GL_PIXEL_MAP_R_TO_R */
+/* GL_PIXEL_MAP_G_TO_G */
+/* GL_PIXEL_MAP_B_TO_B */
+/* GL_PIXEL_MAP_A_TO_A */
+
+/* PixelStore */
+/* GL_UNPACK_SWAP_BYTES */
+/* GL_UNPACK_LSB_FIRST */
+/* GL_UNPACK_ROW_LENGTH */
+/* GL_UNPACK_SKIP_ROWS */
+/* GL_UNPACK_SKIP_PIXELS */
+/* GL_UNPACK_ALIGNMENT */
+/* GL_PACK_SWAP_BYTES */
+/* GL_PACK_LSB_FIRST */
+/* GL_PACK_ROW_LENGTH */
+/* GL_PACK_SKIP_ROWS */
+/* GL_PACK_SKIP_PIXELS */
+/* GL_PACK_ALIGNMENT */
+
+/* PixelTransfer */
+/* GL_MAP_COLOR */
+/* GL_MAP_STENCIL */
+/* GL_INDEX_SHIFT */
+/* GL_INDEX_OFFSET */
+/* GL_RED_SCALE */
+/* GL_RED_BIAS */
+/* GL_GREEN_SCALE */
+/* GL_GREEN_BIAS */
+/* GL_BLUE_SCALE */
+/* GL_BLUE_BIAS */
+/* GL_ALPHA_SCALE */
+/* GL_ALPHA_BIAS */
+/* GL_DEPTH_SCALE */
+/* GL_DEPTH_BIAS */
+
+/* PixelType */
+#define GL_BITMAP 0x1A00
+/* GL_BYTE */
+/* GL_UNSIGNED_BYTE */
+/* GL_SHORT */
+/* GL_UNSIGNED_SHORT */
+/* GL_INT */
+/* GL_UNSIGNED_INT */
+/* GL_FLOAT */
+
+/* PolygonMode */
+#define GL_POINT 0x1B00
+#define GL_LINE 0x1B01
+#define GL_FILL 0x1B02
+
+/* ReadBufferMode */
+/* GL_FRONT_LEFT */
+/* GL_FRONT_RIGHT */
+/* GL_BACK_LEFT */
+/* GL_BACK_RIGHT */
+/* GL_FRONT */
+/* GL_BACK */
+/* GL_LEFT */
+/* GL_RIGHT */
+/* GL_AUX0 */
+/* GL_AUX1 */
+/* GL_AUX2 */
+/* GL_AUX3 */
+
+/* RenderingMode */
+#define GL_RENDER 0x1C00
+#define GL_FEEDBACK 0x1C01
+#define GL_SELECT 0x1C02
+
+/* ShadingModel */
+#define GL_FLAT 0x1D00
+#define GL_SMOOTH 0x1D01
+
+
+/* StencilFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* StencilOp */
+/* GL_ZERO */
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+/* GL_INVERT */
+
+/* StringName */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* TextureCoordName */
+#define GL_S 0x2000
+#define GL_T 0x2001
+#define GL_R 0x2002
+#define GL_Q 0x2003
+
+/* TexCoordPointerType */
+/* GL_SHORT */
+/* GL_INT */
+/* GL_FLOAT */
+/* GL_DOUBLE */
+
+/* TextureEnvMode */
+#define GL_MODULATE 0x2100
+#define GL_DECAL 0x2101
+/* GL_BLEND */
+/* GL_REPLACE */
+
+/* TextureEnvParameter */
+#define GL_TEXTURE_ENV_MODE 0x2200
+#define GL_TEXTURE_ENV_COLOR 0x2201
+
+/* TextureEnvTarget */
+#define GL_TEXTURE_ENV 0x2300
+
+/* TextureGenMode */
+#define GL_EYE_LINEAR 0x2400
+#define GL_OBJECT_LINEAR 0x2401
+#define GL_SPHERE_MAP 0x2402
+
+/* TextureGenParameter */
+#define GL_TEXTURE_GEN_MODE 0x2500
+#define GL_OBJECT_PLANE 0x2501
+#define GL_EYE_PLANE 0x2502
+
+/* TextureMagFilter */
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+
+/* TextureMinFilter */
+/* GL_NEAREST */
+/* GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+/* GL_TEXTURE_BORDER_COLOR */
+/* GL_TEXTURE_PRIORITY */
+
+/* TextureTarget */
+/* GL_TEXTURE_1D */
+/* GL_TEXTURE_2D */
+/* GL_PROXY_TEXTURE_1D */
+/* GL_PROXY_TEXTURE_2D */
+
+/* TextureWrapMode */
+#define GL_CLAMP 0x2900
+#define GL_REPEAT 0x2901
+
+/* VertexPointerType */
+/* GL_SHORT */
+/* GL_INT */
+/* GL_FLOAT */
+/* GL_DOUBLE */
+
+/* ClientAttribMask */
+#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
+#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
+#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff
+
+/* polygon_offset */
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_OFFSET_POINT 0x2A01
+#define GL_POLYGON_OFFSET_LINE 0x2A02
+#define GL_POLYGON_OFFSET_FILL 0x8037
+
+/* texture */
+#define GL_ALPHA4 0x803B
+#define GL_ALPHA8 0x803C
+#define GL_ALPHA12 0x803D
+#define GL_ALPHA16 0x803E
+#define GL_LUMINANCE4 0x803F
+#define GL_LUMINANCE8 0x8040
+#define GL_LUMINANCE12 0x8041
+#define GL_LUMINANCE16 0x8042
+#define GL_LUMINANCE4_ALPHA4 0x8043
+#define GL_LUMINANCE6_ALPHA2 0x8044
+#define GL_LUMINANCE8_ALPHA8 0x8045
+#define GL_LUMINANCE12_ALPHA4 0x8046
+#define GL_LUMINANCE12_ALPHA12 0x8047
+#define GL_LUMINANCE16_ALPHA16 0x8048
+#define GL_INTENSITY 0x8049
+#define GL_INTENSITY4 0x804A
+#define GL_INTENSITY8 0x804B
+#define GL_INTENSITY12 0x804C
+#define GL_INTENSITY16 0x804D
+#define GL_R3_G3_B2 0x2A10
+#define GL_RGB4 0x804F
+#define GL_RGB5 0x8050
+#define GL_RGB8 0x8051
+#define GL_RGB10 0x8052
+#define GL_RGB12 0x8053
+#define GL_RGB16 0x8054
+#define GL_RGBA2 0x8055
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_RGBA12 0x805A
+#define GL_RGBA16 0x805B
+#define GL_TEXTURE_RED_SIZE 0x805C
+#define GL_TEXTURE_GREEN_SIZE 0x805D
+#define GL_TEXTURE_BLUE_SIZE 0x805E
+#define GL_TEXTURE_ALPHA_SIZE 0x805F
+#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
+#define GL_TEXTURE_INTENSITY_SIZE 0x8061
+#define GL_PROXY_TEXTURE_1D 0x8063
+#define GL_PROXY_TEXTURE_2D 0x8064
+
+/* texture_object */
+#define GL_TEXTURE_PRIORITY 0x8066
+#define GL_TEXTURE_RESIDENT 0x8067
+#define GL_TEXTURE_BINDING_1D 0x8068
+#define GL_TEXTURE_BINDING_2D 0x8069
+
+/* vertex_array */
+#define GL_VERTEX_ARRAY 0x8074
+#define GL_NORMAL_ARRAY 0x8075
+#define GL_COLOR_ARRAY 0x8076
+#define GL_INDEX_ARRAY 0x8077
+#define GL_TEXTURE_COORD_ARRAY 0x8078
+#define GL_EDGE_FLAG_ARRAY 0x8079
+#define GL_VERTEX_ARRAY_SIZE 0x807A
+#define GL_VERTEX_ARRAY_TYPE 0x807B
+#define GL_VERTEX_ARRAY_STRIDE 0x807C
+#define GL_NORMAL_ARRAY_TYPE 0x807E
+#define GL_NORMAL_ARRAY_STRIDE 0x807F
+#define GL_COLOR_ARRAY_SIZE 0x8081
+#define GL_COLOR_ARRAY_TYPE 0x8082
+#define GL_COLOR_ARRAY_STRIDE 0x8083
+#define GL_INDEX_ARRAY_TYPE 0x8085
+#define GL_INDEX_ARRAY_STRIDE 0x8086
+#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
+#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
+#define GL_VERTEX_ARRAY_POINTER 0x808E
+#define GL_NORMAL_ARRAY_POINTER 0x808F
+#define GL_COLOR_ARRAY_POINTER 0x8090
+#define GL_INDEX_ARRAY_POINTER 0x8091
+#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
+#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093
+#define GL_V2F 0x2A20
+#define GL_V3F 0x2A21
+#define GL_C4UB_V2F 0x2A22
+#define GL_C4UB_V3F 0x2A23
+#define GL_C3F_V3F 0x2A24
+#define GL_N3F_V3F 0x2A25
+#define GL_C4F_N3F_V3F 0x2A26
+#define GL_T2F_V3F 0x2A27
+#define GL_T4F_V4F 0x2A28
+#define GL_T2F_C4UB_V3F 0x2A29
+#define GL_T2F_C3F_V3F 0x2A2A
+#define GL_T2F_N3F_V3F 0x2A2B
+#define GL_T2F_C4F_N3F_V3F 0x2A2C
+#define GL_T4F_C4F_N3F_V4F 0x2A2D
+
+/* Extensions */
+#define GL_EXT_vertex_array 1
+#define GL_EXT_bgra 1
+#define GL_EXT_paletted_texture 1
+#define GL_WIN_swap_hint 1
+#define GL_WIN_draw_range_elements 1
+// #define GL_WIN_phong_shading 1
+// #define GL_WIN_specular_fog 1
+
+/* EXT_vertex_array */
+#define GL_VERTEX_ARRAY_EXT 0x8074
+#define GL_NORMAL_ARRAY_EXT 0x8075
+#define GL_COLOR_ARRAY_EXT 0x8076
+#define GL_INDEX_ARRAY_EXT 0x8077
+#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078
+#define GL_EDGE_FLAG_ARRAY_EXT 0x8079
+#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A
+#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B
+#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C
+#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D
+#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E
+#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F
+#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080
+#define GL_COLOR_ARRAY_SIZE_EXT 0x8081
+#define GL_COLOR_ARRAY_TYPE_EXT 0x8082
+#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083
+#define GL_COLOR_ARRAY_COUNT_EXT 0x8084
+#define GL_INDEX_ARRAY_TYPE_EXT 0x8085
+#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086
+#define GL_INDEX_ARRAY_COUNT_EXT 0x8087
+#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A
+#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B
+#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C
+#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D
+#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E
+#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F
+#define GL_COLOR_ARRAY_POINTER_EXT 0x8090
+#define GL_INDEX_ARRAY_POINTER_EXT 0x8091
+#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092
+#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093
+#define GL_DOUBLE_EXT GL_DOUBLE
+
+/* EXT_bgra */
+#define GL_BGR_EXT 0x80E0
+#define GL_BGRA_EXT 0x80E1
+
+/* EXT_paletted_texture */
+
+/* These must match the GL_COLOR_TABLE_*_SGI enumerants */
+#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8
+#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9
+#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA
+#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB
+#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC
+#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD
+#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE
+#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF
+
+#define GL_COLOR_INDEX1_EXT 0x80E2
+#define GL_COLOR_INDEX2_EXT 0x80E3
+#define GL_COLOR_INDEX4_EXT 0x80E4
+#define GL_COLOR_INDEX8_EXT 0x80E5
+#define GL_COLOR_INDEX12_EXT 0x80E6
+#define GL_COLOR_INDEX16_EXT 0x80E7
+
+/* WIN_draw_range_elements */
+#define GL_MAX_ELEMENTS_VERTICES_WIN 0x80E8
+#define GL_MAX_ELEMENTS_INDICES_WIN 0x80E9
+
+/* WIN_phong_shading */
+#define GL_PHONG_WIN 0x80EA
+#define GL_PHONG_HINT_WIN 0x80EB
+
+/* WIN_specular_fog */
+#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC
+
+/* For compatibility with OpenGL v1.0 */
+#define GL_LOGIC_OP GL_INDEX_LOGIC_OP
+#define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT
+#include <QtOpenGL/QtOpenGL>
+#endif // QT_NO_OPENGL
+
diff --git a/tests/pysidetest/symbols.filter b/tests/pysidetest/symbols.filter
new file mode 100644
index 000000000..af6c744dd
--- /dev/null
+++ b/tests/pysidetest/symbols.filter
@@ -0,0 +1,7 @@
+{
+local:
+_ZSt*;
+_ZNSt*;
+_ZNSs*;
+_ZNKSt*;
+};
diff --git a/tests/pysidetest/testobject.cpp b/tests/pysidetest/testobject.cpp
new file mode 100644
index 000000000..717c4e3cd
--- /dev/null
+++ b/tests/pysidetest/testobject.cpp
@@ -0,0 +1,14 @@
+#include "testobject.h"
+
+void
+TestObject::emitIdValueSignal()
+{
+ emit idValue(m_idValue);
+}
+
+void
+TestObject::emitStaticMethodDoubleSignal()
+{
+ emit staticMethodDouble();
+}
+
diff --git a/tests/pysidetest/testobject.h b/tests/pysidetest/testobject.h
new file mode 100644
index 000000000..ef0266199
--- /dev/null
+++ b/tests/pysidetest/testobject.h
@@ -0,0 +1,28 @@
+#ifndef TESTOBJECT_H
+#define TESTOBJECT_H
+
+#include <QObject>
+#include "pysidemacros.h"
+
+class PYSIDE_API TestObject : public QObject
+{
+ Q_OBJECT
+public:
+ TestObject(int idValue, QObject* parent = 0) : QObject(parent), m_idValue(idValue) {}
+ int idValue() const { return m_idValue; }
+ static int staticMethodDouble(int value) { return value * 2; }
+
+ void emitIdValueSignal();
+ void emitStaticMethodDoubleSignal();
+
+signals:
+ void idValue(int newValue);
+ void justASignal();
+ void staticMethodDouble();
+
+private:
+ int m_idValue;
+};
+
+#endif // TESTOBJECT_H
+
diff --git a/tests/pysidetest/typesystem_pysidetest.xml b/tests/pysidetest/typesystem_pysidetest.xml
new file mode 100644
index 000000000..a96636262
--- /dev/null
+++ b/tests/pysidetest/typesystem_pysidetest.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<typesystem package="testbinding">
+ <load-typesystem name="typesystem_core.xml" generate="no" />
+ <object-type name="TestObject" />
+</typesystem>
+