From 5ceca8550b82591a6a2661a26d3e0d5e6e3e15ff Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 5 Jul 2023 10:21:48 +0200 Subject: GlueGen: Add 'PascalString' string semantics (length + value-ptr), added prelim code for JavaCallback use-case emitBodyMapCToJNIType() It is common in toolkit APIs that a string might not be passed as a 'nul' terminated (EOS) C string, but as a Pascal string with a given length argument. A C string is specied as ArgumentIsString alEventCallbackInject 3 while allowing multiple indices .. A Pascal string can be specified as ArgumentIsPascalString ALEVENTPROCSOFT 3 4 while allowing multiple indice-tuples for length and value .. The tuple consist of the length agrument-index first (usually an int) followed by the value argument-index (usually a 'char*'). +++ CMethodBindingEmitter.emitBodyMapCToJNIType(), where PascalString is implemented, is currently being used for - JNI return statement (no PascalString impact possible) - JavaCallback C type -> JNI type, PascalString impacting --- src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/junit/com/jogamp') 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 83045cb..08194e6 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg @@ -76,7 +76,7 @@ JavaCallbackDef MessageCallback01 T2_CallbackFunc01 2 # typedef void ( * ALEVENTPROCSOFT)(int eventType, int object, int param, int length, const char *message, void *userParam); # void alEventCallback(ALEVENTPROCSOFT callback, void *userParam /* identity-key */); # void alEventCallbackInject(int eventType, int object, int param, const char* msg); -ArgumentIsString ALEVENTPROCSOFT 4 +ArgumentIsPascalString ALEVENTPROCSOFT 3 4 ArgumentIsString alEventCallbackInject 3 # Define a JavaCallback (OpenAL AL_SOFT_events) -- cgit v1.2.3