summaryrefslogtreecommitdiffstats
path: root/bindings/java/lang.py
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-01-28 15:31:49 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-01-28 15:31:49 +0000
commit1dab7b59e5f36ef0a5cfed124a3a2f5d549d82ce (patch)
tree014771b1f67344ee8ad19807f541f73eb357f7ea /bindings/java/lang.py
parenta1ae48d2ef48492faafd26464e64e2dccd0d8565 (diff)
downloadlasso-1dab7b59e5f36ef0a5cfed124a3a2f5d549d82ce.tar.gz
lasso-1dab7b59e5f36ef0a5cfed124a3a2f5d549d82ce.tar.xz
lasso-1dab7b59e5f36ef0a5cfed124a3a2f5d549d82ce.zip
Bindings: java, php5, python simplify logic in binding generator
* use utils.h macros to manipulate fields. * use utils.py function to filter variables, argument and return types. * finish support of hashtables of strings for php5 and python.
Diffstat (limited to 'bindings/java/lang.py')
-rw-r--r--bindings/java/lang.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/bindings/java/lang.py b/bindings/java/lang.py
index 8c60e7bc..fc0fdd5b 100644
--- a/bindings/java/lang.py
+++ b/bindings/java/lang.py
@@ -416,12 +416,12 @@ protected static native void destroy(long cptr);
return 'get_list_of_xml_nodes(env, %s, &%s)' % (right, left)
else:
return 'get_list_of_objects(env, %s, &%s)' % (right, left)
- elif type in ('GHashTable*',):
+ elif is_hashtable(type):
element_type = options.get('element-type')
- if element_type == 'char*':
- return 'get_hash_of_strings(env, %s, &%s)' % (right, left)
- else:
+ if is_object(element_type):
return 'get_hash_of_objects(env, %s, &%s)' % (right, left)
+ else:
+ return 'get_hash_of_strings(env, %s, &%s)' % (right, left)
elif type == 'xmlNode*':
return 'xml_node_to_jstring(env, %s, &%s)' % (right, left)
else:
@@ -627,16 +627,20 @@ protected static native void destroy(long cptr);
print >> fd, ' add_to_list_of_objects(env, &gobj->%s,value);' % m[1]
print >> fd, '}'
# remove
- if element_type not in ('xmlNode*',):
+ if is_xml_node(element_type):
+ print >>sys.stderr, 'W: remove for list of xml node not supported: %s' % (m,)
+ else:
print >> fd,'/* Remover for %s %s.%s */' % (mtype,klassname,m[1])
wrapper_decl("%s_remove" % prefix, 'void', fd)
print >> fd, ', jobject jobj, %s value)\n {' % jni_elem_type(element_type)
print >> fd, ' %s *gobj;' % klassname
print >> fd, ' jobject_to_gobject(env, jobj, (GObject**)&gobj);'
- if element_type in ('char*','gchar*'):
+ if is_cstring(element_type):
print >> fd, ' remove_from_list_of_strings(env, &gobj->%s,value);' % m[1]
- else:
+ elif is_object(element_type):
print >> fd, ' remove_from_list_of_objects(env, &gobj->%s,value);' % m[1]
+ else:
+ raise Exception('remove_from_list unsupported for %s' % (m,))
print >> fd, '}'
# add/remove/get_by_name
if mtype in ('GHashTable*',):