aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/cgram
Commit message (Collapse)AuthorAgeFilesLines
* GlueGen FunctionType/MethodBinding: get*ParameterList(): Use a more flexible ↵Sven Gothel2023-06-304-33/+70
| | | | way via a ParameterConsumer visitor, also usable for other iterative parameter generator
* GlueGen FunctionType: Factor out getParameterList(..) from toString(..) and ↵Sven Gothel2023-06-291-22/+41
| | | | drop 'void' and use typedef-name; MethodBinding: Add getCParameterList(..) and getJavaParameterList(..) for general usage similar to FunctionType.getParameterList()
* GlueGen FunctionSymbol: Simplify ctor reusing main-ctor; Be always reachable ↵Sven Gothel2023-06-251-3/+2
| | | | via type(def)name, ctor: addAliasedName( type.getCName() )
* GlueGen FunctionType: Expose toString(..) w/ 'isPointer' argumentSven Gothel2023-06-251-0/+3
|
* GlueGen: Fix Type.getSignature(..): Test for isFunctionPointer() to ↵Sven Gothel2023-06-251-6/+9
| | | | elaborate on FunctionType as getTargetType() only retruns a function-ptr and no more a function-type.
* GlueGen: Type: Have get{Base,Target}Type() stop at isFunctionPointer(), ↵Sven Gothel2023-06-235-10/+65
| | | | | | | | | | enhance API doc; Add getArrayBaseOrPointerTargetType() and getTargetFunction() Added getArrayBaseOrPointerTargetType() returns getBaseType() for arrays or getTargetType() for pointer, i.e. stops traversing if an elementType is a pointer and returns the elementType as target-type. This resolves 'int* intPtrArray[10]', but also simplifies all cases of 'int** intPtrPtr' and 'int intPtr[10]' etc. Since get{Base,Target}Type() returns the functionPointer, getTargetFunction() allows to retrieve the actual target function type.
* GlueGen: Type, JavaType: Align getSignature(..) outputSven Gothel2023-06-231-40/+47
|
* GlueGen Type: Use virt getTargetType() for ArrayType dropping ↵Sven Gothel2023-06-194-12/+16
| | | | getElementType(); Rename getBase{Elem ->}Type() to align with getTargetType()
* Merge remote-tracking branch 'Mathieu_Fery/feature/improve_compound_type_errors'Sven Gothel2023-06-181-2/+6
|\
| * feat(CompoundType): Improve error log on CompoundType.addField and ↵Mathieu Féry2023-06-161-2/+6
| | | | | | | | CompoundType.setBodyParsed when body is already parsed
* | Type: Add hasSize(), change getSignature(..) for const: isConstTypedef() -> ↵Sven Gothel2023-06-181-2/+5
| | | | | | | | "typedef", isConstRaw() -> "native"
* | GlueGen Struct [8]: Revised setter (resolved shrinking array, using 'subset' ↵Sven Gothel2023-06-171-6/+12
|/ | | | | | | | | | | | | | | | | | | | | | flag), added (detailed) JavaDoc in generated code Revised setter: A) int32_t val[10] -> setter for a subset change only, as-is with args[src, srcPos, destPos, length] - no new memory, reuse only - no special action to be performed B) int32_t* val -> setter with toggle 'subset' with args[subset, src, srcPos, destPos, length], - replace memory w/ 'subset==false' where it also may copy 'destPos' gap from old -> new - reuse memory w/ 'subset==true', where destPos+length <= elementCount C) const int32_t* val -> setter to replace referenced memory only args[src, srcPos, length] - always replaces memory, no copy of a gap (no destPos) Hence: - case (A) stays as is - case (B) will be revised and argument 'boolean subset' added - case (C) will be revised (simplified) and argument 'destPos' removed
* GlueGen Struct [3]: Adopt to CodeUnit Abstraction (replacing plain ↵Sven Gothel2023-06-161-0/+10
| | | | PrintWriter...)
* Bug 1153 - GlueGen: Support [const] [native] expressions and conversion to ↵Sven Gothel2015-04-012-39/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | java space, incl. [native] numbers Rewrite ConstantDefinition: Add sub-class CNumber: - containing integer/float values and their original qualifiers [long, double, unsigned] - conversion to java number ConstantDefinition: - holds native expression - optionally holds CNumber representing native expression, if [only] a number - can compute equivalent java expression with result type (JavaExpr) Add static native number reg-expression for number detection and parsing. Add static native number to CNumber conversion methods. +++ Retrieve full LISP tree and convert to serialized expression to be utilized for expressions used in enumerates. Parse enumerates, allowing const native expressions: - Utilize ConstantDefinition either for definite CNumber or expression - Simply add "+1" for new default values, if previous is an expression
* Bug 1144 - Add 'DelegateImplementation': Requires own MethodBinding for ↵Sven Gothel2015-03-112-1/+12
| | | | | | | | | | | | | | | | | | | | | | 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 - Add ASTLocusTagProvider for Define and fix newline in c-parser ↵Sven Gothel2015-03-091-1/+15
| | | | (Expose source location for log/error messages)
* Bug 1134 - Fix IntType 'unsigned'; Type: Use copy-ctor instead of Clonable, ..Sven Gothel2015-03-0918-236/+273
| | | | | | | | | | | | - 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 - Use ASTLocationTag in Logging (PCPP, Emitter); Refine ↵Sven Gothel2015-03-084-56/+53
| | | | | | | | 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-072-30/+52
| | | | | | | | | | | | | | | 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 - Pass ASTLocationTag to all types, used for GlueGenExceptionSven Gothel2015-03-0714-105/+208
| | | | | Enhances semantic exception in code generation by adding the AST location of the type or function declaration.
* Bug 1134 - Fix ProcAddressEmitter.getFunctionPointerTypedefName() ; Fix ↵Sven Gothel2015-03-061-4/+13
| | | | | | | | | | | 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 - Add ASTLocationTag, locating source of [semantic] errors while ↵Sven Gothel2015-03-063-7/+49
| | | | | | | 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-052-2/+22
| | | | | | | | | - 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-0520-260/+1130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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(..).
* Bug 1126 - Remove static query requirement of MachineDescriptor, find ↵Sven Gothel2015-02-024-48/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 1122: Refine AArch64 and OSType/32Bit incl. MachineDescriptionSven Gothel2015-01-302-2/+2
| | | | | | | | | | | | 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
* 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-071-1/+1
| | | | annotations
* Code Clean-Up based on our Recommended Settings (jogamp-scripting ↵Sven Gothel2014-07-0328-272/+272
| | | | | | | | | | | | | | | 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-255-38/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-191-5/+29
| | | | | | | | | | | | | | | 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: Add support for 'compound array call-by-value'Sven Gothel2014-06-172-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | Completing commit c3054a01990e55ab35756ea23ab7d7c05f24dd37 by allowing passing compound arrays via 'call-by-value. - Creating linear temp heap, copying NIO values into it and passing to C function. Copy-back if not 'const', see below. - Respect 'const' qualifier to skip write-back of temp heap passed to C function - See tag: // FIXME: Compound and Compound-Arrays for code changes and validation of completeness - triggers for compound arrays are: - javaType.isArrayOfCompoundTypeWrappers() - type.isArray() - simplified const query by c-type: FunctionEmitter.isBaseTypeConst(ctype) +++ Tests: Added call-by-value to test1.[ch] binding test!
* gluegen: remove some unused importsHarvey Harrison2014-05-312-3/+0
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: move all antlr grammars to a top-level directoryHarvey Harrison2014-05-315-5076/+0
| | | | | | | | /src/main/antlr/.. This gets the .g files unmixed from the non-generated java files for the cgram/jgram packages. Signed-off-by: Harvey Harrison <[email protected]>
* Minor Cleanup after merging fixes for bugs 987, 990, 992 and 994Sven Gothel2014-03-101-3/+4
|
* Fix accidental tabs.Wade Walker2014-03-041-4/+4
|
* Remove warnings in emitted C code.Wade Walker2014-03-042-0/+12
| | | | | | | | Fix 1: Only emit "int * _offsetHandle = NULL" if it will be used, to avoid unused variable warning. Fix 2: Add "unsigned" to typecasts in C function calls when needed to avoid implicit typecast warning. This commit also adds a unit test for a method that uses an "unsigned char **" parameter, to mimic the JOCL clCreateProgramWithBinary() function that caused the typecast warnings.
* gluegen: add all missing @Override annotationsHarvey Harrison2013-10-1719-0/+60
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: remove trailing whitespaceHarvey Harrison2013-10-1729-269/+269
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: remove implied use of StringBuffer while appending to StringBuilderHarvey Harrison2013-07-151-2/+2
| | | | | | | - call append on the StringBuilder we are using rather than using String concatenation, which uses StringBuffer. Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: annotate Hastable of attributes as Hashtable<String, Object>Harvey Harrison2013-07-151-11/+11
| | | | | | | - use copy-constructor rather than clone to suppress type warnings - annotate a Class as Class<?> Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: remove unneeded casts to TNodeHarvey Harrison2013-07-151-4/+4
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* FunctionSymbol: Fix equals/hashCode comparison, i.e. skip args/type due to ↵Sven Gothel2013-07-141-7/+25
| | | | non overloading of c-funcs.
* StringBuffer -> StringBuilderSven Gothel2013-07-142-3/+3
|
* gluegen: remove executable bit from java and c source filesHarvey Harrison2013-04-091-0/+0
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* Revert "Minor revert of clone replacement w/ copt-ctor of commit ↵Sven Gothel2012-10-183-7/+4
| | | | | | | | | | | | | | | d7fb6a7bcfbd2d5ac452abdcdd31fb4d71441c70" This reverts commit 73e8828566404e864170688dfb4fd530a83f8add. Convinced after discussing semantics w/ Harvey Harrison: "the copy-constructor is way for predictable (as in branch-predictable) and has better cache behavior, it can issue almost all the writes in parallel, and has no exception catching. So, the copy-constructor actually ends up being more efficient, and you get typechecking to boot."
* Minor revert of clone replacement w/ copt-ctor of commit ↵Sven Gothel2012-10-173-4/+7
| | | | | | d7fb6a7bcfbd2d5ac452abdcdd31fb4d71441c70 clone of ArrayList is more shallow than it's clone operation (?)
* gluegen: generics annotations for various ArrayList/List useHarvey Harrison2012-10-154-5/+5
| | | | | | | - Use the copy constructor rather than ArrayList.clone() - constrain listsEqual so the compiler will warn about comparing lists of different types Signed-off-by: Harvey Harrison <[email protected]>
* Reducing Type's equalsSven Gothel2012-10-161-32/+0
|