diff options
Diffstat (limited to 'src/java/com/jogamp')
15 files changed, 289 insertions, 191 deletions
diff --git a/src/java/com/jogamp/gluegen/ASTLocusTag.java b/src/java/com/jogamp/gluegen/ASTLocusTag.java index babe3df..1e0349d 100644 --- a/src/java/com/jogamp/gluegen/ASTLocusTag.java +++ b/src/java/com/jogamp/gluegen/ASTLocusTag.java @@ -48,26 +48,40 @@ public class ASTLocusTag { } public String toString() { - return toString(true); + return toString(new StringBuilder(), null).toString(); } - public String toString(final boolean includeText) { - final StringBuffer buf = new StringBuffer(); + public StringBuilder toString(final StringBuilder sb, final String level) { + boolean preCol = false; if (source != null) { - buf.append(source).append(":"); + sb.append(source); + preCol = true; } if (line != -1) { - buf.append(line); + if( preCol ) { + sb.append(":"); + } else { + sb.append("line "); + } + sb.append(line); if (column != -1) { - buf.append(":" + column); + sb.append(":" + column); + } + preCol = true; + } + if( null != level && level.length()>0 ) { + if( preCol ) { + sb.append(": "); } + sb.append(level); + preCol = true; } - if( includeText && null != text && text.length()>0 ) { - if( buf.length() > 0 ) { - buf.append(": "); + if( null != text && text.length()>0 ) { + if( preCol ) { + sb.append(": "); } - buf.append("text '").append(text).append("'"); + sb.append("text '").append(text).append("'"); } - return buf.toString(); + return sb; } /** diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java index 10a9648..ed8c2d0 100644 --- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java @@ -602,7 +602,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { // // Note that we properly handle only the case of an array of // compound type wrappers in emitBodyVariablePostCallCleanup below - if (!isBaseTypeConst(cArgType) && + if (!cArgType.isBaseTypeConst() && !javaArgType.isArrayOfCompoundTypeWrappers()) { // FIXME: if the arg type is non-const, the sematics might be that // the function modifies the argument -- we don't yet support @@ -663,7 +663,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { writer, convName+"_copy", cArgElementType.getCName(), - isBaseTypeConst(cArgType), + cArgType.isBaseTypeConst(), arrayLenName, "Could not allocate buffer for copying data in argument \\\""+javaArgName+"\\\""); @@ -729,7 +729,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { writer, convName+"_copy[_copyIndex]", cArgElementType2.getCName(), // assumes cArgPtrType is ptr-to-ptr-to-primitive !! - isBaseTypeConst(cArgType), + cArgType.isBaseTypeConst(), "(*env)->GetArrayLength(env, _tmpObj)", "Could not allocate buffer during copying of data in argument \\\""+javaArgName+"\\\""); // FIXME: copy the data (use matched Get/ReleasePrimitiveArrayCritical() calls) @@ -791,7 +791,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { writer.println(" if ( JNI_FALSE == " + isNIOArgName(i) + " && NULL != " + javaArgName + " ) {"); // Release array - final String modeFlag = isBaseTypeConst(cArgType) ? "JNI_ABORT" : "0" ; + final String modeFlag = cArgType.isBaseTypeConst() ? "JNI_ABORT" : "0" ; writer.print(" (*env)->ReleasePrimitiveArrayCritical(env, " + javaArgName + ", " + convName + ", "+modeFlag+");"); } else { writer.println(" if ( NULL != " + javaArgName + " ) {"); @@ -802,7 +802,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { // // FIXME: should factor out this whole block of code into a separate // method for clarity and maintenance purposes - if (!isBaseTypeConst(cArgType)) { + if (!cArgType.isBaseTypeConst()) { // FIXME: handle any cleanup from treatment of non-const args, // assuming they were treated differently in // emitBodyVariablePreCallSetup() (see the similar section in that @@ -1080,7 +1080,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { final String wmsg = "Assumed return size of equivalent C return type"; writer.println("sizeof(" + cReturnType.getCName() + ") ); // WARNING: "+wmsg); mode = 99; - LOG.warning( + LOG.warning(binding.getCSymbol().getASTLocusTag(), "No capacity specified for java.nio.Buffer return " + "value for function \"" + binding.getName() + "\". " + wmsg + " (sizeof(" + cReturnType.getCName() + ")): " + binding); } @@ -1482,12 +1482,12 @@ public class CMethodBindingEmitter extends FunctionEmitter { if (cPtrType != null) { cElementTypeName = cPtrType.getTargetType().asPointer().getCName(); } - if (isBaseTypeConst(cType)) { + if (cType.isBaseTypeConst()) { writer.print("const "); } writer.print(cElementTypeName+" *"); } else { - if (isBaseTypeConst(cType)) { + if (cType.isBaseTypeConst()) { writer.print("const "); } writer.print(ptrTypeString); diff --git a/src/java/com/jogamp/gluegen/FunctionEmitter.java b/src/java/com/jogamp/gluegen/FunctionEmitter.java index 5655e0e..2009c9f 100644 --- a/src/java/com/jogamp/gluegen/FunctionEmitter.java +++ b/src/java/com/jogamp/gluegen/FunctionEmitter.java @@ -80,25 +80,6 @@ public abstract class FunctionEmitter { public boolean isInterface() { return isInterfaceVal; } - /** - * Checks the base type of pointer-to-pointer, pointer, array or plain for const-ness. - * <p> - * Note: Implementation walks down to the base type and returns it's const-ness. - * Intermediate 'const' qualifier are not considered, e.g. const pointer. - * </p> - */ - protected final boolean isBaseTypeConst(final Type type) { - if ( 2 == type.pointerDepth() ) { - return type.asPointer().getTargetType().asPointer().getTargetType().isConst(); - } else if ( 1 == type.pointerDepth() ) { - return type.asPointer().getTargetType().isConst(); - } else if( type.isArray() ) { - return type.asArray().getBaseElementType().isConst(); - } else { - return type.isConst(); - } - } - public PrintWriter getDefaultOutput() { return defaultOutput; } public void addModifiers(final Iterator<EmissionModifier> mi) { diff --git a/src/java/com/jogamp/gluegen/GlueGenException.java b/src/java/com/jogamp/gluegen/GlueGenException.java index e8e06ec..473f99a 100644 --- a/src/java/com/jogamp/gluegen/GlueGenException.java +++ b/src/java/com/jogamp/gluegen/GlueGenException.java @@ -81,18 +81,12 @@ public class GlueGenException extends JogampRuntimeException { } public String toString() { - final StringBuffer buf = new StringBuffer(); + final StringBuilder sb = new StringBuilder(256); if (null != locus) { - buf.append(locus.toString(false)).append(": error: "); - if( null != locus.text && locus.text.length()>0 ) { - buf.append("text '").append(locus.text).append("': "); - } + locus.toString(sb, "error").append(": "); } - buf.append(getLocalizedMessage()); - final String message = buf.toString(); - - final String className = getClass().getSimpleName(); - return null != message ? className + ": " + message : className; + sb.append(getClass().getSimpleName()).append(": ").append(getLocalizedMessage()); + return sb.toString(); } } diff --git a/src/java/com/jogamp/gluegen/JavaConfiguration.java b/src/java/com/jogamp/gluegen/JavaConfiguration.java index e1bdffd..8f27f69 100644 --- a/src/java/com/jogamp/gluegen/JavaConfiguration.java +++ b/src/java/com/jogamp/gluegen/JavaConfiguration.java @@ -40,6 +40,7 @@ package com.jogamp.gluegen; +import com.jogamp.gluegen.ASTLocusTag.ASTLocusTagProvider; import com.jogamp.gluegen.JavaEmitter.EmissionStyle; import com.jogamp.gluegen.JavaEmitter.MethodAccess; import com.jogamp.gluegen.Logging.LoggerIf; @@ -829,6 +830,7 @@ public class JavaConfiguration { public boolean shouldIgnoreInInterface(final AliasedSymbol symbol) { return shouldIgnoreInInterface_Int(symbol); } + public static <K,V> V oneInMap(final Map<K, V> map, final Set<K> symbols) { if( null != map && map.size() > 0 && null != symbols && symbols.size() > 0 ) { @@ -863,6 +865,15 @@ public class JavaConfiguration { } return false; } + protected static ASTLocusTag getASTLocusTag(final AliasedSymbol s) { + if( s instanceof ASTLocusTagProvider ) { + return ((ASTLocusTagProvider)s).getASTLocusTag(); + } else { + return null; + } + } + + protected final boolean shouldIgnoreInInterface_Int(final AliasedSymbol symbol) { if( GlueGen.debug() ) { logIgnoresOnce(); @@ -875,14 +886,14 @@ public class JavaConfiguration { oneInSet(extendedIntfSymbolsIgnore, aliases) ) { - LOG.log(INFO, "Ignore Intf ignore (one): {0}", symbol.getAliasedString()); + LOG.log(INFO, getASTLocusTag(symbol), "Ignore Intf ignore (one): {0}", symbol.getAliasedString()); return true; } // Simple case-2; the entire symbol (orig and renamed) is _not_ in the not-empty interface only table if ( !extendedIntfSymbolsOnly.isEmpty() && !extendedIntfSymbolsOnly.contains( name ) && !oneInSet(extendedIntfSymbolsOnly, aliases) ) { - LOG.log(INFO, "Ignore Intf !extended (all): {0}", symbol.getAliasedString()); + LOG.log(INFO, getASTLocusTag(symbol), "Ignore Intf !extended (all): {0}", symbol.getAliasedString()); return true; } return shouldIgnoreInImpl_Int(symbol); @@ -904,6 +915,7 @@ public class JavaConfiguration { public boolean shouldIgnoreInImpl(final AliasedSymbol symbol) { return shouldIgnoreInImpl_Int(symbol); } + protected final boolean shouldIgnoreInImpl_Int(final AliasedSymbol symbol) { final String name = symbol.getName(); final Set<String> aliases = symbol.getAliasedNames(); @@ -913,14 +925,14 @@ public class JavaConfiguration { oneInSet(extendedImplSymbolsIgnore, aliases) ) { - LOG.log(INFO, "Ignore Impl ignore (one): {0}", symbol.getAliasedString()); + LOG.log(INFO, getASTLocusTag(symbol), "Ignore Impl ignore (one): {0}", symbol.getAliasedString()); return true; } // Simple case-2; the entire symbol (orig and renamed) is _not_ in the not-empty interface only table if ( !extendedImplSymbolsOnly.isEmpty() && !extendedImplSymbolsOnly.contains( name ) && !oneInSet(extendedImplSymbolsOnly, aliases) ) { - LOG.log(INFO, "Ignore Impl !extended (all): {0}", symbol.getAliasedString()); + LOG.log(INFO, getASTLocusTag(symbol), "Ignore Impl !extended (all): {0}", symbol.getAliasedString()); return true; } @@ -929,7 +941,7 @@ public class JavaConfiguration { for (final Pattern ignoreRegexp : ignores) { final Matcher matcher = ignoreRegexp.matcher(name); if ( matcher.matches() || onePatternMatch(ignoreRegexp, aliases) ) { - LOG.log(INFO, "Ignore Impl RegEx: {0}", symbol.getAliasedString()); + LOG.log(INFO, getASTLocusTag(symbol), "Ignore Impl RegEx: {0}", symbol.getAliasedString()); return true; } } @@ -944,7 +956,7 @@ public class JavaConfiguration { // Special case as this is most often likely to be the case. // Unignores are not used very often. if(unignores.isEmpty()) { - LOG.log(INFO, "Ignore Impl unignores==0: {0} -> {1}", symbol.getAliasedString(), name); + LOG.log(INFO, getASTLocusTag(symbol), "Ignore Impl unignores==0: {0} -> {1}", symbol.getAliasedString(), name); return true; } boolean unignoreFound = false; @@ -957,7 +969,7 @@ public class JavaConfiguration { } if (!unignoreFound) { - LOG.log(INFO, "Ignore Impl !unignore: {0} -> {1}", symbol.getAliasedString(), name); + LOG.log(INFO, getASTLocusTag(symbol), "Ignore Impl !unignore: {0} -> {1}", symbol.getAliasedString(), name); return true; } } diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 2e534b3..8b571c7 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -478,7 +478,7 @@ public class JavaEmitter implements GlueEmitter { // Check to see whether this function should be ignored if ( !cfg.shouldIgnoreInImpl(cFunc) ) { methodBindingEmitters.addAll(generateMethodBindingEmitters(methodBindingSet, cFunc)); - LOG.log(INFO, "Non-Ignored Impl[{0}]: {1}", i++, cFunc.getAliasedString()); + LOG.log(INFO, cFunc.getASTLocusTag(), "Non-Ignored Impl[{0}]: {1}", i++, cFunc.getAliasedString()); } } @@ -493,7 +493,7 @@ public class JavaEmitter implements GlueEmitter { if ( !emitter.isInterface() || !cfg.shouldIgnoreInInterface(cFunc) ) { emitter.emit(); emitter.getDefaultOutput().println(); // put newline after method body - LOG.log(INFO, "Non-Ignored Intf[{0}]: {1}", i++, cFunc.getAliasedString()); + LOG.log(INFO, cFunc.getASTLocusTag(), "Non-Ignored Intf[{0}]: {1}", i++, cFunc.getAliasedString()); } } catch (final Exception e) { throw new RuntimeException( @@ -575,7 +575,7 @@ public class JavaEmitter implements GlueEmitter { if( !requiresStaticInitialization ) { requiresStaticInitialization = binding.signatureRequiresStaticInitialization(); if( requiresStaticInitialization ) { - LOG.log(INFO, "StaticInit Trigger.1 \"{0}\"", binding); + LOG.log(INFO, binding.getCSymbol().getASTLocusTag(), "StaticInit Trigger.1 \"{0}\"", binding); } } @@ -637,7 +637,7 @@ public class JavaEmitter implements GlueEmitter { if( !requiresStaticInitialization ) { requiresStaticInitialization = binding.signatureRequiresStaticInitialization(); if( requiresStaticInitialization ) { - LOG.log(INFO, "StaticInit Trigger.2 \"{0}\"", binding); + LOG.log(INFO, binding.getCSymbol().getASTLocusTag(), "StaticInit Trigger.2 \"{0}\"", binding); } } @@ -882,20 +882,24 @@ public class JavaEmitter implements GlueEmitter { if ( null == structCTypeName ) { final String structName = structCType.getStructName(); if ( null != structName && cfg.shouldIgnoreInInterface(structName) ) { - LOG.log(INFO, "skipping emission of unnamed ignored struct \"{0}\": {1}", structName, structCType.getDebugString()); + LOG.log(INFO, structCType.getASTLocusTag(), + "skipping emission of unnamed ignored struct \"{0}\": {1}", structName, structCType.getDebugString()); return; } else { final String d1 = null != typedefed ? typedefed.getDebugString() : null; - LOG.log(INFO, "skipping emission of unnamed struct {0}, typedef {1} ", structCType.getDebugString(), d1); + LOG.log(INFO, structCType.getASTLocusTag(), + "skipping emission of unnamed struct {0}, typedef {1} ", structCType.getDebugString(), d1); return; } } if ( cfg.shouldIgnoreInInterface(structCTypeName) ) { - LOG.log(INFO, "skipping emission of ignored \"{0}\": {1}", structCTypeName, structCType.getDebugString()); + LOG.log(INFO, structCType.getASTLocusTag(), + "skipping emission of ignored \"{0}\": {1}", structCTypeName, structCType.getDebugString()); return; } if( null != typedefed && isOpaque(typedefed) ) { - LOG.log(INFO, "skipping emission of opaque typedef {0}, c-struct {1}", typedefed.getDebugString(), structCType.getDebugString()); + LOG.log(INFO, structCType.getASTLocusTag(), + "skipping emission of opaque typedef {0}, c-struct {1}", typedefed.getDebugString(), structCType.getDebugString()); return; } @@ -907,26 +911,30 @@ public class JavaEmitter implements GlueEmitter { } final JavaType containingJType = typeToJavaType(containingCType, null); if( containingJType.isOpaqued() ) { - LOG.log(INFO, "skipping emission of opaque {0}, {1}", containingJType.getDebugString(), structCType.getDebugString()); + LOG.log(INFO, structCType.getASTLocusTag(), + "skipping emission of opaque {0}, {1}", containingJType.getDebugString(), structCType.getDebugString()); return; } if( !containingJType.isCompoundTypeWrapper() ) { - LOG.log(WARNING, "skipping emission of non-compound {0}, {1}", containingJType.getDebugString(), structCType.getDebugString()); + LOG.log(WARNING, structCType.getASTLocusTag(), + "skipping emission of non-compound {0}, {1}", containingJType.getDebugString(), structCType.getDebugString()); return; } final String containingJTypeName = containingJType.getName(); - LOG.log(INFO, "perform emission of \"{0}\" -> \"{1}\": {2}", structCTypeName, containingJTypeName, structCType.getDebugString()); + LOG.log(INFO, structCType.getASTLocusTag(), + "perform emission of \"{0}\" -> \"{1}\": {2}", structCTypeName, containingJTypeName, structCType.getDebugString()); if( GlueGen.debug() ) { if( null != typedefed ) { - LOG.log(INFO, " typedefed {0}", typedefed.getDebugString(true)); + LOG.log(INFO, structCType.getASTLocusTag(), " typedefed {0}", typedefed.getDebugString()); } else { - LOG.log(INFO, " typedefed {0}", (Object)null); + LOG.log(INFO, structCType.getASTLocusTag(), " typedefed {0}", (Object)null); } - LOG.log(INFO, " containingCType {0}", containingCType.getDebugString(true)); - LOG.log(INFO, " containingJType {0}", containingJType.getDebugString()); + LOG.log(INFO, structCType.getASTLocusTag(), " containingCType {0}", containingCType.getDebugString(true)); + LOG.log(INFO, structCType.getASTLocusTag(), " containingJType {0}", containingJType.getDebugString()); } if( 0 == structCType.getNumFields() ) { - LOG.log(INFO, "emission of \"{0}\" with zero fields {1}", containingJTypeName, structCType.getDebugString()); + LOG.log(INFO, structCType.getASTLocusTag(), + "emission of \"{0}\" with zero fields {1}", containingJTypeName, structCType.getDebugString()); } this.requiresStaticInitialization = false; // reset @@ -1182,9 +1190,9 @@ public class JavaEmitter implements GlueEmitter { javaWriter.println(" }"); } else if ( ( fieldType.isArray() || fieldType.isPointer() ) && !isOpaqueField ) { - generateArrayGetterSetterCode(methodBindingSet, javaWriter, jniWriter, structCTypeName, structClassPkgName, - containingCType, containingJType, - i, field, fieldName, cfgFieldName1); + generateArrayGetterSetterCode(methodBindingSet, javaWriter, jniWriter, structCType, structCTypeName, + structClassPkgName, containingCType, + containingJType, i, field, fieldName, cfgFieldName1); } else { final JavaType javaType; try { @@ -1209,10 +1217,9 @@ public class JavaEmitter implements GlueEmitter { final String capFieldName = capitalizeString(fieldName); final String sizeDenominator = fieldType.isPointer() ? "pointer" : javaTypeName ; - if( LOG.isLoggable(FINE) ) { - LOG.log(FINE, "Java.StructEmitter.Primitive: "+field.getName()+", "+fieldType.getDebugString()+", "+javaTypeName+", "+ - ", fixedSize "+fieldTypeNativeSizeFixed+", opaque[t "+isOpaqueFieldType+", f "+isOpaqueField+"], sizeDenominator "+sizeDenominator); - } + LOG.log(FINE, structCType.getASTLocusTag(), + "Java.StructEmitter.Primitive: "+field.getName()+", "+fieldType.getDebugString()+", "+javaTypeName+", "+ + ", fixedSize "+fieldTypeNativeSizeFixed+", opaque[t "+isOpaqueFieldType+", f "+isOpaqueField+"], sizeDenominator "+sizeDenominator); if( !fieldType.isConst() ) { // Setter @@ -1553,14 +1560,16 @@ public class JavaEmitter implements GlueEmitter { final String cfgVal = cfg.returnedArrayLength(returnSizeLookupName); if( null != cfgVal ) { if( hasFixedTypeLen[0] ) { - LOG.log(WARNING, "struct array field '"+returnSizeLookupName+"' of '"+type+"' length '"+Arrays.toString(length)+"' overwritten by cfg-expression: "+cfgVal); + LOG.log(WARNING, type.getASTLocusTag(), + "struct array field '"+returnSizeLookupName+"' of '"+type+"' length '"+Arrays.toString(length)+"' overwritten by cfg-expression: "+cfgVal); } return cfgVal; } if( hasFixedTypeLen[0] ) { return lengthExpr.toString(); } else { - LOG.log(WARNING, "struct array field '"+returnSizeLookupName+"' length '"+Arrays.toString(length)+"' without fixed- nor configured-size: "+type.getDebugString()); + LOG.log(WARNING, type.getASTLocusTag(), + "struct array field '"+returnSizeLookupName+"' length '"+Arrays.toString(length)+"' without fixed- nor configured-size: "+type.getDebugString()); return null; } } @@ -1593,6 +1602,7 @@ public class JavaEmitter implements GlueEmitter { private void generateArrayGetterSetterCode(final Set<MethodBinding> methodBindingSet, final PrintWriter javaWriter, final PrintWriter jniWriter, + final CompoundType structCType, final String structCTypeName, final String structClassPkgName, final Type containingCType, final JavaType containingJType, final int i, final Field field, final String fieldName, @@ -1670,7 +1680,7 @@ public class JavaEmitter implements GlueEmitter { javaWriter.println(); final String msg = "SKIP ptr-ptr (depth "+pointerType.pointerDepth()+"): "+returnSizeLookupName +": "+fieldType; javaWriter.println(" // "+msg); - LOG.log(WARNING, msg); + LOG.log(WARNING, structCType.getASTLocusTag(), msg); return; } } @@ -1694,7 +1704,7 @@ public class JavaEmitter implements GlueEmitter { javaWriter.println(); final String msg = "SKIP primitive w/ platform dependent sized type in struct: "+returnSizeLookupName+": "+fieldType.getDebugString(); javaWriter.println(" // "+msg); - LOG.log(WARNING, msg); + LOG.log(WARNING, structCType.getASTLocusTag(), msg); return; } } @@ -1710,7 +1720,7 @@ public class JavaEmitter implements GlueEmitter { _arrayLengthExpr = "getCStringLengthImpl(pString)+1"; _arrayLengthExprIsConst = false; this.requiresStaticInitialization = true; - LOG.log(INFO, "StaticInit Trigger.3 \"{0}\"", returnSizeLookupName); + LOG.log(INFO, structCType.getASTLocusTag(), "StaticInit Trigger.3 \"{0}\"", returnSizeLookupName); } else { useGetCStringLength = false; } @@ -1720,7 +1730,7 @@ public class JavaEmitter implements GlueEmitter { javaWriter.println(); final String msg = "SKIP unsized array in struct: "+returnSizeLookupName+": "+fieldType.getDebugString(); javaWriter.println(" // "+msg); - LOG.log(WARNING, msg); + LOG.log(WARNING, structCType.getASTLocusTag(), msg); return; } boolean _hasSingleElement=false; @@ -1756,7 +1766,7 @@ public class JavaEmitter implements GlueEmitter { // Setter Primitive Pointer final String msg = "SKIP setter for primitive-pointer type in struct: "+returnSizeLookupName+": "+fieldType.getDebugString(); javaWriter.println(" // "+msg); - LOG.log(INFO, msg); + LOG.log(INFO, structCType.getASTLocusTag(), msg); } else { // Setter Primitive Array if( hasSingleElement ) { @@ -1793,7 +1803,7 @@ public class JavaEmitter implements GlueEmitter { // Setter Struct Pointer final String msg = "SKIP setter for complex-pointer type in struct: "+returnSizeLookupName+": "+fieldType.getDebugString(); javaWriter.println(" // "+msg); - LOG.log(INFO, msg); + LOG.log(INFO, structCType.getASTLocusTag(), msg); } else { // Setter Struct Array if( hasSingleElement ) { @@ -2034,7 +2044,7 @@ public class JavaEmitter implements GlueEmitter { private JavaType typeToJavaType(final Type cType, final MachineDataInfo curMachDesc) { final JavaType jt = typeToJavaTypeImpl(cType, curMachDesc); - LOG.log(FINE, "typeToJavaType: {0} -> {1}", cType.getDebugString(), jt.getDebugString()); + LOG.log(FINE, cType.getASTLocusTag(), "typeToJavaType: {0} -> {1}", cType.getDebugString(), jt.getDebugString()); return jt; } private boolean isJNIEnvPointer(final Type cType) { @@ -2071,7 +2081,7 @@ public class JavaEmitter implements GlueEmitter { if( GlueGen.debug() ) { // t is<type>**, targetType is <type>*, we need to get <type> final Type bottomType = targetType.asPointer().getTargetType(); - LOG.log(INFO, "Opaque Type: {0}, targetType: {1}, bottomType: {2} is ptr-ptr", + LOG.log(INFO, cType.getASTLocusTag(), "Opaque Type: {0}, targetType: {1}, bottomType: {2} is ptr-ptr", cType.getDebugString(), targetType, bottomType); } } @@ -2169,7 +2179,7 @@ public class JavaEmitter implements GlueEmitter { // t is<type>**, targetType is <type>*, we need to get <type> bottomType = targetType.asPointer().getTargetType(); if( GlueGen.debug() ) { - LOG.log(INFO, "typeToJavaType(ptr-ptr): {0}, targetType: {1}, bottomType: {2}", + LOG.log(INFO, cType.getASTLocusTag(), "typeToJavaType(ptr-ptr): {0}, targetType: {1}, bottomType: {2}", cType.getDebugString(), targetType, bottomType); } return JavaType.forNIOPointerBufferClass(); @@ -2177,13 +2187,13 @@ public class JavaEmitter implements GlueEmitter { // t is<type>[][], targetType is <type>[], we need to get <type> bottomType = targetType.asArray().getBaseElementType(); if( GlueGen.debug() ) { - LOG.log(INFO, "typeToJavaType(ptr-ptr.array): {0}, targetType: {1}, bottomType: {2}", + LOG.log(INFO, cType.getASTLocusTag(), "typeToJavaType(ptr-ptr.array): {0}, targetType: {1}, bottomType: {2}", cType.getDebugString(), targetType, bottomType); } } else { bottomType = targetType; if( GlueGen.debug() ) { - LOG.log(INFO, "typeToJavaType(ptr-ptr.primitive): {0}, targetType: {1}, bottomType: {2}", + LOG.log(INFO, cType.getASTLocusTag(), "typeToJavaType(ptr-ptr.primitive): {0}, targetType: {1}, bottomType: {2}", cType.getDebugString(), targetType, bottomType); } } diff --git a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java index 9d02c14..3768222 100644 --- a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java @@ -709,7 +709,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter { // ByteBuffers back into the wrapper types for (int i = 0; i < binding.getNumArguments(); i++) { final JavaType javaArgType = binding.getJavaArgumentType(i); - if ( javaArgType.isArrayOfCompoundTypeWrappers() && !isBaseTypeConst(javaArgType.getElementCType()) ) { + if ( javaArgType.isArrayOfCompoundTypeWrappers() && !javaArgType.getElementCType().isBaseTypeConst() ) { final String argName = binding.getArgumentName(i); writer.println(" for (int _ctr = 0; _ctr < " + argName + ".length; _ctr++) {"); writer.println(" if ((" + argName + "[_ctr] == null && " + argName + COMPOUND_ARRAY_SUFFIX + "[_ctr] == null) ||"); diff --git a/src/java/com/jogamp/gluegen/Logging.java b/src/java/com/jogamp/gluegen/Logging.java index 59cb441..f1ba39b 100644 --- a/src/java/com/jogamp/gluegen/Logging.java +++ b/src/java/com/jogamp/gluegen/Logging.java @@ -54,19 +54,38 @@ public class Logging { /** * See {@link Logger#warning(String)} */ - void warning(String msg); + void warning(final String msg); /** - * See {@link Logger#log(Level, String, Object[])} + * See {@link Logger#warning(String)} */ - void log(final Level level, final String msg, final Object ... params); + void warning(final ASTLocusTag loc, final String msg); + + /** + * See {@link Logger#log(Level, String)} + */ + void log(final Level level, final String msg); /** * See {@link Logger#log(Level, String, Object)} */ void log(final Level level, final String msg, final Object param); /** + * See {@link Logger#log(Level, String, Object[])} + */ + void log(final Level level, final String msg, final Object ... params); + + /** * See {@link Logger#log(Level, String)} */ - void log(final Level level, final String msg); + void log(final Level level, final ASTLocusTag loc, final String msg); + /** + * See {@link Logger#log(Level, String, Object)} + */ + void log(final Level level, final ASTLocusTag loc, final String msg, final Object param); + /** + * See {@link Logger#log(Level, String, Object[])} + */ + void log(final Level level, final ASTLocusTag loc, final String msg, final Object ... params); + /** * See {@link Logger#setLevel(Level)} */ @@ -109,17 +128,56 @@ public class Logging { impl.warning(msg); } @Override - public void log(final Level level, final String msg, final Object ... params) { - impl.log(level, msg, params); + public void warning(final ASTLocusTag loc, final String msg) { + handler.plf.setASTLocusTag(loc); + try { + impl.warning(msg); + } finally { + handler.plf.setASTLocusTag(null); + } + } + + @Override + public void log(final Level level, final String msg) { + impl.log(level, msg); } @Override public void log(final Level level, final String msg, final Object param) { impl.log(level, msg, param); } @Override - public void log(final Level level, final String msg) { - impl.log(level, msg); + public void log(final Level level, final String msg, final Object ... params) { + impl.log(level, msg, params); } + + @Override + public void log(final Level level, final ASTLocusTag loc, final String msg) { + handler.plf.setASTLocusTag(loc); + try { + impl.log(level, msg); + } finally { + handler.plf.setASTLocusTag(null); + } + } + @Override + public void log(final Level level, final ASTLocusTag loc, final String msg, final Object param) { + handler.plf.setASTLocusTag(loc); + try { + impl.log(level, msg, param); + } finally { + handler.plf.setASTLocusTag(null); + } + } + @Override + public void log(final Level level, final ASTLocusTag loc, final String msg, final Object ... params) { + handler.plf.setASTLocusTag(loc); + try { + impl.log(level, msg, params); + } finally { + handler.plf.setASTLocusTag(null); + } + } + @Override public void setLevel(final Level newLevel) throws SecurityException { impl.setLevel(newLevel); @@ -145,19 +203,6 @@ public class Logging { return handler.plf.simpleClassName; } } - static class PlainLogFormatter extends Formatter { - final String simpleClassName; - PlainLogFormatter(final String simpleClassName) { - this.simpleClassName = simpleClassName; - } - @Override - public String format(final LogRecord record) { - final StringBuilder sb = new StringBuilder(128); - sb.append("[").append(record.getLevel()).append(' ').append(simpleClassName).append("]: "); - sb.append(formatMessage(record)).append("\n"); - return sb.toString(); - } - } static class PlainLogConsoleHandler extends ConsoleHandler { final PlainLogFormatter plf; PlainLogConsoleHandler(final PlainLogFormatter plf, final Level level) { @@ -170,6 +215,23 @@ public class Logging { return plf; } } + static class PlainLogFormatter extends Formatter { + final String simpleClassName; + ASTLocusTag astLocus; + PlainLogFormatter(final String simpleClassName) { + this.simpleClassName = simpleClassName; + } + public void setASTLocusTag(final ASTLocusTag loc) { astLocus = loc; } + @Override + public String format(final LogRecord record) { + final StringBuilder sb = new StringBuilder(256); + if( null != astLocus ) { + astLocus.toString(sb, getCanonicalName(record.getLevel())).append(": "); + } + sb.append(simpleClassName).append(": ").append(formatMessage(record)).append("\n"); + return sb.toString(); + } + } private final static Map<String, LoggerIf> loggers; private final static FQNLogger rootPackageLogger; @@ -192,6 +254,24 @@ public class Logging { /** provokes static initialization */ static void init() { } + public static String getCanonicalName(final Level level) { + if( Level.CONFIG == level ) { + return "config"; + } else if( Level.FINER == level ) { + return "verbose"; + } else if( Level.FINE == level ) { + return "debug"; + } else if( Level.INFO == level ) { + return "info"; + } else if( Level.WARNING == level ) { + return "warning"; + } else if( Level.SEVERE == level ) { + return "error"; + } else { + return level.getName().toLowerCase(); + } + } + /** Returns the <i>root package logger</i>. */ public static LoggerIf getLogger() { return rootPackageLogger; diff --git a/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java b/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java index 672bccf..cabbcc1 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java @@ -99,20 +99,20 @@ public class ArrayType extends MemoryLayoutType implements Cloneable { } @Override - public ArrayType asArray() { return this; } + public final ArrayType asArray() { return this; } public Type getElementType() { return elementType; } public int getLength() { return length; } public boolean hasLength() { return length >= 0; } @Override - public Type getBaseElementType() { - ArrayType t = this; - while (t.getElementType().isArray()) { - t = t.getElementType().asArray(); - } - return t.getElementType(); - // return elementType.getBaseElementType(); + public final Type getBaseElementType() { + return elementType.getBaseElementType(); + } + + @Override + public final int arrayDimension() { + return 1 + elementType.arrayDimension(); } /** Recompute the size of this array if necessary. This needs to be diff --git a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java index 264389b..dc5becf 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java @@ -161,11 +161,6 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable } @Override - public void setSize(final SizeThunk size) { - super.setSize(size); - } - - @Override public CompoundType asCompound() { return this; } @Override diff --git a/src/java/com/jogamp/gluegen/cgram/types/PointerType.java b/src/java/com/jogamp/gluegen/cgram/types/PointerType.java index 1528f9f..76cb4b3 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/PointerType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/PointerType.java @@ -109,32 +109,31 @@ public class PointerType extends Type implements Cloneable { } @Override - public PointerType asPointer() { + public final PointerType asPointer() { return this; } @Override - public Type getTargetType() { + public final Type getTargetType() { return targetType; } @Override - public Type getBaseElementType() { - /** - if(targetType.isPointer()) { - return ((PointerType)targetType).getBaseElementType(); - } else { - return targetType; - } */ + public final Type getBaseElementType() { return targetType.getBaseElementType(); } @Override - public boolean isFunctionPointer() { + public final boolean isFunctionPointer() { return targetType.isFunction(); } @Override + public final int pointerDepth() { + return 1 + targetType.pointerDepth(); + } + + @Override public String toString() { if ( isTypedef() ) { return super.getCName(true); diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java index bc1b155..04ea3a3 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/Type.java +++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java @@ -134,7 +134,7 @@ public abstract class Type implements Cloneable, SemanticEqualityOp, ASTLocusTag } - private StringBuilder append(final StringBuilder sb, final String val, final boolean prepComma) { + private static StringBuilder append(final StringBuilder sb, final String val, final boolean prepComma) { if( prepComma ) { sb.append(", "); } @@ -142,11 +142,11 @@ public abstract class Type implements Cloneable, SemanticEqualityOp, ASTLocusTag return sb; } // For debugging - public String getDebugString() { + public final String getDebugString() { return getDebugString(false); } // For debugging - public String getDebugString(final boolean withASTLoc) { + public final String getDebugString(final boolean withASTLoc) { final StringBuilder sb = new StringBuilder(); boolean prepComma = false; sb.append("CType["); @@ -286,7 +286,7 @@ public abstract class Type implements Cloneable, SemanticEqualityOp, ASTLocusTag * of hashes. * </p> */ - public void setTypedefName(final String name) { + public final void setTypedefName(final String name) { if( setName(name) ) { // Capture the const/volatile attributes at the time of typedef so // we don't redundantly repeat them in the CV attributes string @@ -326,9 +326,9 @@ public abstract class Type implements Cloneable, SemanticEqualityOp, ASTLocusTag } /** SizeThunk which computes size of this type in bytes. */ - public SizeThunk getSize() { return size; } + public final SizeThunk getSize() { return size; } /** Size of this type in bytes according to the given MachineDataInfo. */ - public long getSize(final MachineDataInfo machDesc) { + public final long getSize(final MachineDataInfo machDesc) { final SizeThunk thunk = getSize(); if (thunk == null) { throw new RuntimeException("No size set for type \"" + getName() + "\""); @@ -336,7 +336,7 @@ public abstract class Type implements Cloneable, SemanticEqualityOp, ASTLocusTag return thunk.computeSize(machDesc); } /** Set the size of this type; only available for CompoundTypes. */ - void setSize(final SizeThunk size) { + final void setSize(final SizeThunk size) { this.size = size; clearCache(); } @@ -363,40 +363,51 @@ public abstract class Type implements Cloneable, SemanticEqualityOp, ASTLocusTag public VoidType asVoid() { return null; } /** Indicates whether this is a BitType. */ - public boolean isBit() { return (asBit() != null); } + public final boolean isBit() { return (asBit() != null); } /** Indicates whether this is an IntType. */ - public boolean isInt() { return (asInt() != null); } + public final boolean isInt() { return (asInt() != null); } /** Indicates whether this is an EnumType. */ - public boolean isEnum() { return (asEnum() != null); } + public final boolean isEnum() { return (asEnum() != null); } /** Indicates whether this is a FloatType. */ - public boolean isFloat() { return (asFloat() != null); } + public final boolean isFloat() { return (asFloat() != null); } /** Indicates whether this is a DoubleType. */ - public boolean isDouble() { return (asDouble() != null); } + public final boolean isDouble() { return (asDouble() != null); } /** Indicates whether this is a PointerType. */ - public boolean isPointer() { return (asPointer() != null); } + public final boolean isPointer() { return (asPointer() != null); } /** Indicates whether this is an ArrayType. */ - public boolean isArray() { return (asArray() != null); } + public final boolean isArray() { return (asArray() != null); } /** Indicates whether this is a CompoundType. */ - public boolean isCompound() { return (asCompound() != null); } + public final boolean isCompound() { return (asCompound() != null); } /** Indicates whether this is a FunctionType. */ - public boolean isFunction() { return (asFunction() != null); } + public final boolean isFunction() { return (asFunction() != null); } /** Indicates whether this is a VoidType. */ - public boolean isVoid() { return (asVoid() != null); } + public final boolean isVoid() { return (asVoid() != null); } /** Indicates whether this type is volatile. */ - public boolean isVolatile() { return 0 != ( ( cvAttributes & ~typedefCVAttributes ) & CVAttributes.VOLATILE ); } + public final boolean isVolatile() { return 0 != ( ( cvAttributes & ~typedefCVAttributes ) & CVAttributes.VOLATILE ); } /** Indicates whether this type is const. */ - public boolean isConst() { return 0 != ( ( cvAttributes & ~typedefCVAttributes ) & CVAttributes.CONST ); } - private boolean isConstTypedef() { return 0 != ( typedefCVAttributes & CVAttributes.CONST ); } - private boolean isConstRaw() { return 0 != ( cvAttributes & CVAttributes.CONST ); } + public final boolean isConst() { return 0 != ( ( cvAttributes & ~typedefCVAttributes ) & CVAttributes.CONST ); } + + private final boolean isConstTypedef() { return 0 != ( typedefCVAttributes & CVAttributes.CONST ); } + private final boolean isConstRaw() { return 0 != ( cvAttributes & CVAttributes.CONST ); } /** Indicates whether this type is a primitive type. */ - public boolean isPrimitive(){ return false; } + public boolean isPrimitive(){ return false; } /** Convenience routine indicating whether this Type is a pointer to a function. */ public boolean isFunctionPointer() { - return (isPointer() && asPointer().getTargetType().isFunction()); + return false; + } + + /** + * Checks the base type of pointer-to-pointer, pointer, array or plain for const-ness. + * <p> + * Note: Intermediate 'const' qualifier are not considered, e.g. const pointer. + * </p> + */ + public final boolean isBaseTypeConst() { + return getBaseElementType().isConst(); } /** Hashcode for Types. */ @@ -524,22 +535,14 @@ public abstract class Type implements Cloneable, SemanticEqualityOp, ASTLocusTag type represents (i.e., "void **" returns 2). Returns 0 if this type is not a pointer type. */ public int pointerDepth() { - final PointerType pt = asPointer(); - if (pt == null) { - return 0; - } - return 1 + pt.getTargetType().pointerDepth(); + return 0; } /** Helper method for determining how many array dimentions this type represents (i.e., "char[][]" returns 2). Returns 0 if this type is not an array type. */ public int arrayDimension() { - final ArrayType arrayType = asArray(); - if (arrayType == null) { - return 0; - } - return 1 + arrayType.getElementType().arrayDimension(); + return 0; } /** diff --git a/src/java/com/jogamp/gluegen/pcpp/PCPP.java b/src/java/com/jogamp/gluegen/pcpp/PCPP.java index 1ef0cd6..d660764 100644 --- a/src/java/com/jogamp/gluegen/pcpp/PCPP.java +++ b/src/java/com/jogamp/gluegen/pcpp/PCPP.java @@ -57,6 +57,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import com.jogamp.gluegen.ASTLocusTag; +import com.jogamp.gluegen.GlueGenException; import com.jogamp.gluegen.Logging; import com.jogamp.gluegen.Logging.LoggerIf; @@ -463,28 +465,30 @@ public class PCPP { if (enabled()) { final String oldDef = defineMap.remove(name); if (oldDef == null) { - LOG.log(WARNING, "ignoring redundant \"#undef {0}\", at \"{1}\" line {2}: \"{3}\" was not previously defined", - name, filename(), lineNumber(), name); + LOG.log(WARNING, new ASTLocusTag(filename(), lineNumber(), -1, name), + "ignoring redundant \"#undef {0}\" - was not previously defined", + name); } else { // System.err.println("UNDEFINED: '" + name + "' (line " + lineNumber() + " file " + filename() + ")"); } nonConstantDefines.remove(name); } else { - LOG.log(INFO, "DISABLED UNDEFINE: ''{0}'' (line {1} file {2})", name, lineNumber(), filename()); + LOG.log(INFO, new ASTLocusTag(filename(), lineNumber(), -1, name), + "DISABLED UNDEFINE: ''{0}''", name); } } private void handleWarning() throws IOException { final String msg = nextWordOrString(); if (enabled()) { - LOG.log(WARNING, "#warning {0} at \"{1}\" line \"{2}\"", msg, filename(), lineNumber()); + LOG.log(WARNING, new ASTLocusTag(filename(), lineNumber(), -1, null), msg); } } - private void handleError() throws IOException { + private void handleError() throws IOException, GlueGenException { final String msg = nextWordOrString(); if (enabled()) { - throw new RuntimeException("#error "+msg+" at \""+filename()+"\" line "+lineNumber()); + throw new GlueGenException(msg, new ASTLocusTag(filename(), lineNumber(), -1, null)); } } @@ -545,7 +549,8 @@ public class PCPP { final String value = ""; final String oldDef = defineMap.put(name, value); if (oldDef != null && !oldDef.equals(value)) { - LOG.log(WARNING, "\"{0}\" redefined from \"{1}\" to \"\"", name, oldDef); + LOG.log(WARNING, new ASTLocusTag(filename(), lineNumber(), -1, null), + "\"{0}\" redefined from \"{1}\" to \"\"", name, oldDef); } // We don't want to emit the define, because it would serve no purpose // and cause GlueGen errors (confuse the GnuCParser) @@ -560,7 +565,8 @@ public class PCPP { // Put it in the #define map final String oldDef = defineMap.put(name, value); if (oldDef != null && !oldDef.equals(value)) { - LOG.log(WARNING, "\"{0}\" redefined from \"{1}\" to \"{2}\"", name, oldDef, value); + LOG.log(WARNING, new ASTLocusTag(filename(), lineNumber(), -1, null), + "\"{0}\" redefined from \"{1}\" to \"{2}\"", name, oldDef, value); } debugPrint(true, "DEFINE " + name + " ["+oldDef+" ] -> "+value + " CONST"); //System.err.println("//---DEFINED: " + name + " to \"" + value + "\""); @@ -610,7 +616,8 @@ public class PCPP { final Macro macro = new Macro(params, values); final Macro oldDef = macroMap.put(name, macro); if (oldDef != null) { - LOG.log(WARNING, "\"{0}\" redefined from \"{1}\" to \"{2}\"", name, oldDef, macro); + LOG.log(WARNING, new ASTLocusTag(filename(), lineNumber(), -1, null), + "\"{0}\" redefined from \"{1}\" to \"{2}\"", name, oldDef, macro); } emitDefine = false; @@ -661,7 +668,8 @@ public class PCPP { final String oldDef = defineMap.put(name, value); if (oldDef != null && !oldDef.equals(value)) { - LOG.log(WARNING, "\"{0}\" redefined from \"{1}\" to \"{2}\"", name, oldDef, value); + LOG.log(WARNING, new ASTLocusTag(filename(), lineNumber(), -1, null), + "\"{0}\" redefined from \"{1}\" to \"{2}\"", name, oldDef, value); } debugPrint(true, "DEFINE " + name + " ["+oldDef+" ] -> "+value + " CONST"); // System.err.println("#define " + name +" "+value + " CONST EXPRESSION"); @@ -1012,7 +1020,8 @@ public class PCPP { buf.append(curTokenAsString()); } if (t == StreamTokenizer.TT_EOF) { - LOG.warning("unexpected EOF while processing #include directive"); + LOG.warning(new ASTLocusTag(filename(), lineNumber(), -1, null), + "unexpected EOF while processing #include directive"); } filename = buf.toString(); } diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java index 50334c6..c10e03b 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java @@ -42,6 +42,7 @@ import static java.util.logging.Level.INFO; import com.jogamp.gluegen.JavaConfiguration; import com.jogamp.gluegen.cgram.types.AliasedSymbol; +import com.jogamp.gluegen.cgram.types.FunctionSymbol; import java.io.*; import java.text.*; @@ -273,12 +274,12 @@ public class ProcAddressConfiguration extends JavaConfiguration { return tableClassName; } - public boolean skipProcAddressGen(final AliasedSymbol symbol) { + public boolean skipProcAddressGen(final FunctionSymbol symbol) { if ( skipProcAddressGen.contains( symbol.getName() ) || oneInSet(skipProcAddressGen, symbol.getAliasedNames()) ) { - LOG.log(INFO, "Skip ProcAddress: {0}", symbol.getAliasedString()); + LOG.log(INFO, symbol.getASTLocusTag(), "Skip ProcAddress: {0}", symbol.getAliasedString()); return true; } return false; @@ -309,11 +310,11 @@ public class ProcAddressConfiguration extends JavaConfiguration { return procAddressNameConverter.convert(funcName); } - public boolean forceProcAddressGen(final AliasedSymbol symbol) { + public boolean forceProcAddressGen(final FunctionSymbol symbol) { if( forceProcAddressGen4All ) { if(!forceProcAddressGen4AllOnce) { forceProcAddressGen4AllOnce = true; - LOG.log(INFO, "Force ALL ProcAddress"); + LOG.log(INFO, symbol.getASTLocusTag(), "Force ALL ProcAddress"); } return true; } @@ -322,7 +323,7 @@ public class ProcAddressConfiguration extends JavaConfiguration { oneInSet(forceProcAddressGenSet, symbol.getAliasedNames()) ) { - LOG.log(INFO, "Force ProcAddress: {0}", symbol.getAliasedString()); + LOG.log(INFO, symbol.getASTLocusTag(), "Force ProcAddress: {0}", symbol.getAliasedString()); return true; } return false; @@ -338,7 +339,7 @@ public class ProcAddressConfiguration extends JavaConfiguration { localProcAddressCallingConventionMap.put(funcName, callingConvention); } - public String getLocalProcAddressCallingConvention(final AliasedSymbol symbol) { + public String getLocalProcAddressCallingConvention(final FunctionSymbol symbol) { if ( isLocalProcAddressCallingConvention4All() ) { return getLocalProcAddressCallingConvention4All(); } diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java index 23c7fb5..180c48f 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java @@ -134,7 +134,7 @@ public class ProcAddressEmitter extends JavaEmitter { // honor that (for example, the superclass might have caught an Ignore // direction that matched the symbol's name). if (defaultEmitters.isEmpty()) { - LOG.log(Level.INFO, "genModProcAddrEmitter: SKIP, empty binding set: {0}", sym.getAliasedString()); + LOG.log(Level.INFO, sym.getASTLocusTag(), "genModProcAddrEmitter: SKIP, empty binding set: {0}", sym.getAliasedString()); return defaultEmitters; } @@ -143,7 +143,7 @@ public class ProcAddressEmitter extends JavaEmitter { // Don't do anything special if this symbol doesn't require modifications if( !callThroughProcAddress || isUnimplemented ) { - LOG.log(Level.INFO, "genModProcAddrEmitter: SKIP, not needed: callThrough {0}, isUnimplemented {1}: {2}", + LOG.log(Level.INFO, sym.getASTLocusTag(), "genModProcAddrEmitter: SKIP, not needed: callThrough {0}, isUnimplemented {1}: {2}", callThroughProcAddress, isUnimplemented, sym.getAliasedString()); return defaultEmitters; } @@ -252,7 +252,7 @@ public class ProcAddressEmitter extends JavaEmitter { final boolean needsLocalTypedef = getProcAddressConfig().forceProcAddressGen(cSymbol) || !hasFunctionPointerTypedef(cSymbol); final boolean callThroughProcAddress = needsLocalTypedef || callThroughProcAddress(cSymbol); - LOG.log(Level.INFO, "genModProcAddrEmitter: needsTypedef {0}, callThrough {1}: {2}", + LOG.log(Level.INFO, cSymbol.getASTLocusTag(), "genModProcAddrEmitter: needsTypedef {0}, callThrough {1}: {2}", needsLocalTypedef, callThroughProcAddress, cSymbol.getAliasedString()); String forcedCallingConvention = null; @@ -300,13 +300,13 @@ public class ProcAddressEmitter extends JavaEmitter { mode = 3; } } - LOG.log(Level.INFO, "callThroughProcAddress: {0} [m {1}]: {2}", res, mode, sym.getAliasedString()); + LOG.log(Level.INFO, sym.getASTLocusTag(), "callThroughProcAddress: {0} [m {1}]: {2}", res, mode, sym.getAliasedString()); return res; } protected boolean hasFunctionPointerTypedef(final FunctionSymbol sym) { final String funcPointerTypedefName = getFunctionPointerTypedefName(sym); final boolean res = typedefDictionary.containsKey(funcPointerTypedefName); - LOG.log(Level.INFO, "hasFunctionPointerTypedef: {0}: {1}", res, sym.getAliasedString()); + LOG.log(Level.INFO, sym.getASTLocusTag(), "hasFunctionPointerTypedef: {0}: {1}", res, sym.getAliasedString()); return res; } |