summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/JavaConfiguration.java
Commit message (Collapse)AuthorAgeFilesLines
* Code Clean-Up based on our Recommended Settings (jogamp-scripting ↵Sven Gothel2014-07-031-218/+218
| | | | | | | | | | | | | | | c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
* Bug 1025 - GlueGen: Add accessor for compound fields of type array, pointer ↵Sven Gothel2014-06-251-17/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and string (code generation) Enhance compound access as delivered by Bug 1022, to also generate accessors (getter and setter) for array, pointer and string types. Allow configuration of array length either via their internal size (c-header) or config 'ReturnedArrayLength'. 'ReturnedArrayLength' allows specifying a java expression. Canonical field names of compounds are _now_ specified as follows for configuration entries: COMPOUND.FIELD e.g. StructA.fieldB Also allow configuration of pointer fields to be treated as referenced arrays via 'ReturnedArrayLength'. Further, allow specifying 'pointer fields' as String values via 'ReturnsString' configuration. ++++ Implementation details: - handle above described accessor features - enhance JavaDoc for generated accessors - generate native JNI compound and string accessor on demand - encapsule accessor code generation in their own methods - enhance exception messages - enhance type verbosity in debug mode - verbose debug output via GlueGen.debug() Tests: - Features covered by test1.[ch] and Test1p1JavaEmitter and Test1p2ProcAddressEmitter - Validated compilation and unit tests for modules: - joal - jogl (minor config changes req.) - jocl (minor config changes req.)
* GlueGen: Refine compound [array] call-by-value native code injection and ↵Sven Gothel2014-06-181-10/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initialization Follow-up of commit 9843e983a4fc71a64eb3de9cb364a1f4ffa56b3a Only add static initialization code (java, native) and hence native code 'JVMUtil_NewDirectByteBufferCopy(..)' if either required _or_ forced via configuration. This shall reduce possible sideffects and dead code. Add JavaConfiguration: /** * Returns true if the static initialization java code calling <code>initializeImpl()</code> * for the given class will be manually implemented by the end user * as requested via configuration directive <code>ManualStaticInitCall 'class-name'</code>. */ public boolean manualStaticInitCall(String clazzName); /** * Returns true if the static initialization java code implementing <code>initializeImpl()</code> * and the native code implementing: * <pre> * static jobject JVMUtil_NewDirectByteBufferCopy(JNIEnv *env, void * source_address, jlong capacity); * </pre> * for the given class will be included in the generated code, always, * as requested via configuration directive <code>ForceStaticInitCode 'class-name'</code>. * <p> * If case above code has been generated, static class initialization is generated * to call <code>initializeImpl()</code>, see {@link #manualStaticInitCall(String)}. * </p> */ public boolean forceStaticInitCode(String clazzName);
* GlueGen: Add support for 'compound call-by-value', i.e. passing and ↵Sven Gothel2014-06-171-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning struct instance 'compound call-by-value' is not efficient. However, to allow mapping APIs utilizing passing small structs as arguments and return values - this feature has been added. +++ To return the struct value, native code needs to allocate a NIO ByteBuffer and copy the data. The stack return value can be dismissed afterwards and the NIO buffer is returned. We include this functionality for all generated [impl] classes, native method: 'static jobject JVMUtil_NewDirectByteBufferCopy(JNIEnv *env, void * source_address, jlong capacity)' (See: 'JavaEmitter.initClassAccessCode') Since this code requires knowledge of java classes and methods, for which a reference needs to be acquired, a static initialization method has been introduced for all generated [impl] classes: 'private static native boolean initializeImpl();' Per default the this method will be called in the new static initializer block of the class, which can be supressed via the configuration element: 'ManualStaticInit <class-name>' 'ManualStaticInit' can be used to issue the 'initializeImpl()' call in a custom static initializer written by the user. However, at the time 'initializeImpl()' gets called the JNI native library must have been loaded, of course! +++ - See tag: // FIXME: Compound call-by-value for code changes and validation of completeness Trigger for compond call-by-value in CMethodBindingEmitter is: !cArgType.isPointer() && javaArgType.isCompoundTypeWrapper() Trigger for compond call-by-value in JavaEmitter is: t.isCompound() +++ Further more we do tolerate 'javaType.isCPrimitivePointerType()', i.e. adding comments for offset/size and field entries, which are all NOP. This allows to utilize the remaining fields of the native structure. +++ Tests: Added call-by-value to test1.[ch] binding test!
* GlueGen: Add 'MethodJavadoc <method-name> comment-line..' configuration ↵Sven Gothel2014-01-211-35/+66
| | | | element, allowing to add custom API doc lines per method for the JavaMethodBindingEmitter
* gluegen: remove trailing whitespaceHarvey Harrison2013-10-171-31/+31
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* Cleanup GlueGen config 'ExtendedInterfaceSymbols*'Sven Gothel2013-01-311-17/+64
| | | | | | | | | | | | | | | | | | | Semantics Change: ExtendedInterfaceSymbolsOnly was used for implementation generation only, which is considered a bug! - ExtendedInterfaceSymbolsIgnore C.java - Ignore symbols in C.java for interface generation - ExtendedInterfaceSymbolsOnly C.java - Only use symbols in C.java for interface generation - ExtendedImplementationSymbolsIgnore C.java - Ignore symbols in C.java for implementation generation - ExtendedImplementationSymbolsOnly C.java - Only use symbols in C.java for implementation generation - ExtendedIntfAndImplSymbolsIgnore C.java - Ignore symbols in C.java for interface and implementation generation - ExtendedIntfAndImplSymbolsOnly C.java - Only use symbols in C.java for interface and implementation generation
* gluegen: remove two fast-path tests that can never triggerHarvey Harrison2012-10-161-14/+0
| | | | | | | | ignores and unimplemented are both Set<Pattern>, they cannot contain a String, immediately after these 'fast paths' we loop over the patterns calling .matches() which makes sense, so remove the misleading tests. Signed-off-by: Harvey Harrison <[email protected]>
* Fix 'NIOOnly' impl ; Use 'final' in gen. Java stubs ;Sven Gothel2012-03-221-24/+27
| | | | | | | | | | | | | | | | | | - Fix 'NIOOnly' impl - Use 'final' in gen. Java stubs ; - No null check for Buffers.isDirect(arrayArg) [required] - Clarify Buffer arg API doc (NIOOnly or NIODirectOnly) - cleaned up loop / branch (CMethodBindingEmitter) - remove unsued vars/code - Tests: - covers normal/NIOOnly/NIODirectOnly - covers passing null for array and NIO
* Add more debug/analisys information. Throw exception when attempting to ↵Sven Gothel2012-02-151-5/+33
| | | | override a rename instruction w/ diff new value
* Don't ignore GlueGen.debug() in static DEBUG flags; Add ↵Sven Gothel2012-02-151-3/+18
| | | | JavaConfiguration.DEBUG_RENAMES
* Reversed Type relocation ; Minor fixSven Gothel2011-07-211-1/+0
| | | | | | | Reversed Type relocation (commit 92d6c9dc5fa72b01703456452c60822f36c14fff) from com.jogamp.gluegen.runtime.types back to com.jogamp.gluegen.cgram.types Enabled MemoryLayoutType.setLayouted(), avoiding double layout
* - Moved most types and StructLayout to runtime package:Sven Gothel2011-07-181-0/+2
| | | | | | | | | | | | | | | | | | | | | com.jogamp.gluegen.cgram.types -> com.jogamp.gluegen.runtime.types This is required for desired runtime memory layout. - Split CompoundType to StructType + UnionType - StructLayout: - Utilizing SizeThunk alignment - Alignment 1) Natural type alignment 2) Add Size 3) Trailing padding w/ largest element alignment - Only perform memory layout once for type. Status: - Unit test passes w/ static MachineDescriptor64Bit - FIXME static 32bit is faulty, uses 64bit size/alignment - TODO runtime struct layout to please all platforms w/o worrying
* Renamed com.sun.gluegen -> com.jogamp.gluegenSven Gothel2010-11-061-0/+1594