aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java9
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test2.java25
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test2.c12
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test2.h2
4 files changed, 21 insertions, 27 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index 23aae96..cc86cac 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -1098,15 +1098,8 @@ public class JavaEmitter implements GlueEmitter {
if ( fieldType.isFunctionPointer() && !isOpaqueField ) {
final FunctionSymbol func = new FunctionSymbol(field.getName(), fieldType.asPointer().getTargetType().asFunction());
func.rename(renamed); // null is OK
- generateFunctionPointerCode(methodBindingSet, javaUnit, jniUnit, structCTypeName,
- containingCType, containingJType, i, func, fqStructFieldName1);
final String javaTypeName = "long";
final String capFieldName = capitalizeString(fieldName);
- generateIsNullSignature(javaUnit, false, fieldName, fieldType, Ownership.Parent, capFieldName, false, false, null);
- javaUnit.emitln(" {");
- javaUnit.emitln(" return 0 == accessor.getLongAt(" + fieldName+"_offset[mdIdx], md.pointerSizeInBytes());");
- javaUnit.emitln(" }");
- javaUnit.emitln();
if( !immutableField && !fieldType.isConst() ) {
// Setter
generateSetterSignature(javaUnit, MethodAccess.PUBLIC, false, false, fieldName, fieldType, Ownership.Parent, containingJTypeName, capFieldName, null, javaTypeName, null, false, false, null, null, null);
@@ -1122,6 +1115,8 @@ public class JavaEmitter implements GlueEmitter {
javaUnit.emitln(" return accessor.getLongAt(" + fieldName+"_offset[mdIdx], md.pointerSizeInBytes());");
javaUnit.emitln(" }");
javaUnit.emitln();
+ generateFunctionPointerCode(methodBindingSet, javaUnit, jniUnit, structCTypeName,
+ containingCType, containingJType, i, func, fqStructFieldName1);
} else if ( fieldType.isCompound() && !isOpaqueField ) {
// FIXME: will need to support this at least in order to
// handle the union in jawt_Win32DrawingSurfaceInfo (fabricate a name?)
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2.java
index 636eea7..28a3060 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2.java
@@ -82,20 +82,19 @@ public class Test2 extends BaseClass {
Assert.assertEquals(true, options.isOverrideThreadAffinityNull());
Assert.assertEquals(true, options.isProductNameNull());
Assert.assertEquals(true, options.isProductVersionNull());
- Assert.assertEquals(true, options.isCustomFuncA1Null());
- Assert.assertEquals(true, options.isCustomFuncA2Null());
- Assert.assertEquals(true, options.isCustomFuncB1Null());
- Assert.assertEquals(true, options.isCustomFuncB2Null());
+ Assert.assertEquals(0, options.getCustomFuncA1());
+ Assert.assertEquals(0, options.getCustomFuncA2());
+ Assert.assertEquals(0, options.getCustomFuncB1());
+ Assert.assertEquals(0, options.getCustomFuncB2());
bt2.Initialize(options);
Assert.assertEquals(true, options.isOverrideThreadAffinityNull());
Assert.assertEquals(false, options.isProductNameNull());
Assert.assertEquals(false, options.isProductVersionNull());
- Assert.assertEquals(false, options.isCustomFuncA1Null());
- Assert.assertEquals(false, options.isCustomFuncA2Null());
- Assert.assertEquals(false, options.isCustomFuncB1Null());
- Assert.assertEquals(false, options.isCustomFuncB2Null());
- Assert.assertEquals(false, options.isCustomFuncA1Null());
+ Assert.assertNotEquals(0, options.getCustomFuncA1());
+ Assert.assertNotEquals(0, options.getCustomFuncA2());
+ Assert.assertNotEquals(0, options.getCustomFuncB1());
+ Assert.assertNotEquals(0, options.getCustomFuncB2());
Assert.assertEquals(1, options.getApiVersion());
Assert.assertEquals("Product Name", options.getProductName());
Assert.assertEquals("Product Version", options.getProductVersion());
@@ -135,10 +134,10 @@ public class Test2 extends BaseClass {
Assert.assertEquals(true, options.isOverrideThreadAffinityNull());
Assert.assertEquals(true, options.isProductNameNull());
Assert.assertEquals(true, options.isProductVersionNull());
- Assert.assertEquals(true, options.isCustomFuncA1Null());
- Assert.assertEquals(true, options.isCustomFuncA2Null());
- Assert.assertEquals(true, options.isCustomFuncB1Null());
- Assert.assertEquals(true, options.isCustomFuncB2Null());
+ Assert.assertEquals(0, options.getCustomFuncA1());
+ // const Assert.assertEquals(0, options.getCustomFuncA2());
+ Assert.assertEquals(0, options.getCustomFuncB1());
+ Assert.assertEquals(0, options.getCustomFuncB2());
}
public static void main(final String args[]) throws IOException {
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c
index 561b3ae..75eafcf 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c
@@ -24,13 +24,13 @@ static int32_t CustomFuncB2(T2_UserData* pUserData) {
int Initialize(T2_InitializeOptions* Options) {
Options->ProductName = calloc(100, sizeof(char));
Options->ProductVersion = calloc(100, sizeof(char));
- strncpy(Options->ProductName, "Product Name", 100);
- strncpy(Options->ProductVersion, "Product Version", 100);
+ strncpy((char*)Options->ProductName, "Product Name", 100); // yuck: nonsense-warning
+ strncpy((char*)Options->ProductVersion, "Product Version", 100); // yuck: nonsense-warning
Options->ApiVersion = 1;
Options->Reserved1 = NULL;
Options->CustomFuncA1 = CustomFuncA1;
- Options->CustomFuncA2 = CustomFuncA2;
+ *( (T2_CustomFuncA*) &Options->CustomFuncA2 ) = CustomFuncA2; // yuck: real yuck
Options->CustomFuncB1 = CustomFuncB1;
Options->CustomFuncB2 = CustomFuncB2;
@@ -39,15 +39,15 @@ int Initialize(T2_InitializeOptions* Options) {
int Release(T2_InitializeOptions* Options) {
if( NULL != Options->ProductName ) {
- free( Options->ProductName );
+ free( (void*) Options->ProductName ); // yuck: nonsense-warning
Options->ProductName = NULL;
}
if( NULL != Options->ProductVersion ) {
- free( Options->ProductVersion );
+ free( (void*) Options->ProductVersion ); // yuck: nonsense-warning
Options->ProductVersion = NULL;
}
Options->CustomFuncA1 = NULL;
- Options->CustomFuncA2 = NULL;
+ // Options->CustomFuncA2 = NULL; // keep const
Options->CustomFuncB1 = NULL;
Options->CustomFuncB2 = NULL;
}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h
index 0fca16a..cf0808d 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.h
@@ -29,7 +29,7 @@ typedef struct {
void* Reserved1;
T2_CustomFuncA CustomFuncA1;
- T2_CustomFuncA CustomFuncA2;
+ const T2_CustomFuncA CustomFuncA2;
T2_CustomFuncB CustomFuncB1;
T2_CustomFuncB CustomFuncB2;