summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-11-22 13:18:43 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-11-23 11:48:03 -0300
commitc48f9163b42c20c91c33183a1835e0b356f104dc (patch)
tree47ca47283fbafc3bde0050815c6647d0d9e91de4 /doc
parente85fcb77b2f1c9db7fbb3008d073609bf710190a (diff)
downloadshiboken-c48f9163b42c20c91c33183a1835e0b356f104dc.tar.gz
shiboken-c48f9163b42c20c91c33183a1835e0b356f104dc.tar.xz
shiboken-c48f9163b42c20c91c33183a1835e0b356f104dc.zip
Added the method injectedCodeCallsPythonOverride(func) to
ShibokenGenerator, it returns true if a code injection on a virtual method override (a "native" inject-code) does a call to the Python override. Added the %PYTHON_METHOD_OVERRIDE type system variable, it is replaced by the name of the pointer to a Python method that represents an override to a C++ virtual method. A code injection in the "native/end" position for a method modification is now put before the dereferencing of the variables used in the Python call (the method object and the Python argument tuple). If a call to the Python override method is detected on code injections of the "native" class from method modifications, the generator doesn't write the same call again. All documentation was updated with the changes.
Diffstat (limited to 'doc')
-rw-r--r--doc/codeinjectionsemantics.rst13
-rw-r--r--doc/typesystemvariables.rst9
2 files changed, 18 insertions, 4 deletions
diff --git a/doc/codeinjectionsemantics.rst b/doc/codeinjectionsemantics.rst
index c0d6fa2d..aaa965fe 100644
--- a/doc/codeinjectionsemantics.rst
+++ b/doc/codeinjectionsemantics.rst
@@ -71,9 +71,9 @@ The following table describes the semantics of ``inject-code`` tag as used on
| | | |Python override, if there is any), right after the C++ |
| | | |arguments have been converted but before the Python call. |
| | +---------+--------------------------------------------------------------+
- | | |end |This code injection goes to the end of a virtual method |
- | | | |override on the C++ wrapper class, right before the return |
- | | | |statement (if any). |
+ | | |end |This code injection is put in a virtual method override on the|
+ | | | |C++ wrapper class, after the call to Python and before |
+ | | | |dereferencing the Python method and tuple of arguments. |
| +------+---------+--------------------------------------------------------------+
| |target|beginning|This code is injected on the Python method wrapper |
| | | |(``PyCLASS_METHOD(...)``), right after the decisor have found |
@@ -186,6 +186,9 @@ instead of
Code Injection for Functions/Methods
====================================
+
+.. _codeinjecting_method_native:
+
On The Native Side
------------------
@@ -197,7 +200,7 @@ class is polymorphic.
int InjectCodeWrapper::virtualMethod(int arg)
{
PyObject* method = BindingManager::instance().getOverride(this, "virtualMethod");
- if (!method)
+ if (!py_override)
return this->InjectCode::virtualMethod(arg);
(... here C++ arguments are converted to Python ...)
@@ -212,6 +215,8 @@ class is polymorphic.
// Uses: post method call custom code, modify the result before delivering
// it to C++ caller.
+ (... Python method and argument tuple are dereferenced here ...)
+
return Shiboken::Converter<int>::toCpp(method_result);
}
diff --git a/doc/typesystemvariables.rst b/doc/typesystemvariables.rst
index dbfc2935..9966cfc5 100644
--- a/doc/typesystemvariables.rst
+++ b/doc/typesystemvariables.rst
@@ -206,6 +206,15 @@ Variables
C++ parent's one.
+.. _python_method_override:
+
+**%PYTHON_METHOD_OVERRIDE**
+
+ This variable is used only on :ref:`native method code injections
+ <codeinjecting_method_native>`, i.e. on the binding overrides for C++ virtual
+ methods. It is replaced by a pointer to the Python method override.
+
+
.. _pythontypeobject:
**%PYTHONTYPEOBJECT**