aboutsummaryrefslogtreecommitdiffstats
path: root/tests/samplebinding/typesystem_sample.xml
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-12-08 12:59:40 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-12-08 13:48:22 -0300
commitb27f6f347dc19db7706b69c0e7c22e74dea2853b (patch)
tree223206ee3b3009bd3103d7dc38a2bd28a44f5915 /tests/samplebinding/typesystem_sample.xml
parentdd1680a72c7709439f0ea5b91d1ac6f7957c1179 (diff)
Fixed inconsistency on type system variables and added a new one.
The %# group of type system variables are meant to be replaced by C++ arguments and %PYARG_# by Python arguments. For some reason %0 is replaced by the Python return variable and %PYARG_0 is considered invalid by the replacement system. Now %PYARG_0 is replaced by the Python return variable and %0 by the C++ version. The %CONVERTTOCPP type system variable was added. Fixed ShibokenGenerator::injectedCodeHasReturnValueAttribution to consider a return value attribution when the user does "%PYARG_0 = ..." instead of "%0 = ...". The changes were documented and all the test bindings inject codes were updated to use the modified variables properly. Reviewed by Hugo Lima <hugo.lima@openbossa.org>
Diffstat (limited to 'tests/samplebinding/typesystem_sample.xml')
-rw-r--r--tests/samplebinding/typesystem_sample.xml72
1 files changed, 36 insertions, 36 deletions
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index c3c5786ba..6ae08c2b4 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -82,7 +82,7 @@
<inject-code class="native" position="beginning">
static void reparent_layout_items(PyObject* parent, PyObject* layout)
{
- const ObjectTypeList&amp; objChildren = SbkObjectTypeLayout_cptr(layout)->objects();
+ const ObjectTypeList&amp; objChildren = %CONVERTTOCPP[ObjectTypeLayout*](layout)->objects();
ObjectTypeList::const_iterator it = objChildren.begin();
for (; it != objChildren.end(); ++it) {
if ((*it)->isLayoutType()) {
@@ -123,9 +123,9 @@
</modify-function>
<modify-function signature="children()const">
<inject-code class="target" position="end">
- Py_ssize_t max = PyList_GET_SIZE(%0);
+ Py_ssize_t max = PyList_GET_SIZE(%PYARG_0);
for (int i = 0; i &lt; max; ++i) {
- Shiboken::setParent(%PYSELF, PyList_GET_ITEM(%0, i));
+ Shiboken::setParent(%PYSELF, PyList_GET_ITEM(%PYARG_0, i));
}
</inject-code>
</modify-function>
@@ -171,7 +171,7 @@
</modify-function>
<modify-function signature="modifiedProtectedSum(int, int)">
<inject-code class="target" position="beginning">
- %0 = %CONVERTTOPYTHON[%RETURN_TYPE](%CPPSELF.%TYPE::%FUNCTION_NAME(%1, %2) * 10);
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%CPPSELF.%TYPE::%FUNCTION_NAME(%1, %2) * 10);
</inject-code>
</modify-function>
<modify-function signature="dataTypeName(void*) const" remove="all"/>
@@ -182,7 +182,7 @@
</modify-function>
<add-function signature="dataTypeName(PyObject*)const" return-type="const char*">
<inject-code class="target" position="beginning">
- %0 = %CONVERTTOPYTHON[%RETURN_TYPE](%CPPSELF.%FUNCTION_NAME(%PYARG_1));
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%CPPSELF.%FUNCTION_NAME(%PYARG_1));
</inject-code>
</add-function>
</value-type>
@@ -221,45 +221,45 @@
<template name="boolptr_at_end_fix_beginning">
bool __ok__;
- %0 = %CONVERTTOPYTHON[%RETURN_TYPE](
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](
%CPPSELF.%TYPE::%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;__ok__)
);
</template>
<template name="boolptr_at_start_fix_beginning">
bool __ok__;
- %0 = %CONVERTTOPYTHON[%RETURN_TYPE](
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](
%CPPSELF.%TYPE::%FUNCTION_NAME(&amp;__ok__, %ARGUMENT_NAMES)
);
</template>
<template name="boolptr_fix_end">
PyObject* _tuple_ = PyTuple_New(2);
- PyTuple_SET_ITEM(_tuple_, 0, %0);
+ PyTuple_SET_ITEM(_tuple_, 0, %PYARG_0);
PyObject* _item_ = %CONVERTTOPYTHON[bool](__ok__);
PyTuple_SET_ITEM(_tuple_, 1, _item_);
- %0 = _tuple_;
+ %PYARG_0 = _tuple_;
</template>
<template name="return_4_arguments_as_tuple">
- %0 = PyTuple_New(4);
- PyTuple_SET_ITEM(%0, 0, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
- PyTuple_SET_ITEM(%0, 1, %CONVERTTOPYTHON[%ARG2_TYPE](%2));
- PyTuple_SET_ITEM(%0, 2, %CONVERTTOPYTHON[%ARG3_TYPE](%3));
- PyTuple_SET_ITEM(%0, 3, %CONVERTTOPYTHON[%ARG4_TYPE](%4));
+ %PYARG_0 = PyTuple_New(4);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG2_TYPE](%2));
+ PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[%ARG3_TYPE](%3));
+ PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[%ARG4_TYPE](%4));
</template>
<template name="return_5_arguments_as_tuple">
- %0 = PyTuple_New(5);
- PyTuple_SET_ITEM(%0, 0, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
- PyTuple_SET_ITEM(%0, 1, %CONVERTTOPYTHON[%ARG2_TYPE](%2));
- PyTuple_SET_ITEM(%0, 2, %CONVERTTOPYTHON[%ARG3_TYPE](%3));
- PyTuple_SET_ITEM(%0, 3, %CONVERTTOPYTHON[%ARG4_TYPE](%4));
- PyTuple_SET_ITEM(%0, 4, %CONVERTTOPYTHON[%ARG5_TYPE](%5));
+ %PYARG_0 = PyTuple_New(5);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG2_TYPE](%2));
+ PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[%ARG3_TYPE](%3));
+ PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[%ARG4_TYPE](%4));
+ PyTuple_SET_ITEM(%PYARG_0, 4, %CONVERTTOPYTHON[%ARG5_TYPE](%5));
</template>
<template name="return_none">
- %0 = Py_None;
+ %PYARG_0 = Py_None;
Py_INCREF(Py_None);
</template>
@@ -270,7 +270,7 @@
<remove-argument/>
</modify-argument>
<inject-code class="target" position="beginning">
- %0 = %CONVERTTOPYTHON[%RETURN_TYPE](
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](
%CPPSELF.%TYPE::%FUNCTION_NAME(%1, true, %3, %4)
);
</inject-code>
@@ -526,7 +526,7 @@
<remove-argument/>
</modify-argument>
<inject-code class="target" position="beginning">
- %0 = %CONVERTTOPYTHON[%RETURN_TYPE](
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](
%CPPSELF.%TYPE::%FUNCTION_NAME(%1, %1+%3, %3)
);
</inject-code>
@@ -544,7 +544,7 @@
</modify-function>
<modify-function signature="name()">
<inject-code class="native" position="end">
- SbkStr_cptr(%0)->prepend(Str("Pimped"));
+ %0.prepend(Str("Pimped"));
</inject-code>
</modify-function>
<modify-function signature="callMe()">
@@ -574,10 +574,10 @@
</add-function>
<modify-function signature="pointer() const">
<inject-code class="target" position="beginning">
- %0 = (PyObject*)%CPPSELF.%FUNCTION_NAME();
- if (!%0)
- %0 = Py_None;
- Py_XINCREF(%0);
+ %PYARG_0 = (PyObject*)%CPPSELF.%FUNCTION_NAME();
+ if (!%PYARG_0)
+ %PYARG_0 = Py_None;
+ Py_XINCREF(%PYARG_0);
</inject-code>
</modify-function>
</value-type>
@@ -609,7 +609,7 @@
</inject-code>
<inject-code class="target" position="end">
PyObject* tmp = PyString_FromString("end");
- PyString_Concat(&amp;%0, tmp);
+ PyString_Concat(&amp;%PYARG_0, tmp);
Py_DECREF(tmp);
</inject-code>
</modify-function>
@@ -618,7 +618,7 @@
<modify-function signature="simpleMethod2()">
<inject-code class="target" position="end">
PyObject* tmp = PyString_FromString("end");
- PyString_Concat(&amp;%0, tmp);
+ PyString_Concat(&amp;%PYARG_0, tmp);
Py_DECREF(tmp);
</inject-code>
</modify-function>
@@ -639,7 +639,7 @@
return 0;
}
%RETURN_TYPE foo = %CPPSELF.%FUNCTION_NAME(argc, argv);
- %0 = %CONVERTTOPYTHON[%RETURN_TYPE](foo);
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](foo);
for (int i = 0; i &lt; argc; ++i)
delete[] argv[i];
@@ -663,7 +663,7 @@
return 0;
}
%RETURN_TYPE foo = %CPPSELF.%FUNCTION_NAME(argc, argv);
- %0 = %CONVERTTOPYTHON[%RETURN_TYPE](foo);
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](foo);
for (int i = 0; i &lt; argc; ++i)
delete[] argv[i];
@@ -689,7 +689,7 @@
int x2 = ((int) (%CPPSELF.x() * 100)) - (x1 * 100);
int y1 = (int) %CPPSELF.y();
int y2 = ((int) (%CPPSELF.y() * 100)) - (y1 * 100);
- %0 = PyString_FromFormat("Point(%d.%d, %d.%d)", x1, x2, y1, y2);
+ %PYARG_0 = PyString_FromFormat("Point(%d.%d, %d.%d)", x1, x2, y1, y2);
</inject-code>
</add-function>
<add-function signature="__repr__" return-type="PyObject*">
@@ -698,7 +698,7 @@
int x2 = ((int) (%CPPSELF.x() * 10)) - (x1 * 10);
int y1 = (int) %CPPSELF.y();
int y2 = ((int) (%CPPSELF.y() * 10)) - (y1 * 10);
- %0 = PyString_FromFormat("&lt;Point object at %p: (%d.%d, %d.%d)&gt;", %CPPSELF, x1, x2, y1, y2);
+ %PYARG_0 = PyString_FromFormat("&lt;Point object at %p: (%d.%d, %d.%d)&gt;", %CPPSELF, x1, x2, y1, y2);
</inject-code>
</add-function>
</value-type>
@@ -731,7 +731,7 @@
<value-type name="Str">
<add-function signature="__str__" return-type="PyObject*">
<inject-code class="target" position="beginning">
- %0 = PyString_FromString(%CPPSELF.cstring());
+ %PYARG_0 = PyString_FromString(%CPPSELF.cstring());
</inject-code>
</add-function>
<add-function signature="__len__" >
@@ -814,7 +814,7 @@
<value-type name="Echo">
<add-function signature="echo(const char *)" return-type="PyObject*">
<inject-code class="target" position="beginning">
- %0 = PyString_FromString(%1);
+ %PYARG_0 = PyString_FromString(%1);
</inject-code>
</add-function>
</value-type>