aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-06-18 05:27:41 +0200
committerSven Gothel <[email protected]>2023-06-18 05:27:41 +0200
commit195bf966e4946ee9e80cd7aec68685218ad7a777 (patch)
tree91de0bc3bb400dfb314605cf0e8219f0ed005419
parentafe477a687b516969494f2cbcdf46a6e4961edc6 (diff)
CustomJNICode: Fix/complete commit d7bc10d7ff0e3a30d74c4e4c439230f3983bcfb4: Add emitCustomJNICode(..) for JavaEmitter.endFunctions() not just structs and fix the JNI-c stub code
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java4
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1-CustomJNICode.cfg13
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1-CustomJavaCode.java.stub (renamed from src/junit/com/jogamp/gluegen/test/junit/generation/test1-CustomJavaCode.cfg)0
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg8
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-CustomJNICode.c.stub5
5 files changed, 13 insertions, 17 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index 0a403ea..784976a 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -722,8 +722,12 @@ public class JavaEmitter implements GlueEmitter {
if (cfg.allStatic() || cfg.emitInterface()) {
emitCustomJavaCode(javaUnit(), cfg.className());
}
+ if( cfg.allStatic() && cfg.emitImpl()) {
+ emitCustomJNICode(cUnit(), cfg.className());
+ }
if (!cfg.allStatic() && cfg.emitImpl()) {
emitCustomJavaCode(javaImplUnit(), cfg.implClassName());
+ emitCustomJNICode(cUnit(), cfg.implClassName());
}
}
}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-CustomJNICode.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-CustomJNICode.cfg
deleted file mode 100644
index b76997d..0000000
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-CustomJNICode.cfg
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "test1.h"
-
-JNIEXPORT jobject JNICALL
-com.jogamp.gluegen.test.junit.generation
-Java_com_jogamp_gluegen_test_junit_generation_Bindingtest1p1_I_returnFooImpl(JNIEnv *env, jobject _unused) {
- return FOO_VALUE;
-}
-
-JNIEXPORT jobject JNICALL
-com.jogamp.gluegen.test.junit.generation
-Java_com_jogamp_gluegen_test_junit_generation_Bindingtest1p2_I_returnFooImpl(JNIEnv *env, jobject _unused) {
- return FOO_VALUE;
-} \ No newline at end of file
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-CustomJavaCode.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-CustomJavaCode.java.stub
index c210ec9..c210ec9 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-CustomJavaCode.cfg
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-CustomJavaCode.java.stub
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg
index e01f748..05bed70 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg
@@ -48,10 +48,10 @@ RenameJavaSymbol testXID_EXT testXID
DelegateImplementation testDelegate testDelegateOrigImpl
CustomJavaCode Bindingtest1 public int getFoo();
-IncludeAs CustomJavaCode Bindingtest1p1Impl test1-CustomJavaCode.cfg
-IncludeAs CustomJNICode Bindingtest1p1Impl test1-CustomJNICode.cfg
-IncludeAs CustomJavaCode Bindingtest1p2Impl test1-CustomJavaCode.cfg
-IncludeAs CustomJNICode Bindingtest1p2Impl test1-CustomJNICode.cfg
+IncludeAs CustomJavaCode Bindingtest1p1Impl test1-CustomJavaCode.java.stub
+IncludeAs CustomJNICode Bindingtest1p1Impl test1p1-CustomJNICode.c.stub
+IncludeAs CustomJavaCode Bindingtest1p2Impl test1-CustomJavaCode.java.stub
+IncludeAs CustomJNICode Bindingtest1p2Impl test1p2-CustomJNICode.c.stub
StructPackage TK_Dimension com.jogamp.gluegen.test.junit.generation
EmitStruct TK_Dimension
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-CustomJNICode.c.stub b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-CustomJNICode.c.stub
new file mode 100644
index 0000000..bee94f2
--- /dev/null
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1p2-CustomJNICode.c.stub
@@ -0,0 +1,5 @@
+
+JNIEXPORT jint JNICALL Java_com_jogamp_gluegen_test_junit_generation_impl_Bindingtest1p2Impl_returnFooImpl(JNIEnv *env, jobject _unused) {
+ return FOO_VALUE;
+}
+