diff options
author | Sven Gothel <[email protected]> | 2008-07-05 22:01:47 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-07-05 22:01:47 +0000 |
commit | 9e5d4716a654e425f0ca5a3f676797e1ffb263ad (patch) | |
tree | 475d45059823ae6d9f2e6051f57258b07e3959c0 /src | |
parent | 204764628bbbd8228dcc2e735ac5ee6c21714295 (diff) |
Added fine javadoc entries for aliased/unified GL functions
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/branches/JOGL_2_SANDBOX@94 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src')
4 files changed, 71 insertions, 13 deletions
diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index fb6c0dd..27a77fc 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -324,6 +324,12 @@ public class GLEmitter extends ProcAddressEmitter // Internals only below this point // + // map the uniName to the GLUnifiedName type + protected HashMap/*<String uniNameStr, GLUnifiedName uniName>*/ funcNameMap = new HashMap(); + protected Map/*<String uniNameStr, GLUnifiedName uniName>*/ getFuncNameMap() { + return funcNameMap; + } + protected void validateFunctionsToBind(Set/*FunctionSymbol*/ funcsSet) { ArrayList newUniFuncs = new ArrayList(); for (Iterator iter = funcsSet.iterator(); iter.hasNext(); ) { @@ -334,6 +340,9 @@ public class GLEmitter extends ProcAddressEmitter } else { if( uniName.isExtensionARB() && !((GLConfiguration)cfg).skipProcAddressGen(fsOrig.getName()) ) { + if(!funcNameMap.containsKey(uniName.getUni())) { + funcNameMap.put(uniName.getUni(), uniName); + } FunctionSymbol fsUni = new FunctionSymbol(uniName.getUni(), fsOrig.getType()); if(!funcsSet.contains(fsUni)) { newUniFuncs.add(fsUni); // add new uni name @@ -359,10 +368,17 @@ public class GLEmitter extends ProcAddressEmitter if(uniName.isExtensionVEN()) { uniName.normalizeVEN(); if (GLEmitter.shouldIgnore(uniName, (GLConfiguration)cfg)) { + System.err.println("INFO: Ignored: Remove Function:"+ uniName); iter.remove(); // remove ignored function } else { FunctionSymbol fsUni = new FunctionSymbol(uniName.getUni(), fsOrig.getType()); if(funcsSet.contains(fsUni)) { + GLUnifiedName uniNameMap = (GLUnifiedName) funcNameMap.get(uniName.getUni()); + if(null!=uniNameMap) { + uniNameMap.addOrig(fsOrig.getName()); + } else { + funcNameMap.put(uniName.getUni(), uniName); + } iter.remove(); // remove VEN function (already incl. as ARB) System.err.println("INFO: Dub VEN Function:"+ "\n\tVEN: "+fsOrig+ @@ -381,17 +397,13 @@ public class GLEmitter extends ProcAddressEmitter // See whether this is one of the Buffer Object variants boolean bufferObjectVariant = bufferObjectMethodBindings.containsKey(baseJavaEmitter.getBinding()); - if (bufferObjectVariant) { - for (Iterator iter = superEmitters.iterator(); iter.hasNext(); ) { + for (Iterator iter = superEmitters.iterator(); iter.hasNext(); ) { JavaMethodBindingEmitter emitter = (JavaMethodBindingEmitter) iter.next(); if (emitter instanceof ProcAddressJavaMethodBindingEmitter) { - emitters.add(new GLJavaMethodBindingEmitter((ProcAddressJavaMethodBindingEmitter) emitter, bufferObjectVariant)); + emitters.add(new GLJavaMethodBindingEmitter((ProcAddressJavaMethodBindingEmitter) emitter, this, bufferObjectVariant)); } else { emitters.add(emitter); } - } - } else { - emitters.addAll(superEmitters); } } diff --git a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java index 8512f38..3983916 100755 --- a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -44,6 +44,7 @@ import java.util.*; import com.sun.gluegen.*; import com.sun.gluegen.cgram.types.*; import com.sun.gluegen.procaddress.*; +import com.sun.gluegen.runtime.opengl.GLUnifiedName; /** A specialization of the proc address emitter which knows how to change argument names to take into account Vertex Buffer Object / @@ -51,6 +52,7 @@ import com.sun.gluegen.procaddress.*; public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmitter { protected boolean bufferObjectVariant; + protected GLEmitter glEmitter; public GLJavaMethodBindingEmitter(JavaMethodBindingEmitter methodToWrap, boolean callThroughProcAddress, @@ -64,16 +66,21 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit changeNameAndArguments, emitter); this.bufferObjectVariant = bufferObjectVariant; + this.glEmitter=emitter; + setCommentEmitter(new WrappedMethodCommentEmitter()); } public GLJavaMethodBindingEmitter(ProcAddressJavaMethodBindingEmitter methodToWrap, + GLEmitter emitter, boolean bufferObjectVariant) { super(methodToWrap); this.bufferObjectVariant = bufferObjectVariant; + this.glEmitter=emitter; + setCommentEmitter(new WrappedMethodCommentEmitter()); } public GLJavaMethodBindingEmitter(GLJavaMethodBindingEmitter methodToWrap) { - this(methodToWrap, methodToWrap.bufferObjectVariant); + this(methodToWrap, methodToWrap.glEmitter, methodToWrap.bufferObjectVariant); } protected String getArgumentName(int i) { @@ -96,4 +103,23 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit return name; } + /** This class emits the comment for the wrapper method */ + public class WrappedMethodCommentEmitter extends ProcAddressJavaMethodBindingEmitter.WrappedMethodCommentEmitter { + protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { + if(null!=glEmitter) { + GLUnifiedName uniName = (GLUnifiedName) glEmitter.getFuncNameMap().get(binding.getCSymbol().getName()); + if(null!=uniName) { + writer.print("- Alias for: <br> <code> "); + writer.print(binding.getCSymbol().getType().toString(uniName.getOrigStringList(", "), tagNativeBinding)); + writer.print(" </code> "); + return ; // done + } + } + writer.print(": <br> "); + super.emitBindingCSignature(binding, writer); + } + protected void emitBeginning(FunctionEmitter methodEmitter, PrintWriter writer) { + writer.print("Entry point (through function pointer) to C language function "); + } + } } diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java index 7900d67..4b65d84 100755 --- a/src/java/com/sun/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/procaddress/ProcAddressJavaMethodBindingEmitter.java @@ -145,7 +145,7 @@ public class ProcAddressJavaMethodBindingEmitter extends JavaMethodBindingEmitte } /** This class emits the comment for the wrapper method */ - private class WrappedMethodCommentEmitter extends JavaMethodBindingEmitter.DefaultCommentEmitter { + public class WrappedMethodCommentEmitter extends JavaMethodBindingEmitter.DefaultCommentEmitter { protected void emitBeginning(FunctionEmitter methodEmitter, PrintWriter writer) { writer.print("Entry point (through function pointer) to C language function: <br> "); } diff --git a/src/java/com/sun/gluegen/runtime/opengl/GLUnifiedName.java b/src/java/com/sun/gluegen/runtime/opengl/GLUnifiedName.java index 44b5b1b..89d40e3 100644 --- a/src/java/com/sun/gluegen/runtime/opengl/GLUnifiedName.java +++ b/src/java/com/sun/gluegen/runtime/opengl/GLUnifiedName.java @@ -57,9 +57,10 @@ public class GLUnifiedName implements Cloneable { if(str.endsWith(extensions[i])) { return true; } + /* if(str.startsWith("GL_"+extensions[i]+"_")) { return true; - } + } */ } return false; } @@ -76,10 +77,11 @@ public class GLUnifiedName implements Cloneable { str = str.substring(0, str.length()-extensions[i].length()); touched=true; } + /* if(str.startsWith("GL_"+extensions[i]+"_")) { str = "GL_"+str.substring(4+extensions[i].length()); touched=true; - } + } */ } return str; } @@ -185,14 +187,32 @@ public class GLUnifiedName implements Cloneable { } public String getCommentString() { + return getCommentString(true, " "); + } + public String getCommentString(boolean encloseCommentStartEnd, String seperator) { if(nameOrig.size()==1 && ((String)nameOrig.get(0)).equals(nameUni)) { return new String(); } - String res = " /** " + nameUni + ": Alias of: "; + String res = new String(); + if(encloseCommentStartEnd) { + res = res.concat(" /** "); + } + res = res.concat("Alias for: <code>"); + res = res.concat(getOrigStringList(seperator)); + res = res.concat("</code> "); + if(encloseCommentStartEnd) { + res = res.concat("*/"); + } + return res; + } + public String getOrigStringList(String seperator) { + String res = new String(); for (Iterator iter = nameOrig.iterator(); iter.hasNext(); ) { - res = res.concat((String)iter.next()+", "); + res = res.concat((String)iter.next()); + if(iter.hasNext()) { + res = res.concat(seperator); + } } - res = res.concat(" */"); return res; } |