summaryrefslogtreecommitdiffstats
path: root/php
diff options
context:
space:
mode:
authorEmmanuel Raviart <eraviart@entrouvert.com>2005-01-21 16:12:46 +0000
committerEmmanuel Raviart <eraviart@entrouvert.com>2005-01-21 16:12:46 +0000
commitb9a98851882ef49126faca925578284b83351dd3 (patch)
tree1afbc7ef1d86617eff60d298b4adfdb32515f1cf /php
parent061b6861408379601c62b8ce92ee0e9104e79524 (diff)
downloadlasso-b9a98851882ef49126faca925578284b83351dd3.tar.gz
lasso-b9a98851882ef49126faca925578284b83351dd3.tar.xz
lasso-b9a98851882ef49126faca925578284b83351dd3.zip
SWIG: Added patch for PHP lasso_wrap.c to correct handling of optional
arguments in methods.
Diffstat (limited to 'php')
-rwxr-xr-xphp/patch_swig_output.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/php/patch_swig_output.py b/php/patch_swig_output.py
index cd43e013..4daf4e4e 100755
--- a/php/patch_swig_output.py
+++ b/php/patch_swig_output.py
@@ -34,6 +34,8 @@ The PHP binding of SWIG version 1.3.22 has several bugs:
(2) It doesn't handle dynamic cast of function results well: After the C object is dynamically
casted, it creates a statically casted PHP object.
+(3) It handles badly optional arguments of methods.
+
This program corrects (1) and (2), by replacing things like:
if (!result) {
ZVAL_NULL(return_value);
@@ -122,6 +124,11 @@ with:
add_property_zval(obj,"_cPtr",_cPtr);
*return_value=*obj;
}}
+
+This program corrects (3), by replacing things like:
+ if(arg_count > 1) {
+with:
+ if(arg_count > 1 - argbase) {
"""
import sys
@@ -170,4 +177,8 @@ while i >= 0:
wrap = '%s%s%s' % (wrap[:i], segment, wrap[j:])
i = wrap.find(begin, i + len(segment))
+# (3)
+for i in range(10):
+ wrap = wrap.replace('if(arg_count > %d) {' % i, 'if(arg_count > %d - argbase) {' % i)
+
print wrap