aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-06-25 08:03:23 +0200
committerSven Gothel <[email protected]>2023-06-25 08:03:23 +0200
commit5a130ab0c6db44225692e362e41e7b45481f9392 (patch)
tree29ee4d05fec554d33a839a02b582d936c9ffe21a /src/junit/com/jogamp
parent7caf66ccae2dea53b82fb6552cb9144d4146259f (diff)
GlueGen JavaCallback: Add preliminary implementation (WIP): Produces proper interfaces, TODO implementation
Note: JavaCallbackDef is commented out on test2.cfg example, since implementation is missing.
Diffstat (limited to 'src/junit/com/jogamp')
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg9
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test2.h7
2 files changed, 12 insertions, 4 deletions
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg
index d40ac9a..77a8433 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg
@@ -19,7 +19,7 @@ ForceProcAddressGen __ALL__
# pointer typedefs for these routines to MYAPIENTRY
# LocalProcAddressCallingConvention __ALL__ MYAPIENTRY
-Opaque long void*
+# Opaque long void*
# Undefined struct forward declaration, implementation secret: 'struct T2_UndefStruct;'
Opaque long T2_UndefStruct*
@@ -43,6 +43,13 @@ ReturnsStringOnly T2_InitializeOptions.ProductVersion
# ReturnedArrayLength T2_InitializeOptions.OverrideThreadAffinity 1
MaxOneElement T2_InitializeOptions.OverrideThreadAffinity
+# typedef int32_t ( * T2_CallbackFunc)(size_t id, const char* msg, void* userParam);
+# void InjectMessageCallback(size_t id, const char* msg);
+ArgumentIsString T2_CallbackFunc 1
+ArgumentIsString InjectMessageCallback 1
+# Define a JavaCallback, enacted on a function-pointer argument `T2_CallbackFunc` and a user-param `void*` for Java Object mapping
+# JavaCallbackDef T2_CallbackFunc 2
+
CustomCCode #include "test2.h"
Import com.jogamp.gluegen.test.junit.generation.Bindingtest2
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h
index 75c7ffa..78bdf87 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h
@@ -6,7 +6,7 @@
// struct T2_UndefStruct; // undefined struct forward declaration, implementation secret
typedef struct T2_UndefStruct* T2_UndefStructPtr;
-typedef int32_t ( * T2_CustomFuncA)(void* aptr);
+typedef int32_t ( * T2_CustomFuncA)(T2_UndefStructPtr aptr);
typedef struct {
int32_t balance;
@@ -58,8 +58,9 @@ typedef struct {
extern int Initialize(T2_InitializeOptions* Options);
extern int Release(T2_InitializeOptions* Options);
-typedef int32_t ( * T2_CallbackFunc)(size_t id, size_t msg_len, const char* msg, void* userParam);
+typedef int32_t ( * T2_CallbackFunc)(size_t id, const char* msg, void* userParam);
void AddMessageCallback(T2_CallbackFunc func, void* userParam);
void RemoveMessageCallback(T2_CallbackFunc func, void* userParam);
-void InjectMessageCallback(size_t id, size_t msg_len, const char* msg);
+void InjectMessageCallback(size_t id, const char* msg);
+