summaryrefslogtreecommitdiffstats
path: root/bindings/java
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-01-04 09:13:43 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-01-04 09:13:43 +0000
commitf61c178bec7d4f298c73b33372fbb0370c282e55 (patch)
treeeee521b42e47d192a95266019bbfcbfd9129e4d4 /bindings/java
parent003b2511ab0430d43aa0bc8007b7994e5932feb2 (diff)
downloadlasso-f61c178bec7d4f298c73b33372fbb0370c282e55.tar.gz
lasso-f61c178bec7d4f298c73b33372fbb0370c282e55.tar.xz
lasso-f61c178bec7d4f298c73b33372fbb0370c282e55.zip
Bindings: in bindings.py, parse '(in)' gobject-introspection annotation, in utils.py, use it to reverse default annotation for pointer of pointers
Bindings: in bindings.py, improve regular expression for declarations Bindings: parse gobject-introspection annotation in return value documentation, add cast to C calls when parameter type is const in java binding, problem arise with const char ** arrays
Diffstat (limited to 'bindings/java')
-rw-r--r--bindings/java/lang.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/bindings/java/lang.py b/bindings/java/lang.py
index 21fb5bd5..ed6688f1 100644
--- a/bindings/java/lang.py
+++ b/bindings/java/lang.py
@@ -110,9 +110,6 @@ def is_collection(type):
def is_string_type(type):
return type in ['char*', 'const char*', 'gchar*', 'const gchar*']
-def is_const_type(type):
- return type in ['const char*', 'const gchar*']
-
class Binding:
def __init__(self, binding_data):
self.binding_data = binding_data
@@ -526,8 +523,12 @@ protected static native void destroy(long cptr);
print >> fd, 'return_value = ',
if 'new' in m.name:
print >>fd, '(%s)' % m.return_type,
-
- print >> fd, '%s(%s);' % (m.name, ', '.join([x[1] for x in m.args]))
+ def arg2ref(x):
+ if is_const(x):
+ return '(%s) %s' % (x[0],x[1])
+ else:
+ return x[1]
+ print >> fd, '%s(%s);' % (m.name, ', '.join([arg2ref(x) for x in m.args]))
# Free const char * args
idx=0
for arg in m.args:
@@ -554,7 +555,7 @@ protected static native void destroy(long cptr);
if m.return_owner:
if m.return_type == 'GList*' or m.return_type == 'const GList*':
print >> fd, ' free_glist(&return_value, NULL);'
- elif is_string_type(m.return_type) and not is_const_type(m.return_type):
+ elif is_string_type(m.return_type) and not is_const(m.return_arg):
print >> fd, ' if (return_value)'
print >> fd, ' g_free(return_value);'
print >> fd, ' return ret;'