summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build.xml1
-rw-r--r--src/net/java/games/gluegen/opengl/BuildComposablePipeline.java61
2 files changed, 60 insertions, 2 deletions
diff --git a/make/build.xml b/make/build.xml
index 7811a86b3..37ab9dbec 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -659,6 +659,7 @@
(the uptodate element doesn't support arbitrary source and destination files) -->
<dependset>
<srcfilelist dir="${classes}/net/java/games/jogl" files="GL.class" />
+ <srcfilelist dir="${classes}/net/java/games/gluegen/opengl" files="BuildComposablePipeline.class" />
<targetfileset dir="${src.generated.java}/net/java/games/jogl"
includes="DebugGL.java,TraceGL.java" />
</dependset>
diff --git a/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java b/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java
index c6ac77c7b..d3f9a4603 100644
--- a/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java
@@ -470,6 +470,34 @@ public class BuildComposablePipeline
protected void postMethodEmissionHook(PrintWriter output)
{
output.println("private PrintStream " + getOutputStreamName() + ";");
+ output.println("private int indent = 0;");
+ output.println("protected String dumpArray(Object obj)");
+ output.println("{");
+ output.println(" StringBuffer sb = new StringBuffer(\"[\");");
+ output.println(" int len = java.lang.reflect.Array.getLength(obj);");
+ output.println(" int count = Math.min(len,16);");
+ output.println(" for ( int i =0; i < count; i++ ) {");
+ output.println(" sb.append(java.lang.reflect.Array.get(obj,i));");
+ output.println(" if (i < count-1)");
+ output.println(" sb.append(',');");
+ output.println(" }");
+ output.println(" if ( len > 16 )");
+ output.println(" sb.append(\"...\").append(len);");
+ output.println(" sb.append(']');");
+ output.println(" return sb.toString();");
+ output.println("}");
+ output.println("protected void print(String str)");
+ output.println("{");
+ output.println(" "+getOutputStreamName()+".print(str);");
+ output.println("}");
+ output.println("protected void println(String str)");
+ output.println("{");
+ output.println(" "+getOutputStreamName()+".println(str);");
+ output.println("}");
+ output.println("protected void printIndent()");
+ output.println("{");
+ output.println(" for( int i =0; i < indent; i++) {"+getOutputStreamName()+".print(' ');}");
+ output.println("}");
}
protected void emitClassDocComment(PrintWriter output)
{
@@ -485,13 +513,42 @@ public class BuildComposablePipeline
protected void preDownstreamCallHook(PrintWriter output, Method m)
{
- output.println(getOutputStreamName() + ".println(\"Entered " + m.getName() + "\");");
+ Class[] params = m.getParameterTypes();
+ if ( m.getName().equals("glEnd") || m.getName().equals("glEndList"))
+ {
+ output.println("indent-=2;");
+ output.println(" printIndent();");
+ }
+ else
+ {
+ output.println("printIndent();");
+ }
+
+ output.print(" print(\"" + m.getName() + "(\"");
+ for ( int i =0; i < params.length; i++ )
+ {
+ if ( params[i].isArray() )
+ output.print("+dumpArray(arg"+i+")");
+ else
+ output.print("+arg"+i);
+ if ( i < params.length-1)
+ output.print("+\",\"");
+ }
+ output.println("+\")\");");
output.print(" ");
}
protected void postDownstreamCallHook(PrintWriter output, Method m)
{
- output.println(" " + getOutputStreamName() + ".println(\"Exited " + m.getName() + "\");");
+ Class ret = m.getReturnType();
+ if ( ret != Void.TYPE )
+ {
+ output.println(" println(\" = \"+_res);");
+ }
+ else
+ {
+ output.println(" println(\"\");");
+ }
}
private String getOutputStreamName() {