# Opaque long void*

# Undefined struct forward declaration, implementation secret: 'struct T2_UndefStruct;'
Opaque long T2_UndefStruct*
Ignore T2_UndefStruct

EmitStruct T2_ThreadAffinity
StructPackage T2_ThreadAffinity com.jogamp.gluegen.test.junit.generation

EmitStruct T2_UserData
StructPackage T2_UserData com.jogamp.gluegen.test.junit.generation
ReturnsStringOnly T2_UserData.name

EmitStruct T2_PointerStorage
StructPackage T2_PointerStorage com.jogamp.gluegen.test.junit.generation

EmitStruct T2_InitializeOptions
StructPackage T2_InitializeOptions com.jogamp.gluegen.test.junit.generation
ReturnsStringOnly T2_InitializeOptions.ProductName
ReturnsStringOnly T2_InitializeOptions.ProductVersion

# ReturnedArrayLength T2_InitializeOptions.OverrideThreadAffinity 1
MaxOneElement T2_InitializeOptions.OverrideThreadAffinity

# Begin JavaCallback.
#
# JavaCallback requires `JNI_OnLoad*(..)` and `JVMUtil_GetJNIEnv(..)`
LibraryOnLoad Bindingtest2

# typedef void ( * T2_CallbackFunc01)(size_t id, const char* msg, void* usrParam);
# void MessageCallback01(T2_CallbackFunc01 cbFunc, void* usrParam);
# void InjectMessageCallback01(size_t id, const char* msg);
ArgumentIsString T2_CallbackFunc01 1
ArgumentIsString InjectMessageCallback01 1

# Define a JavaCallback.
#   Set JavaCallback via function `MessageCallback01` if `T2_CallbackFunc01` argument is non-null, otherwise removes the mapped callback and associated resources.
#
#   It uses the function-pointer argument `T2_CallbackFunc01` as the callback function type
#   and marks `T2_CallbackFunc01`s 3rd argument (index 2) as the mandatory user-param.
#
#   This callback has no keys defines, rendering it of global scope!
#
#   Explicit maintenance methods are generated, passing the keys as paramters
#   - `boolean isMessageCallback01Mapped()` queries whether `MessageCallback0` is mapped globally
#   - `T2_CallbackFunc01 getMessageCallback01()` returns the global T2_CallbackFunc01, null if not mapped
#   - `Object getMessageCallback01UserParam()` returns the global `usrParam` object, null if not mapped
#   - `void releaseMessageCallback01()` releases callback data skipping toolkit API. Favor passing `null` callback ref to `MessageCallback01(..)`
JavaCallbackDef  MessageCallback01 1 T2_CallbackFunc01 2
#
# End JavaCallback

# Begin JavaCallback (OpanAL AL_SOFT_callback_buffer)
#
# // typedef void ( * ALBUFFERCALLBACKTYPESOFT)(int buffer /* key */, void *userptr, void *sampledata, int numbytes);
# typedef void ( * ALBUFFERCALLBACKTYPESOFT)(int buffer /* key */, void *userptr, int sampledata, int numbytes);
#
# void alBufferCallback0(int buffer /* key */, int format, int freq, ALBUFFERCALLBACKTYPESOFT callback, void *userptr);
#
# // void alBufferCallback0Inject(int buffer, void *sampledata, int numbytes);
# void alBufferCallback0Inject(int buffer, int sampledata, int numbytes);

# Define a JavaCallback.
#   Set JavaCallback via function `alBufferCallback0` if `ALBUFFERCALLBACKTYPESOFT` argument is non-null, otherwise removes the mapped callback and associated resources.
#
#   It uses the function-pointer argument `ALBUFFERCALLBACKTYPESOFT` as the callback function type
#   and marks `ALBUFFERCALLBACKTYPESOFT`s 2nd argument (index 1) as the mandatory user-param.
#
#   This callback defines one key, `buffer`, index 0 of alBufferCallback0(..) parameter list, limiting it to buffer-name scope!
#   The `buffer` key allows setting one callback per buffer-name, compatible with the `AL_SOFT_callback_buffer` spec.
#
#   Explicit maintenance methods are generated, passing the keys as paramters
#   - `Set<AlBufferCallback0Key> getAlBufferCallback0Keys()` returns set of Key { int buffer }
#   - `boolean isAlBufferCallback0Mapped(AlBufferCallback0Key)` queries whether `alBufferCallback0` is mapped to `buffer`.
#   - `ALBUFFERCALLBACKTYPESOFT getAlBufferCallback0(AlBufferCallback0Key)` returns the `buffer` mapped ALEVENTPROCSOFT, null if not mapped
#   - `ALCcontext getAlBufferCallback0UserParam(AlBufferCallback0Key)` returns the `buffer` mapped `userptr` object, null if not mapped
#   - `void releaseAllAlBufferCallback0()` releases all callback data mapped via Key { int buffer } skipping toolkit API. Favor passing `null` callback ref to `alBufferCallback0(..)`
#   - `void releaseAlBufferCallback0(AlBufferCallback0Key)` releases callback data mapped to Key { int buffer } skipping toolkit API. Favor passing `null` callback ref to `alBufferCallback0(..)`
JavaCallbackDef  alBufferCallback0 4 ALBUFFERCALLBACKTYPESOFT 1 ALCcontext
JavaCallbackKey  alBufferCallback0 0 ALBUFFERCALLBACKTYPESOFT 0
#
# End JavaCallback

