diff options
author | Sven Gothel <[email protected]> | 2023-08-04 20:57:17 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-04 20:57:17 +0200 |
commit | 1e4e23c1a4bd6737e3513df2c3e905d83337fd8d (patch) | |
tree | a0e73abee9db9d7c4fd1e53b579ae26f76ac32b1 | |
parent | 8fcea7ef29de9036871efabcd2288b0059af5007 (diff) | |
parent | 2abb40b0ca9a6a06bdbe3e66b4235301ed15c693 (diff) |
Merge remote-tracking branch 'Mathieu_Fery/wip/test_case_callback_emission'
22 files changed, 902 insertions, 313 deletions
diff --git a/doc/GlueGen_Mapping.html b/doc/GlueGen_Mapping.html index 43f9219..4ea6b76 100644 --- a/doc/GlueGen_Mapping.html +++ b/doc/GlueGen_Mapping.html @@ -2415,7 +2415,7 @@ accommodating a different key-parameter order between <p>GlueGen configuration snippet with the added option attribute for the <code>Callback-KeyClass</code> in directive <code>JavaCallbackDef</code>.</p> -<pre><code>JavaCallbackDef alBufferCallback1 0 ALBUFFERCALLBACKTYPESOFT 1 ALCcontext com.jogamp.gluegen.test.junit.generation.Test4JavaCallback.CustomAlBufferCallback1Key +<pre><code>JavaCallbackDef alBufferCallback1 0 ALBUFFERCALLBACKTYPESOFT 1 ALCcontext com.jogamp.gluegen.test.junit.generation.BaseTest4JavaCallback.CustomAlBufferCallback1Key JavaCallbackKey alBufferCallback1 1 ALBUFFERCALLBACKTYPESOFT 0 </code></pre> <p>Implementation utilizes a custom <code>Callback-KeyClass</code> diff --git a/doc/GlueGen_Mapping.md b/doc/GlueGen_Mapping.md index 1262082..45892db 100644 --- a/doc/GlueGen_Mapping.md +++ b/doc/GlueGen_Mapping.md @@ -1108,7 +1108,7 @@ C-API Header snipped GlueGen configuration snippet with the added option attribute for the `Callback-KeyClass` in directive `JavaCallbackDef`. ``` -JavaCallbackDef alBufferCallback1 0 ALBUFFERCALLBACKTYPESOFT 1 ALCcontext com.jogamp.gluegen.test.junit.generation.Test4JavaCallback.CustomAlBufferCallback1Key +JavaCallbackDef alBufferCallback1 0 ALBUFFERCALLBACKTYPESOFT 1 ALCcontext com.jogamp.gluegen.test.junit.generation.BaseTest4JavaCallback.CustomAlBufferCallback1Key JavaCallbackKey alBufferCallback1 1 ALBUFFERCALLBACKTYPESOFT 0 ``` diff --git a/make/build-test.xml b/make/build-test.xml index a791c7c..f472063 100644 --- a/make/build-test.xml +++ b/make/build-test.xml @@ -671,44 +671,90 @@ chmod 644 ${results}/* \${line.separator} <gluegen src="${test.junit.generation.dir}/test2.h" outputRootDir="${build_t.gen}" - config="${test.junit.generation.dir}/test2.cfg" + config="${test.junit.generation.dir}/test2-gluegen.cfg" literalInclude="${test.junit.generation.dir}" includeRefid="stub.includes.fileset.test" - emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter" + emitter="com.jogamp.gluegen.JavaEmitter" dumpCPP="false" debug="false" logLevel="WARNING"> <classpath refid="gluegen.classpath" /> </gluegen> <antcall target="java.generate.copy2temp" inheritRefs="true" /> + + <gluegen src="${test.junit.generation.dir}/test2.h" + outputRootDir="${build_t.gen}" + config="${test.junit.generation.dir}/test2p1.cfg" + literalInclude="${test.junit.generation.dir}" + includeRefid="stub.includes.fileset.test" + emitter="com.jogamp.gluegen.JavaEmitter" + dumpCPP="false" + debug="false" + logLevel="WARNING"> + <classpath refid="gluegen.classpath" /> + </gluegen> + + <gluegen src="${test.junit.generation.dir}/test2.h" + outputRootDir="${build_t.gen}" + config="${test.junit.generation.dir}/test2p2.cfg" + literalInclude="${test.junit.generation.dir}" + includeRefid="stub.includes.fileset.test" + emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter" + dumpCPP="false" + debug="false" + logLevel="WARNING"> + <classpath refid="gluegen.classpath" /> + </gluegen> </target> - <target name="junit.test2.c.build"> - <!-- this is the test2 implementation --> - <patternset id="junit.test2.implc.src.files"> - <include name="src/junit/${test.junit.generation.rel}/test2.c"/> + <target name="junit.test2.c.build" depends="junit.test2i.c.build, junit.test2p1.c.build, junit.test2p2.c.build" unless="build.javaonly" /> + + <!-- this is the test2 implementation --> + <target name="junit.test2i.c.build"> + <patternset id="junit.test2i.c.src.files"> + <include name="src/junit/${test.junit.generation.rel}/test2.c"/> </patternset> <!-- Windows hacks ro make a proper DLL --> <linker id="linker.test2.dll.cfg.id" extends="${linker.cfg.id}"> </linker> - <c.build c.compiler.src.files="junit.test2.implc.src.files" + <c.build c.compiler.src.files="junit.test2i.c.src.files" output.lib.name="test2" compiler.cfg.id="${compiler.cfg.id}" linker.cfg.id="linker.test2.dll.cfg.id"/> - <!-- this is a dynamic lookup binding to the test1 implementation --> + </target> + + <!-- this is a fixed binding to the test2 implementation --> + <target name="junit.test2p1.c.build"> + <linker id="linker.test2.fixed.cfg.id" extends="${linker.cfg.id}"> + <syslibset dir="${build_t.lib}" libs="test1"/> + </linker> + + <patternset id="junit.test2p1.c.src.files"> + <include name="${build_t.gen.rootrel}/native/Bindingtest2p1Impl_JNI.c"/> + <include name="${build_t.gen.rootrel}/native/T2_InitializeOptions_JNI.c"/> + </patternset> + + <c.build c.compiler.src.files="junit.test2p1.c.src.files" + output.lib.name="Bindingtest2p1" + compiler.cfg.id="${compiler.cfg.id}" + linker.cfg.id="linker.test2.fixed.cfg.id"/> + </target> + + <!-- this is a dynamic lookup binding to the test2 implementation --> + <target name="junit.test2p2.c.build"> <linker id="linker.test2.runtime.cfg.id" extends="${linker.cfg.id}"> </linker> - <patternset id="junit.test2.jnic.src.files"> - <include name="${build_t.gen.rootrel}/native/Bindingtest2Impl_JNI.c"/> - <include name="${build_t.gen.rootrel}/native/T2_InitializeOptions_JNI.c"/> + <patternset id="junit.test2p2.c.src.files"> + <include name="${build_t.gen.rootrel}/native/Bindingtest2p2Impl_JNI.c"/> + <include name="${build_t.gen.rootrel}/native/T2_InitializeOptions_JNI.c"/> </patternset> - <c.build c.compiler.src.files="junit.test2.jnic.src.files" - output.lib.name="Bindingtest2" + <c.build c.compiler.src.files="junit.test2p2.c.src.files" + output.lib.name="Bindingtest2p2" compiler.cfg.id="${compiler.cfg.id}" linker.cfg.id="linker.test2.runtime.cfg.id"/> </target> diff --git a/make/scripts/runtest.sh b/make/scripts/runtest.sh index e20c09e..ef5a879 100755 --- a/make/scripts/runtest.sh +++ b/make/scripts/runtest.sh @@ -152,9 +152,12 @@ function onetest() { #onetest com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter 2>&1 | tee -a $LOG #onetest com.jogamp.gluegen.test.junit.generation.Test1p2LoadJNIAndImplLib 2>&1 | tee -a $LOG onetest com.jogamp.gluegen.test.junit.generation.Test1p2DynamicLibraryBundle 2>&1 | tee -a $LOG -onetest com.jogamp.gluegen.test.junit.generation.Test2FuncPtr 2>&1 | tee -a $LOG -onetest com.jogamp.gluegen.test.junit.generation.Test3PtrStorage 2>&1 | tee -a $LOG -onetest com.jogamp.gluegen.test.junit.generation.Test4JavaCallback 2>&1 | tee -a $LOG +onetest com.jogamp.gluegen.test.junit.generation.Test2p1FuncPtr 2>&1 | tee -a $LOG +onetest com.jogamp.gluegen.test.junit.generation.Test2p2FuncPtr 2>&1 | tee -a $LOG +onetest com.jogamp.gluegen.test.junit.generation.Test3p1PtrStorage 2>&1 | tee -a $LOG +onetest com.jogamp.gluegen.test.junit.generation.Test3p2PtrStorage 2>&1 | tee -a $LOG +onetest com.jogamp.gluegen.test.junit.generation.Test4p1JavaCallback 2>&1 | tee -a $LOG +onetest com.jogamp.gluegen.test.junit.generation.Test4p2JavaCallback 2>&1 | tee -a $LOG #onetest com.jogamp.gluegen.test.junit.structgen.TestStructGen01 2>&1 | tee -a $LOG #onetest com.jogamp.gluegen.test.junit.structgen.TestStructGen02 2>&1 | tee -a $LOG diff --git a/src/antlr/com/jogamp/gluegen/jgram/JavaParser.g b/src/antlr/com/jogamp/gluegen/jgram/JavaParser.g index 1c06bfd..a4d8c72 100644 --- a/src/antlr/com/jogamp/gluegen/jgram/JavaParser.g +++ b/src/antlr/com/jogamp/gluegen/jgram/JavaParser.g @@ -171,9 +171,35 @@ tokens { return functionNames; } + /** Clears the list of inner interfaces this HeaderParser has parsed. + Useful when reusing the same HeaderParser for more than one + header file. */ + public void clearParsedInnerInterfacesNames() { + innerInterfacesNames.clear(); + } + + /** Returns the list of inner interfaces this HeaderParser has parsed. */ + public Set<String> getParsedInnerInterfacesNames() { + return innerInterfacesNames; + } + + /** Clears the list of inner classes this HeaderParser has parsed. + Useful when reusing the same HeaderParser for more than one + header file. */ + public void clearParsedInnerClassesNames() { + innerClassesNames.clear(); + } + + /** Returns the list of inner classes this HeaderParser has parsed. */ + public Set<String> getParsedInnerClassesNames() { + return innerClassesNames; + } + private Set<String> functionNames = new HashSet<String>(); // hash from name of an enumerated value to the EnumType to which it belongs private Set<String> enumNames = new HashSet<String>(); + private Set<String> innerInterfacesNames = new HashSet<String>(); + private Set<String> innerClassesNames = new HashSet<String>(); private int blockDepth = 0; } @@ -213,9 +239,11 @@ importDefinition // A type definition in a file is either a class or interface definition. typeDefinition options {defaultErrorHandler = true;} - : m:modifiers! - ( classDefinition[#m] - | interfaceDefinition[#m] + : antsBefore:annotations + m:modifiers! + antsAfter:annotations + ( classDefinition[#antsBefore,#m,#antsAfter] + | interfaceDefinition[#antsBefore,#m,#antsAfter] ) | SEMI! ; @@ -224,7 +252,7 @@ typeDefinition * Create a separate Type/Var tree for each var in the var list. */ declaration! - : m:modifiers t:typeSpec[false] v:variableDefinitions[#m,#t] + : antsBefore:annotations m:modifiers antsAfter:annotations t:typeSpec[false] v:variableDefinitions[#antsBefore,#m,#antsAfter,#t] {#declaration = #v;} ; @@ -238,7 +266,7 @@ typeSpec[boolean addImagNode] // A class type specification is a class type with possible brackets afterwards // (which would make it an array type). classTypeSpec[boolean addImagNode] - : identifier (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)* + : identifier (LT gen:classTypeSpec[false] GT)? (lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)* { if ( addImagNode ) { #classTypeSpec = #(#[TYPE,"TYPE"], #classTypeSpec); @@ -316,8 +344,8 @@ modifier ; // Definition of a Java class -classDefinition![AST modifiers] - : "class" IDENT +classDefinition![AST antsBefore, AST modifiers, AST antsAfter] + : "class" cn:IDENT // it _might_ have a superclass... sc:superClassClause // it might implement some interfaces... @@ -325,7 +353,9 @@ classDefinition![AST modifiers] // now parse the body of the class cb:classBlock {#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"], - modifiers,IDENT,sc,ic,cb);} + antsBefore,modifiers,antsAfter,cn,sc,ic,cb); + if(blockDepth==1) { + innerClassesNames.add(cn.getText()); } } ; superClassClause! @@ -334,14 +364,16 @@ superClassClause! ; // Definition of a Java Interface -interfaceDefinition![AST modifiers] - : "interface" IDENT +interfaceDefinition![AST antsBefore, AST modifiers, AST antsAfter] + : "interface" in:IDENT // it might extend some other interfaces ie:interfaceExtends // now parse the body of the interface (looks like a class...) cb:classBlock {#interfaceDefinition = #(#[INTERFACE_DEF,"INTERFACE_DEF"], - modifiers,IDENT,ie,cb);} + antsBefore,modifiers,antsAfter,in,ie,cb); + if(blockDepth==1) { + innerInterfacesNames.add(in.getText()); } } ; @@ -379,14 +411,16 @@ implementsClause // need to be some semantic checks to make sure we're doing the right thing... field! : // method, constructor, or variable declaration + antsBefore:annotations mods:modifiers + antsAfter:annotations ( h:ctorHead s:constructorBody // constructor - {#field = #(#[CTOR_DEF,"CTOR_DEF"], mods, h, s);} + {#field = #(#[CTOR_DEF,"CTOR_DEF"], antsBefore, mods, antsAfter, h, s);} - | cd:classDefinition[#mods] // inner class + | cd:classDefinition[#antsBefore,#mods,#antsAfter] // inner class {#field = #cd;} - | id:interfaceDefinition[#mods] // inner interface + | id:interfaceDefinition[#antsBefore,#mods,#antsAfter] // inner interface {#field = #id;} | t:typeSpec[false] // method or variable declaration(s) @@ -403,7 +437,9 @@ field! ( s2:compoundStatement | SEMI ) {#field = #(#[METHOD_DEF,"METHOD_DEF"], + antsBefore, mods, + antsAfter, #(#[TYPE,"TYPE"],rt), fn, param, @@ -411,7 +447,7 @@ field! s2); if(blockDepth==1) { functionNames.add(fn.getText()); } } - | v:variableDefinitions[#mods,#t] SEMI + | v:variableDefinitions[#antsBefore,#mods,#antsAfter,#t] SEMI // {#field = #(#[VARIABLE_DEF,"VARIABLE_DEF"], v);} {#field = #v;} ) @@ -441,11 +477,15 @@ explicitConstructorInvocation {#lp2.setType(SUPER_CTOR_CALL);} ; -variableDefinitions[AST mods, AST t] - : variableDeclarator[getASTFactory().dupTree(mods), - getASTFactory().dupTree(t)] +variableDefinitions[AST antsBefore, AST mods, AST antsAfter, AST t] + : variableDeclarator[getASTFactory().dupTree(antsBefore), + getASTFactory().dupTree(mods), + getASTFactory().dupTree(antsAfter), + getASTFactory().dupTree(t)] ( COMMA! - variableDeclarator[getASTFactory().dupTree(mods), + variableDeclarator[getASTFactory().dupTree(antsBefore), + getASTFactory().dupTree(mods), + getASTFactory().dupTree(antsAfter), getASTFactory().dupTree(t)] )* ; @@ -454,11 +494,11 @@ variableDefinitions[AST mods, AST t] * or a local variable in a method * It can also include possible initialization. */ -variableDeclarator![AST mods, AST t] +variableDeclarator![AST antsBefore, AST mods, AST antsAfter, AST t] : id:IDENT d:declaratorBrackets[t] v:varInitializer - {#variableDeclarator = #(#[VARIABLE_DEF,"VARIABLE_DEF"], mods, #(#[TYPE,"TYPE"],d), id, v); - if(blockDepth==1) { - enumNames.add(id.getText()); + {#variableDeclarator = #(#[VARIABLE_DEF,"VARIABLE_DEF"], antsBefore, mods, antsAfter, #(#[TYPE,"TYPE"],d), id, v); + if(blockDepth==1) { + enumNames.add(id.getText()); } } ; @@ -528,10 +568,11 @@ parameterDeclarationList // A formal parameter. parameterDeclaration! - : pm:parameterModifier t:typeSpec[false] id:IDENT + : antsBefore:annotations pm:parameterModifier antsAfter:annotations + t:typeSpec[false] id:IDENT pd:declaratorBrackets[#t] {#parameterDeclaration = #(#[PARAMETER_DEF,"PARAMETER_DEF"], - pm, #([TYPE,"TYPE"],pd), id);} + antsBefore, pm, antsAfter, #([TYPE,"TYPE"],pd), id);} ; parameterModifier @@ -572,7 +613,7 @@ statement | expression SEMI! // class definition - | m:modifiers! classDefinition[#m] + | antsBefore:annotations m:modifiers! antsAfter:annotations classDefinition[#antsBefore,#m,#antsAfter] // Attach a label to the front of a statement | IDENT c:COLON^ {#c.setType(LABELED_STAT);} statement @@ -695,6 +736,27 @@ handler : "catch"^ LPAREN! parameterDeclaration RPAREN! compoundStatement ; +annotations + : ( annotation )* + ; + +annotation + : ( AT type:typeSpec[false] ( + LPAREN + ( + content:primaryExpression + | + identPrimary ASSIGN primaryExpression + ( + COMMA + identPrimary ASSIGN primaryExpression + )* + ) + RPAREN + )? + ) + ; + // expressions // Note that most of these expressions follow the pattern @@ -1079,52 +1141,53 @@ options { } // OPERATORS -QUESTION : '?' ; -LPAREN : '(' ; -RPAREN : ')' ; -LBRACK : '[' ; -RBRACK : ']' ; -LCURLY : '{' ; -RCURLY : '}' ; -COLON : ':' ; -COMMA : ',' ; -//DOT : '.' ; -ASSIGN : '=' ; -EQUAL : "==" ; -LNOT : '!' ; -BNOT : '~' ; -NOT_EQUAL : "!=" ; -DIV : '/' ; -DIV_ASSIGN : "/=" ; -PLUS : '+' ; -PLUS_ASSIGN : "+=" ; -INC : "++" ; -MINUS : '-' ; -MINUS_ASSIGN : "-=" ; -DEC : "--" ; -STAR : '*' ; -STAR_ASSIGN : "*=" ; -MOD : '%' ; -MOD_ASSIGN : "%=" ; -SR : ">>" ; -SR_ASSIGN : ">>=" ; -BSR : ">>>" ; +QUESTION : '?' ; +LPAREN : '(' ; +RPAREN : ')' ; +LBRACK : '[' ; +RBRACK : ']' ; +LCURLY : '{' ; +RCURLY : '}' ; +COLON : ':' ; +COMMA : ',' ; +//DOT : '.' ; +ASSIGN : '=' ; +EQUAL : "==" ; +LNOT : '!' ; +BNOT : '~' ; +NOT_EQUAL : "!=" ; +DIV : '/' ; +DIV_ASSIGN : "/=" ; +PLUS : '+' ; +PLUS_ASSIGN : "+=" ; +INC : "++" ; +MINUS : '-' ; +MINUS_ASSIGN : "-=" ; +DEC : "--" ; +STAR : '*' ; +STAR_ASSIGN : "*=" ; +MOD : '%' ; +MOD_ASSIGN : "%=" ; +SR : ">>" ; +SR_ASSIGN : ">>=" ; +BSR : ">>>" ; BSR_ASSIGN : ">>>=" ; -GE : ">=" ; -GT : ">" ; -SL : "<<" ; -SL_ASSIGN : "<<=" ; -LE : "<=" ; -LT : '<' ; -BXOR : '^' ; -BXOR_ASSIGN : "^=" ; -BOR : '|' ; -BOR_ASSIGN : "|=" ; -LOR : "||" ; -BAND : '&' ; -BAND_ASSIGN : "&=" ; -LAND : "&&" ; -SEMI : ';' ; +GE : ">=" ; +GT : ">" ; +SL : "<<" ; +SL_ASSIGN : "<<=" ; +LE : "<=" ; +LT : '<' ; +BXOR : '^' ; +BXOR_ASSIGN : "^=" ; +BOR : '|' ; +BOR_ASSIGN : "|=" ; +LOR : "||" ; +BAND : '&' ; +BAND_ASSIGN : "&=" ; +LAND : "&&" ; +SEMI : ';' ; +AT : '@' ; // Whitespace -- ignored diff --git a/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java b/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java index 01ffe8f..3359c1c 100644 --- a/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java @@ -348,6 +348,8 @@ public final class JavaCallbackEmitter { } private final void emitJavaKeyClass(final CodeUnit unit) { + if( cfg.shouldIgnoreInInterface(KeyClassName) ) return; + emitJavaBriefAPIDoc(unit, "", "", "", "for "); unit.emitln(" public static class "+KeyClassName+" {"); binding.forEachParameter( ( final int idx, final int consumedCount, final Type cType, final JavaType jType, final String name ) -> { diff --git a/src/java/com/jogamp/gluegen/JavaConfiguration.java b/src/java/com/jogamp/gluegen/JavaConfiguration.java index 95e1480..82019f1 100644 --- a/src/java/com/jogamp/gluegen/JavaConfiguration.java +++ b/src/java/com/jogamp/gluegen/JavaConfiguration.java @@ -1808,23 +1808,33 @@ public class JavaConfiguration { final Set<String> parsedEnumNames = parser.getParsedEnumNames(); final Set<String> parsedFuncNames = parser.getParsedFunctionNames(); + final Set<String> parsedInnerInterfaces = parser.getParsedInnerInterfacesNames(); + final Set<String> parsedInnerClasses = parser.getParsedInnerClassesNames(); if(forInterface) { if(onlyList) { extendedIntfSymbolsOnly.addAll(parsedEnumNames); extendedIntfSymbolsOnly.addAll(parsedFuncNames); + extendedIntfSymbolsOnly.addAll(parsedInnerInterfaces); + extendedIntfSymbolsOnly.addAll(parsedInnerClasses); } else { extendedIntfSymbolsIgnore.addAll(parsedEnumNames); extendedIntfSymbolsIgnore.addAll(parsedFuncNames); + extendedIntfSymbolsIgnore.addAll(parsedInnerInterfaces); + extendedIntfSymbolsIgnore.addAll(parsedInnerClasses); } } if(forImplementation) { if(onlyList) { extendedImplSymbolsOnly.addAll(parsedEnumNames); extendedImplSymbolsOnly.addAll(parsedFuncNames); + extendedImplSymbolsOnly.addAll(parsedInnerInterfaces); + extendedImplSymbolsOnly.addAll(parsedInnerClasses); } else { extendedImplSymbolsIgnore.addAll(parsedEnumNames); extendedImplSymbolsIgnore.addAll(parsedFuncNames); + extendedImplSymbolsIgnore.addAll(parsedInnerInterfaces); + extendedImplSymbolsIgnore.addAll(parsedInnerClasses); } } } diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index d126215..8ed269e 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -1506,11 +1506,17 @@ public class JavaEmitter implements GlueEmitter { LOG.log(INFO, "JavaCallbackInfo: Reusing {0} -> {1}", jcbd.setFuncName, jcbi0); } else { final StringBuilder cbMethodSignature = new StringBuilder(); - javaUnit.emitln(" /** JavaCallback interface: "+jcbd.cbFuncTypeName+" -> "+funcType.toString(jcbd.cbFuncTypeName, false, true)+" */"); - javaUnit.emitln(" public static interface "+cbSimpleClazzName+" {"); - final List<MethodBinding> mbs = generateFunctionInterfaceCode(javaUnit, funcSym, jcbd, cbMethodSignature); - javaUnit.emitln(" }"); - javaUnit.emitln(); + final List<MethodBinding> mbs; + if( !cfg.shouldIgnoreInInterface(jcbd.cbFuncTypeName) ) { + javaUnit.emitln(" /** JavaCallback interface: "+jcbd.cbFuncTypeName+" -> "+funcType.toString(jcbd.cbFuncTypeName, false, true)+" */"); + javaUnit.emitln(" public static interface "+cbSimpleClazzName+" {"); + mbs = generateFunctionInterfaceCode(javaUnit, funcSym, jcbd, cbMethodSignature); + javaUnit.emitln(" }"); + javaUnit.emitln(); + } else { + LOG.log(WARNING, "JavaCallbackInfo: Java Configuration indicate current JavaCallback must be ignored so assume JavaCallback meet presents requirements of {0}", jcbd.setFuncName); + mbs = generateFunctionInterfaceCode(null, funcSym, jcbd, cbMethodSignature); + } if( 1 != mbs.size() ) { throw new UnsupportedOperationException("Multiple bindings generated where only 1 is allowed for func "+funcType.toString(jcbd.cbFuncTypeName, false, true)); } @@ -1520,9 +1526,9 @@ 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, jcbd.cbFuncKeyIndices, - jcbd.setFuncName, jcbd.setFuncUserParamIdx, jcbd.setFuncKeyIndices, - jcbd.userParamClassName, jcbd.customKeyClassName); + funcType, cbFuncBinding, jcbd.cbFuncUserParamIdx, jcbd.cbFuncKeyIndices, + jcbd.setFuncName, jcbd.setFuncUserParamIdx, jcbd.setFuncKeyIndices, + jcbd.userParamClassName, jcbd.customKeyClassName); cfg.setFuncToJavaCallbackMap.put(jcbd.setFuncName, jcbi1); javaCallbackInterfaceMap.put(cbFQClazzName, jcbi1); LOG.log(INFO, "JavaCallbackInfo: Added {0} -> {1}", jcbd.setFuncName, jcbi1); @@ -1568,29 +1574,31 @@ public class JavaEmitter implements GlueEmitter { final boolean useNIOOnly = true; final boolean useNIODirectOnly = true; - for (final MethodBinding binding : bindings) { - // Emit public Java entry point for calling this function pointer - final JavaMethodBindingEmitter emitter = new JavaMethodBindingEmitter(binding, - javaUnit, - cfg.runtimeExceptionType(), - cfg.unsupportedExceptionType(), - false, // emitBody - cfg.tagNativeBinding(), - false, // eraseBufferAndArrayTypes - useNIOOnly, - useNIODirectOnly, - false, // forDirectBufferImplementation - false, // forIndirectBufferAndArrayImplementation - true, // isUnimplemented - true, // isInterface - false, // isNativeMethod - false, // isPrivateNativeMethod - cfg) { - @Override - protected String getBaseIndentString() { return " "; } - }; - emitter.addModifier(JavaMethodBindingEmitter.PUBLIC); - emitter.emit(); + if( null != javaUnit) { + for (final MethodBinding binding : bindings) { + // Emit public Java entry point for calling this function pointer + final JavaMethodBindingEmitter emitter = new JavaMethodBindingEmitter(binding, + javaUnit, + cfg.runtimeExceptionType(), + cfg.unsupportedExceptionType(), + false, // emitBody + cfg.tagNativeBinding(), + false, // eraseBufferAndArrayTypes + useNIOOnly, + useNIODirectOnly, + false, // forDirectBufferImplementation + false, // forIndirectBufferAndArrayImplementation + true, // isUnimplemented + true, // isInterface + false, // isNativeMethod + false, // isPrivateNativeMethod + cfg) { + @Override + protected String getBaseIndentString() { return " "; } + }; + emitter.addModifier(JavaMethodBindingEmitter.PUBLIC); + emitter.emit(); + } } return bindings; } diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2FuncPtr.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest2FuncPtr.java index 915b3eb..595ecbc 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2FuncPtr.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest2FuncPtr.java @@ -28,56 +28,17 @@ package com.jogamp.gluegen.test.junit.generation; -import java.io.IOException; - -import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest2Impl; -import com.jogamp.common.os.NativeLibrary; - -import org.junit.AfterClass; import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import org.junit.FixMethodOrder; -import org.junit.runners.MethodSorters; /** * Test {@link Bindingtest2} with {@link T2_InitializeOptions} instance and function pointer... */ -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class Test2FuncPtr extends BaseClass { - - static NativeLibrary dynamicLookupHelper; - - /** - * Verifies loading of the new library. - */ - @BeforeClass - public static void chapter__TestLoadLibrary() throws Exception { - BindingJNILibLoader.loadBindingtest2(); - dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test2FuncPtr.class.getClassLoader(), true); - Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper); - - Bindingtest2Impl.resetProcAddressTable(dynamicLookupHelper); - } - - /** - * Verifies unloading of the new library. - */ - @AfterClass - public static void chapter0XTestUnloadLibrary() throws Exception { - Assert.assertNotNull(dynamicLookupHelper); - dynamicLookupHelper.close(); - dynamicLookupHelper = null; - } +public class BaseTest2FuncPtr extends BaseClass { /** * Test Bindingtest2 with T2_InitializeOptions instance and function pointer */ - @Test - public void chapter01() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter01(final Bindingtest2 bt2) throws Exception { final T2_InitializeOptions options = T2_InitializeOptions.create(); Assert.assertEquals(true, options.isOverrideThreadAffinityNull()); Assert.assertEquals(true, options.isProductNameNull()); @@ -162,8 +123,4 @@ public class Test2FuncPtr extends BaseClass { Assert.assertEquals(0, options.getCustomFuncB2()); } - public static void main(final String args[]) throws IOException { - final String tstname = Test2FuncPtr.class.getName(); - org.junit.runner.JUnitCore.main(tstname); - } } diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test3PtrStorage.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest3PtrStorage.java index 2bf82a8..f255c31 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test3PtrStorage.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest3PtrStorage.java @@ -28,61 +28,24 @@ package com.jogamp.gluegen.test.junit.generation; -import java.io.IOException; import java.nio.IntBuffer; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.ElementBuffer; -import com.jogamp.common.os.NativeLibrary; -import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest2Impl; -import org.junit.AfterClass; import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import org.junit.FixMethodOrder; -import org.junit.runners.MethodSorters; /** * Test {@link Bindingtest2} with {@link T2_PointerStorage} instance and pointer pointer.. */ -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class Test3PtrStorage extends BaseClass { - - static NativeLibrary dynamicLookupHelper; - - /** - * Verifies loading of the new library. - */ - @BeforeClass - public static void chapter__TestLoadLibrary() throws Exception { - BindingJNILibLoader.loadBindingtest2(); - dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test2FuncPtr.class.getClassLoader(), true); - Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper); - - Bindingtest2Impl.resetProcAddressTable(dynamicLookupHelper); - } - - /** - * Verifies unloading of the new library. - */ - @AfterClass - public static void chapter0XTestUnloadLibrary() throws Exception { - Assert.assertNotNull(dynamicLookupHelper); - dynamicLookupHelper.close(); - dynamicLookupHelper = null; - } - +public class BaseTest3PtrStorage extends BaseClass { /** * Test {@link Bindingtest2} with {@link T2_PointerStorage} instance and pointer pointer */ - @Test - public void chapter01() throws Exception { + public void chapter01(final Bindingtest2 bt2) throws Exception { Assert.assertEquals(false, T2_PointerStorage.usesNativeCode()); - final Bindingtest2 bt2 = new Bindingtest2Impl(); final T2_PointerStorage store = bt2.createT2PointerStorage(); // final T2_PointerStorage store = T2_PointerStorage.create(); final long[] int32PtrArray = store.getInt32PtrArray(0, new long[10], 0, 10); // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 @@ -132,8 +95,4 @@ public class Test3PtrStorage extends BaseClass { bt2.destroyT2PointerStorage(store); } - public static void main(final String args[]) throws IOException { - final String tstname = Test3PtrStorage.class.getName(); - org.junit.runner.JUnitCore.main(tstname); - } } diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test4JavaCallback.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest4JavaCallback.java index 92ab2f6..28e31fd 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test4JavaCallback.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseTest4JavaCallback.java @@ -46,7 +46,6 @@ import com.jogamp.gluegen.test.junit.generation.Bindingtest2.T2_CallbackFunc11; import com.jogamp.gluegen.test.junit.generation.Bindingtest2.T2_CallbackFunc12a; import com.jogamp.gluegen.test.junit.generation.Bindingtest2.T2_CallbackFunc12b; import com.jogamp.gluegen.test.junit.generation.Bindingtest2.T2_CallbackFunc13; -import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest2Impl; import org.junit.AfterClass; import org.junit.Assert; @@ -59,31 +58,7 @@ import org.junit.runners.MethodSorters; /** * Test {@link Bindingtest2} with {@link T2_PointerStorage} instance and pointer pointer.. */ -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class Test4JavaCallback extends BaseClass { - static NativeLibrary dynamicLookupHelper; - - /** - * Verifies loading of the new library. - */ - @BeforeClass - public static void chapter__TestLoadLibrary() throws Exception { - BindingJNILibLoader.loadBindingtest2(); - dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test2FuncPtr.class.getClassLoader(), true); - Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper); - - Bindingtest2Impl.resetProcAddressTable(dynamicLookupHelper); - } - - /** - * Verifies unloading of the new library. - */ - @AfterClass - public static void chapter0XTestUnloadLibrary() throws Exception { - Assert.assertNotNull(dynamicLookupHelper); - dynamicLookupHelper.close(); - dynamicLookupHelper = null; - } +public class BaseTest4JavaCallback extends BaseClass { private static class MyUserParam01 { final long i; @@ -109,10 +84,7 @@ public class Test4JavaCallback extends BaseClass { /** * Test Bindingtest2 with T2_CallbackFunc JavaCallback */ - @Test - public void chapter01() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter01(final Bindingtest2 bt2) throws Exception { final long[] id_res = { -1 }; final String[] msg_res = { null }; final T2_CallbackFunc01 myCallback01 = new T2_CallbackFunc01() { @@ -225,10 +197,7 @@ public class Test4JavaCallback extends BaseClass { * Test Bindingtest2 with ALBUFFERCALLBACKTYPESOFT JavaCallback via alBufferCallback1() * using the default AlBufferCallback1Key class. */ - @Test - public void chapter02() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter02(final Bindingtest2 bt2) throws Exception { final long[] id_res = { -1 }; final ALBUFFERCALLBACKTYPESOFT myCallback01 = new ALBUFFERCALLBACKTYPESOFT() { @Override @@ -477,10 +446,7 @@ public class Test4JavaCallback extends BaseClass { * Test Bindingtest2 with ALBUFFERCALLBACKTYPESOFT JavaCallback via alBufferCallback1() * using our custom CustomAlBufferCallback1Key class. */ - @Test - public void chapter03() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter03(final Bindingtest2 bt2) throws Exception { final long[] id_res = { -1 }; final ALBUFFERCALLBACKTYPESOFT myCallback01 = new ALBUFFERCALLBACKTYPESOFT() { @Override @@ -682,10 +648,7 @@ public class Test4JavaCallback extends BaseClass { * Test in depth lifecycle of Bindingtest2 with ALBUFFERCALLBACKTYPESOFT JavaCallback via alBufferCallback1() * using the default AlBufferCallback1Key class. */ - @Test - public void chapter04() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter04(final Bindingtest2 bt2) throws Exception { final long[] id_res = { -1 }; final ALBUFFERCALLBACKTYPESOFT myCallback01 = new ALBUFFERCALLBACKTYPESOFT() { @Override @@ -938,10 +901,7 @@ public class Test4JavaCallback extends BaseClass { * Test Bindingtest2 with ALEVENTPROCSOFT JavaCallback * on alEventCallback0(..) having the 'Object userParam` as single key. */ - @Test - public void chapter05a() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter05a(final Bindingtest2 bt2) throws Exception { final int[] id_res = { -1 }; final String[] msg_res = { null }; final ALEVENTPROCSOFT myCallback01 = new ALEVENTPROCSOFT() { @@ -1061,10 +1021,7 @@ public class Test4JavaCallback extends BaseClass { * Test Bindingtest2 with ALEVENTPROCSOFT JavaCallback * on alEventCallback0(..) having the 'Object userParam` and `int object` as keys. */ - @Test - public void chapter05b() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter05b(final Bindingtest2 bt2) throws Exception { final int[] id_res = { -1 }; final String[] msg_res = { null }; final ALEVENTPROCSOFT myCallback01 = new ALEVENTPROCSOFT() { @@ -1196,10 +1153,7 @@ public class Test4JavaCallback extends BaseClass { * Test Bindingtest2 with T2_CallbackFunc11 JavaCallback via MessageCallback11a() * using the default MessageCallback11aKey class. */ - @Test - public void chapter11a() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter11a(final Bindingtest2 bt2) throws Exception { final long userParam01Ptr = 0xAFFEBEAFC0FFEEL; final long userParam02Ptr = 0xC0FFEEDEADBEAFL; @@ -1420,10 +1374,7 @@ public class Test4JavaCallback extends BaseClass { * Test Bindingtest2 with T2_CallbackFunc11 JavaCallback via MessageCallback11b() * using the default MessageCallback11bKey class. */ - @Test - public void chapter11b() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter11b(final Bindingtest2 bt2) throws Exception { final long userParam01Ptr = 0xAFFEBEAFC0FFEEL; final long userParam02Ptr = 0xC0FFEEDEADBEAFL; @@ -1617,10 +1568,7 @@ public class Test4JavaCallback extends BaseClass { /** * Test Bindingtest2 with T2_CallbackFunc12a JavaCallback via SetLogCallBack12a() */ - @Test - public void chapter12a() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter12a(final Bindingtest2 bt2) throws Exception { final AtomicReference<T2_Callback12LogMessage> messageExpected = new AtomicReference<>(null); final AtomicReference<String> messageReturned = new AtomicReference<>(null); final T2_CallbackFunc12a logCallBack = new T2_CallbackFunc12a() { @@ -1672,10 +1620,7 @@ public class Test4JavaCallback extends BaseClass { /** * Test Bindingtest2 with T2_CallbackFunc12a JavaCallback via SetLogCallBack12a() */ - @Test - public void chapter12b() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter12b(final Bindingtest2 bt2) throws Exception { final AtomicReference<T2_Callback12LogMessage> expMessage = new AtomicReference<>(null); final AtomicReference<String> hasReturnedMsg = new AtomicReference<>(null); final T2_CallbackFunc12b logCallBack = new T2_CallbackFunc12b() { @@ -1740,10 +1685,7 @@ public class Test4JavaCallback extends BaseClass { /** * Test Bindingtest2 with T2_CallbackFunc13 JavaCallback via MessageCallback13() */ - @Test - public void chapter13() throws Exception { - final Bindingtest2 bt2 = new Bindingtest2Impl(); - + public void chapter13(final Bindingtest2 bt2) throws Exception { // // Key 1 // @@ -1907,8 +1849,4 @@ public class Test4JavaCallback extends BaseClass { static private String toHexString(final int v) { return "0x"+Integer.toHexString(v); } - public static void main(final String args[]) throws IOException { - final String tstname = Test4JavaCallback.class.getName(); - org.junit.runner.JUnitCore.main(tstname); - } } diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BindingJNILibLoader.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BindingJNILibLoader.java index 67f4918..8180204 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/BindingJNILibLoader.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BindingJNILibLoader.java @@ -55,11 +55,21 @@ public class BindingJNILibLoader extends JNILibLoaderBase { }); } - public static void loadBindingtest2() { + public static void loadBindingtest2p1() { SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { - loadLibrary("Bindingtest2", null, true, BindingJNILibLoader.class.getClassLoader()); + loadLibrary("Bindingtest2p1", null, true, BindingJNILibLoader.class.getClassLoader()); + return null; + } + }); + } + + public static void loadBindingtest2p2() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { + @Override + public Object run() { + loadLibrary("Bindingtest2p2", null, true, BindingJNILibLoader.class.getClassLoader()); return null; } }); diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2p1FuncPtr.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2p1FuncPtr.java new file mode 100644 index 0000000..82247ce --- /dev/null +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2p1FuncPtr.java @@ -0,0 +1,75 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.gluegen.test.junit.generation; + +import com.jogamp.common.os.NativeLibrary; +import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest2p1Impl; +import org.junit.*; +import org.junit.runners.MethodSorters; + +import java.io.IOException; + +/** + * Test {@link Bindingtest2p1} with {@link T2_InitializeOptions} instance and function pointer... + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class Test2p1FuncPtr extends BaseTest2FuncPtr { + + static NativeLibrary dynamicLookupHelper; + + /** + * Verifies loading of the new library. + */ + @BeforeClass + public static void chapter__TestLoadLibrary() throws Exception { + BindingJNILibLoader.loadBindingtest2p1(); + dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test2p1FuncPtr.class.getClassLoader(), true); + Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper); + } + + /** + * Verifies unloading of the new library. + */ + @AfterClass + public static void chapter0XTestUnloadLibrary() throws Exception { + Assert.assertNotNull(dynamicLookupHelper); + dynamicLookupHelper.close(); + dynamicLookupHelper = null; + } + + @Test + public void chapter01() throws Exception { + chapter01(new Bindingtest2p1Impl()); + } + + public static void main(final String args[]) throws IOException { + final String tstname = Test2p1FuncPtr.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } +} diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2p2FuncPtr.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2p2FuncPtr.java new file mode 100644 index 0000000..6a553d8 --- /dev/null +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2p2FuncPtr.java @@ -0,0 +1,77 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.gluegen.test.junit.generation; + +import com.jogamp.common.os.NativeLibrary; +import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest2p2Impl; +import org.junit.*; +import org.junit.runners.MethodSorters; + +import java.io.IOException; + +/** + * Test {@link Bindingtest2p1} with {@link T2_InitializeOptions} instance and function pointer... + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class Test2p2FuncPtr extends BaseTest2FuncPtr { + + static NativeLibrary dynamicLookupHelper; + + /** + * Verifies loading of the new library. + */ + @BeforeClass + public static void chapter__TestLoadLibrary() throws Exception { + BindingJNILibLoader.loadBindingtest2p2(); + dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test2p2FuncPtr.class.getClassLoader(), true); + Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper); + + Bindingtest2p2Impl.resetProcAddressTable(dynamicLookupHelper); + } + + /** + * Verifies unloading of the new library. + */ + @AfterClass + public static void chapter0XTestUnloadLibrary() throws Exception { + Assert.assertNotNull(dynamicLookupHelper); + dynamicLookupHelper.close(); + dynamicLookupHelper = null; + } + + @Test + public void chapter01() throws Exception { + chapter01(new Bindingtest2p2Impl()); + } + + public static void main(final String args[]) throws IOException { + final String tstname = Test2p2FuncPtr.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } +} diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test3p1PtrStorage.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test3p1PtrStorage.java new file mode 100644 index 0000000..bbe7986 --- /dev/null +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test3p1PtrStorage.java @@ -0,0 +1,75 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.gluegen.test.junit.generation; + +import com.jogamp.common.os.NativeLibrary; +import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest2p1Impl; +import org.junit.*; +import org.junit.runners.MethodSorters; + +import java.io.IOException; + +/** + * Test {@link Bindingtest2p1} with {@link T2_PointerStorage} instance and pointer pointer.. + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class Test3p1PtrStorage extends BaseTest3PtrStorage { + + static NativeLibrary dynamicLookupHelper; + + /** + * Verifies loading of the new library. + */ + @BeforeClass + public static void chapter__TestLoadLibrary() throws Exception { + BindingJNILibLoader.loadBindingtest2p1(); + dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test3p1PtrStorage.class.getClassLoader(), true); + Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper); + } + + /** + * Verifies unloading of the new library. + */ + @AfterClass + public static void chapter0XTestUnloadLibrary() throws Exception { + Assert.assertNotNull(dynamicLookupHelper); + dynamicLookupHelper.close(); + dynamicLookupHelper = null; + } + + @Test + public void chapter01() throws Exception { + chapter01(new Bindingtest2p1Impl()); + } + + public static void main(final String args[]) throws IOException { + final String tstname = Test3p1PtrStorage.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } +} diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test3p2PtrStorage.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test3p2PtrStorage.java new file mode 100644 index 0000000..cd61d2c --- /dev/null +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test3p2PtrStorage.java @@ -0,0 +1,77 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.gluegen.test.junit.generation; + +import com.jogamp.common.os.NativeLibrary; +import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest2p2Impl; +import org.junit.*; +import org.junit.runners.MethodSorters; + +import java.io.IOException; + +/** + * Test {@link Bindingtest2p2} with {@link T2_PointerStorage} instance and pointer pointer.. + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class Test3p2PtrStorage extends BaseTest3PtrStorage { + + static NativeLibrary dynamicLookupHelper; + + /** + * Verifies loading of the new library. + */ + @BeforeClass + public static void chapter__TestLoadLibrary() throws Exception { + BindingJNILibLoader.loadBindingtest2p2(); + dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test3p2PtrStorage.class.getClassLoader(), true); + Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper); + + Bindingtest2p2Impl.resetProcAddressTable(dynamicLookupHelper); + } + + /** + * Verifies unloading of the new library. + */ + @AfterClass + public static void chapter0XTestUnloadLibrary() throws Exception { + Assert.assertNotNull(dynamicLookupHelper); + dynamicLookupHelper.close(); + dynamicLookupHelper = null; + } + + @Test + public void chapter01() throws Exception { + chapter01(new Bindingtest2p2Impl()); + } + + public static void main(final String args[]) throws IOException { + final String tstname = Test3p2PtrStorage.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } +} diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test4p1JavaCallback.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test4p1JavaCallback.java new file mode 100644 index 0000000..b07faa7 --- /dev/null +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test4p1JavaCallback.java @@ -0,0 +1,125 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.gluegen.test.junit.generation; + +import com.jogamp.common.os.NativeLibrary; +import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest2p1Impl; +import org.junit.*; +import org.junit.runners.MethodSorters; + +import java.io.IOException; + +/** + * Test {@link Bindingtest2p1} with {@link T2_PointerStorage} instance and pointer pointer.. + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class Test4p1JavaCallback extends BaseTest4JavaCallback { + + static NativeLibrary dynamicLookupHelper; + + /** + * Verifies loading of the new library. + */ + @BeforeClass + public static void chapter__TestLoadLibrary() throws Exception { + BindingJNILibLoader.loadBindingtest2p1(); + dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test4p1JavaCallback.class.getClassLoader(), true); + Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper); + } + + /** + * Verifies unloading of the new library. + */ + @AfterClass + public static void chapter0XTestUnloadLibrary() throws Exception { + Assert.assertNotNull(dynamicLookupHelper); + dynamicLookupHelper.close(); + dynamicLookupHelper = null; + } + + @Test + public void chapter01() throws Exception { + chapter01(new Bindingtest2p1Impl()); + } + + @Test + public void chapter02() throws Exception { + chapter02(new Bindingtest2p1Impl()); + } + + @Test + public void chapter03() throws Exception { + chapter03(new Bindingtest2p1Impl()); + } + + @Test + public void chapter04() throws Exception { + chapter04(new Bindingtest2p1Impl()); + } + + @Test + public void chapter05a() throws Exception { + chapter05a(new Bindingtest2p1Impl()); + } + + @Test + public void chapter05b() throws Exception { + chapter05b(new Bindingtest2p1Impl()); + } + + @Test + public void chapter11a() throws Exception { + chapter11a(new Bindingtest2p1Impl()); + } + + @Test + public void chapter11b() throws Exception { + chapter11b(new Bindingtest2p1Impl()); + } + + @Test + public void chapter12a() throws Exception { + chapter12a(new Bindingtest2p1Impl()); + } + + @Test + public void chapter12b() throws Exception { + chapter12b(new Bindingtest2p1Impl()); + } + + @Test + public void chapter13() throws Exception { + chapter13(new Bindingtest2p1Impl()); + } + + public static void main(final String args[]) throws IOException { + final String tstname = Test4p1JavaCallback.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } +} diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test4p2JavaCallback.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test4p2JavaCallback.java new file mode 100644 index 0000000..3f94565 --- /dev/null +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test4p2JavaCallback.java @@ -0,0 +1,127 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.gluegen.test.junit.generation; + +import com.jogamp.common.os.NativeLibrary; +import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest2p2Impl; +import org.junit.*; +import org.junit.runners.MethodSorters; + +import java.io.IOException; + +/** + * Test {@link Bindingtest2p2} with {@link T2_PointerStorage} instance and pointer pointer.. + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class Test4p2JavaCallback extends BaseTest4JavaCallback { + + static NativeLibrary dynamicLookupHelper; + + /** + * Verifies loading of the new library. + */ + @BeforeClass + public static void chapter__TestLoadLibrary() throws Exception { + BindingJNILibLoader.loadBindingtest2p1(); + dynamicLookupHelper = NativeLibrary.open("test2", false, false, Test4p2JavaCallback.class.getClassLoader(), true); + Assert.assertNotNull("NativeLibrary.open(test2) failed", dynamicLookupHelper); + + Bindingtest2p2Impl.resetProcAddressTable(dynamicLookupHelper); + } + + /** + * Verifies unloading of the new library. + */ + @AfterClass + public static void chapter0XTestUnloadLibrary() throws Exception { + Assert.assertNotNull(dynamicLookupHelper); + dynamicLookupHelper.close(); + dynamicLookupHelper = null; + } + + @Test + public void chapter01() throws Exception { + chapter01(new Bindingtest2p2Impl()); + } + + @Test + public void chapter02() throws Exception { + chapter02(new Bindingtest2p2Impl()); + } + + @Test + public void chapter03() throws Exception { + chapter03(new Bindingtest2p2Impl()); + } + + @Test + public void chapter04() throws Exception { + chapter04(new Bindingtest2p2Impl()); + } + + @Test + public void chapter05a() throws Exception { + chapter05a(new Bindingtest2p2Impl()); + } + + @Test + public void chapter05b() throws Exception { + chapter05b(new Bindingtest2p2Impl()); + } + + @Test + public void chapter11a() throws Exception { + chapter11a(new Bindingtest2p2Impl()); + } + + @Test + public void chapter11b() throws Exception { + chapter11b(new Bindingtest2p2Impl()); + } + + @Test + public void chapter12a() throws Exception { + chapter12a(new Bindingtest2p2Impl()); + } + + @Test + public void chapter12b() throws Exception { + chapter12b(new Bindingtest2p2Impl()); + } + + @Test + public void chapter13() throws Exception { + chapter13(new Bindingtest2p2Impl()); + } + + public static void main(final String args[]) throws IOException { + final String tstname = Test4p2JavaCallback.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } +} diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test2-common.cfg index 44b6468..d187577 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.cfg +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2-common.cfg @@ -1,24 +1,3 @@ -Package com.jogamp.gluegen.test.junit.generation -JavaClass Bindingtest2 -Style InterfaceAndImpl -JavaOutputDir classes -NativeOutputDir native - -# Use a ProcAddressTable so we dynamically look up the routines -EmitProcAddressTable true -ProcAddressTableClassName Bindingtest2ProcAddressTable -GetProcAddressTableExpr _table -ProcAddressNameExpr PFN $UPPERCASE({0}) PROC - -# Force all of the methods to be emitted using dynamic linking so we -# don't need to link against any emulation library on the desktop or -# depend on the presence of an import library for a particular device -ForceProcAddressGen __ALL__ - -# Also force the calling conventions of the locally generated function -# pointer typedefs for these routines to MYAPIENTRY -# LocalProcAddressCallingConvention __ALL__ MYAPIENTRY - # Opaque long void* # Undefined struct forward declaration, implementation secret: 'struct T2_UndefStruct;' @@ -127,7 +106,7 @@ JavaCallbackKey alBufferCallback0 0 ALBUFFERCALLBACKTYPESOFT 0 # - `boolean isAlBufferCallback1Mapped(int buffer)` queries whether `alBufferCallback1` is mapped to `buffer`. # - `ALBUFFERCALLBACKTYPESOFT getAlBufferCallback1(int buffer)` returns the `buffer` mapped ALEVENTPROCSOFT, null if not mapped # - `ALCcontext getAlBufferCallback1UserParam(int buffer)` returns the `buffer` mapped `userptr` object, null if not mapped -JavaCallbackDef alBufferCallback1 0 ALBUFFERCALLBACKTYPESOFT 1 ALCcontext com.jogamp.gluegen.test.junit.generation.Test4JavaCallback.CustomAlBufferCallback1Key +JavaCallbackDef alBufferCallback1 0 ALBUFFERCALLBACKTYPESOFT 1 ALCcontext com.jogamp.gluegen.test.junit.generation.BaseTest4JavaCallback.CustomAlBufferCallback1Key JavaCallbackKey alBufferCallback1 1 ALBUFFERCALLBACKTYPESOFT 0 # # End JavaCallback @@ -168,7 +147,7 @@ IncludeAs CustomJavaCode Bindingtest2Impl test2-CustomJavaImplCode.java.stub # typedef void ( * T2_CallbackFunc11)(size_t id, const T2_Callback11UserType* usrParam); # void MessageCallback11a(size_t id /* key */, T2_CallbackFunc11 cbFunc, const T2_Callback11UserType* usrParam); # void MessageCallback11aInject(size_t id); -#JavaCallbackDef MessageCallback11a T2_CallbackFunc11 1 Object com.jogamp.gluegen.test.junit.generation.Test4JavaCallback.CustomMessageCallback11Key +#JavaCallbackDef MessageCallback11a T2_CallbackFunc11 1 Object com.jogamp.gluegen.test.junit.generation.BaseTest4JavaCallback.CustomMessageCallback11Key JavaCallbackDef MessageCallback11a 2 T2_CallbackFunc11 1 JavaCallbackKey MessageCallback11a 0 T2_CallbackFunc11 0 # @@ -227,10 +206,5 @@ Import com.jogamp.gluegen.test.junit.generation.T2_Callback11UserType Import com.jogamp.gluegen.test.junit.generation.T2_Callback12LogMessage Import com.jogamp.gluegen.test.junit.generation.T2_Callback13UserType Import com.jogamp.gluegen.test.junit.generation.T2_Callback13UserKey1 -Import com.jogamp.gluegen.test.junit.generation.Test4JavaCallback.ALCcontext - -CustomJavaCode Bindingtest2Impl private static Bindingtest2ProcAddressTable _table = new Bindingtest2ProcAddressTable(); -CustomJavaCode Bindingtest2Impl public static void resetProcAddressTable(DynamicLookupHelper lookup) { -CustomJavaCode Bindingtest2Impl _table.reset(lookup); -CustomJavaCode Bindingtest2Impl } +Import com.jogamp.gluegen.test.junit.generation.BaseTest4JavaCallback.ALCcontext diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2-gluegen.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test2-gluegen.cfg new file mode 100644 index 0000000..6531a7b --- /dev/null +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2-gluegen.cfg @@ -0,0 +1,11 @@ +Package com.jogamp.gluegen.test.junit.generation +Style AllStatic +JavaClass Bindingtest2 +Style InterfaceOnly +JavaOutputDir classes +NativeOutputDir native + +Include test2-common.cfg + + + diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2p1.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test2p1.cfg new file mode 100644 index 0000000..58dc44e --- /dev/null +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2p1.cfg @@ -0,0 +1,16 @@ +Package com.jogamp.gluegen.test.junit.generation +JavaClass Bindingtest2p1 +Style InterfaceAndImpl +JavaOutputDir classes +NativeOutputDir native + +Extends Bindingtest2p1 Bindingtest2 + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/gluegen/test/junit/generation/Bindingtest2.java + +Include test2-common.cfg + +Import com.jogamp.gluegen.test.junit.generation.Bindingtest2 +Import com.jogamp.gluegen.test.junit.generation.Bindingtest2p1 + + diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2p2.cfg b/src/junit/com/jogamp/gluegen/test/junit/generation/test2p2.cfg new file mode 100644 index 0000000..4aecb5f --- /dev/null +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2p2.cfg @@ -0,0 +1,36 @@ +Package com.jogamp.gluegen.test.junit.generation +JavaClass Bindingtest2p2 +Style InterfaceAndImpl +JavaOutputDir classes +NativeOutputDir native + +Extends Bindingtest2p2 Bindingtest2 + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/gluegen/test/junit/generation/Bindingtest2.java + +# Use a ProcAddressTable so we dynamically look up the routines +EmitProcAddressTable true +ProcAddressTableClassName Bindingtest2p2ProcAddressTable +GetProcAddressTableExpr _table +ProcAddressNameExpr PFN $UPPERCASE({0}) PROC + +# Force all of the methods to be emitted using dynamic linking so we +# don't need to link against any emulation library on the desktop or +# depend on the presence of an import library for a particular device +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to MYAPIENTRY +# LocalProcAddressCallingConvention __ALL__ MYAPIENTRY + +Include test2-common.cfg + +Import com.jogamp.gluegen.test.junit.generation.Bindingtest2 +Import com.jogamp.gluegen.test.junit.generation.Bindingtest2p2 + +CustomJavaCode Bindingtest2p2Impl private static Bindingtest2p2ProcAddressTable _table = new Bindingtest2p2ProcAddressTable(); +CustomJavaCode Bindingtest2p2Impl public static void resetProcAddressTable(DynamicLookupHelper lookup) { +CustomJavaCode Bindingtest2Ip2mpl _table.reset(lookup); +CustomJavaCode Bindingtest2p2Impl } + + |