summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build-test.xml4
-rw-r--r--src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g120
-rw-r--r--src/java/com/jogamp/gluegen/GlueGen.java13
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java91
-rw-r--r--src/java/com/jogamp/gluegen/ReferencedStructs.java56
-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
9 files changed, 216 insertions, 144 deletions
diff --git a/make/build-test.xml b/make/build-test.xml
index 49080b6..b270ccd 100644
--- a/make/build-test.xml
+++ b/make/build-test.xml
@@ -542,7 +542,7 @@ chmod 644 ${results}/* \${line.separator}
includeRefid="stub.includes.fileset.test"
emitter="com.jogamp.gluegen.JavaEmitter"
dumpCPP="false"
- debug="true"
+ debug="false"
logLevel="WARNING">
<classpath refid="gluegen.classpath" />
</gluegen>
@@ -555,7 +555,7 @@ chmod 644 ${results}/* \${line.separator}
emitter="com.jogamp.gluegen.JavaEmitter"
dumpCPP="false"
debug="false"
- logLevel="INFO">
+ logLevel="WARNING">
<classpath refid="gluegen.classpath" />
</gluegen>
diff --git a/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g b/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
index 0478293..9ec3b9b 100644
--- a/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
+++ b/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
@@ -142,6 +142,8 @@ options {
if (t == null) {
t = CompoundType.create(structName, null, kind, cvAttrs, locusTag);
structDictionary.put(structName, t);
+ debugPrintln("Adding compound mapping: [" + structName + "] -> "+getDebugTypeString(t)+" @ "+locusTag);
+ debugPrintln(t.getStructString());
}
return t;
}
@@ -168,29 +170,6 @@ options {
void setType(final Type t) { type = t; }
public String toString() { return "ParamDecl["+id+": "+type.getDebugString()+"]"; }
}
- Type resolveAnonCompound(Type type) {
- int mode = 0;
- debugPrint("resolveAnonCompound: "+type.getDebugString());
- if( !type.hasName() ) {
- if( type.isCompound() ) {
- final CompoundType ct = type.asCompound();
- // return a copy w/ resolved name
- type = ((CompoundType) ct.clone()).evalStructTypeName();
- mode = 1;
- } else if( type.isPointer() ) {
- // non typedefed PointerType and base-elem w/o name
- final PointerType pt = type.asPointer();
- final Type b = pt.getBaseElementType();
- if( b != null && b.isCompound() && !b.hasName() ) {
- // return same w/ resolved name
- b.asCompound().evalStructTypeName();
- mode = 2;
- }
- }
- }
- debugPrintln(" -> "+type.getDebugString()+" - MODE "+mode);
- return type;
- }
// A box for a Type. Allows type to be passed down to be modified by recursive rules.
static class TypeBox {
@@ -319,13 +298,13 @@ options {
private void processDeclaration(Type returnType) {
if (isFuncDeclaration) {
final FunctionSymbol sym = new FunctionSymbol(funcDeclName,
- new FunctionType(null, null, resolveAnonCompound(returnType), 0, funcLocusTag),
+ new FunctionType(null, null, returnType, 0, funcLocusTag),
funcLocusTag);
debugPrintln("Function ... "+sym.toString()+" @ "+funcLocusTag);
if (funcDeclParams != null) { // handle funcs w/ empty parameter lists (e.g., "foo()")
for (Iterator<ParameterDeclaration> iter = funcDeclParams.iterator(); iter.hasNext(); ) {
ParameterDeclaration pd = iter.next();
- pd.setType(resolveAnonCompound(pd.type()));
+ pd.setType(pd.type());
debugPrintln(" add "+pd.toString());
sym.addArgument(pd.type(), pd.id());
}
@@ -683,7 +662,10 @@ structOrUnionBody[CompoundTypeKind kind, int cvAttrs] returns [CompoundType t] {
// anonymous struct
t = (CompoundType) canonicalize(lookupInStructDictionary(id2.getText(), kind, cvAttrs, locusTag));
}
- )
+ ) {
+ debugPrintln("Adding compound body: [" + t.getName() + "] -> "+getDebugTypeString(t)+" @ "+locusTag);
+ debugPrintln(t.getStructString());
+ }
;
structDeclarationList[CompoundType t] returns [boolean addedAny] {
@@ -773,10 +755,10 @@ enumSpecifier [int cvAttrs] returns [Type t] {
final EnumType dupE = enumMap.get(eName);
if( null != dupE && !dupE.equalSemantics(e) ) {
throwGlueGenException(enumSpecifier_AST_in,
- String.format("Duplicate enum w/ incompatible type:%n have '%s',%n this '%s'",
- getTypeString(dupE), getTypeString(e)));
+ String.format("Duplicate enum w/ incompatible type:%n this '%s',%n have '%s',%n previously declared here: %s",
+ getTypeString(e), getTypeString(dupE), dupE.getASTLocusTag()));
}
- enumMap.put(eName, (EnumType)e.clone());
+ enumMap.put(eName, (EnumType)e.clone(locusTag));
}
}
t = e; // return val
@@ -819,8 +801,8 @@ enumerator[EnumType enumeration, long defaultValue] returns [long newDefaultValu
final long oldValue = oldEnumType.getEnumValue(eTxt);
if( oldValue != newValue ) {
throwGlueGenException(enumerator_AST_in,
- String.format("Duplicate enum value '%s.%s' w/ diff value:%n have %d,%n this %d",
- oldEnumType.getName(), eTxt, oldValue, newValue));
+ String.format("Duplicate enum value '%s.%s' w/ diff value:%n this %d,%n have %d",
+ oldEnumType.getName(), eTxt, newValue, oldValue));
}
// remove old definition
oldEnumType.removeEnumerate(eTxt);
@@ -853,39 +835,39 @@ initDecl[TypeBox tb] {
{
if ((declName != null) && (tb != null) && tb.isTypedef()) {
Type t = tb.type();
- debugPrint("Adding typedef mapping: [" + declName + "] -> "+getDebugTypeString(t));
+ debugPrintln("Adding typedef mapping: [" + declName + "] -> "+getDebugTypeString(t));
+ final Type tg;
+ if( t.isPointer() ) {
+ tg = t.getTargetType();
+ debugPrintln(" - has target: "+getDebugTypeString(tg));
+ } else {
+ tg = null;
+ }
+ // NOTE: Struct Name Resolution (JavaEmitter, HeaderParser)
+ // Also see NOTE below.
if (!t.isTypedef()) {
if( t.isCompound() ) {
- // Allow redefinition of newly defined struct, i.e. use same instance.
- // This aliases '_a' -> 'A' for 'typedef struct _a { } A, *B;', where '*B' will become also '*A'.
+ // This aliases '_a' -> 'A' for 'typedef struct _a { } A;' in-place
t.setTypedefName(declName);
- debugPrint(" - redefine -> "+getDebugTypeString(t));
+ debugPrintln(" - alias.11 -> "+getDebugTypeString(t));
} else {
// Use new typedef, using a copy to preserve canonicalized base type
t = t.clone(locusTag);
t.setTypedefName(declName);
- debugPrint(" - newdefine -> "+getDebugTypeString(t));
+ debugPrintln(" - newdefine.12 -> "+getDebugTypeString(t));
}
} else {
// Adds typeInfo alias w/ t's typeInfo, if exists
cfg.addTypeInfo(declName, t);
final Type alias;
if( t.isCompound() ) {
- // Attempt to find a previous declared compound typedef
- // This aliases 'D' -> 'A' for 'typedef struct _a { } A, D;'
- alias = typedefDictionary.getEqualSemantics1(t, cfg, true);
- } else {
- alias = null;
- }
- if( null != alias ) {
- // use previous typedef
- t = alias;
- debugPrint(" - alias -> "+getDebugTypeString(t));
+ // This aliases 'D' -> 'A' for 'typedef struct _a { } A, D;' in-place
+ debugPrintln(" - alias.21 -> "+getDebugTypeString(t));
} else {
// copy to preserve canonicalized base type
t = t.clone(locusTag);
t.setTypedefName(declName);
- debugPrint(" - copy -> "+getDebugTypeString(t));
+ debugPrintln(" - copy.22 -> "+getDebugTypeString(t));
}
}
final Type dupT = typedefDictionary.get(declName);
@@ -901,6 +883,50 @@ initDecl[TypeBox tb] {
tb.reset();
}
}
+ /*
+ // Below just shows a different handling using copying
+ // and enforcing aliased names, which is not desired.
+ // Keeping it in here for documentation.
+ // NOTE: Struct Name Resolution (JavaEmitter, HeaderParser)
+ if ( !t.isTypedef() ) {
+ if( t.isCompound() ) {
+ // This aliases '_a' -> 'A' for 'typedef struct _a { } A;'
+ t.setTypedefName(declName);
+ debugPrintln(" - alias.10 -> "+getDebugTypeString(t));
+ } else if( null != tg && tg.isCompound() ) {
+ if( !tg.isTypedef() ) {
+ // This aliases '_a *' -> 'A*' for 'typedef struct _a { } *A;'
+ t.setTypedefName(declName);
+ debugPrintln(" - alias.11 -> "+getDebugTypeString(t));
+ } else {
+ // This aliases 'B' -> 'A*' for 'typedef struct _a { } A, *B;' and 'typedef A * B;'
+ t = new PointerType(SizeThunk.POINTER, tg, 0, locusTag); // name: 'A*'
+ t.setTypedefName(t.getName()); // make typedef
+ debugPrintln(" - alias.12 -> "+getDebugTypeString(t));
+ }
+ } else {
+ // Use new typedef, using a copy to preserve canonicalized base type
+ t = t.clone(locusTag);
+ t.setTypedefName(declName);
+ debugPrintln(" - newdefine.13 -> "+getDebugTypeString(t));
+ }
+ } else {
+ // Adds typeInfo alias w/ t's typeInfo, if exists
+ cfg.addTypeInfo(declName, t);
+ if( t.isCompound() ) {
+ // This aliases 'D' -> 'A' for 'typedef struct _a { } A, D;'
+ debugPrintln(" - alias.20 -> "+getDebugTypeString(t));
+ } else if( null != tg && tg.isCompound() ) {
+ // This aliases 'B' -> 'A' for 'typedef A B;', where A is pointer to compound
+ debugPrintln(" - alias.21 -> "+getDebugTypeString(t));
+ } else {
+ // copy to preserve canonicalized base type
+ t = t.clone(locusTag);
+ t.setTypedefName(declName);
+ debugPrintln(" - copy.22 -> "+getDebugTypeString(t));
+ }
+ }
+*/
;
pointerGroup[TypeBox tb] { int x = 0; int y = 0; }
diff --git a/src/java/com/jogamp/gluegen/GlueGen.java b/src/java/com/jogamp/gluegen/GlueGen.java
index 4ef5648..c4eb1c5 100644
--- a/src/java/com/jogamp/gluegen/GlueGen.java
+++ b/src/java/com/jogamp/gluegen/GlueGen.java
@@ -294,8 +294,7 @@ public class GlueGen implements GlueEmitterControls {
for (final FunctionSymbol sym : allFunctions) {
// FIXME: this doesn't take into account the possibility that some of
// the functions we send to emitMethodBindings() might not actually be
- // emitted (e.g., if an Ignore directive in the JavaEmitter causes it
- // to be skipped).
+ // emitted (e.g., if an Ignore directive in the JavaEmitter causes it to be skipped).
sym.getType().visit(referencedStructs);
}
@@ -315,13 +314,9 @@ public class GlueGen implements GlueEmitterControls {
// Lay out structs
emit.beginStructLayout();
- for (final Iterator<Type> iter = referencedStructs.results(); iter.hasNext();) {
- final Type t = iter.next();
- if (t.isCompound()) {
- emit.layoutStruct(t.asCompound());
- } else if (t.isPointer()) {
- final PointerType p = t.asPointer();
- final CompoundType c = p.getTargetType().asCompound();
+ for (final Iterator<CompoundType> iter = referencedStructs.layouts(); iter.hasNext();) {
+ final CompoundType c = iter.next();
+ if( !c.isLayouted() ) {
emit.layoutStruct(c);
}
}
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index ca89b0e..52e8834 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -877,53 +877,64 @@ public class JavaEmitter implements GlueEmitter {
}
@Override
- public void emitStruct(final CompoundType structCType, final Type typedefed) throws Exception {
+ public void emitStruct(final CompoundType structCType, final Type structCTypedefPtr) throws Exception {
final String structCTypeName, typedefedName;
{
final String _name = structCType.getName();
- if ( null == _name && null != typedefed && null != typedefed.getName() ) {
- // use typedef'ed name
- typedefedName = typedefed.getName();
+ if ( null != structCTypedefPtr && null != structCTypedefPtr.getName() ) {
+ // always use typedef'ed name if available
+ typedefedName = structCTypedefPtr.getName();
structCTypeName = typedefedName;
} else {
- // use actual struct type name
+ // fall back to actual struct type name
typedefedName = null;
structCTypeName = _name;
}
- }
- LOG.log(INFO, structCType.getASTLocusTag(),
- "Struct emission of structCType \"{0}\" -> {1}", structCTypeName, structCType);
- LOG.log(INFO, structCType.getASTLocusTag(),
- " which has a typedef \"{0}\" -> {1}", typedefedName, typedefed);
-
- if ( null == structCTypeName ) {
- final String structName = structCType.getStructName();
- if ( null != structName && cfg.shouldIgnoreInInterface(structName) ) {
+ LOG.log(INFO, structCType.getASTLocusTag(), "Struct emission of structCType {0}", structCType);
+ LOG.log(INFO, structCType.getASTLocusTag()," structCTypedefPtr {0}", structCTypedefPtr);
+ LOG.log(INFO, structCType.getASTLocusTag()," : structCTypeName \"{0}\" -> typedefedName \"{1}\" -> \"{2}\"",
+ _name, typedefedName, structCTypeName);
+ if ( null == structCTypeName ) {
LOG.log(INFO, structCType.getASTLocusTag(),
- "skipping emission of unnamed ignored struct \"{0}\": {1}", structName, structCType);
+ "skipping emission of unnamed struct {0} w/o typedef", structCType);
return;
- } else {
+ }
+ final AliasedSymbol.AliasedSymbolImpl aliases = new AliasedSymbol.AliasedSymbolImpl(structCTypeName);
+ aliases.addAliasedName(_name);
+ aliases.addAliasedName(typedefedName);
+ if ( cfg.shouldIgnoreInInterface(aliases) ) {
LOG.log(INFO, structCType.getASTLocusTag(),
- "skipping emission of unnamed struct {0}, typedef {1} ", structCType, typedefed);
+ "skipping emission of ignored \"{0}\": {1}", aliases, structCType);
return;
}
}
- if ( cfg.shouldIgnoreInInterface(structCTypeName) ) {
+
+ if( null != structCTypedefPtr && isOpaque(structCTypedefPtr) ) {
LOG.log(INFO, structCType.getASTLocusTag(),
- "skipping emission of ignored \"{0}\": {1}", structCTypeName, structCType);
+ "skipping emission of opaque typedef {0}", structCTypedefPtr);
return;
}
- if( null != typedefed && isOpaque(typedefed) ) {
+ if( isOpaque(structCType) ) {
LOG.log(INFO, structCType.getASTLocusTag(),
- "skipping emission of opaque typedef {0}, c-struct {1}", typedefed, structCType);
+ "skipping emission of opaque c-struct {0}", structCType);
return;
}
final Type containingCType;
{
- final Type aptr = new PointerType(SizeThunk.POINTER, structCType, 0);
- aptr.setTypedefName(typedefedName);
+ // NOTE: Struct Name Resolution (JavaEmitter, HeaderParser)
+ final Type aptr;
+ int mode;
+ if( null != typedefedName ) {
+ aptr = structCTypedefPtr;
+ mode = 1;
+ } else {
+ aptr = new PointerType(SizeThunk.POINTER, structCType, 0);
+ aptr.setTypedefName(typedefedName);
+ mode = 2;
+ }
containingCType = canonicalize(aptr);
+ LOG.log(INFO, structCType.getASTLocusTag(), "containingCType[{0}]: {1} -canon-> {2}", mode, aptr, containingCType);
}
final JavaType containingJType = typeToJavaType(containingCType, null);
if( containingJType.isOpaqued() ) {
@@ -939,15 +950,7 @@ public class JavaEmitter implements GlueEmitter {
final String containingJTypeName = containingJType.getName();
LOG.log(INFO, structCType.getASTLocusTag(),
"perform emission of \"{0}\" -> \"{1}\": {2}", structCTypeName, containingJTypeName, structCType);
- if( GlueGen.debug() ) {
- if( null != typedefed ) {
- LOG.log(INFO, structCType.getASTLocusTag(), " typedefed {0}", typedefed);
- } else {
- LOG.log(INFO, structCType.getASTLocusTag(), " typedefed {0}", (Object)null);
- }
- LOG.log(INFO, structCType.getASTLocusTag(), " containingCType {0}", containingCType);
- LOG.log(INFO, structCType.getASTLocusTag(), " containingJType {0}", containingJType);
- }
+
if( 0 == structCType.getNumFields() ) {
LOG.log(INFO, structCType.getASTLocusTag(),
"emission of \"{0}\" with zero fields {1}", containingJTypeName, structCType);
@@ -2168,14 +2171,22 @@ public class JavaEmitter implements GlueEmitter {
cType.getName().equals("jobject")) {
return javaType(java.lang.Object.class);
}
- String name = targetType.getName();
- if (name == null) {
- // Try containing pointer type for any typedefs
- name = cType.getName();
- if (name == null) {
- throw new GlueGenException("Couldn't find a proper type name for pointer type " + cType.getDebugString(),
- cType.getASTLocusTag());
- }
+ // NOTE: Struct Name Resolution (JavaEmitter, HeaderParser)
+ String name;
+ if( !targetType.isTypedef() && cType.isTypedef() ) {
+ // If compound is not a typedef _and_ containing pointer is typedef, use the latter.
+ name = cType.getName();
+ } else {
+ // .. otherwise try compound name
+ name = targetType.getName();
+ if( null == name ) {
+ // .. fall back to pointer type name
+ name = cType.getName();
+ if (name == null) {
+ throw new GlueGenException("Couldn't find a proper type name for pointer type " + cType.getDebugString(),
+ cType.getASTLocusTag());
+ }
+ }
}
return JavaType.createForCStruct(cfg.renameJavaType(name));
} else {
diff --git a/src/java/com/jogamp/gluegen/ReferencedStructs.java b/src/java/com/jogamp/gluegen/ReferencedStructs.java
index 46a2a7e..26deb3a 100644
--- a/src/java/com/jogamp/gluegen/ReferencedStructs.java
+++ b/src/java/com/jogamp/gluegen/ReferencedStructs.java
@@ -44,31 +44,43 @@ import com.jogamp.gluegen.cgram.types.*;
public class ReferencedStructs implements TypeVisitor {
- private final Set<Type> results = new HashSet<Type>();
+ private final Map<String, Type> resultMap = new HashMap<String, Type>();
+ private final Set<CompoundType> layoutSet = new HashSet<CompoundType>();
+ private final Set<Type> skip = new HashSet<Type>();
- public void clear() {
- results.clear();
- }
+ public void clear() {
+ resultMap.clear();
+ }
- public Iterator<Type> results() {
- return results.iterator();
- }
+ public Iterator<Type> results() {
+ return resultMap.values().iterator();
+ }
+ public Iterator<CompoundType> layouts() {
+ return layoutSet.iterator();
+ }
- @Override
- public void visitType(final Type t) {
- if (t.isPointer()) {
- final PointerType p = t.asPointer();
- if (p.isTypedef()) {
- final CompoundType c = p.getTargetType().asCompound();
- if (c != null && c.getName() == null) {
- // This otherwise-unnamed CompoundType is referred to by a
- // PointerType that has a typedef name. Assume that it is
- // referred to in the glue code and emit it.
- results.add(p);
+ @Override
+ public void visitType(final Type t) {
+ if( skip.contains(t) ) {
+ return;
+ }
+ if ( t.isPointer() ) {
+ final PointerType p = t.asPointer();
+ final CompoundType c = p.getTargetType().asCompound();
+ if( p.isTypedef() && null != c ) {
+ // If containing pointer is typedef, use it (preferred)
+ skip.add(c); // earmark to skip the compound!
+ resultMap.put(c.getName(), p);
+ layoutSet.add(c);
+ } else {
+ // .. otherwise skip pointer and use followup compound
+ }
+ } else if( t.isCompound() ) {
+ // Use compound if not yet mapped, e.g. by typedef'ed (preferred)
+ if( !resultMap.containsKey(t.getName()) ) {
+ resultMap.put(t.getName(), t);
+ }
+ layoutSet.add(t.asCompound()); // always: could be const/volatile variants ..
}
- }
- } else if (t.isCompound()) {
- results.add(t);
}
- }
}
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]);