# Begin JavaCallback (OpanAL AL_SOFT_callback_buffer, variant 2)
#
# Reuses: ALBUFFERCALLBACKTYPESOFT, see above.
#
# // typedef void ( * ALBUFFERCALLBACKTYPESOFT)(int buffer /* key */, void *userptr, void *sampledata, int numbytes);
# typedef void ( * ALBUFFERCALLBACKTYPESOFT)(int buffer /* key */, void *userptr, int sampledata, int numbytes);
#
# void alBufferCallback1(void* user_ptr, int buffer_key /* key */, int format, int freq, ALBUFFERCALLBACKTYPESOFT callback);
#
# // void alBufferCallback1Inject(int buffer, void *sampledata, int numbytes);
# void alBufferCallback1Inject(int buffer, int sampledata, int numbytes);

# Define a JavaCallback.
#   Set JavaCallback via function `alBufferCallback1` if `ALBUFFERCALLBACKTYPESOFT` argument is non-null, otherwise removes the mapped callback and associated resources.
#
#   It uses the function-pointer argument `ALBUFFERCALLBACKTYPESOFT` as the callback function type
#   and marks `ALBUFFERCALLBACKTYPESOFT`s 2nd argument (index 1) as the mandatory user-param.
#
#   This callback defines one key, `buffer`, index 0 of alBufferCallback1(..) parameter list, limiting it to buffer-name scope!
#   The `buffer` key allows setting one callback per buffer-name, compatible with the `AL_SOFT_callback_buffer` spec.
#
#   Explicit maintenance methods are generated, passing the keys as paramters
#   - `boolean isAlBufferCallback1Mapped(int buffer)` queries whether `alBufferCallback1` is mapped to `buffer`.
#   - `ALBUFFERCALLBACKTYPESOFT getAlBufferCallback1(int buffer)` returns the `buffer` mapped ALEVENTPROCSOFT, null if not mapped
#   - `ALCcontext getAlBufferCallback1UserParam(int buffer)` returns the `buffer` mapped `userptr` object, null if not mapped
JavaCallbackDef  alBufferCallback1 0 ALBUFFERCALLBACKTYPESOFT 1 ALCcontext com.jogamp.gluegen.test.junit.generation.BaseClass4JavaCallback.CustomAlBufferCallback1Key
JavaCallbackKey  alBufferCallback1 1 ALBUFFERCALLBACKTYPESOFT 0
#
# End JavaCallback

# Begin JavaCallback.
#
# typedef void ( * ALEVENTPROCSOFT)(int eventType, int object, int param, int length, const char *message, void *userParam /* key */);
# 
# void alEventCallback0(ALEVENTPROCSOFT callback, void *userParam /* key */);
ArgumentIsPascalString ALEVENTPROCSOFT 3 4

# Define a JavaCallback (OpenAL AL_SOFT_events)
#   Set JavaCallback via function `alEventCallback` if `ALEVENTPROCSOFT` argument is non-null, otherwise removes the mapped callback and associated resources.
#
#   It uses the function-pointer argument `ALEVENTPROCSOFT` as the callback function type
#   and marks `ALEVENTPROCSOFT`s 6th argument (index 5) as the mandatory user-param.
#
#   This callback uses 'Object userParam' as its key (for a context), similar to `AL_SOFT_events` context binding.
JavaCallbackDef  alEventCallback0 1 ALEVENTPROCSOFT 5 ALCcontext
JavaCallbackKey  alEventCallback0 1 ALEVENTPROCSOFT 5
#
# End JavaCallback

