diff options
Diffstat (limited to 'src/java/com')
-rwxr-xr-x | src/java/com/sun/gluegen/opengl/GLConfiguration.java | 7 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/opengl/GLEmitter.java | 20 | ||||
-rwxr-xr-x | src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java | 17 |
3 files changed, 41 insertions, 3 deletions
diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java index 3013848dc..923dcf52d 100755 --- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java +++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java @@ -202,6 +202,13 @@ public class GLConfiguration extends ProcAddressConfiguration { super.dumpIgnores(); } + protected String getExtension(String symbol) { + if (glInfo != null) { + return glInfo.getExtension(symbol); + } + return null; + } + protected boolean shouldIgnoreExtension(String symbol, boolean criteria) { if (criteria && glInfo != null) { String extension = glInfo.getExtension(symbol); diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index fff9d7e94..83e688eec 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -305,6 +305,21 @@ public class GLEmitter extends ProcAddressEmitter return bufferObjectMethodBindings.containsKey(binding); } + public void emitDefine(String name, String value, String optionalComment) throws Exception { + String extensionName = getGLConfig().getExtension(name); + StringBuffer newComment = new StringBuffer(); + if(null!=extensionName) { + newComment.append("Part of <code>"+extensionName+"</code>"); + } else { + newComment.append("Part of <code>unknown extension</code>"); + } + if(null!=optionalComment) { + newComment.append(" "); + newComment.append(optionalComment); + } + super.emitDefine(name, value, newComment.toString()); + } + //---------------------------------------------------------------------- // Internals only below this point // @@ -319,10 +334,9 @@ public class GLEmitter extends ProcAddressEmitter for (Iterator iter = superEmitters.iterator(); iter.hasNext(); ) { JavaMethodBindingEmitter emitter = (JavaMethodBindingEmitter) iter.next(); if (emitter instanceof ProcAddressJavaMethodBindingEmitter) { - emitters.add(new GLJavaMethodBindingEmitter((ProcAddressJavaMethodBindingEmitter) emitter, this, bufferObjectVariant)); - } else { - emitters.add(emitter); + emitter = new GLJavaMethodBindingEmitter((ProcAddressJavaMethodBindingEmitter) emitter, this, bufferObjectVariant); } + emitters.add(emitter); } } diff --git a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java index c6a030935..b952272f3 100755 --- a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -52,6 +52,7 @@ import com.sun.gluegen.procaddress.*; public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmitter { protected boolean bufferObjectVariant; protected GLEmitter glEmitter; + protected CommentEmitter glCommentEmitter = new GLCommentEmitter(); public GLJavaMethodBindingEmitter(JavaMethodBindingEmitter methodToWrap, boolean callThroughProcAddress, @@ -66,6 +67,7 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit emitter); this.bufferObjectVariant = bufferObjectVariant; this.glEmitter=emitter; + setCommentEmitter(glCommentEmitter); } public GLJavaMethodBindingEmitter(ProcAddressJavaMethodBindingEmitter methodToWrap, @@ -74,6 +76,7 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit super(methodToWrap); this.bufferObjectVariant = bufferObjectVariant; this.glEmitter=emitter; + setCommentEmitter(glCommentEmitter); } public GLJavaMethodBindingEmitter(GLJavaMethodBindingEmitter methodToWrap) { @@ -100,4 +103,18 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit return name; } + + protected class GLCommentEmitter + extends JavaMethodBindingEmitter.DefaultCommentEmitter + { + protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { + super.emitBindingCSignature(binding, writer); + String extensionName = glEmitter.getGLConfig().getExtension(binding.getCSymbol().getName()); + if(null!=extensionName) { + writer.print("<br>Part of <code>"+extensionName+"</code>"); + } else { + writer.print("<br>Part of <code>unknown extension</code>"); + } + } + } } |