aboutsummaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2003-07-15 06:10:13 +0000
committerKenneth Russel <[email protected]>2003-07-15 06:10:13 +0000
commit1ad0557911c2466a6943564528b31cc33f48851d (patch)
tree07725a1dfe84c780507d49a643816f0a9292a721 /src/net
parent8aa90c17b6d44515efee8abcc592b41c9ad854dc (diff)
Fixed issue 12: Better tracing output
Applied patches submitted by [email protected]. Added better dependence information for BuildComposablePipeline. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@31 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net')
-rw-r--r--src/net/java/games/gluegen/opengl/BuildComposablePipeline.java61
1 files changed, 59 insertions, 2 deletions
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() {