summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/gluegen
Commit message (Collapse)AuthorAgeFilesLines
* GlueGen proper size / alignment of primitive and compound types usage [2/2] ↵Sven Gothel2011-07-214-33/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | - Fin MachineDesction == MD MD.StaticConfig: - enum for all supported static configs (ID -> MD) - verified at runtime: test runtime queried-MD versus static-MD, hard fail if not compatible (size/alignment) SizeThunk primitive sizes: - Add notion of fixed native size (eg. int64_t) and otherwise (eg. long) java struct 'wrappers' code generation: - single class using size/offset arrays of all MachineDescription configurations - at runtime the array idx is queried in static block - type aligment for not fixed-native-size types (SizeThunk, undef long/int) via StructAccessor junit test: - add float test - fix native code - add java (create, write) -> native (verify) test works (tested) on: linux 32/64 and windows 32/64
* - Moved most types and StructLayout to runtime package:Sven Gothel2011-07-181-0/+7
| | | | | | | | | | | | | | | | | | | | | 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
* GlueGen proper size / alignment of primitive and compound types usage [1/2] ↵Sven Gothel2011-07-179-2/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Preparation. Currently GlueGen fails for type long (size) and some alignments (see package.html). - The size and alignment values shall be queried at runtime. - Compound alignment needs to follow the described natural alignment (also @runtime). - - Build - add Linux Arm7 (EABI) - junit test - added compound/struct tests, pointing out the shortcomings of current impl. - package.html - Added alignment documentation - remove intptr.cfg - add GluGen types int8_t, int16_t, uint8_t, uint16_t - move MachineDescription* into runtime - Platform - has runtime MachineDescription - moved size, .. to MachineDescription - use enums for OSType, CPUArch and CPUType defined by os.name/os.arch, triggering exception if os/arch is not supported. This avoids Java String comparison and conscious os/arch detection. - MachineDescription: - compile time instances MachineDescription32Bits, MachineDescription64Bits - runtime queried instance MachineDescriptionRuntime - correct size, alignment, page size, ..
* NativeBuffer/PointerBuffer API/Impl Change (remove explicit backup array, ↵Sven Gothel2011-04-275-51/+235
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | alloc referenced data map if used only) This patch doesn't impact GlueGen's code generation, but enhance and fix PointerBuffer usage only. remove explicit backup array As suggested by Michael Bien with a proposed patch, PointerBuffer's backup array is not only redundant in case it's not used, but also erroneous - due to possible sliced buffers. Removes the explicit backup array implementation leaving it up to the user, ie how PointerBuffer is created (alloc/allocDirect) and use the underlying nio's buffer backup array, if available. This also fixes the (never tested) case of indirect w/ backup array usage on 32bit platform size. In this case the array shall be of type int[], holding 32bit pointer - on 64bit long[]. Previous to this patch, it was always long[]. Added more thorough tests of PointerBuffer, notably indirect w/ backup array and native deep copy and filling of a pointer array. alloc referenced data map if used only As suggested by Michael Bien with a proposed patch, the allocation of the dataMap hash map is redundant in case it's not used. The hash map will be initialized lazy, if needed only.
* refactoring in common.nio public api - removed Int64BufferMichael Bien2011-04-261-26/+26
| | | | | | - removed Int64Buffer since it is no longer needed for LongBuffer emulation Signed-off-by: Sven Gothel <[email protected]>
* moved struct and buffer test to its nio friends, cleaned up importsMichael Bien2011-02-132-96/+0
|
* Disabled Struct* Tests (not working on Windows .. platform; Moved ↵Sven Gothel2010-11-255-29/+249
| | | | BuffersTest and PCPP to the proper src/junit folder. All junit tests are now handled by build-junit.xml
* Fix size_t, uintptr_t and uint32_t, uint64_t: suppress 'unsigned' in ↵Sven Gothel2010-11-143-0/+61
| | | | | | | 'toString()' ; Added type tests. For size_t and uintptr_t this actually generated invalid C code. Added type tests for those.
* Gluegen: Types (stddef/stdint), Header and Predefined Macro ChangeSven Gothel2010-11-091-1/+10
| | | | | | | | | | | | | Read API doc ad GlueGen.java New predefined types: wchar_t, intptr_t, uintptr_t New reusable headers for gluegen usage: make/stub_includes/gluegen for native usage: make/stub_includes/platform New predefined macro #define __GLUEGEN__ 2
* Fix PCPP 'define' case; Keep PCPP output file if 'debug' ; GlueGen uses PCPP ↵Sven Gothel2010-11-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | in same thread via File. Fix PCPP 'define' case ------------------------ A recursive define like: #define LALA ((int)1) #define LILI LALA was streamed out of PCPP, even though such 'macro defines' like #define LILI ((int)1) are disabled due to the parsers inability to digg those. Added test on macro definition for replaced values. GlueGen uses PCPP in same thread via File ------------------------------------------ To ease debugging we call PCPP from the same thread and use normal temp files as i/o. Keep PCPP output file if 'debug' --------------------------------- Keep temp outfile if debug is enabled
* LICENSE.txt changes:Sven Gothel2010-09-145-134/+114
| | | | | | | | | | | | | - Added JogAmp Community and common denominator: New BSD 3-clause license - Added note to make/lib binary file (source and license) Added source and license text for external binaries used in build process (make/lib folder). Changed 'Sven Gothel' and 'Michael Bien' New BSD 3-clause license to 'JogAmp Community' Simplified BSD 2-clause license.
* Move HashMapTest to junit.run; Unify classes to only 'Test' in their name if ↵Sven Gothel2010-05-107-88/+88
| | | | they are a junit test.
* renamed method.Michael Bien2010-04-242-15/+1
|
* Refactored ProcAddressTable generation.Michael Bien2010-04-241-1/+1
| | | | | - ProcAddressTable is now the common superclass for all tables - Removed ProcAddressHelpers and added FunctionAddressResolver extension mechanism
* Use JNILibLoader in the junit testSven Gothel2010-04-243-3/+61
|
* *** Now Using Apache-Ant-1.8.0 ***Sven Gothel2010-04-101-6/+0
| | | | | | | | Adding ant-contrib-1.0b3.jar for loops and mutable properties. Cleanup: - Adding Javac includeAntRuntime argument (false whenever possible) - Clear junit results folder before testing - Move deprecated stuff from lib to lib/archive
* http://jogamp.org/bugzilla/show_bug.cgi?id=393Sven Gothel2010-04-084-30/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed junit test: test1 - Create seperate native libraries to reflect a real world example: test1 - the library to bind to (no more declaring __stdcall @nn functions) BindingTest1p1 - the dynamic fixed linkage binding test1p1, references dynamic library test1 at linktime. BindingTest1p2 - the dynamic runtime linkage binding test1p2, loads dynamic library test1 at runtime. Generic: - gluegen-cpptasks-base.xml - target 'gluegen.cpptasks.detect.os' Set new property 'system.env.library.path' DYLD_LIBRARY_PATH (macosx) LD_LIBRARY_PATH (unix) PATH (windows) - target 'gluegen.cpptasks.striplibs' Strips the symbols out of the native libraries in case c.compiler.debug is false. Maybe configured with the properties: c.strip.tool, c.strip.args - Using system.env.library.path in junit call to find the test1 library in case of runtime linkage and lookup (test1p2). - Use gluegen.cpptasks.striplibs for all native libs .. - Added macosx32 in analogy to macosx64, both defaults to true now - com.jogamp.common.os.WindowsDynamicLinkerImpl:lookupSymbol() - Added lookup for __stdcall @nn (stepping alignment 4, max-args: 12) in case no undecorated __cdecl symbol is found. Fixed Windows platform: - Use proper path.seperator on Windows. - test1.dll needs proper soname inside for fixed linkage (test1p1) hence the output name must be test1.dll, not libtest1.so +++ http://jogamp.org/bugzilla/show_bug.cgi?id=394 Fix MacOsX platform: The commit of cpptasks.jar, git hash 129e783741d91e9ee5cd7da5d5c962c32ec96b0b, broke the universal binary build on MacOSX. The above change used cpptasks-1.05b with a few patches in regards to crosscompilation, but missed one, which accepts the '-arch' argument for GccLinker undecorated. The new cpptasks.jar is vanilla 1.05b + cpptasks-1.0b5-darwin-patch.diff, the latter a more refined one. This version accepts the '-arch' argument undecorated on the darwin platform. +++
* Fix 32bit masking / testsSven Gothel2010-04-012-2/+2
|
* Fix build ..Sven Gothel2010-04-011-1/+0
|
* Merged with latest of mbienSven Gothel2010-03-317-13/+17
|\
| * introduced com.jogamp.common.{nio,os} packages and moved some classes.Michael Bien2010-03-315-11/+13
| |
* | Buffer heritage added. Migrated old runtime tests.Sven Gothel2010-03-3114-31/+126
|/
* http://www.jogamp.org/bugzilla/show_bug.cgi?id=392Sven Gothel2010-03-301-2/+44
| | | | | | | | | | | | | | | | | | 32bit/64bit values and arrays are misrepresented - PointerBuffer: Adding methods PointeRBuffer referenceBuffer(int index, Buffer data) PointeRBuffer referenceBuffer(Buffer data) Buffer getReferencedBuffer(int index) Buffer getReferencedBuffer() Adding a reference of a given direct Buffer to this pointer buffer, and retrieving a previously referenced direct Buffer. This allows a more convenient handling of PointerBuffer with the user API's ..
* http://www.jogamp.org/bugzilla/show_bug.cgi?id=389Sven Gothel2010-03-304-10/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 32bit/64bit values and arrays are misrepresented - PointerBuffer is used to map 64bit integer values, which is illegal due to the latest PointerBuffer changes, where the underlying ByteBuffer is either 32bit wide or 64bit wide (in respect to the pointer size). The PointerBuffer semantic itself is correct, but no more suitable to represent 64bit values and arrays. A Int64Buffer (LongBuffer does not exist in CDC/CVM patch) should be used instead. - Determine use of Int64Buffer and PointerBuffer Assuming the 1st step being solved, it has to determined for which cases gluegen shall map a type to a PointerBuffer. All pointer pointer types, regardless of a Opaque mapping, ie: +++ typedef struct __MYAPIConfig * MYAPIConfig; Opaque long MYAPIConfig void foo(MYAPIConfig * ptrarray); +++ The argument 'ptrarray' must be represented as a PointerBuffer otherwise data is misrepresented in case: - 32bit machines _and_ - array semantics - more than one value is being used Impl: java/com/sun/gluegen/JavaEmitter.java: - Checks ptr-ptr for Opaque values - Returns PointerBuffer mapping for ptr-ptr types - Allow PointerBuffer being mapped as String[] Very elaborated tests .. :) ++++++++++++ Misc Changes: - Added <Type>.put(<Type>Buffer src) for Int64Buffer/PointerBuffer
* Resolved conflictsSven Gothel2010-03-293-6/+6
|\
| * renamed BufferFactory into Buffers.Michael Bien2010-03-293-6/+6
| |
* | New Int64Buffer type, which is being used for gluegen 'long *'Sven Gothel2010-03-293-52/+114
|/
* Merge with mbien's 2ea8c93d5fd27207872b97c964e3f8af5ac850c6Sven Gothel2010-03-284-9/+9
|\
| * Merge branch 'master' of [email protected]:mbien/gluegenMichael Bien2010-03-272-68/+92
| |\ | | | | | | | | | | | | Conflicts: src/junit/com/jogamp/gluegen/test/junit/Test1.java
| * | renamed com.sun.gluegen.runtime -> com.jogamp.gluegen.runtime.Michael Bien2010-03-271-2/+2
| | |
* | | http://www.jogamp.org/bugzilla/show_bug.cgi?id=389Sven Gothel2010-03-2810-193/+680
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mixed types in generated code are functioning now, even though not all permutations are generated - still. However, this patch merges the indirect object passing, wheather it is a primitive array or an indirect NIO buffer, incl. PointerBuffer. This allows the usage of only one JNI functions for all combinations. Only in case of NIODirectOnly, the simplified direct only '0' variation is created - otherwise the parametrized '1' variant. The junit tests proves the implementation and almost completes the gluegen junit tests coverage for JavaEmitter and ProcAddressEmitter. Impact/Result: - Working mixed array types - JOGL GL2 native library shrunk around 30% - Simplified gluegen code - Almost complete gluegen junit tests TODO: Complete permutations of array/NIO arguments, if desired. ++++ Misc changes: - NativeLibrary implements DynamicLookupHelper: lookupFunction() -> dynamicLookupFunction()
* | Add coverage test (signatures and execution) ..Sven Gothel2010-03-272-63/+87
|/
* http://www.jogamp.org/bugzilla/show_bug.cgi?id=390Sven Gothel2010-03-256-0/+294
Adding 'plain' junit tests. Plain stands for the simple processing of: ant.junit.compile: gluegen -> java/c files, javac/cc, jar ant.junit.run: junit batch run Avoiding 'black magic', ie kicking off gluegen and ant-compilation from within the junit tests. Same methodology as the JOGL junit tests, junit test sources are under 'src/junit' This way, the migration to other platform tests might be easier, as well as the we don't need to pass through ant properties (ant - junit - ant), see 3a32650d4229f9b4ad1f527d9e30c24ddb69bb3f.