diff options
author | Sven Gothel <[email protected]> | 2023-08-03 21:18:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-03 21:18:36 +0200 |
commit | 910ce385d5e56eeb1fd7f81678042f19f76b1870 (patch) | |
tree | 3c2a0f3b4c3506f280584f12fa807494baa5cce2 | |
parent | 1e78cc429f148aa200ae487bacb6d4a9b6b7c8d9 (diff) |
JavaCallbackEmitter.{emitCSetFuncPreCall, emitCAdditionalCode}(): Group 'userParamDefined' case (cleanup)
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaCallbackEmitter.java | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java b/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java index 5278db3..a0874cb 100644 --- a/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java @@ -668,10 +668,15 @@ public final class JavaCallbackEmitter { final String staticBindingClazzVarName = "staticCBClazz"+jcbNativeBasename; final String staticBindingMethodIDVarName = "staticCBMethod"+jcbNativeBasename; final String cbFuncArgName = binding.getArgumentName(info.setFuncCBParamIdx); - final String userParamTypeName = userParamDefined ? info.cbFuncUserParamType.getCName() : null; - final String userParamArgName = userParamDefined ? binding.getArgumentName(info.setFuncUserParamIdx) : null; final String nativeCBFuncVarName = cbFuncArgName+"_native"; - final String nativeUserParamVarName = userParamDefined ? userParamArgName+"_native" : null; + final String userParamTypeName, nativeUserParamVarName; + if( userParamDefined ) { + userParamTypeName = info.cbFuncUserParamType.getCName(); + nativeUserParamVarName = binding.getArgumentName(info.setFuncUserParamIdx)+"_native"; + } else { + userParamTypeName = null; + nativeUserParamVarName = null; + } unit.emitln(); unit.emitln(" // JavaCallback handling"); unit.emitln(" if( NULL == staticCBClazz ) { (*env)->FatalError(env, \"NULL staticCBClazz passed to '"+jcbFriendlyBasename+"'\"); }"); @@ -739,9 +744,15 @@ public final class JavaCallbackEmitter { final String staticBindingClazzVarName = "staticCBClazz"+jcbNativeBasename; final String staticBindingMethodIDVarName = "staticCBMethod"+jcbNativeBasename; final String staticCallbackName = "func"+jcbNativeBasename; - // final Type userParamType = javaCallback.cbFuncBinding.getCArgumentType(javaCallback.cbFuncUserParamIdx); - final String userParamTypeName = userParamDefined ? info.cbFuncUserParamType.getCName() : null ; - final String userParamArgName = userParamDefined ? info.cbFuncBinding.getArgumentName(info.cbFuncUserParamIdx) : null; + final String userParamTypeName, userParamArgName; + if( userParamDefined ) { + // final Type userParamType = javaCallback.cbFuncBinding.getCArgumentType(javaCallback.cbFuncUserParamIdx); + userParamTypeName = info.cbFuncUserParamType.getCName(); + userParamArgName = info.cbFuncBinding.getArgumentName(info.cbFuncUserParamIdx); + } else { + userParamTypeName = null; + userParamArgName = null; + } final Type cReturnType = info.cbFuncBinding.getCReturnType(); final JavaType jretType = info.cbFuncBinding.getJavaReturnType(); unit.emitln(); |