summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen
Commit message (Collapse)AuthorAgeFilesLines
* JavaEmitter: Always use 'containingJTypeName' for ↵Sven Gothel2015-03-261-6/+6
| | | | | | | JavaConfiguration.canonicalStructFieldSymbol(..) Patch harmonizes configuration, was also using 'structCTypeName' besides 'containingJTypeName', but surely it makes no sense to use different type names for struct-field configurations.
* Bug 1149: Fix parsing of hexadecimal w/ binary exponent floats in ↵Sven Gothel2015-03-252-36/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | regexp-constant and java-parser. (Due to PCPP -> JCPP) Lack of parsing binary exponent floats is exposed due to using JCPP and correct constant-definitions. - JavaParser.g: - Add support for hexadecimal w/ binary exponent floats - TAB -> 4 spaces - ConstantDefinition.java: - Add RegExp 'fpRegexp', patternDecimalNumber: decimal number w/ support for hexadecimal w/ binary exponent floats. - isDecimalNumber(..): Use patternDecimalNumber instead of try-and-error (NumberFormatException) - patternCPPOperand: exclude patternDecimalNumber! - JavaEmitter.java: - Respect explicit suffix [dD] for double type. - Drop floating point suffixes [fF] - Test: Added tests for hexadecimal w/ binary exponent floats
* Bug 1149 - Replacing PCPP w/ JCPP: Name used CPP impl.Sven Gothel2015-03-241-7/+9
|
* Fix Logging: PlainLogConsoleHandler shall start w/ Level.ALL, add explicit ↵Sven Gothel2015-03-241-7/+26
| | | | Level setter for handler.
* Bug 1149 - Replacing PCPP w/ JCPP, allowing complete macro handling (Part-2: ↵Sven Gothel2015-03-243-5/+7
| | | | JCPP submodule, build, test and doc)
* Bug 1149 - Replacing PCPP w/ JCPP, allowing complete macro handling (Part-1: ↵Sven Gothel2015-03-236-143/+320
| | | | Cleanup / Preparation)
* Bug 1144 - Add 'DelegateImplementation': Requires own MethodBinding for ↵Sven Gothel2015-03-118-58/+128
| | | | | | | | | | | | | | | | | | | | | | delegates impl. / Adding ReturnsOpaque - DelegateImplementation requires own MethodBinding for delegates impl. The delegation name must be included within the FunctionSymbol's aliases _only_ for implementations, where delegation applies. This allows all subsequent type/cfg checks to hit on AliasedSymbol! Hence we need to create individual MethodBinding instances for interfaces and public/private implementations. - Adding ReturnsOpaque Configuration: ReturnsOpaque <Primitive Java Type> <Function Name> This feature is necessary to achieve 'Opaque' functionality for function's return type - instead of types in general. - Fix AliasedSymbolImpl copy-ctor, i.e. this.name = o.name !
* Bug 1134 - LOG AliasedSymbol: Don't issue getAliasedString(), logger takes ↵Sven Gothel2015-03-114-18/+18
| | | | care of that, when it logs.
* Bug 1144 - Add 'DelegateImplementation', manually impl. may delegate to ↵Sven Gothel2015-03-113-9/+106
| | | | | | | | | | | | | | | | | | | | | | | | renamed original 'DelegateImplementation' is a variation of 'ManuallyImplement'. 'ManuallyImplement' emits the interface method, but suppresses the Java and native-code implementation. The latter shall be implemented manually by the user. 'DelegateImplementation' emits the interface method, and the _private_ renamed Java and native-code implementation. Both can be called from the manual user implementation, hence delegation. Configuration: DelegateImplementation <ORIG-SYMBOL> <RENAMED-IMPL-SYMBOL> I.e. delegation model shall apply to <ORIG-SYMBOL> and the Java and native-code implementation renamed to <RENAMED-IMPL-SYMBOL>. The user manual implementation of <ORIG-SYMBOL> may delegate to <RENAMED-IMPL-SYMBOL>.
* Bug 1144 - Add 'DelegateImplementation': Cleanup ↵Sven Gothel2015-03-119-118/+197
| | | | | | | | MethodBinding/FunctionBinding Semantics - Clarify name semantics: name -> [interfaceName, implName, nativeName] - JavaMethodBindingEmitter: Refine native identity via isNativeMethod + isPrivateNativeMethod - ProcAddressEmitter: Remove hack whether we need to wrap .. use isNativeMethod + isPrivateNativeMethod
* Bug 1144 - Add 'DelegateImplementation': Sort JavaMethodBindingEmitter ↵Sven Gothel2015-03-104-48/+51
| | | | argument list; forImplementingMethodCall -> isNativeMethod
* Bug 1144 - Add 'DelegateImplementation': Cleanup JavaConfiguration and use ↵Sven Gothel2015-03-102-65/+83
| | | | manuallyImplement(AliasedSymbol) for FunctionSymbol
* Bug 1134 - Refine err/log message of 'previous definition is here'Sven Gothel2015-03-091-2/+2
|
* Bug 1134 - Add ASTLocusTagProvider for Define and fix newline in c-parser ↵Sven Gothel2015-03-092-3/+16
| | | | (Expose source location for log/error messages)
* Bug 1134 - Fix CMethodBindingEmitter return type '_res' qualifiers (part 2)Sven Gothel2015-03-092-2/+13
| | | | | | | | | Commit 414a0146660cadd35d5ae270f7f819717e9c7374 removed the const/volatile of the local return variable. This change also casts the function calling result to the same - hence removing a possible c-compiler warning of dropping qualifier const.
* Bug 1134 - ProcAddressCMethodBindingEmitter: Use available 'ProcAddrTypedef' ↵Sven Gothel2015-03-092-39/+43
| | | | | | | | | | | | | | | | | for type validation w/ local generated variant (robustness) ProcAddressCMethodBindingEmitter code regarding having the public 'ProcAddrTypedef' (from input header) was simply broken, since it always used the local generated 'ProcAddrTypedef', if 'ProcAddrTypedef' was forced. Hence the public 'ProcAddrTypedef' was ignored in most cases. ProcAddressCMethodBindingEmitter's semantic changed from: needsLocalTypedef -> hasProcAddrTypedef New Code generation: - always generated the local 'ProcAddrTypedef' - if hasProcAddrTypedef, use public 'ProcAddrTypedef' for return type variable - cast local 'ProcAddrTypedef' to public 'ProcAddrTypedef', which renders the native compiler to validate the local and public types.
* Bug 1134 - Fix CMethodBindingEmitter return type '_res' qualifiersSven Gothel2015-03-091-2/+3
| | | | | We cannot have the local variable holding the return type 'const' and assign a value to it later.
* Bug 1134 - Fix aliased typedef struct emissionSven Gothel2015-03-093-71/+89
| | | | | | | | | | | | | | | | | | | | | | - Code regarding 'aliased typedef struct' is tagged in JavaEmitter and HeaderParser: 'NOTE: Struct Name Resolution (JavaEmitter, HeaderParser)' Prefers containing cstruct typedef pointer if available _and_ if cstruct is _not_ a typedef! - Removed: 'HeaderParser.resolveAnonCompound(..)' no more required, since CompoundType always sets its name! Commit cf9f28cf249393f42d7d2835775521dfadee6b92 - JavaEmitter.emitStruct: - Regard above 'aliased typedef struct' NOTE - JavaEmitter.typeToJavaType: - Regard above 'aliased typedef struct' NOTE - ReferencedStructs - Drop duplicate CompoundType instances of same name. This can happen due to const/volatile and ASTLocusTag variants.
* Bug 1134 - Fix IntType 'unsigned'; Type: Use copy-ctor instead of Clonable, ..Sven Gothel2015-03-0920-240/+277
| | | | | | | | | | | | - Fix IntType 'unsigned' - Need to handle 'unsigned' for typedef and !typedef, when exposing 'unsigned' for code emission. - Consider IntType.typedefUnsigned in hash/equals - Type: Use copy-ctor instead of Clonable enhancing strong typing. - add 'Type clone(final ASTLocusTag newLoc)' - Consider Type.typedefCVAttributes in hash/equals
* Bug 1134 - Make ASTLocusTag's text optionalSven Gothel2015-03-093-7/+15
|
* Bug 1134 - Logging's formatter now takes care of Type -> getDebugString() ↵Sven Gothel2015-03-083-43/+72
| | | | | | | when desired, not at 'log' call Removes load to assemble the getDebugString() of Type and JavaType when invoking log function. Note: the log may be skipped if log-level is not reached.
* Bug 1134 - Use ASTLocationTag in Logging (PCPP, Emitter); Refine ↵Sven Gothel2015-03-0815-191/+289
| | | | | | | | ASTLocationTag log/exception formatting. Since commit eca019cdea4017227e951d8a9eb30cb34fca4a07, we have ASTLocationTag available. Hence use it for all logging purposes and emit a standard compiler output, which shall be parsable by other tools.
* Fix Type.getDebugString() comma separationSven Gothel2015-03-071-53/+59
|
* Bug 1134 - Fix IntType: Add getCName(..) for proper C-type code; Fix its ↵Sven Gothel2015-03-073-44/+55
| | | | | | | | | | | | | | | newCVVariant(..), don't pass given cv-attr as typedef Add getCName(..) for proper C-type code - Add 'unsigned ' if not typedef and is unsigned. - Allows removal of special case in CMethodBindingEmitter - Fixes ProcAddressCMethodBindingEmitter typedef emission and removes clang warnings, caused by this (many). Fix its newCVVariant(..), don't pass given cv-attr as typedef - Proper delegation of 'const', regression of prev. commits
* Bug 1134 - Handle Opaque fields in structs; Print struct field name in ↵Sven Gothel2015-03-072-35/+59
| | | | apidoc of getter/setter
* Bug 1134 - Pass ASTLocationTag to all types, used for GlueGenExceptionSven Gothel2015-03-0720-188/+332
| | | | | Enhances semantic exception in code generation by adding the AST location of the type or function declaration.
* Bug 1134 - GlueGenException.toString(): Produce a 'gcc' like/compatible ↵Sven Gothel2015-03-062-5/+13
| | | | error message
* Bug 1134 - Fix ProcAddressEmitter.getFunctionPointerTypedefName() ; Fix ↵Sven Gothel2015-03-063-6/+17
| | | | | | | | | | | JavaEmitter's Function/Struct Emission Fix ProcAddressEmitter.getFunctionPointerTypedefName(): - needs to produce function-pointer-type name w/ original name Fix JavaEmitter's Function/Struct Emission: - needs to create FunctionSymbol w/ original native name, - then rename - preserving the original one.
* Bug 1134 - Utilize AliasedSymbol where required in *Configuration; Clarify ↵Sven Gothel2015-03-065-65/+115
| | | | ProcAddressEmitter criteria
* Bug 1134 - Refine Logging using 'LoggerIf' - Replace System.err w/ Logging ↵Sven Gothel2015-03-068-156/+263
| | | | where appropriate
* Bug 1134 - Add ASTLocationTag, locating source of [semantic] errors while ↵Sven Gothel2015-03-068-17/+253
| | | | | | | parsing / analyzing New GlueGenException supports ASTLocationTag, which will be throws in case of semantic and/or parsing errors.
* Bug 1134 - Fix regression: Static C-Function call must use original API nameSven Gothel2015-03-054-4/+24
| | | | | | | | | - Regression of commit 72d3635279ffc8ad88e47dff9bbe95d211226d11 CMethodBindingEmitter emits statically linked function calls, hence needs to use the original name of AliasedSymbol. AliasedSymbol: Add 'getOrigName()' at creation!
* Bug 1134 - Enhance GlueGen Compiler: Minimal GL Header Changes _and_ TypesafetySven Gothel2015-03-0537-701/+1965
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - We shall be able to import 'most' vanilla GL header, i.e. only change the typedef part using our GlueGen types - Type Safety: - GlueGen now detects '#define' and 'enum' redefines and throw an exception in this case. This helps detecting wrongly renamed GL extensions into core! - GlueGen now detects function redefines (overloading) and throw an exception in this case. Hence the semantics of duplicate functions has to be equal! This helps detecting wrongly renamed GL extensions into core! - Semantic equality for all types is provided via interface TypeComparator.SemanticEqualityOp, i.e. 'boolean equalSemantics(..)' implemented by com.jogamp.gluegen.cgram.types.Type. Semantic equality can be relaxed via config "RelaxedEqualSemanticsTest true", i.e. ignoring integer size, and const / volatile qualifiers. - All equality/hash methods of 'com.jogamp.gluegen.cgram.types.*' are restructured. - Track and simplify renamed 'symbol', i.e. use a common sub-interface for all renamed symbols (ConstantDefinition, FunctionSymbol, ..) - This is provided in a unified manner via interface com.jogamp.gluegen.cgram.types.AliasedSymbol and its common implementation AliasedSymbolImpl - All JavaConfiguration.shouldIgnore* methods operate w/ 'AliasedSymbol' trying to match all aliases. - Support 'struct NAME [ { ... } ]' w/o typedef's - New GL / CL headers do not use typedef's for anonymous opaque types - Opaque Type handling - JavaConfiguration.typeInfo(..), identifying opaque types, no more back references from target-type -> typedef. Hence the following is possible now: typedef void * Opaque01; // Opaque typedef void * APointerBuffer; // A Buffer - All Logger instances are no more static and derive their warning level from the package's root Logger via Logging.getLogger(..).
* Refine commit 12feaa7d3b1544098f684d851e3caff1ec88cbc8: Add 'throws ↵Sven Gothel2015-02-052-6/+9
| | | | SecurityException' decl., remove dead code, remove redundant check.
* Bug 1126 - Remove static query requirement of MachineDescriptor, find ↵Sven Gothel2015-02-029-83/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | matching StaticConfig at runtime; Fix PPC (Bug 1056) and MIPSLE (Bug 1014) issues. Currently the StaticConfig is being queried via the key[OSType, CPUType ..] as pre-determined by Java properties or the ELF parser. This adds complication to maintain different platforms and the key query might not even be sufficient. The MachineDescriptor's StaticConfig only purpose shall be to speed-up native data size and offset/alignment retrieval. This is done by using the StaticConfig index within all StaticConfig[]s as a lookup-index for the precomputed struct's size and offset tables. +++ Solution: Rename: MachineDescriptor -> MachineDataInfo Rename: MachineDescriptorRuntime -> MachineDataInfoRuntime After having defined os.and.arch (OSType, CPUType and ABIType) w/ the optional help of the now self containing ELF Reader (Bug 1125), the native gluegen-rt library gets loaded enabling JNI methods. It is satisfactory to retrieve MachineDataInfo at runtime w/ JNI and find the matching/compatible StaticConfig. Only in case none is found, the program needs to abort. Otherwise the found MachineDataInfo.StaticConfig and MachineDataInfo are stored for further use (see above). This removes above complication and key to StaticConfig mapping. New platforms simply need to add a new unique entry into the StaticConfig[] table. ++ Also fixes Bug 1056 (PPC), thanks to tmancill [@] debian [.] org, and Bug 1014 (MIPSLE), thanks to Dejan Latinovic. Parts of the patch for Bug 1014 from Dejan Latinovic are included. also solved by this change set.
* Bug 1125 - Make ELF Reader 'jogamp.common.os.elf' StatelessSven Gothel2015-02-012-23/+73
| | | | | | | | | | | | | | | | | | | | | | | | | ELF Reader 'jogamp.common.os.elf' currently uses Platform's pre-determined OS_TYPE and CPUType. It also uses the host platforms MachineDescription, hence can not read ELF files from other machines. This also forbids Platform to determine CPUType etc w/o having a valid 'os.arch' property. +++ ElfHeader should be split in - ElfHeaderPart1 (CPUType independent) - ElfHeaderPart2 (CPUType dependent) Fix shall make the ELF Reader self containing by only using ELF CPUType data, etc. This requires customization of struct parsing, where MachineDescription.Static index shall be - defined in ElfHeaderPart1 using e_Ident's CPUType. - used in ElfHeaderPart2 and all its struct types.
* Bug 1122: Refine AArch64 and OSType/32Bit incl. MachineDescriptionSven Gothel2015-01-303-3/+3
| | | | | | | | | | | | Android: - Detect ABIType.EABI_GNU_ARMHF via 'armeabi-v7a-hard' Platform.CPUType: - contains is32Bit now MachineDescription: - Rename *x86_64_unix* -> *lp64_unix*, reflecting universal __LP64__ mode - Remove is32Bit, which is determined by CPUType
* Refine Native Library Code: Bulk Permissions, Cleanup DynamicLinker impl. - ↵Sven Gothel2015-01-301-8/+10
| | | | | | | | | | | | | | | and fix Android AArch64 BionicDynamicLinker (Bug 1122) - Bulk Permissions ProcAddressTable.reset(..) performs address lookup in one block. Now claiming all permissions upfront once, and releasing them afterwards. - Cleanup DynamicLinker impl. Proper top-down impl. of DynamicLinkerImpl, handling all security code and validations. - Fix Android AArch64 BionicDynamicLinker (Bug 1122) Dalvik uses diff RTLD_* defines for AArch64!
* GlueGen: Make const array-length getter static, if constant.Sven Gothel2015-01-301-18/+26
|
* ProcAddressConfiguration: Allow setting default value for ↵Sven Gothel2014-12-181-1/+4
| | | | 'GetProcAddressTableExpr'
* GlueGen JavaEmitter: Use proper class access modifiers for emitted classes ↵Sven Gothel2014-12-113-20/+32
| | | | | | | incl. ProcAddressTable Emitted Java classes as well as optional ProcAddressTable shall use unique generated access modifiers covering all MethodAccess cases.
* gluegen: remove the unused reverse map from TypeDictionaryHarvey Harrison2014-07-071-9/+0
|
* gluegen: remove unused imports, unneeded semicolons, add missing @Override ↵Harvey Harrison2014-07-072-2/+2
| | | | annotations
* Code Clean-Up based on our Recommended Settings (jogamp-scripting ↵Sven Gothel2014-07-0352-1275/+1275
| | | | | | | | | | | | | | | 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
* Fix 'typo' in messages: 'Catched' -> 'Caught'Sven Gothel2014-06-281-1/+1
|
* CMethodBindingEmitter: Suppress compiler warning in NewDirectByteBuffer ↵Sven Gothel2014-06-251-2/+2
| | | | usage (cast to void*)
* Bug 1025 - GlueGen: Fix regression of single non-native sized compound fieldsSven Gothel2014-06-251-5/+21
| | | | | Single non-native sized compound fields, if an opaque array/pointer, must utilized the native size StructAccessor get/set method.
* Bug 1025 - GlueGen: Add accessor for compound fields of type array, pointer ↵Sven Gothel2014-06-2511-414/+1149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Add support for compound-array in structs (accessors) ; Allow using ↵Sven Gothel2014-06-192-39/+124
| | | | | | | | | | | | | | | C-Enum values for array length - Parser (HeaderParser.g): Support using C-Enum values for array length specification - Will throw an exception if enum identifier is unknown or exceeds int-size - Add StructEmitter supports for compound-arrays - Add Debug stderr verbose info: - Struct Emitter prefix 'SE.' - to analyze emitting struct fields (offset+size and accessors) - Struct Layout prefix 'SL.' - to analyze memory layout (based on MachineDescription.StaticConfig.X86_64_UNIX) Tested via test1.[ch] BaseClass ..
* GlueGen: Refine compound [array] call-by-value native code injection and ↵Sven Gothel2014-06-182-7/+46
| | | | | | | | | | | initialization Follow-up of commit 1eadaf928f4f61aae4de1c8bf33c5b77bdfa882f - Refine MethodBinding detection for 'requiresStaticInitialization', i.e. return type is a "compound type" and not a pointer - JVMUtil_NewDirectByteBufferCopy: Throw FatalError if initializeImpl() has not been called