summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bindings/java/Makefile.am2
-rw-r--r--bindings/java/lang.py (renamed from bindings/lang_java.py)17
-rw-r--r--bindings/java/wrapper_bottom.c (renamed from bindings/lang_java_wrapper_bottom.c)0
-rw-r--r--bindings/java/wrapper_top.c (renamed from bindings/lang_java_wrapper_top.c)0
4 files changed, 10 insertions, 9 deletions
diff --git a/bindings/java/Makefile.am b/bindings/java/Makefile.am
index d4403ed9..d13502ae 100644
--- a/bindings/java/Makefile.am
+++ b/bindings/java/Makefile.am
@@ -50,7 +50,7 @@ BUILT_SOURCES = com_entrouvert_lasso_LassoJNI.c com_entrouvert_lasso_LassoJNI.h
BINDING_OPTION=#--enable-exception-docs
-$(java_lasso_source_files) com_entrouvert_lasso_LassoJNI.c: ../lang_java_wrapper_top.c ../lang_java.py ../bindings.py
+$(java_lasso_source_files) com_entrouvert_lasso_LassoJNI.c: wrapper_top.c wrapper_bottom.c lang.py ../bindings.py
$(PYTHON) $(top_srcdir)/bindings/bindings.py $(BINDING_OPTION) -l java --src-dir=$(top_srcdir)/lasso/ $(EXTRA_ARGS)
cp $(srcdir)/GObject.java com/entrouvert/lasso
diff --git a/bindings/lang_java.py b/bindings/java/lang.py
index 8b00494b..044e468e 100644
--- a/bindings/lang_java.py
+++ b/bindings/java/lang.py
@@ -103,9 +103,10 @@ def is_string_type(type):
def is_const_type(type):
return type in ['const char*', 'const gchar*']
-class JavaBinding:
+class Binding:
def __init__(self, binding_data):
self.binding_data = binding_data
+ self.src_dir = os.path.dirname(__file__)
def print_list_of_files(self):
l = ['GObject.java','LassoConstants.java','LassoJNI.java','LassoException.java', 'LassoUndefinedException.java', 'LassoUnimplementedException.java']
@@ -234,11 +235,14 @@ protected static native void destroy(long cptr);
return 'GObject'
def JNI_return_type(self, vtype):
+ if vtype:
+ m = re.match(r'(?:const\s*)?(.*)',vtype)
+ vtype = m.group(1)
if vtype == 'gboolean':
return 'boolean'
elif vtype in ['int','gint'] + self.binding_data.enums:
return 'int'
- elif vtype in ('char*', 'gchar*', 'const char*', 'const gchar*'):
+ elif vtype in ('char*', 'gchar*'):
return 'String'
elif vtype in ('const GList*','GList*','GHashTable*'):
return 'Object[]'
@@ -339,13 +343,11 @@ protected static native void destroy(long cptr);
for c in self.binding_data.structs:
for m in c.methods:
self.generate_wrapper_function(m, fd)
- print >> fd, open(os.path.join(self.binding_data.src_dir,
- 'lang_java_wrapper_bottom.c')).read()
+ print >> fd, open(os.path.join(self.src_dir,'wrapper_bottom.c')).read()
fd.close()
def generate_wrapper_header(self, fd):
- print >> fd, open(os.path.join(self.binding_data.src_dir,
- 'lang_java_wrapper_top.c')).read()
+ print >> fd, open(os.path.join(self.src_dir,'wrapper_top.c')).read()
print >> fd, ''
for h in self.binding_data.headers:
print >> fd, '#include <%s>' % h
@@ -668,8 +670,7 @@ protected static native void destroy(long cptr);
def generate_exception_classes(self):
efd = open(lasso_java_path + 'LassoException.java', 'w')
- print >> efd, open(os.path.join(self.binding_data.src_dir,
- 'java/LassoException_top.java')).read()
+ print >> efd, open(os.path.join(self.src_dir,'LassoException_top.java')).read()
# Generate the function to get class name by error code
supers = []
for c in self.binding_data.constants:
diff --git a/bindings/lang_java_wrapper_bottom.c b/bindings/java/wrapper_bottom.c
index e69de29b..e69de29b 100644
--- a/bindings/lang_java_wrapper_bottom.c
+++ b/bindings/java/wrapper_bottom.c
diff --git a/bindings/lang_java_wrapper_top.c b/bindings/java/wrapper_top.c
index 03736866..03736866 100644
--- a/bindings/lang_java_wrapper_top.c
+++ b/bindings/java/wrapper_top.c