diff options
author | Sven Gothel <[email protected]> | 2010-04-08 02:24:30 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-04-08 02:24:30 +0200 |
commit | d3ec98ea43cf0e38860e64c111c7b09ed4b363bd (patch) | |
tree | 1601fd95b56d7271b80ef111500e1f087797bcb7 | |
parent | 7cc4bb2a8bcc4c16b6a12826abbd874bf38f9dc1 (diff) | |
parent | 8831df5f260e84e4fc342092afa19c786e7883b9 (diff) |
Merge branch 'master' of github.com:mbien/gluegenVALID_BUILDS_01
-rw-r--r-- | gluegen.iml | 27 | ||||
-rw-r--r-- | nbproject/ide-file-targets.xml | 60 | ||||
-rwxr-xr-x | nbproject/project.xml | 26 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/JavaEmitter.java | 2 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/JavaMethodBindingEmitter.java | 79 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/MethodBinding.java | 72 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java | 2 |
7 files changed, 167 insertions, 101 deletions
diff --git a/gluegen.iml b/gluegen.iml new file mode 100644 index 0000000..8ce7bca --- /dev/null +++ b/gluegen.iml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/build/test/build/gensrc/classes" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/build/gensrc/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/test/junit" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/junit" isTestSource="true" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/build/antlr-3.2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="library" name="junit" level="application" /> + <orderEntry type="library" name="ant" level="application" /> + </component> +</module> + diff --git a/nbproject/ide-file-targets.xml b/nbproject/ide-file-targets.xml index f763c48..46dc184 100644 --- a/nbproject/ide-file-targets.xml +++ b/nbproject/ide-file-targets.xml @@ -1,73 +1,75 @@ <?xml version="1.0" encoding="UTF-8"?> <project basedir=".." name="GlueGen-IDE"> - <!-- edit the following targets according to your needs --> <!-- (more info: http://www.netbeans.org/kb/articles/freeform-config.html--> - <target name="compile-test"> - <mkdir dir="build/test/build/classes"/> - - <javac destdir="build/test/build/classes" failonerror="false" source="1.5" srcdir="test/junit" debug="true" debuglevel="lines,vars,source"> + <javac debug="true" debuglevel="lines,vars,source" destdir="build/test/build/classes" failonerror="false" source="1.5" srcdir="test/junit"> <classpath path="build/test/build/classes:build/classes:build/test/gensrc/java:lib/antlr-3.2.jar:make/lib/junit-4.5.jar:${jdk.home}/lib/tools.jar:${ant.core.lib}"/> </javac> </target> - <target name="compile-selected-files-in-junit"> <fail unless="files">Must set property 'files'</fail> - <mkdir dir="build/test/build/classes"/> - - <javac destdir="build/test/build/classes" includes="${files}" source="1.5" srcdir="test/junit" debug="true" debuglevel="lines,vars,source"> + <javac debug="true" debuglevel="lines,vars,source" destdir="build/test/build/classes" includes="${files}" source="1.5" srcdir="test/junit"> <classpath path="build/test/build/classes:build/classes:build/test/gensrc/java:lib/antlr-3.2.jar:make/lib/junit-4.5.jar:${jdk.home}/lib/tools.jar:${ant.core.lib}"/> </javac> </target> - - <target name="run-selected-file-in-junit" depends="compile-test"> + <target depends="compile-test" name="run-selected-file-in-junit"> <fail unless="run.class">Must set property 'run.class'</fail> - <java classname="${run.class}" failonerror="true" fork="true"> <classpath> <path path="build/test/build/classes:build/classes:lib/antlr-3.2.jar:make/lib/junit-4.5.jar:${jdk.home}/lib/tools.jar:${ant.core.lib}"/> </classpath> </java> </target> - - <target name="test-selected-file-in-junit" depends="compile-test"> + <target depends="compile-test" name="test-selected-file-in-junit"> <fail unless="run.class">Must set property 'run.class'</fail> - <junit forkmode="once" showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed"> - <test name="${run.class}"> - </test> + <junit errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="once" showoutput="true"> + <test name="${run.class}"/> <jvmarg value="-Djava.library.path=${basedir}/build/test/build/natives"/> <classpath> <path path="build/test/build/classes:build/test/gensrc/java:build/classes:lib/antlr-3.2.jar:make/lib/junit-4.5.jar:${jdk.home}/lib/tools.jar:${ant.core.lib}"/> </classpath> - <formatter usefile="false" type="brief"/> + <formatter type="brief" usefile="false"/> </junit> </target> - - <target name="debug-selected-file-in-junit" depends="compile-test"> + <target depends="compile-test" name="debug-selected-file-in-junit"> <fail unless="run.class">Must set property 'debug.class'</fail> - <path id="cp"> <path path="build/test/build/classes:build/test/gensrc/java:build/classes:lib/antlr-3.2.jar:make/lib/junit-4.5.jar:${jdk.home}/lib/tools.jar:${ant.core.lib}"/> </path> - <nbjpdastart addressproperty="jpda.address" name="GlueGen" transport="dt_socket"> <classpath refid="cp"/> </nbjpdastart> - - <junit forkmode="once" showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed"> - <test name="${run.class}"> - </test> + <junit errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="once" showoutput="true"> + <test name="${run.class}"/> <classpath refid="cp"/> <jvmarg value="-Djava.library.path=${basedir}/build/test/build/natives"/> <jvmarg value="-Xdebug"/> <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/> - <formatter usefile="false" type="brief"/> + <formatter type="brief" usefile="false"/> </junit> - <java classname="${run.class}" fork="true"> + <java classname="${run.class}" fork="true"/> + </target> + <!-- TODO: edit the following target according to your needs --> + <!-- (more info: http://www.netbeans.org/kb/articles/freeform-config.html#runsingle) --> + <target name="run-selected-file-in-java"> + <fail unless="run.class">Must set property 'run.class'</fail> + <java classname="${run.class}" failonerror="true" fork="true"> + <classpath> + <pathelement path="build/classes:${jdk.home}/lib/tools.jar:/lib/antlr-3.2.jar"/> + <pathelement location="build/classes"/> + </classpath> </java> </target> - + <!-- TODO: edit the following target according to your needs --> + <!-- (more info: http://www.netbeans.org/kb/articles/freeform-config.html#compilesingle) --> + <target name="compile-selected-files-in-java"> + <fail unless="files">Must set property 'files'</fail> + <mkdir dir="build/classes"/> + <javac destdir="build/classes" includes="${files}" source="1.5" srcdir="src/java"> + <classpath path="build/classes:${jdk.home}/lib/tools.jar:${ant.core.lib}:lib/antlr-3.2.jar"/> + </javac> + </target> </project> diff --git a/nbproject/project.xml b/nbproject/project.xml index 054a6bc..66a1c6c 100755 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -137,6 +137,32 @@ <script>${ant.script}</script> <target>test</target> </action> + <action name="run.single"> + <script>nbproject/ide-file-targets.xml</script> + <target>run-selected-file-in-java</target> + <context> + <property>run.class</property> + <folder>src/java</folder> + <pattern>\.java$</pattern> + <format>java-name</format> + <arity> + <one-file-only/> + </arity> + </context> + </action> + <action name="compile.single"> + <script>nbproject/ide-file-targets.xml</script> + <target>compile-selected-files-in-java</target> + <context> + <property>files</property> + <folder>src/java</folder> + <pattern>\.java$</pattern> + <format>relative-path</format> + <arity> + <separated-files>,</separated-files> + </arity> + </context> + </action> </ide-actions> <export> <type>folder</type> diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java index 4cee09c..ec7d951 100644 --- a/src/java/com/sun/gluegen/JavaEmitter.java +++ b/src/java/com/sun/gluegen/JavaEmitter.java @@ -46,6 +46,7 @@ import java.util.*; import java.text.MessageFormat; import com.sun.gluegen.cgram.types.*; +import java.nio.Buffer; import java.util.logging.Logger; import static java.util.logging.Level.*; @@ -1589,6 +1590,7 @@ public class JavaEmitter implements GlueEmitter { imports.add(cfg.gluegenRuntimePackage()+".*"); imports.add(DynamicLookupHelper.class.getPackage().getName()+".*"); imports.add(Buffers.class.getPackage().getName()+".*"); + imports.add(Buffer.class.getPackage().getName()+".*"); if (cfg.allStatic() || cfg.emitInterface()) { diff --git a/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java b/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java index 4153e32..f7bbc99 100644 --- a/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/JavaMethodBindingEmitter.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -28,11 +28,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -49,8 +49,8 @@ import com.sun.gluegen.cgram.*; /** * An emitter that emits only the interface for a Java<->C JNI binding. */ -public class JavaMethodBindingEmitter extends FunctionEmitter -{ +public class JavaMethodBindingEmitter extends FunctionEmitter { + public static final EmissionModifier PUBLIC = new EmissionModifier("public"); public static final EmissionModifier PROTECTED = new EmissionModifier("protected"); public static final EmissionModifier PRIVATE = new EmissionModifier("private"); @@ -61,7 +61,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter protected final CommentEmitter defaultJavaCommentEmitter = new DefaultCommentEmitter(); protected final CommentEmitter defaultInterfaceCommentEmitter = new InterfaceCommentEmitter(); - + // Exception type raised in the generated code if runtime checks fail private String runtimeExceptionType; private String unsupportedExceptionType; @@ -128,7 +128,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter } cfg = configuration; } - + public JavaMethodBindingEmitter(JavaMethodBindingEmitter arg) { super(arg); binding = arg.binding; @@ -226,7 +226,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter this.forIndirectBufferAndArrayImplementation = indirect; } - protected void emitReturnType(PrintWriter writer) { + protected void emitReturnType(PrintWriter writer) { writer.print(getReturnTypeString(false)); } @@ -240,7 +240,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter } if (!type.isNIOByteBuffer()) { // Return buffer requiring change of view from ByteBuffer to e.g. LongBuffer - return "java.nio.ByteBuffer"; + return "ByteBuffer"; } } else if (type.isPrimitiveArray()) { if (!skipBuffers) { @@ -254,23 +254,27 @@ public class JavaMethodBindingEmitter extends FunctionEmitter return "Object[]"; } else if (type.isCompoundTypeWrapper()) { // Compound type wrappers are unwrapped to ByteBuffer - return "java.nio.ByteBuffer"; + return "ByteBuffer"; } else if (type.isArrayOfCompoundTypeWrappers()) { if (skipBuffers) { - return "java.nio.ByteBuffer"; + return "ByteBuffer"; } else { // In the case where this is called with a false skipBuffers // argument we want to erase the array of compound type // wrappers to ByteBuffer[] - return "java.nio.ByteBuffer[]"; + return "ByteBuffer[]"; } } } + String name = type.getName(); + int index = name.lastIndexOf('.')+1; // always >= 0 + name = name.substring(index); + if (type.isArrayOfCompoundTypeWrappers()) { // We don't want to bake the array specification into the type name - return type.getName() + "[]"; + return name + "[]"; } - return type.getName(); + return name; } protected String getReturnTypeString(boolean skipArray) { @@ -278,7 +282,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter // generation for arrays of compound type wrappers if (skipArray || // The following arm is used by most other kinds of return types - (getReturnedArrayLengthExpression() == null && + (getReturnedArrayLengthExpression() == null && !binding.getJavaReturnType().isArrayOfCompoundTypeWrappers()) || // The following arm is used specifically to get the splitting up // of one returned ByteBuffer into an array of compound type @@ -305,15 +309,15 @@ public class JavaMethodBindingEmitter extends FunctionEmitter if (forImplementingMethodCall && binding.hasContainingType()) { // Always emit outgoing "this" argument - writer.print("java.nio.ByteBuffer "); - writer.print(javaThisArgumentName()); + writer.print("ByteBuffer "); + writer.print(javaThisArgumentName()); ++numEmitted; needComma = true; } for (int i = 0; i < binding.getNumArguments(); i++) { JavaType type = binding.getJavaArgumentType(i); - if (type.isVoid()) { + if (type.isVoid()) { // Make sure this is the only param to the method; if it isn't, // there's something wrong with our parsing of the headers. if (binding.getNumArguments() != 1) { @@ -322,7 +326,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter "multi-argument function \"" + binding + "\""); } continue; - } + } if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { // Don't need to expose these at the Java level @@ -348,8 +352,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter writer.print(", boolean " + isNIOArgName(i)); } } else if (type.isNIOBufferArray()) { - writer.print(", int[] " + - byteOffsetArrayArgName(i)); + writer.print(", int[] " + byteOffsetArrayArgName(i)); } } @@ -376,7 +379,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter protected String byteOffsetArgName(String s) { return s + "_byte_offset"; } - + protected String isNIOArgName(int i) { return isNIOArgName(binding.getArgumentName(i)); } @@ -384,11 +387,11 @@ public class JavaMethodBindingEmitter extends FunctionEmitter protected String isNIOArgName(String s) { return s + "_is_direct"; } - + protected String byteOffsetArrayArgName(int i) { return getArgumentName(i) + "_byte_offset_array"; } - + protected String offsetArgName(int i) { return getArgumentName(i) + "_offset"; } @@ -466,7 +469,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter writer.println(" if (" + argName + " != null) {"); writer.println(" for (int _ctr = 0; _ctr < " + argName + ".length; _ctr++) {"); writer.println(" if (!Buffers.isDirect(" + argName + "[_ctr])) {"); - writer.println(" throw new " + getRuntimeExceptionType() + + writer.println(" throw new " + getRuntimeExceptionType() + "(\"Element \" + _ctr + \" of argument \\\"" + getArgumentName(i) + "\\\" was not a direct buffer\");"); writer.println(" }"); @@ -479,7 +482,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter String argName = getArgumentName(i); String offsetArg = offsetArgName(i); writer.println(" if(" + argName + " != null && " + argName + ".length <= " + offsetArg + ")"); - writer.print (" throw new " + getRuntimeExceptionType()); + writer.print (" throw new " + getRuntimeExceptionType()); writer.println("(\"array offset argument \\\"" + offsetArg + "\\\" (\" + " + offsetArg + " + \") equals or exceeds array length (\" + " + argName + ".length + \")\");"); } @@ -523,10 +526,10 @@ public class JavaMethodBindingEmitter extends FunctionEmitter if (!returnType.isVoid()) { if (returnType.isCompoundTypeWrapper() || returnType.isNIOBuffer()) { - writer.println("java.nio.ByteBuffer _res;"); + writer.println("ByteBuffer _res;"); needsResultAssignment = true; } else if (returnType.isArrayOfCompoundTypeWrappers()) { - writer.println("java.nio.ByteBuffer[] _res;"); + writer.println("ByteBuffer[] _res;"); needsResultAssignment = true; } else if (((epilogue != null) && (epilogue.size() > 0)) || binding.signatureUsesArraysOfCompoundTypeWrappers()) { @@ -554,7 +557,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter emitCallResultReturn(binding, writer); } } - + protected int emitCallArguments(MethodBinding binding, PrintWriter writer) { boolean needComma = false; int numArgsEmitted = 0; @@ -578,7 +581,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter // there's something wrong with our parsing of the headers. assert(binding.getNumArguments() == 1); continue; - } + } if (needComma) { writer.print(", "); @@ -715,7 +718,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter // compound types (rounding up to machine-dependent alignment) writer.println(" _res.position(_count * " + getReturnTypeString(true) + ".size());"); writer.println(" _res.limit ((1 + _count) * " + getReturnTypeString(true) + ".size());"); - writer.println(" java.nio.ByteBuffer _tmp = _res.slice();"); + writer.println(" ByteBuffer _tmp = _res.slice();"); writer.println(" Buffers.nativeOrder(_tmp);"); writer.println(" _res.position(0);"); writer.println(" _res.limit(_res.capacity());"); @@ -802,7 +805,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter protected void emitBeginning(FunctionEmitter emitter, PrintWriter writer) { writer.print("Entry point to C language function: "); } - protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { + protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { writer.print("<code> "); writer.print(binding.getCSymbol().toString(tagNativeBinding)); writer.print(" </code> "); @@ -822,7 +825,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter if (type.isEnum() && !HeaderParser.ANONYMOUS_ENUM_NAME.equals(type.getName())) { EnumType enumType = (EnumType)type; writer.println(); - writer.print(emitter.getBaseIndentString()); + writer.print(emitter.getBaseIndentString()); writer.print(" "); writer.print("@param "); writer.print(getArgumentName(i)); @@ -834,7 +837,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter writer.println("</code>"); } else if (directNIOOnly && javaType.isNIOBuffer()) { writer.println(); - writer.print(emitter.getBaseIndentString()); + writer.print(emitter.getBaseIndentString()); writer.print(" "); writer.print("@param "); writer.print(getArgumentName(i)); diff --git a/src/java/com/sun/gluegen/MethodBinding.java b/src/java/com/sun/gluegen/MethodBinding.java index 5805be1..7b3984e 100644 --- a/src/java/com/sun/gluegen/MethodBinding.java +++ b/src/java/com/sun/gluegen/MethodBinding.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -28,20 +28,24 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ package com.sun.gluegen; -import java.util.*; +import com.sun.gluegen.cgram.types.FunctionSymbol; +import com.sun.gluegen.cgram.types.Type; -import com.sun.gluegen.cgram.types.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; /** Represents the binding of a C function to a Java method. Also used to represent calls through function pointers contained in @@ -73,7 +77,7 @@ public class MethodBinding { * argument, including the java return type and java argument * types. It's safe to modify this binding after construction. */ - public MethodBinding(MethodBinding bindingToCopy) { + public MethodBinding(MethodBinding bindingToCopy) { this.sym = bindingToCopy.sym; this.renamedMethodName = bindingToCopy.renamedMethodName; @@ -94,7 +98,7 @@ public class MethodBinding { this.signatureUsesJavaPrimitiveArrays = bindingToCopy.signatureUsesJavaPrimitiveArrays; this.thisPointerIndex = bindingToCopy.thisPointerIndex; } - + /** Constructor for calling a C function. */ public MethodBinding(FunctionSymbol sym) { this.sym = sym; @@ -312,7 +316,7 @@ public class MethodBinding { protected void computeSignatureProperties() { if (computedSignatureProperties) return; - + argumentsUseNIO = false; signatureUsesNIO = false; signatureCanUseIndirectNIO = false; @@ -439,7 +443,7 @@ public class MethodBinding { thisPointerIndex = i; break; } - + if (!arg.isJNIEnv()) { break; // this pointer must be leftmost argument excluding JNIEnvs } @@ -461,7 +465,7 @@ public class MethodBinding { if (obj == this) { return true; } - + if (obj == null || ! (obj instanceof MethodBinding)) { return false; } @@ -474,7 +478,7 @@ public class MethodBinding { other.getContainingCType() != null && (!(containingCType.equals(other.getContainingCType())))) { return false; - } + } if (javaArgumentTypes.size() != other.javaArgumentTypes.size()) { return false; } @@ -486,13 +490,13 @@ public class MethodBinding { return false; } } - + return true; } @Override public int hashCode() { - StringBuffer buf = new StringBuffer(200); + StringBuilder buf = new StringBuilder(200); buf.append(getName()); buf.append(sym.getType().getName(true)); buf.append(getJavaReturnType().getName()); @@ -507,8 +511,8 @@ public class MethodBinding { // there's something wrong with our parsing of the headers. assert(getNumArguments() == 1); continue; - } - + } + buf.append(type.getName()); } return buf.toString().hashCode(); @@ -517,35 +521,35 @@ public class MethodBinding { /** Returns the signature of this binding. */ @Override public String toString() { - StringBuffer buf = new StringBuffer(200); + StringBuilder buf = new StringBuilder(200); buf.append(getJavaReturnType().getName()); - buf.append(" "); + buf.append(' '); buf.append(getName()); - buf.append("("); + buf.append('('); boolean needComma = false; for (int i = 0; i < getNumArguments(); i++) { JavaType type = getJavaArgumentType(i); - if (type.isVoid()) { + if (type.isVoid()) { // Make sure this is the only param to the method; if it isn't, // there's something wrong with our parsing of the headers. assert(getNumArguments() == 1); continue; - } + } if (type.isJNIEnv() || isArgumentThisPointer(i)) { // Don't need to expose these at the Java level continue; } - + if (needComma) { buf.append(", "); } buf.append(type.getName()); - buf.append(" "); + buf.append(' '); buf.append(getArgumentName(i)); needComma = true; } - buf.append(")"); + buf.append(')'); return buf.toString(); } @@ -560,9 +564,9 @@ public class MethodBinding { manually specifying prologue and epilogue code, for example. */ public String getDescriptor(boolean forImplementingMethodCall, boolean eraseBufferAndArrayTypes) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); - buf.append("("); + buf.append('('); if (forImplementingMethodCall && hasContainingType()) { // Always emit outgoing "this" argument @@ -571,7 +575,7 @@ public class MethodBinding { for (int i = 0; i < getNumArguments(); i++) { JavaType type = getJavaArgumentType(i); - if (type.isVoid()) { + if (type.isVoid()) { // Make sure this is the only param to the method; if it isn't, // there's something wrong with our parsing of the headers. if (getNumArguments() != 1) { @@ -580,7 +584,7 @@ public class MethodBinding { "multi-argument function \"" + this + "\""); } continue; - } + } if (type.isJNIEnv() || isArgumentThisPointer(i)) { // Don't need to expose these at the Java level @@ -592,7 +596,7 @@ public class MethodBinding { // Add Buffer and array index offset arguments after each associated argument if (forImplementingMethodCall) { if (type.isNIOBuffer()) { - buf.append("I"); + buf.append('I'); } else if (type.isNIOBufferArray()) { buf.append("[I"); } @@ -600,11 +604,11 @@ public class MethodBinding { // Add offset argument after each primitive array if (type.isPrimitiveArray()) { - buf.append("I"); + buf.append('I'); } } - buf.append(")"); + buf.append(')'); // Emit return type for completeness even though we can't overload // based solely on return type diff --git a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java index 54aa759..a5e826e 100644 --- a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java +++ b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java @@ -42,6 +42,7 @@ import com.sun.gluegen.*; import java.lang.reflect.*; import java.io.*; +import java.nio.Buffer; import java.util.*; import java.util.ArrayList; @@ -353,6 +354,7 @@ public class BuildComposablePipeline { imports.add("java.io.*"); imports.add("javax.media.opengl.*"); imports.add("com.jogamp.gluegen.runtime.*"); + imports.add(Buffer.class.getPackage().getName()+".*"); for (Class<?> clasS : clazzList) { imports.add(clasS.getName()); } |