aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix & Enhance Test4JavaCallback for non-userParam chapter12*: Fix ad-hoc ↵Sven Gothel2023-08-044-38/+142
| | | | | | | | compound equals and add chapter12b for additional parameter with different order - ad-hoc compound equals must compare value, since native code creates a new class instance from native struct - Add additional case with addition callback argument for further validation
* JavaEmitter: Encapsulate 'needsJavaCallbackCode' query in JavaConfiguration. ↵Sven Gothel2023-08-042-7/+11
| | | | | | | | | | | | | | TBD: Is this even required? - needsIntermediateOperation -> needsJavaCallbackCode - Use JavaConfiguration.requiresJavaCallbackCode(..) TBD: Is this even required? As far as I see, the non-userParam callback case adds no additional code requirements. Both, callback with and without userParam shares same code path and the respective native static fields. Only that the non-userParam code path adds additional native static fields, but all code sections are produced in both cases.
* JavaCallbackEmitter.emitCAdditionalCode(): Use `info.cbFuncBinding` locally ↵Sven Gothel2023-08-041-6/+11
| | | | | | | | and passed 'jcbFuncCMethodEmitter' only to invoke CMethodBindingEmitter.emitBodyMapCToJNIType(..) Passed 'jcbFuncCMethodEmitter' only used to access CMethodBindingEmitter.emitBodyMapCToJNIType(int, boolean), a non-ideal hack! (FIXME) General processing shall use the local `info.cbFuncBinding`.
* JavaCallbackEmitter.emitJavaCallbackBodyPassJavaArguments(): Drop redundant ↵Sven Gothel2023-08-041-5/+5
| | | | | | | | | arg 'MethodBinding jcbFuncCMethodBinding', use local 'info.cbFuncBinding' Since emitJavaCallbackBodyPassJavaArguments() is private now, only use case is to handle info.cbFuncBinding and we can drop the redundant argument. Similar to cleanup commit e9a2294b3f18bb4c4f38347ccf347058cb4642b3
* JavaCallbackEmitter.emitCSetFuncPreCall(): Drop redundant arg ↵Sven Gothel2023-08-032-5/+5
| | | | | | | 'CMethodBindingEmitter jcbFuncCMethodEmitter', use local 'info.cbFuncBinding' Was added in commit ad69716fda64b517c33ed847c4b215ea398aac99 'callback without userData', while adding ad-hoc compound conversion.
* JavaCallbackEmitter.{emitCSetFuncPreCall, emitCAdditionalCode, ↵Sven Gothel2023-08-032-37/+33
| | | | | | | | | | | | | | emitJavaCallbackBodyPassJavaArguments}(): Fix exclusion of ad-hoc compound conversion for userParam Passed CMethodBindingEmitter denotes the callback-function, including the binding. The new iteration to handle the ad-hoc compound conversion, introduced in commit ad69716fda64b517c33ed847c4b215ea398aac99 'callback without userData', iterates over the callback-function argument list. Hence it shall only exclude the ad-hoc compound conversion if index != info.cbFuncUserParamIdx. Dropping the addition exclusion 'i != info.setFuncUserParamIdx'.
* JavaCallbackEmitter.{emitCSetFuncPreCall, emitCAdditionalCode, ↵Sven Gothel2023-08-031-4/+5
| | | | emitJavaCallbackBodyPassJavaArguments}(): Use capitalized sub-string 'baseArgName' for (static) callback related entities
* JavaCallbackEmitter.{emitCSetFuncPreCall, emitCAdditionalCode}(): Group ↵Sven Gothel2023-08-031-6/+17
| | | | 'userParamDefined' case (cleanup)
* CMethodBindingEmitter.emitBodyMapCToJNIType(..): Add proper intendation to ↵Sven Gothel2023-08-031-9/+13
| | | | NIO ByteBuffer generation (isNIOBuffer || isCompoundTypeWrapper)
* Merge remote-tracking branch ↵Sven Gothel2023-08-0210-110/+418
|\ | | | | | | 'Mathieu_Fery/feature/java_callback_without_user_data' into pulled
| * doc/GlueGen_Mapping.md: Add some documentation with JavaCallback without ↵Mathieu Féry2023-08-011-2/+68
| | | | | | | | userData
| * feat(callbackGenerator): Add basic management of callback without userDataMathieu Féry2023-07-319-108/+350
| |
* | feat(generation): Add setter generation for not constant and not opaque ↵Mathieu Féry2023-07-314-5/+33
|/ | | | compound attribute
* doc/GlueGen_Mapping.md: Using 'UserParamClass' .. grammar (3 commits for 1 ↵rcSven Gothel2023-07-102-3/+3
| | | | | | discount today) Cough cough .. should have reviewed the whole thing once. Must be the summer distraction causing premature commits. Sorry about that :)
* doc/GlueGen_Mapping.md: Typos 'UserParam' -> 'UserParamClass' (2 more ↵Sven Gothel2023-07-102-8/+8
| | | | occassions)
* doc/GlueGen_Mapping.md: Typos 'UserParam' -> 'UserParamClass'Sven Gothel2023-07-102-4/+4
|
* GlueGen JavaCallback: Add optional custom 'Callback-UserParamClass` for ↵Sven Gothel2023-07-109-443/+513
| | | | non-compound `UserParam` types to have more clarity in resulting API
* Manual: Fix ArgumentIsPascalStringSven Gothel2023-07-081-2/+2
|
* GlueGen JavaCallback: Add capability to have UserParam as (part of) keySven Gothel2023-07-0811-106/+709
| | | | | | | | | Resolves use case where UserParam reflects e.g. a context (AL_SOFT_events) and will be (part of) the key mapping. Implementation required an additional userParamID -> userParam mapping for default Object/ID usage. Added 2 test cases.
* GlueGen JavaCallback Doc: Remove reasoning (avoiding ambiguity) to ↵Sven Gothel2023-07-062-10/+4
| | | | CallbackFunction parameter index
* GlueGen JavaCallback: Remove ambiguity: Config ↵Sven Gothel2023-07-069-157/+200
| | | | JavaCallbackDef/JavaCallbackKey: Always define both parameter indices; emitJavaStaticCallback(): Use cbFuncBinding and cbFuncKeyIndices from callback parameter to build key
* GlueGen JavaCallback: Fix `staticCBClazz*` initial setup (only), using a ↵Sven Gothel2023-07-051-18/+22
| | | | | | NewGlobalRef() for jclass (not required for static jmethodID) Also use a longer jclass argument name 'clazz' -> 'staticCBClazz' to avoid potential collisions
* Manual: Refine `ArgumentIsPascalString`Sven Gothel2023-07-051-3/+3
|
* GlueGen: Add 'PascalString' string semantics (length + value-ptr), added ↵Sven Gothel2023-07-056-25/+177
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* GlueGen JavaCallback/LibraryOnLoad: Always include the `libraryBasename` ↵Sven Gothel2023-07-055-68/+132
| | | | agnostic 'emitJNIEnvDecl()' (declaration) in JNI code; Detach the thread from the JVM if newly attach in callback!
* doc/GlueGen_Mapping.md: Quote `void*` correctly ..Sven Gothel2023-07-042-4/+5
|
* GlueGen JavaType.appendDescriptor(..): Fix regression: Must return a vanilla ↵Sven Gothel2023-07-041-3/+1
| | | | descriptor ('/' not '_') i.e. non JNI method-name descriptor to avoid double conversion
* GlueGen JavaCallback: Revised: Static Java callback dispatcher, dropping ↵Sven Gothel2023-07-0418-862/+1999
| | | | | | | | | | | | | | | | | | | | | | | | | native heap, support Struct UserParam ... Implementation now generates a static Java callback dispatcher for each defined SetCallbackFunction, which gets invoked by the generated native static counterpart with all arguments required. The static callback utilizes its own synchronization for thread-safety and fetches the required data set stored at SetCallbackFunction to dispatch the call to the users' CallbackFunction. In case the callback has been removed already, the static callback simply bails out quietly. The native code does not create, release or manage heap memory and therefore is considered safe. +++ Further Struct Type UserParam are now supported including Heterogeneous UserParam mapping (read GlueGen_Mapping.*). +++ Cleaned up code by extracting all JavaCallback emitter code into JavaCallbackEmitter class in one place, leaving JavaMethodbindingEmitter and CMethodbindingEmitter mostly in their original stage (non-convoluted). In this regard, I had to refactor a few function, i.e. moving CMethodbindingEmitter.getJNIMangledArg(..) into JavaType.appendDescriptor(..) and JavaType.appendJNIDescriptor(..) while reusing the toJNIMethodDescriptor(..) conversion. Test4JavaCallback covers and passes all cases.
* GlueGen JavaCallback: Unify native 'T_JavaCallbackGlueData' typedef structcallback_jniuserparamproxySven Gothel2023-07-023-11/+25
|
* GlueGen JavaCallback: CMethodBindingEmitter: Check, describe & clear ↵Sven Gothel2023-07-022-7/+103
| | | | | | exception if occurring - we must assume async off-thread source in general Covered by unit tests now
* GlueGen JavaCallback: CMethodBindingEmitter: Check lockObj for NULL before ↵Sven Gothel2023-07-021-0/+1
| | | | GetObjectRefType(), avoid certain (older) Hotspot issues
* CMethodBindingEmitter JavaCallback: Use a friendly readable basename for errorsSven Gothel2023-07-021-16/+19
|
* GlueGen Struct [18]: Drop redundant 'static get*ElemCount() { return 1 }` ↵Sven Gothel2023-07-022-3/+5
| | | | for: isPrimitive && !isPointer && staticElemCount && maxOneElement
* GlueGen JavaCallback: Native Callback: Reduce 'look-ahead' of ↵Sven Gothel2023-07-021-9/+9
| | | | read-after-free to critical lockObj only
* GlueGen JavaCallback: Document native callback use-after-free potential ↵Sven Gothel2023-07-021-1/+6
| | | | (caught), zero-mem @ release
* doc/GlueGen_Mapping.md: TypoSven Gothel2023-07-022-2/+2
|
* GlueGen JavaCallback: Emphasize all methods are thread-safeSven Gothel2023-07-022-2/+3
|
* GlueGen JavaCallback: Native callback: Check ObjectRef validity and ↵Sven Gothel2023-07-023-21/+66
| | | | synchronize (MonitorEnter/Exit) with same Object of Java impl. -> thread safe
* GlueGen JavaCallback: Use `SetCallback-KeyClass` if manually specified, even ↵Sven Gothel2023-07-015-12/+41
| | | | if no keys are defined!
* GlueGen JavaCallback: Only produce default 'Key' class if keys are used, ↵Sven Gothel2023-07-018-271/+734
| | | | | | | | | | | expose 'Key' to public and use it. Expose release*() and get*Keys() methods Further we use a dedicated lock Object used in the Java implementation. TODO: Native static callback dispatch code shall - (also) acquire the lock - handle case where the data has been released already to render this solution thread-safe and data-race free
* GlueGen JavaCallback: Release the associated data (natively) only after the ↵Sven Gothel2023-07-011-2/+8
| | | | | | actual toolkit setCallback call .. to avoid a potential race condition
* GlueGen Intro: Add section about its comprehensive runtime library, shorten ↵Sven Gothel2023-07-014-20/+66
| | | | the JNI_OnLoad section
* GlueGen JavaCallback: Resolve key mapping of callback and associated ↵Sven Gothel2023-06-3010-177/+1429
| | | | | | | | | | | | | | | | resources via 'JavaCallbackKey' config and custom `SetCallback-KeyClass` Updated unit test and doc accordingly. Unit tests handle OpenAL's AL_SOFT_callback_buffer and AL_SOFT_events. Tested global scope (no key, default) and 1 key (default) and 1 key (custom class). Added more query functions, which all only take the `SetCallbackFunction` key arguments as specified. Cleaned up JavaCallback* config class field naminig scheme. Added 'synchronized (..Map) { }' block in crucial `SetCallbackFunction`, rendering implementation thread safe.
* GlueGen FunctionType/MethodBinding: get*ParameterList(): Use a more flexible ↵Sven Gothel2023-06-308-84/+210
| | | | way via a ParameterConsumer visitor, also usable for other iterative parameter generator
* Eclipse classpathSven Gothel2023-06-301-1/+1
|
* Test4JavaCallback: Just rename myUserParam -> myUserParam01 for future tests..Sven Gothel2023-06-291-22/+22
|
* GlueGen JavaCallback: Set-Callback: Ensure a previously mapped 'userParam' ↵Sven Gothel2023-06-292-12/+42
| | | | instance is released before binding new one; Add test changing callback function.
* README.md: Fix linksSven Gothel2023-06-291-2/+2
|
* Doc intro: Fix LibraryOnLoad using generic LibraryBasenameSven Gothel2023-06-294-4/+4
|
* Doc: www/index.html: Fix JOGL UML linkSven Gothel2023-06-291-1/+1
|