aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/gluegen/JavaMethodBindingEmitter.java
diff options
context:
space:
mode:
authorTravis Bryson <[email protected]>2005-05-25 01:49:58 +0000
committerTravis Bryson <[email protected]>2005-05-25 01:49:58 +0000
commit48fda1ba14e025d9d6a984953219868c73318e5b (patch)
treeb92757971b17ab08a9ba23158bb1e14a2cc090d7 /src/net/java/games/gluegen/JavaMethodBindingEmitter.java
parent492f117fd3f76c7a5778ca2a07c6f5803242b8e0 (diff)
Modified Files:
jogl/make/gl-common.cfg jogl/make/gl-glx-common.cfg jogl/src/net/java/games/gluegen/opengl/JavaGLPAWrapperEmitter.java jogl/src/net/java/games/gluegen/runtime/BufferFactory.java jogl/src/net/java/games/gluegen/JavaEmitter.java jogl/src/net/java/games/gluegen/JavaConfiguration.java jogl/src/net/java/games/gluegen/CMethodBindingEmitter.java jogl/src/net/java/games/gluegen/JavaMethodBindingEmitter.java jogl/src/net/java/games/gluegen/CMethodBindingImplEmitter.java jogl/src/net/java/games/gluegen/JavaMethodBindingImplEmitter.java jogl/src/net/java/games/jogl/util/BufferUtils.java Changes: * Add NIODirectOnly grammar for description of methods that should have only NIO Direct Buffer option (no expansion into other types, and also will not be expanded to include indirect Buffer when we add that functionality) * Make changes to respect Direct Buffer position value. This allows a setting of an internal Buffer object parameter and JOGL will start reading data at the point in the buffer to which this position is set * The code is now generated to always respect this offset option. This has the affect of changing the internal signatures of all methods that use Buffers. But it does not affect the external API at all. * Old JOGL programs will continue working the same as long as they had the Buffer position set to zero before (the default value) git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@281 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/gluegen/JavaMethodBindingEmitter.java')
-rw-r--r--src/net/java/games/gluegen/JavaMethodBindingEmitter.java34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/net/java/games/gluegen/JavaMethodBindingEmitter.java b/src/net/java/games/gluegen/JavaMethodBindingEmitter.java
index e5b83a26c..d6a34c1d3 100644
--- a/src/net/java/games/gluegen/JavaMethodBindingEmitter.java
+++ b/src/net/java/games/gluegen/JavaMethodBindingEmitter.java
@@ -65,8 +65,10 @@ public class JavaMethodBindingEmitter extends FunctionEmitter
// Exception type raised in the generated code if runtime checks fail
private String runtimeExceptionType;
- private MethodBinding binding;
- private boolean forImplementingMethodCall;
+ protected MethodBinding binding;
+ protected boolean forImplementingMethodCall;
+
+ protected boolean prefixedMethod = false;
// A non-null value indicates that rather than returning a compound
// type accessor we are returning an array of such accessors; this
@@ -149,13 +151,16 @@ public class JavaMethodBindingEmitter extends FunctionEmitter
{
boolean needComma = false;
int numEmitted = 0;
+ int numBufferOffsetArgs = 0, numBufferOffsetArrayArgs = 0;
- if (forImplementingMethodCall && binding.hasContainingType()) {
+ if (forImplementingMethodCall && binding.hasContainingType()) {
// Always emit outgoing "this" argument
writer.print("java.nio.Buffer ");
writer.print(javaThisArgumentName());
++numEmitted;
needComma = true;
+ numBufferOffsetArgs++;
+ writer.print(", int " + byteOffsetConversionArgName(numBufferOffsetArgs));
}
for (int i = 0; i < binding.getNumArguments(); i++) {
@@ -185,15 +190,38 @@ public class JavaMethodBindingEmitter extends FunctionEmitter
writer.print(binding.getArgumentName(i));
++numEmitted;
needComma = true;
+ // Add Buffer offset argument to store the buffer offset
+ if((forImplementingMethodCall || prefixedMethod) &&
+ (type.isNIOBuffer() || type.isNIOBufferArray())) {
+ if(!type.isArray()) {
+ numBufferOffsetArgs++;
+ writer.print(", int " + byteOffsetConversionArgName(numBufferOffsetArgs));
+ } else {
+ numBufferOffsetArrayArgs++;
+ writer.print(", int[] " +
+ byteOffsetArrayConversionArgName(numBufferOffsetArrayArgs));
+ }
+ }
}
return numEmitted;
}
+
protected String getImplMethodName()
{
return binding.getName() + "0";
}
+
+ protected String byteOffsetConversionArgName(int i) {
+ return "__byteOffset" + i;
+ }
+
+ protected String byteOffsetArrayConversionArgName(int i) {
+ return "__byteOffsetArray" + i;
+ }
+
+
protected void emitBody(PrintWriter writer)
{
writer.println(';');