diff options
Diffstat (limited to 'src/java/com/jogamp/gluegen')
28 files changed, 120 insertions, 0 deletions
diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java index 7ae3192..d856767 100644 --- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java @@ -147,6 +147,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { public final MethodBinding getBinding() { return binding; } + @Override public String getName() { return binding.getName(); } @@ -291,12 +292,14 @@ public class CMethodBindingEmitter extends FunctionEmitter { public final MachineDescription getMachineDescription() { return machDesc; } + @Override protected void emitReturnType(PrintWriter writer) { writer.print("JNIEXPORT "); writer.print(binding.getJavaReturnType().jniTypeName()); writer.print(" JNICALL"); } + @Override protected void emitName(PrintWriter writer) { writer.println(); // start name on new line writer.print("Java_"); @@ -326,6 +329,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { return ""; } + @Override protected int emitArguments(PrintWriter writer) { writer.print("JNIEnv *env, "); int numEmitted = 1; // initially just the JNIEnv @@ -374,6 +378,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { } + @Override protected void emitBody(PrintWriter writer) { writer.println(" {"); // writer.println("printf(\" - - - - "+ getName() + getImplSuffix() +" - - - -\\n\");"); @@ -1478,6 +1483,7 @@ public class CMethodBindingEmitter extends FunctionEmitter { * emitter java method. */ protected static class DefaultCommentEmitter implements CommentEmitter { + @Override public void emit(FunctionEmitter emitter, PrintWriter writer) { emitBeginning((CMethodBindingEmitter)emitter, writer); emitEnding((CMethodBindingEmitter)emitter, writer); diff --git a/src/java/com/jogamp/gluegen/DebugEmitter.java b/src/java/com/jogamp/gluegen/DebugEmitter.java index d5fab6e..781188e 100644 --- a/src/java/com/jogamp/gluegen/DebugEmitter.java +++ b/src/java/com/jogamp/gluegen/DebugEmitter.java @@ -48,26 +48,33 @@ import com.jogamp.gluegen.cgram.types.*; public class DebugEmitter implements GlueEmitter { + @Override public void readConfigurationFile(String filename) {} + @Override public void beginEmission(GlueEmitterControls controls) { System.out.println("----- BEGIN EMISSION OF GLUE CODE -----"); } + @Override public void endEmission() { System.out.println("----- END EMISSION OF GLUE CODE -----"); } + @Override public void beginDefines() {} + @Override public void emitDefine(ConstantDefinition def, String optionalComment) { String name = def.getName(); String value = def.getValue(); System.out.println("#define " + name + " " + value + (optionalComment != null ? ("// " + optionalComment) : "")); } + @Override public void endDefines() {} + @Override public void beginFunctions(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type, Type> canonMap) { @@ -78,6 +85,7 @@ public class DebugEmitter implements GlueEmitter { } } + @Override public Iterator<FunctionSymbol> emitFunctions(List<FunctionSymbol> originalCFunctions) throws Exception { for (FunctionSymbol sym : originalCFunctions) { emitSingleFunction(sym); @@ -88,15 +96,21 @@ public class DebugEmitter implements GlueEmitter { System.out.println(sym); System.out.println(" -> " + sym.toString()); } + @Override public void endFunctions() {} + @Override public void beginStructLayout() throws Exception {} + @Override public void layoutStruct(CompoundType t) throws Exception {} + @Override public void endStructLayout() throws Exception {} + @Override public void beginStructs(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type, Type> canonMap) { } + @Override public void emitStruct(CompoundType t, String alternateName) { String name = t.getName(); if (name == null && alternateName != null) { @@ -106,5 +120,6 @@ public class DebugEmitter implements GlueEmitter { System.out.println("Referenced type \"" + name + "\""); } + @Override public void endStructs() {} } diff --git a/src/java/com/jogamp/gluegen/GlueGen.java b/src/java/com/jogamp/gluegen/GlueGen.java index 76eda1f..6a2b854 100644 --- a/src/java/com/jogamp/gluegen/GlueGen.java +++ b/src/java/com/jogamp/gluegen/GlueGen.java @@ -71,14 +71,17 @@ public class GlueGen implements GlueEmitterControls { public static boolean debug() { return debug; } + @Override public void forceStructEmission(String typedefName) { forcedStructNames.add(typedefName); } + @Override public String findHeaderFile(String headerFileName) { return preprocessor.findFile(headerFileName); } + @Override public void runSymbolFilter(SymbolFilter filter) { filter.filterSymbols(constants, functions); List<ConstantDefinition> newConstants = filter.getConstants(); diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 33b089a..380b5e4 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -105,6 +105,7 @@ public class JavaEmitter implements GlueEmitter { protected final static Logger LOG = Logger.getLogger(JavaEmitter.class.getPackage().getName()); + @Override public void readConfigurationFile(String filename) throws Exception { cfg = createConfig(); cfg.read(filename); @@ -114,15 +115,18 @@ public class JavaEmitter implements GlueEmitter { private List<ConstantDefinition> constants; + @Override public void filterSymbols(List<ConstantDefinition> constants, List<FunctionSymbol> functions) { this.constants = constants; doWork(); } + @Override public List<ConstantDefinition> getConstants() { return constants; } + @Override public List<FunctionSymbol> getFunctions() { return null; } @@ -138,6 +142,7 @@ public class JavaEmitter implements GlueEmitter { } } + @Override public void beginEmission(GlueEmitterControls controls) throws IOException { // Request emission of any structs requested @@ -158,6 +163,7 @@ public class JavaEmitter implements GlueEmitter { } } + @Override public void endEmission() { if (!cfg.structsOnly()) { emitAllFileFooters(); @@ -170,6 +176,7 @@ public class JavaEmitter implements GlueEmitter { } } + @Override public void beginDefines() throws Exception { if ((cfg.allStatic() || cfg.emitInterface()) && !cfg.structsOnly()) { javaWriter().println(); @@ -342,6 +349,7 @@ public class JavaEmitter implements GlueEmitter { "\" cannot be assigned to a int, long, float, or double"); } + @Override public void emitDefine(ConstantDefinition def, String optionalComment) throws Exception { if (cfg.allStatic() || cfg.emitInterface()) { @@ -376,9 +384,11 @@ public class JavaEmitter implements GlueEmitter { } } + @Override public void endDefines() throws Exception { } + @Override public void beginFunctions(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type, Type> canonMap) throws Exception { @@ -391,6 +401,7 @@ public class JavaEmitter implements GlueEmitter { } } + @Override public Iterator<FunctionSymbol> emitFunctions(List<FunctionSymbol> originalCFunctions) throws Exception { // Sometimes headers will have the same function prototype twice, once @@ -412,6 +423,7 @@ public class JavaEmitter implements GlueEmitter { ArrayList<FunctionSymbol> funcsToBind = new ArrayList<FunctionSymbol>(funcsToBindSet); // sort functions to make them easier to find in native code Collections.sort(funcsToBind, new Comparator<FunctionSymbol>() { + @Override public int compare(FunctionSymbol o1, FunctionSymbol o2) { return o1.getName().compareTo(o2.getName()); } @@ -739,6 +751,7 @@ public class JavaEmitter implements GlueEmitter { } + @Override public void endFunctions() throws Exception { if (!cfg.structsOnly()) { if (cfg.allStatic() || cfg.emitInterface()) { @@ -750,12 +763,16 @@ public class JavaEmitter implements GlueEmitter { } } + @Override public void beginStructLayout() throws Exception {} + @Override public void layoutStruct(CompoundType t) throws Exception { getLayout().layout(t); } + @Override public void endStructLayout() throws Exception {} + @Override public void beginStructs(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type, Type> canonMap) throws Exception { @@ -763,6 +780,7 @@ public class JavaEmitter implements GlueEmitter { this.canonMap = canonMap; } + @Override public void emitStruct(CompoundType structType, String alternateName) throws Exception { String name = structType.getName(); if (name == null && alternateName != null) { @@ -1124,6 +1142,7 @@ public class JavaEmitter implements GlueEmitter { newWriter.close(); } } + @Override public void endStructs() throws Exception {} public static int addStrings2Buffer(StringBuilder buf, String sep, String first, Collection<String> col) { @@ -1576,6 +1595,7 @@ public class JavaEmitter implements GlueEmitter { final List<String> intfDocs = cfg.javadocForClass(cfg.className()); CodeGenUtils.EmissionCallback docEmitter = new CodeGenUtils.EmissionCallback() { + @Override public void emit(PrintWriter w) { for (Iterator<String> iter = intfDocs.iterator(); iter.hasNext(); ) { w.println(iter.next()); @@ -1606,6 +1626,7 @@ public class JavaEmitter implements GlueEmitter { final List<String> implDocs = cfg.javadocForClass(cfg.implClassName()); CodeGenUtils.EmissionCallback docEmitter = new CodeGenUtils.EmissionCallback() { + @Override public void emit(PrintWriter w) { for (Iterator<String> iter = implDocs.iterator(); iter.hasNext(); ) { w.println(iter.next()); diff --git a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java index 81188a5..46ecab2 100644 --- a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java @@ -162,6 +162,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter { public boolean isForDirectBufferImplementation() { return forDirectBufferImplementation; } public boolean isForIndirectBufferAndArrayImplementation() { return forIndirectBufferAndArrayImplementation; } + @Override public String getName() { return binding.getName(); } @@ -234,6 +235,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter { this.forIndirectBufferAndArrayImplementation = indirect; } + @Override protected void emitReturnType(PrintWriter writer) { writer.print(getReturnTypeString(false)); } @@ -303,6 +305,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter { return erasedTypeString(binding.getJavaReturnType(), true) + "[]"; } + @Override protected void emitName(PrintWriter writer) { if (forImplementingMethodCall) { writer.print(getImplMethodName()); @@ -311,6 +314,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter { } } + @Override protected int emitArguments(PrintWriter writer) { boolean needComma = false; int numEmitted = 0; @@ -404,6 +408,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter { return getArgumentName(i) + "_offset"; } + @Override protected void emitBody(PrintWriter writer) { if (!emitBody) { writer.println(';'); @@ -804,6 +809,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter { * emitter java method. */ protected class DefaultCommentEmitter implements CommentEmitter { + @Override public void emit(FunctionEmitter emitter, PrintWriter writer) { emitBeginning(emitter, writer); emitBindingCSignature(((JavaMethodBindingEmitter)emitter).getBinding(), writer); diff --git a/src/java/com/jogamp/gluegen/ReferencedStructs.java b/src/java/com/jogamp/gluegen/ReferencedStructs.java index f88594e..50c39b8 100644 --- a/src/java/com/jogamp/gluegen/ReferencedStructs.java +++ b/src/java/com/jogamp/gluegen/ReferencedStructs.java @@ -54,6 +54,7 @@ public class ReferencedStructs implements TypeVisitor { return results.iterator(); } + @Override public void visitType(Type t) { if (t.isPointer()) { PointerType p = t.asPointer(); diff --git a/src/java/com/jogamp/gluegen/ant/GlueGenTask.java b/src/java/com/jogamp/gluegen/ant/GlueGenTask.java index 0b74bc3..a3d134f 100644 --- a/src/java/com/jogamp/gluegen/ant/GlueGenTask.java +++ b/src/java/com/jogamp/gluegen/ant/GlueGenTask.java @@ -371,6 +371,7 @@ public void setIncludeRefid(Reference reference) { * * @see org.apache.tools.ant.Task#execute() */ + @Override public void execute() throws BuildException { diff --git a/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java b/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java index 69ec0ed..ec2f979 100644 --- a/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java +++ b/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java @@ -114,6 +114,7 @@ public class CSymbolTable { } /** convert this table to a string */ + @Override public String toString() { StringBuilder buff = new StringBuilder(300); buff.append("CSymbolTable { \nCurrentScope: " + currentScopeAsString() + diff --git a/src/java/com/jogamp/gluegen/cgram/CToken.java b/src/java/com/jogamp/gluegen/cgram/CToken.java index 7bd48ad..cfa88fc 100644 --- a/src/java/com/jogamp/gluegen/cgram/CToken.java +++ b/src/java/com/jogamp/gluegen/cgram/CToken.java @@ -26,6 +26,7 @@ public class CToken extends antlr.CommonToken { tokenNumber = i; } + @Override public String toString() { return "CToken:" +"(" + hashCode() + ")" + "[" + getType() + "] "+ getText() + " line:" + getLine() + " source:" + source ; } diff --git a/src/java/com/jogamp/gluegen/cgram/LineObject.java b/src/java/com/jogamp/gluegen/cgram/LineObject.java index 4914759..31489fc 100644 --- a/src/java/com/jogamp/gluegen/cgram/LineObject.java +++ b/src/java/com/jogamp/gluegen/cgram/LineObject.java @@ -105,6 +105,7 @@ class LineObject { return treatAsC; } + @Override public String toString() { StringBuilder ret; ret = new StringBuilder("# " + line + " \"" + source + "\""); diff --git a/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java b/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java index 7cf64b0..3bc8056 100644 --- a/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java +++ b/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java @@ -50,6 +50,7 @@ public class PreprocessorInfoChannel return lines; } + @Override public String toString() { StringBuilder sb = new StringBuilder("PreprocessorInfoChannel:\n"); diff --git a/src/java/com/jogamp/gluegen/cgram/TNode.java b/src/java/com/jogamp/gluegen/cgram/TNode.java index 00c4ffa..2840d01 100644 --- a/src/java/com/jogamp/gluegen/cgram/TNode.java +++ b/src/java/com/jogamp/gluegen/cgram/TNode.java @@ -51,6 +51,7 @@ public class TNode extends CommonAST { } +@Override public void initialize(Token token) { CToken tok = (CToken) token; setText(tok.getText()); @@ -59,6 +60,7 @@ public void initialize(Token token) { setAttribute("source", tok.getSource()); setAttribute("tokenNumber", new Integer(tok.getTokenNumber())); } +@Override public void initialize(AST tr) { TNode t = (TNode) tr; setText(t.getText()); @@ -70,9 +72,11 @@ public void initialize(AST tr) { /** Get the token type for this node */ + @Override public int getType() { return ttype; } /** Set the token type for this node */ + @Override public void setType(int ttype_) { ttype = ttype_; } @@ -146,9 +150,11 @@ public void initialize(AST tr) { } /** Get the token text for this node */ + @Override public String getText() { return text; } /** Set the token text for this node */ + @Override public void setText(String text_) { text = text_; } @@ -303,6 +309,7 @@ public void initialize(AST tr) { /** return a short string representation of the node */ + @Override public String toString() { StringBuilder str = new StringBuilder( getNameForType(getType()) + "[" + getText() + ", " + "]"); diff --git a/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java b/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java index 2984a84..ccbd233 100644 --- a/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java +++ b/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java @@ -9,11 +9,13 @@ import antlr.collections.AST; public class TNodeFactory extends ASTFactory { /** Create a new ampty AST node */ + @Override public AST create() { return new TNode(); } /** Create a new AST node from type and text */ + @Override public AST create(int ttype, String text) { AST ast = new TNode(); ast.setType(ttype); @@ -22,6 +24,7 @@ public class TNodeFactory extends ASTFactory { } /** Create a new AST node from an existing AST node */ + @Override public AST create(AST ast) { AST newast = new TNode(); newast.setType(ast.getType()); diff --git a/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java b/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java index bad63db..6cedc9c 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java @@ -129,6 +129,7 @@ public class ArrayType extends MemoryLayoutType implements Cloneable { elementType.visit(arg); } + @Override Type newCVVariant(int cvAttributes) { return new ArrayType(elementType, getSize(), length, cvAttributes); } diff --git a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java index 4582a81..803cb50 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java @@ -71,6 +71,7 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable } } + @Override public Object clone() { CompoundType n = (CompoundType) super.clone(); if(null!=this.fields) { diff --git a/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java b/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java index e95ffb9..278b3d8 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java @@ -62,6 +62,7 @@ public class DoubleType extends PrimitiveType implements Cloneable { return this; } + @Override Type newCVVariant(int cvAttributes) { return new DoubleType(getName(), getSize(), cvAttributes); } diff --git a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java index 9e142bd..d02388b 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java @@ -85,6 +85,7 @@ public class EnumType extends IntType implements Cloneable { this.underlyingType = underlyingType; } + @Override public Object clone() { EnumType n = (EnumType) super.clone(); if(null!=this.underlyingType) { diff --git a/src/java/com/jogamp/gluegen/cgram/types/FloatType.java b/src/java/com/jogamp/gluegen/cgram/types/FloatType.java index dff7a00..ef1b4b9 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/FloatType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/FloatType.java @@ -61,6 +61,7 @@ public class FloatType extends PrimitiveType implements Cloneable { @Override public FloatType asFloat() { return this; } + @Override Type newCVVariant(int cvAttributes) { return new FloatType(getName(), getSize(), cvAttributes); } diff --git a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java index c32d184..bb62eba 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java @@ -54,6 +54,7 @@ public class FunctionType extends Type implements Cloneable { this.returnType = returnType; } + @Override public Object clone() { FunctionType n = (FunctionType) super.clone(); if(null!=this.argumentTypes) { @@ -195,6 +196,7 @@ public class FunctionType extends Type implements Cloneable { } } + @Override Type newCVVariant(int cvAttributes) { // Functions don't have const/volatile attributes return this; diff --git a/src/java/com/jogamp/gluegen/cgram/types/IntType.java b/src/java/com/jogamp/gluegen/cgram/types/IntType.java index b37e741..ffc5696 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/IntType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/IntType.java @@ -87,6 +87,7 @@ public class IntType extends PrimitiveType implements Cloneable { return getCVAttributesString() + ((isUnsigned() & (!typedefedUnsigned)) ? "unsigned " : "") + getName(); } + @Override Type newCVVariant(int cvAttributes) { return new IntType(getName(), getSize(), isUnsigned(), cvAttributes, typedefedUnsigned); } diff --git a/src/java/com/jogamp/gluegen/cgram/types/PointerType.java b/src/java/com/jogamp/gluegen/cgram/types/PointerType.java index 92544c5..4922d28 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/PointerType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/PointerType.java @@ -153,6 +153,7 @@ public class PointerType extends Type implements Cloneable { targetType.visit(arg); } + @Override Type newCVVariant(int cvAttributes) { return new PointerType(getSize(), targetType, cvAttributes, hasTypedefedName, (hasTypedefedName ? getName() : null)); } diff --git a/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java b/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java index b40d4f3..021fa90 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java +++ b/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java @@ -53,6 +53,7 @@ public abstract class SizeThunk implements Cloneable { // Private constructor because there are only a few of these private SizeThunk(boolean fixedNativeSize) { this.fixedNativeSize = fixedNativeSize; } + @Override public Object clone() { try { return super.clone(); @@ -67,81 +68,99 @@ public abstract class SizeThunk implements Cloneable { public abstract long computeAlignment(MachineDescription machDesc); public static final SizeThunk INT8 = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.int8SizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.int8AlignmentInBytes(); } }; public static final SizeThunk INT16 = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.int16SizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.int16AlignmentInBytes(); } }; public static final SizeThunk INT32 = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.int32SizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.int32AlignmentInBytes(); } }; public static final SizeThunk INTxx = new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.intSizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.intAlignmentInBytes(); } }; public static final SizeThunk LONG = new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.longSizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.longAlignmentInBytes(); } }; public static final SizeThunk INT64 = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.int64SizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.int64AlignmentInBytes(); } }; public static final SizeThunk FLOAT = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.floatSizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.floatAlignmentInBytes(); } }; public static final SizeThunk DOUBLE = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.doubleSizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.doubleAlignmentInBytes(); } }; public static final SizeThunk POINTER = new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.pointerSizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.pointerAlignmentInBytes(); } @@ -152,9 +171,11 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk add(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return thunk1.computeSize(machDesc) + thunk2.computeSize(machDesc); } + @Override public long computeAlignment(MachineDescription machDesc) { final long thunk1A = thunk1.computeAlignment(machDesc); final long thunk2A = thunk2.computeAlignment(machDesc); @@ -166,9 +187,11 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk mul(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return thunk1.computeSize(machDesc) * thunk2.computeSize(machDesc); } + @Override public long computeAlignment(MachineDescription machDesc) { final long thunk1A = thunk1.computeAlignment(machDesc); final long thunk2A = thunk2.computeAlignment(machDesc); @@ -180,6 +203,7 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk align(final SizeThunk offsetThunk, final SizeThunk alignmentThunk) { return new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { // x % 2n == x & (2n - 1) // remainder = net_size & ( alignment - 1 ) @@ -194,6 +218,7 @@ public abstract class SizeThunk implements Cloneable { return size + padding; } + @Override public long computeAlignment(MachineDescription machDesc) { final long thunk1A = offsetThunk.computeAlignment(machDesc); final long thunk2A = alignmentThunk.computeAlignment(machDesc); @@ -205,9 +230,11 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk max(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return Math.max(thunk1.computeSize(machDesc), thunk2.computeSize(machDesc)); } + @Override public long computeAlignment(MachineDescription machDesc) { final long thunk1A = thunk1.computeAlignment(machDesc); final long thunk2A = thunk2.computeAlignment(machDesc); @@ -218,9 +245,11 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk constant(final int constant) { return new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return constant; } + @Override public long computeAlignment(MachineDescription machDesc) { return 1; // no alignment for constants } diff --git a/src/java/com/jogamp/gluegen/cgram/types/StructType.java b/src/java/com/jogamp/gluegen/cgram/types/StructType.java index 74fca7c..da58a5f 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/StructType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/StructType.java @@ -45,9 +45,12 @@ public class StructType extends CompoundType { return super.equals(arg); } + @Override public final boolean isStruct() { return true; } + @Override public final boolean isUnion() { return false; } + @Override Type newCVVariant(int cvAttributes) { StructType t = new StructType(getName(), getSize(), cvAttributes, getStructName()); t.setFields(getFields()); diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java index cffbb67..a403de6 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/Type.java +++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java @@ -63,6 +63,7 @@ public abstract class Type implements Cloneable { hasTypedefName = false; } + @Override public Object clone() { try { return super.clone(); diff --git a/src/java/com/jogamp/gluegen/cgram/types/UnionType.java b/src/java/com/jogamp/gluegen/cgram/types/UnionType.java index 857507c..36b4fdb 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/UnionType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/UnionType.java @@ -45,9 +45,12 @@ public class UnionType extends CompoundType { return super.equals(arg); } + @Override public final boolean isStruct() { return false; } + @Override public final boolean isUnion() { return true; } + @Override Type newCVVariant(int cvAttributes) { UnionType t = new UnionType(getName(), getSize(), cvAttributes, getStructName()); t.setFields(getFields()); diff --git a/src/java/com/jogamp/gluegen/cgram/types/VoidType.java b/src/java/com/jogamp/gluegen/cgram/types/VoidType.java index 1f76e70..afde0d2 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/VoidType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/VoidType.java @@ -54,6 +54,7 @@ public class VoidType extends Type implements Cloneable { return this; } + @Override Type newCVVariant(int cvAttributes) { return new VoidType(getName(), cvAttributes); } diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java index 14b15d2..3341e45 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java @@ -197,6 +197,7 @@ public class ProcAddressConfiguration extends JavaConfiguration { msgFmt = new MessageFormat(fmt); } + @Override String convert(String funcName) { StringBuffer buf = new StringBuffer(); msgFmt.format(new Object[]{funcName}, buf, null); @@ -212,6 +213,7 @@ public class ProcAddressConfiguration extends JavaConfiguration { this.str = str; } + @Override String convert(String funcName) { return str; } @@ -225,6 +227,7 @@ public class ProcAddressConfiguration extends JavaConfiguration { this.children = children; } + @Override String convert(String funcName) { StringBuilder res = new StringBuilder(); for (ConvNode node : children) { @@ -244,6 +247,7 @@ public class ProcAddressConfiguration extends JavaConfiguration { this.child = child; } + @Override public String convert(String funcName) { if (upperCase) { return child.convert(funcName).toUpperCase(); diff --git a/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java b/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java index f54d5db..727d0b4 100644 --- a/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java +++ b/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java @@ -90,6 +90,7 @@ public abstract class ProcAddressTable { static { AccessController.doPrivileged(new PrivilegedAction<Object>() { + @Override public Object run() { DEBUG = (System.getProperty("jogamp.debug.ProcAddressHelper") != null); if (DEBUG) { @@ -206,6 +207,7 @@ public abstract class ProcAddressTable { */ private final Field fieldForFunctionInSec(final String name) throws IllegalArgumentException { return AccessController.doPrivileged(new PrivilegedAction<Field>() { + @Override public Field run() { try { final Field addressField = ProcAddressTable.this.getClass().getDeclaredField(PROCADDRESS_VAR_PREFIX + name); @@ -340,6 +342,7 @@ public abstract class ProcAddressTable { } private static class One2OneResolver implements FunctionAddressResolver { + @Override public long resolve(String name, DynamicLookupHelper lookup) { return lookup.dynamicLookupFunction(name); } |