add debug variable
authorcrawshaw <crawshaw@ibex.org>
Tue, 23 Nov 2004 15:30:05 +0000 (15:30 +0000)
committercrawshaw <crawshaw@ibex.org>
Tue, 23 Nov 2004 15:30:05 +0000 (15:30 +0000)
darcs-hash:20041123153005-2eb37-7bda1c3cde8ac932e466113f062ecc45bfb53d8f.gz

src/java/org/ibex/tool/Compiler.java

index 08a399a..5b14672 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.jdt.internal.compiler.impl.*;
 import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
 
 public class Compiler {
 import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
 
 public class Compiler {
+    private static final boolean DEBUG = false;
 
     // Static Entry Point /////////////////////////////////////////////////////
 
 
     // Static Entry Point /////////////////////////////////////////////////////
 
@@ -104,12 +105,11 @@ public class Compiler {
     public void compile() {
         List s = new ArrayList();
         filterSources(s, sourcedir, new char[0][]);
     public void compile() {
         List s = new ArrayList();
         filterSources(s, sourcedir, new char[0][]);
-        System.out.println("working with "+s.size() +" sources");
+        if (DEBUG) System.out.println("working with "+s.size() +" sources");
         sources = new Source[s.size()]; s.toArray(sources);
         ICompilationUnit[] units = new ICompilationUnit[s.size()];
         for (int i=0; i < sources.length; i++) units[i] = sources[i].unit;
 
         sources = new Source[s.size()]; s.toArray(sources);
         ICompilationUnit[] units = new ICompilationUnit[s.size()];
         for (int i=0; i < sources.length; i++) units[i] = sources[i].unit;
 
-        System.out.println("compiling");
         org.eclipse.jdt.internal.compiler.Compiler jdt =
             new org.eclipse.jdt.internal.compiler.Compiler(
                 env, policy, settings, results, problems);
         org.eclipse.jdt.internal.compiler.Compiler jdt =
             new org.eclipse.jdt.internal.compiler.Compiler(
                 env, policy, settings, results, problems);
@@ -272,8 +272,6 @@ public class Compiler {
             for (int i=0; i < ex.length; i++) ex[i] = name(exs[i]);
 
             desc = descriptor(m.getParameterTypes(), m.getReturnType());
             for (int i=0; i < ex.length; i++) ex[i] = name(exs[i]);
 
             desc = descriptor(m.getParameterTypes(), m.getReturnType());
-            /*if (new String(desc).indexOf("[") > -1)
-                System.out.println("method: "+m+", desc="+new String(desc));*/ // DEBUG
         }
         public int getModifiers() { return m.getModifiers(); }
         public char[] getSelector() { return m.getName().toCharArray(); }
         }
         public int getModifiers() { return m.getModifiers(); }
         public char[] getSelector() { return m.getName().toCharArray(); }
@@ -352,7 +350,6 @@ public class Compiler {
     final INameEnvironment env = new INameEnvironment() {
         public NameEnvironmentAnswer findType(char[][] c) { return findType(name(c), pack(c)); }
         public NameEnvironmentAnswer findType(char[] n, char[][] p) {
     final INameEnvironment env = new INameEnvironment() {
         public NameEnvironmentAnswer findType(char[][] c) { return findType(name(c), pack(c)); }
         public NameEnvironmentAnswer findType(char[] n, char[][] p) {
-            boolean DEBUG = false;
             if (DEBUG) System.out.println("requesting: "+ str(p, '.') + "."+new String(n));
 
             try {
             if (DEBUG) System.out.println("requesting: "+ str(p, '.') + "."+new String(n));
 
             try {
@@ -407,7 +404,7 @@ public class Compiler {
     /** Used by compiler for processing compiled classes and their errors. */
     private final ICompilerRequestor results = new ICompilerRequestor() {
         public void acceptResult(CompilationResult result) {
     /** Used by compiler for processing compiled classes and their errors. */
     private final ICompilerRequestor results = new ICompilerRequestor() {
         public void acceptResult(CompilationResult result) {
-            System.out.println("got result: "+result);
+            if (DEBUG) System.out.println("got result: "+result);
             if (result.hasProblems()) {
                 boolean hasErrors = false;
                 IProblem[] p = result.getProblems();
             if (result.hasProblems()) {
                 boolean hasErrors = false;
                 IProblem[] p = result.getProblems();
@@ -430,12 +427,12 @@ public class Compiler {
                     File path = builddir;
                     char[][] name = c[i].getCompoundName();
                     path = new File(builddir, str(pack(name), '/'));
                     File path = builddir;
                     char[][] name = c[i].getCompoundName();
                     path = new File(builddir, str(pack(name), '/'));
-                    System.out.println("DEBUG: creating path "+path+", out of builddir="+builddir);
+                    if (DEBUG) System.out.println("DEBUG: creating path "+path+", out of builddir="+builddir);
                     if (!path.exists()) path.mkdirs();
 
                     // write new class file
                     path = new File(path, new String(name(name)) + ".class");
                     if (!path.exists()) path.mkdirs();
 
                     // write new class file
                     path = new File(path, new String(name(name)) + ".class");
-                    System.out.println("DEBUG: writing file "+path);
+                    if (DEBUG) System.out.println("DEBUG: writing file "+path);
                     OutputStream o = new BufferedOutputStream(
                         new FileOutputStream(path));
                     o.write(c[i].getBytes());
                     OutputStream o = new BufferedOutputStream(
                         new FileOutputStream(path));
                     o.write(c[i].getBytes());