From 1ad0557911c2466a6943564528b31cc33f48851d Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Tue, 15 Jul 2003 06:10:13 +0000 Subject: Fixed issue 12: Better tracing output Applied patches submitted by abies@dev.java.net. 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 --- make/build.xml | 1 + .../gluegen/opengl/BuildComposablePipeline.java | 61 +++++++++++++++++++++- 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) --> + 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() { -- cgit v1.2.3