diff options
author | Sven Gothel <[email protected]> | 2010-03-31 23:32:39 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-03-31 23:32:39 +0200 |
commit | efd20749b7142798163be29253f01b9e914e1b15 (patch) | |
tree | bd1418732573f4dafe1a7b3cecd067fed4e238cb /src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java | |
parent | 384c1d6d39e345d092965ec926de249fc6ff2bb4 (diff) | |
parent | af9ff963c4120731ec65ed1a9628e82d1f5b66e1 (diff) |
Merged with latest of mbien
Diffstat (limited to 'src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java')
-rwxr-xr-x | src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java | 146 |
1 files changed, 68 insertions, 78 deletions
diff --git a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java index 33f94fb19..51182c153 100755 --- a/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -36,7 +36,6 @@ * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ - package com.sun.gluegen.opengl; import java.io.*; @@ -45,89 +44,80 @@ import com.sun.gluegen.cgram.types.*; import com.sun.gluegen.procaddress.*; /** A specialization of the proc address emitter which knows how to - change argument names to take into account Vertex Buffer Object / - Pixel Buffer Object variants. */ - +change argument names to take into account Vertex Buffer Object / +Pixel Buffer Object variants. */ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmitter { - protected boolean bufferObjectVariant; - protected GLEmitter glEmitter; - protected CommentEmitter glCommentEmitter = new GLCommentEmitter(); - - public GLJavaMethodBindingEmitter(JavaMethodBindingEmitter methodToWrap, - boolean callThroughProcAddress, - String getProcAddressTableExpr, - boolean changeNameAndArguments, - boolean bufferObjectVariant, - GLEmitter emitter) { - super(methodToWrap, - callThroughProcAddress, - getProcAddressTableExpr, - changeNameAndArguments, - emitter); - this.bufferObjectVariant = bufferObjectVariant; - this.glEmitter=emitter; - setCommentEmitter(glCommentEmitter); - } - - public GLJavaMethodBindingEmitter(ProcAddressJavaMethodBindingEmitter methodToWrap, - GLEmitter emitter, - boolean bufferObjectVariant) { - super(methodToWrap); - this.bufferObjectVariant = bufferObjectVariant; - this.glEmitter=emitter; - setCommentEmitter(glCommentEmitter); - } - - public GLJavaMethodBindingEmitter(GLJavaMethodBindingEmitter methodToWrap) { - this(methodToWrap, methodToWrap.glEmitter, methodToWrap.bufferObjectVariant); - } - - @Override - protected String getArgumentName(int i) { - String name = super.getArgumentName(i); - - if (!bufferObjectVariant) { - return name; + + protected boolean bufferObjectVariant; + protected GLEmitter glEmitter; + protected CommentEmitter glCommentEmitter = new GLCommentEmitter(); + + public GLJavaMethodBindingEmitter(JavaMethodBindingEmitter methodToWrap, boolean callThroughProcAddress, + String getProcAddressTableExpr, boolean changeNameAndArguments, boolean bufferObjectVariant, GLEmitter emitter) { + + super(methodToWrap, callThroughProcAddress, getProcAddressTableExpr, changeNameAndArguments, emitter); + this.bufferObjectVariant = bufferObjectVariant; + this.glEmitter = emitter; + setCommentEmitter(glCommentEmitter); } - // Emitters for VBO/PBO-related routines change the outgoing - // argument name for the buffer - if (binding.getJavaArgumentType(i).isLong()) { - Type cType = binding.getCArgumentType(i); - if (cType.isPointer() && - (cType.asPointer().getTargetType().isVoid() || - cType.asPointer().getTargetType().isPrimitive())) { - return name + "_buffer_offset"; - } + public GLJavaMethodBindingEmitter(ProcAddressJavaMethodBindingEmitter methodToWrap, GLEmitter emitter, boolean bufferObjectVariant) { + super(methodToWrap); + this.bufferObjectVariant = bufferObjectVariant; + this.glEmitter = emitter; + setCommentEmitter(glCommentEmitter); } - return name; - } + public GLJavaMethodBindingEmitter(GLJavaMethodBindingEmitter methodToWrap) { + this(methodToWrap, methodToWrap.glEmitter, methodToWrap.bufferObjectVariant); + } - protected class GLCommentEmitter extends JavaMethodBindingEmitter.DefaultCommentEmitter { - @Override - protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { - super.emitBindingCSignature(binding, writer); - - String symbolRenamed = binding.getName(); - StringBuffer newComment = new StringBuffer(); - newComment.append("<br>Part of <code>"); - if(0==glEmitter.addExtensionsOfSymbols2Buffer(newComment, ", ", symbolRenamed, binding.getAliasedNames())) { - if(glEmitter.getGLConfig().getAllowNonGLExtensions()) { - newComment.append("CORE FUNC"); - } else { - StringBuffer sb = new StringBuffer(); - JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, binding.getAliasedNames()); - RuntimeException ex = new RuntimeException("Couldn't find extension to: "+binding+" ; "+sb.toString()); - ex.printStackTrace(); - glEmitter.getGLConfig().getGLInfo().dump(); - // glEmitter.getGLConfig().dumpRenames(); - throw ex; - } - } - newComment.append("</code>"); - writer.print(newComment.toString()); + protected String getArgumentName(int i) { + String name = super.getArgumentName(i); + + if (!bufferObjectVariant) { + return name; + } + + // Emitters for VBO/PBO-related routines change the outgoing + // argument name for the buffer + if (binding.getJavaArgumentType(i).isLong()) { + Type cType = binding.getCArgumentType(i); + Type targetType = cType.asPointer().getTargetType(); + if (cType.isPointer() && (targetType.isVoid() || targetType.isPrimitive())) { + return name + "_buffer_offset"; + } + } + + return name; + } + + protected class GLCommentEmitter extends JavaMethodBindingEmitter.DefaultCommentEmitter { + + @Override + protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { + + super.emitBindingCSignature(binding, writer); + + String symbolRenamed = binding.getName(); + StringBuilder newComment = new StringBuilder(); + + newComment.append("<br>Part of <code>"); + if (0 == glEmitter.addExtensionsOfSymbols2Buffer(newComment, ", ", symbolRenamed, binding.getAliasedNames())) { + if (glEmitter.getGLConfig().getAllowNonGLExtensions()) { + newComment.append("CORE FUNC"); + } else { + StringBuilder sb = new StringBuilder(); + JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, binding.getAliasedNames()); + RuntimeException ex = new RuntimeException("Couldn't find extension to: " + binding + " ; " + sb.toString()); + glEmitter.getGLConfig().getGLInfo().dump(); + // glEmitter.getGLConfig().dumpRenames(); + throw ex; + } + } + newComment.append("</code>"); + writer.print(newComment.toString()); + } } - } } |