# Begin JavaCallback.
#
# void alEventCallback1(int object /* key */, ALEVENTPROCSOFT callback, void *userParam /* key */);
JavaCallbackDef  alEventCallback1 2 ALEVENTPROCSOFT 5 ALCcontext
JavaCallbackKey  alEventCallback1 0 2 ALEVENTPROCSOFT 1 5

#
# End JavaCallback

IncludeAs CustomJavaCode Bindingtest2       test2-CustomJavaIfCode.java.stub
IncludeAs CustomJavaCode Bindingtest2p1Impl test2-CustomJavaImplCode.java.stub
IncludeAs CustomJavaCode Bindingtest2p2Impl test2-CustomJavaImplCode.java.stub

# Begin JavaCallback
#
# typedef void ( * T2_CallbackFunc11)(size_t id, const T2_Callback11UserType* usrParam);
# void MessageCallback11a(size_t id /* key */, T2_CallbackFunc11 cbFunc, const T2_Callback11UserType* usrParam);
# void MessageCallback11aInject(size_t id);
#JavaCallbackDef  MessageCallback11a T2_CallbackFunc11 1 Object com.jogamp.gluegen.test.junit.generation.BaseClass4JavaCallback.CustomMessageCallback11Key
JavaCallbackDef  MessageCallback11a 2 T2_CallbackFunc11 1
JavaCallbackKey  MessageCallback11a 0 T2_CallbackFunc11 0
#
# End JavaCallback

# void MessageCallback11b(size_t id /* key */, T2_CallbackFunc11 cbFunc, void* Data);
# void MessageCallback11bInject(size_t id);
JavaCallbackDef  MessageCallback11b 2 T2_CallbackFunc11 1
JavaCallbackKey  MessageCallback11b 0 T2_CallbackFunc11 0


# T2_Callback12LogMessage
ReturnsStringOnly T2_Callback12LogMessage.Category
ReturnsStringOnly T2_Callback12LogMessage.Message

# Begin JavaCallback
#
# typedef void ( * T2_CallbackFunc12a)(const T2_Callback12LogMessage* usrParam);
# void SetLogCallBack12a(T2_CallbackFunc12a cbFunc);
# void LogCallBack12aInject(const T2_Callback12LogMessage* message);
JavaCallbackDef SetLogCallBack12a -1 T2_CallbackFunc12a -1
#
# End JavaCallback

# Begin JavaCallback
#
# typedef void ( * T2_CallbackFunc12b)(int param0, const T2_Callback12LogMessage* usrParam1);
# void SetLogCallBack12b(T2_CallbackFunc12b cbFunc);
# void LogCallBack12bInject(const T2_Callback12LogMessage* message);
JavaCallbackDef SetLogCallBack12b -1 T2_CallbackFunc12b -1
#
# End JavaCallback

# Begin JavaCallback
#
# typedef void ( * T2_CallbackFunc13)(const char* msg1, const T2_Callback13UserType* info, const char* msg2, const T2_Callback13UserKey1* usrParamKey1 /* key */, size_t usrKey2 /* key */);
# void MessageCallback13(const char* debugMsg, T2_CallbackFunc13 cbFunc, const T2_Callback13UserKey1* usrParamKey1 /* key */, size_t usrKey2 /* key */);
# void InjectMessageCallback13(const char* msg1, const T2_Callback13UserType* info, const char* msg2, const T2_Callback13UserKey1* usrParamKey1 /* key */, size_t usrKey2 /* key */);

ArgumentIsString T2_CallbackFunc13 0 2
ArgumentIsString InjectMessageCallback13 0 2
ArgumentIsString MessageCallback13 0
JavaCallbackDef  MessageCallback13 2   T2_CallbackFunc13 3
JavaCallbackKey  MessageCallback13 2 3 T2_CallbackFunc13 3 4
#
# End JavaCallback

CustomCCode #include "test2.h"

Import com.jogamp.gluegen.test.junit.generation.Bindingtest2
Import com.jogamp.gluegen.test.junit.generation.T2_PointerStorage
Import com.jogamp.gluegen.test.junit.generation.T2_InitializeOptions
Import com.jogamp.gluegen.test.junit.generation.T2_ThreadAffinity
Import com.jogamp.gluegen.test.junit.generation.T2_UserData
Import com.jogamp.gluegen.test.junit.generation.T2_Callback11UserType
Import com.jogamp.gluegen.test.junit.generation.T2_Callback12LogMessage
Import com.jogamp.gluegen.test.junit.generation.T2_Callback13UserType
Import com.jogamp.gluegen.test.junit.generation.T2_Callback13UserKey1
Import com.jogamp.gluegen.test.junit.generation.BaseClass4JavaCallback.ALCcontext

