diff options
author | Sven Gothel <[email protected]> | 2023-07-06 10:35:30 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-07-06 10:35:30 +0200 |
commit | 3ed3e9887c459169b807165c9df2ae2bc2990a31 (patch) | |
tree | 895211a59571e09e4128223dca2cda1bcf9a9d5c /src/java/com/jogamp/gluegen/JavaEmitter.java | |
parent | 5b867d0f90a43a02e1fbd03fb1ed588a391806eb (diff) |
GlueGen JavaCallback: Remove ambiguity: Config JavaCallbackDef/JavaCallbackKey: Always define both parameter indices; emitJavaStaticCallback(): Use cbFuncBinding and cbFuncKeyIndices from callback parameter to build key
Diffstat (limited to 'src/java/com/jogamp/gluegen/JavaEmitter.java')
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaEmitter.java | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 8af79e4..07bd55d 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -1473,7 +1473,7 @@ public class JavaEmitter implements GlueEmitter { funcType.toString(jcbd.cbFuncTypeName, false, true)); } final JavaCallbackInfo jcbi1 = new JavaCallbackInfo(jcbd.cbFuncTypeName, cbSimpleClazzName, cbFQClazzName, jcbi0.staticCBMethodSignature, - funcType, jcbi0.cbFuncBinding, jcbi0.cbFuncUserParamIdx, + funcType, jcbi0.cbFuncBinding, jcbi0.cbFuncUserParamIdx, jcbi0.cbFuncKeyIndices, jcbd.setFuncName, jcbd.setFuncUserParamIdx, jcbd.setFuncKeyIndices, jcbd.setFuncKeyClassName); cfg.setFuncToJavaCallbackMap.put(jcbd.setFuncName, jcbi1); LOG.log(INFO, "JavaCallbackInfo: Reusing {0} -> {1}", jcbd.setFuncName, jcbi0); @@ -1493,7 +1493,7 @@ public class JavaEmitter implements GlueEmitter { cbFuncBinding.getJavaReturnType()+", func "+funcType.toString(jcbd.cbFuncTypeName, false, true)); } final JavaCallbackInfo jcbi1 = new JavaCallbackInfo(jcbd.cbFuncTypeName, cbSimpleClazzName, cbFQClazzName, cbMethodSignature.toString(), - funcType, cbFuncBinding, jcbd.cbFuncUserParamIdx, + funcType, cbFuncBinding, jcbd.cbFuncUserParamIdx, jcbd.cbFuncKeyIndices, jcbd.setFuncName, jcbd.setFuncUserParamIdx, jcbd.setFuncKeyIndices, jcbd.setFuncKeyClassName); cfg.setFuncToJavaCallbackMap.put(jcbd.setFuncName, jcbi1); javaCallbackInterfaceMap.put(cbFQClazzName, jcbi1); @@ -3104,7 +3104,7 @@ public class JavaEmitter implements GlueEmitter { stringArgIndices = PascalStringIdx.pushValueIndex(pascalStringArgs, stringArgIndices); } final JavaCallbackInfo jcbi = cfg.setFuncToJavaCallbackMap.get( sym.getName() ); - int jcbiSetFuncCBParamIdx=-1, jcbiSetFuncUserParamIdx=-1; + int jcbiSetFuncCBParamIdx=-1; for (int i = 0; i < sym.getNumArguments(); i++) { final Type cArgType = sym.getArgumentType(i); @@ -3121,20 +3121,6 @@ public class JavaEmitter implements GlueEmitter { mappedType = JavaType.createForNamedClass( jcbi.cbFQClazzName ); } else if( null != jcbi && i == jcbi.setFuncUserParamIdx && cArgType.isPointer() ) { // Replace userParam argument '<userParamType>*' if 'void*' with Object - jcbiSetFuncUserParamIdx=i; - if( cArgType.getTargetType().isVoid() ) { - if( jcbi.cbFuncUserParamType.isCompound() ) { - mappedType = JavaType.createForClass(long.class); - } else { - mappedType = JavaType.forObjectClass(); - } - } - } else if( null != jcbi && jcbi.cbFuncUserParamName.equals( cArgName ) && - ( !jcbi.setFuncProcessed || i == jcbi.setFuncUserParamIdx ) && - cArgType.isPointer() && jcbi.cbFuncUserParamType.equals( cArgType.getTargetType() ) ) - { - // Replace userParam argument '<userParamType>*' if 'void*' with Object - jcbiSetFuncUserParamIdx=i; if( cArgType.getTargetType().isVoid() ) { if( jcbi.cbFuncUserParamType.isCompound() ) { mappedType = JavaType.createForClass(long.class); @@ -3174,9 +3160,9 @@ public class JavaEmitter implements GlueEmitter { //System.out.println("During binding of [" + sym + "], added mapping from C type: " + cArgType + " to Java type: " + mappedType); } if( null != jcbi ) { - jcbi.setFuncProcessed(jcbiSetFuncCBParamIdx, jcbiSetFuncUserParamIdx); - LOG.log(INFO, "BindFunc.JavaCallback: {0}: set[cbParamIdx {1}, userParamIdx {2}], {3}, {4}", - sym.getName(), jcbiSetFuncCBParamIdx, jcbiSetFuncUserParamIdx, sym.getType().toString(sym.getName(), false, true), jcbi); + jcbi.setFuncProcessed(sym.getType(), jcbiSetFuncCBParamIdx); + LOG.log(INFO, "BindFunc.JavaCallback: {0}: set[cbParamIdx {1}], {3}, {4}", + sym.getName(), jcbiSetFuncCBParamIdx, sym.getType().toString(sym.getName(), false, true), jcbi); } final MethodBinding mb = new MethodBinding(sym, delegationImplName, javaReturnType, javaArgumentTypes, |