summaryrefslogtreecommitdiffstats
path: root/src/junit/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-09 03:09:18 +0100
committerSven Gothel <[email protected]>2015-03-09 03:09:18 +0100
commit9eb9403d774db0c55ea3cb2fc5bd04114b8b5feb (patch)
tree266780ea786df13e582d4ecdd0b05ef9c46bccfb /src/junit/com
parentcf9f28cf249393f42d7d2835775521dfadee6b92 (diff)
Bug 1134 - Fix aliased typedef struct emission
- 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.
Diffstat (limited to 'src/junit/com')
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java26
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg1
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1.c17
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1.h32
4 files changed, 52 insertions, 24 deletions
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
index 4564019..92015dd 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
@@ -101,11 +101,13 @@ public class BaseClass extends SingletonJunitCase {
bb = binding.testAnonBuffer(bb);
- sb = binding.testShortBlob0(sb);
- sb = binding.testShortBlob1(sb);
- sb = binding.testShortBlob2(sb);
- sb = binding.testShortBlob3(sb);
- sb = binding.testShortBlob4(sb);
+ sb = binding.testShortBlob(sb);
+ sb = binding.testLPShortBlob0(sb);
+ sb = binding.testLPShortBlob1(sb);
+ sb = binding.testLPShortBlob2(sb);
+ sb = binding.testLPShortBlob3(sb);
+ sb = binding.testShortBlobL1(sb);
+ sb = binding.testShortBlobL2(sb);
i32s = binding.testInt32Struct(i32s);
@@ -673,16 +675,20 @@ public class BaseClass extends SingletonJunitCase {
final ShortBlob sb = ShortBlob.create();
sb.setB1((byte)0xAA);
sb.setB2((byte)0xEE);
- final ShortBlob sb0 = binding.testShortBlob0(sb);
- final ShortBlob sb1 = binding.testShortBlob1(sb);
- final ShortBlob sb2 = binding.testShortBlob2(sb);
- final ShortBlob sb3 = binding.testShortBlob3(sb);
- final ShortBlob sb4 = binding.testShortBlob4(sb);
+ final ShortBlob sb_ = binding.testShortBlob(sb);
+ final ShortBlob sb0 = binding.testLPShortBlob0(sb);
+ final ShortBlob sb1 = binding.testLPShortBlob1(sb);
+ final ShortBlob sb2 = binding.testLPShortBlob2(sb);
+ final ShortBlob sb3 = binding.testLPShortBlob3(sb);
+ final ShortBlob sb4 = binding.testShortBlobL1(sb);
+ final ShortBlob sb5 = binding.testShortBlobL2(sb);
+ Assert.assertEquals(sb.getBuffer(), sb_.getBuffer());
Assert.assertEquals(sb.getBuffer(), sb0.getBuffer());
Assert.assertEquals(sb.getBuffer(), sb1.getBuffer());
Assert.assertEquals(sb.getBuffer(), sb2.getBuffer());
Assert.assertEquals(sb.getBuffer(), sb3.getBuffer());
Assert.assertEquals(sb.getBuffer(), sb4.getBuffer());
+ Assert.assertEquals(sb.getBuffer(), sb5.getBuffer());
final Int32Struct i32s = Int32Struct.create();
i32s.setB1((byte)0x02);
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg
index 59dc083..29c13fa 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1-common.cfg
@@ -36,6 +36,7 @@ Opaque long XID
# For 'struct _AnonBlob2*', we need to drop 'struct'
Opaque long _AnonBlob2*
+Opaque long _Crazy*;
Opaque long ShortBlob.Cool
CustomCCode #include "test1.h"
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c
index 894dc10..316603b 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.c
@@ -17,19 +17,26 @@ MYAPI XID_2 MYAPIENTRY testXID_2(XID_2 v) {
MYAPI AnonBuffer MYAPIENTRY testAnonBuffer(AnonBuffer v) {
return v;
}
-MYAPI const ShortBlob * MYAPIENTRY testShortBlob0(const ShortBlob *v) {
+
+MYAPI const ShortBlob * MYAPIENTRY testShortBlob(const ShortBlob *v) {
+ return v;
+}
+MYAPI const LPShortBlob0 MYAPIENTRY testLPShortBlob0(const LPShortBlob0 v) {
+ return v;
+}
+MYAPI LPShortBlob1 MYAPIENTRY testLPShortBlob1(LPShortBlob1 v) {
return v;
}
-MYAPI LPShortBlob1 MYAPIENTRY testShortBlob1(LPShortBlob1 v) {
+MYAPI const LPShortBlob2 MYAPIENTRY testLPShortBlob2(const LPShortBlob2 v) {
return v;
}
-MYAPI LPShortBlob2 MYAPIENTRY testShortBlob2(LPShortBlob2 v) {
+MYAPI LPShortBlob3 MYAPIENTRY testLPShortBlob3(LPShortBlob3 v) {
return v;
}
-MYAPI LPShortBlob3 MYAPIENTRY testShortBlob3(LPShortBlob3 v) {
+MYAPI const ShortBlobL1 * MYAPIENTRY testShortBlobL1(const ShortBlobL1 * v) {
return v;
}
-MYAPI LPShortBlob4 MYAPIENTRY testShortBlob4(LPShortBlob4 v) {
+MYAPI ShortBlobL2 * MYAPIENTRY testShortBlobL2(ShortBlobL2 * v) {
return v;
}
MYAPI struct Int32Struct * MYAPIENTRY testInt32Struct(struct Int32Struct * v) {
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
index a8c125d..459bf8c 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
@@ -65,10 +65,12 @@ typedef struct _ShortBlob {
uint8_t b1;
uint8_t b2;
struct _Crazy * Cool; // Opaque field!
-} ShortBlob, ShortBlob2, *LPShortBlob1; // Aliased to 'ShortBlob'
+} ShortBlob, ShortBlob2, *LPShortBlob0; // Aliased to 'ShortBlob'
+typedef ShortBlob * LPShortBlob1; // Aliased to 'ShortBlob'
typedef ShortBlob2 * LPShortBlob2; // Aliased to 'ShortBlob'
-typedef ShortBlob * LPShortBlob3; // Aliased to 'ShortBlob'
-typedef LPShortBlob1 LPShortBlob4; // Aliased to 'ShortBlob'
+typedef LPShortBlob1 LPShortBlob3; // Aliased to 'ShortBlob'
+typedef ShortBlob ShortBlobL1; // Aliased to 'ShortBlob'
+typedef ShortBlob2 ShortBlobL2; // Aliased to 'ShortBlob'
struct Int32Struct {
uint8_t b1;
@@ -88,11 +90,13 @@ MYAPI XID MYAPIENTRY testXID_EXT(XID v); // renamed duplicate w/ compat value
// MYAPI XID MYAPIENTRY testXID_EXT(int v); // renamed duplicate w/ diff value ERROR
MYAPI XID_2 MYAPIENTRY testXID_2(XID_2 v);
MYAPI AnonBuffer MYAPIENTRY testAnonBuffer(AnonBuffer v);
-MYAPI const ShortBlob * MYAPIENTRY testShortBlob0(const ShortBlob *v);
-MYAPI LPShortBlob1 MYAPIENTRY testShortBlob1(LPShortBlob1 v);
-MYAPI LPShortBlob2 MYAPIENTRY testShortBlob2(LPShortBlob2 v);
-MYAPI LPShortBlob3 MYAPIENTRY testShortBlob3(LPShortBlob3 v);
-MYAPI LPShortBlob4 MYAPIENTRY testShortBlob4(LPShortBlob4 v);
+MYAPI const ShortBlob * MYAPIENTRY testShortBlob(const ShortBlob *v);
+MYAPI const LPShortBlob0 MYAPIENTRY testLPShortBlob0(const LPShortBlob0 v);
+MYAPI LPShortBlob1 MYAPIENTRY testLPShortBlob1(LPShortBlob1 v);
+MYAPI const LPShortBlob2 MYAPIENTRY testLPShortBlob2(const LPShortBlob2 v);
+MYAPI LPShortBlob3 MYAPIENTRY testLPShortBlob3(LPShortBlob3 v);
+MYAPI const ShortBlobL1 * MYAPIENTRY testShortBlobL1(const ShortBlobL1 *v);
+MYAPI ShortBlobL2 * MYAPIENTRY testShortBlobL2(ShortBlobL2 *v);
MYAPI struct Int32Struct * MYAPIENTRY testInt32Struct(struct Int32Struct * v);
MYAPI AnonBlob MYAPIENTRY testCreateAnonBlob();
@@ -318,9 +322,12 @@ typedef struct {
int32_t i2;
} TK_DimensionPair;
+// some implicity _local_ typedef -> public typedef checks
+typedef TK_Surface * (MYAPIENTRY* PFNCREATESURFACEPROC)();
+typedef void (MYAPIENTRY* PFNDESTROYSURFACEPROC)(TK_Surface * surface);
+
MYAPI TK_Surface * MYAPIENTRY createSurface();
MYAPI void MYAPIENTRY destroySurface(TK_Surface * surface);
-
MYAPI TK_ComplicatedSuperSet * MYAPIENTRY createComplicatedSuperSet();
MYAPI Bool MYAPIENTRY hasInitValues(TK_ComplicatedSuperSet * s);
MYAPI void MYAPIENTRY destroyComplicatedSuperSet(TK_ComplicatedSuperSet * s);
@@ -338,6 +345,13 @@ MYAPI TK_Dimension MYAPIENTRY addDimensions(const TK_Dimension s[TWO]);
MYAPI TK_Dimension MYAPIENTRY addDimensionPair(const TK_DimensionPair s);
MYAPI void MYAPIENTRY zeroDimensions(TK_Dimension s[2]);
+
+// some implicity _local_ typedef -> public typedef checks
+typedef void (MYAPIENTRY* PFNCOPYPRIMTODIMENSIONSPROC)(const int pos[2], const int size[2], TK_Dimension dest[1]);
+typedef int (MYAPIENTRY* PFNRGBATOINTPROC)(const char rgba[4]);
+typedef void (MYAPIENTRY* PFNINTTORGBAPROC)(int irgba, char rgbaSink[4]);
+typedef void (MYAPIENTRY* PFNADDBYTEPROC)(const char summands[2], char result[1]);
+
MYAPI void MYAPIENTRY copyPrimToDimensions(const int pos[2], const int size[2], TK_Dimension dest[1]);
MYAPI void MYAPIENTRY copyDimensionsToPrim(TK_Dimension dim, int dpos[2], int dsize[2]);
MYAPI int MYAPIENTRY rgbaToInt(const char rgba[4]);