From 5a130ab0c6db44225692e362e41e7b45481f9392 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 25 Jun 2023 08:03:23 +0200 Subject: GlueGen JavaCallback: Add preliminary implementation (WIP): Produces proper interfaces, TODO implementation Note: JavaCallbackDef is commented out on test2.cfg example, since implementation is missing. --- src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg | 9 ++++++++- src/junit/com/jogamp/gluegen/test/junit/generation/test2.h | 7 ++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/junit') 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); + -- cgit v1.2.3