Commits

sk  committed f78c766

Replace system.out to traces and logs.

  • Participants
  • Parent commits 7f09265

Comments (0)

Files changed (4)

File src/org/lispdev/swank/LispImplementation.java

   public boolean createExe(String exeFile, String asdFile, String toplevel,
       String pkg)
   {
-    System.out
-      .println("Creating executable is not implemented for your CL implementation");
+    Log.logWarning(
+      "Creating executable is not implemented for your CL implementation");
     return false;
   }
 

File src/org/lispdev/swank/LispNode.java

 
 import java.util.ArrayList;
 
+import org.lispdev.log.Log;
+
 /**
  * Handy structure I use to store s-expressions. Luckily for us, we don't
  * actually do much with them beyond pass them back into Lisp, so we don't
 public class LispNode
 {
   public String value = "";
-  private ArrayList<LispNode> params = new ArrayList<LispNode>();
+  private final ArrayList<LispNode> params = new ArrayList<LispNode>();
 
   public boolean isString = false;
 
     }
     catch(Exception e)
     {
-      System.out.println(e);
+      Log.logWarning("LispNode does not have "+i+"'th element");
       return new LispNode();
     }
   }

File src/org/lispdev/swank/SwankInterface.java

 import java.util.Hashtable;
 
 import org.eclipse.core.runtime.Assert;
+import org.lispdev.log.Trace;
 import org.lispdev.swank.debug.LispDebugTarget;
 import org.lispdev.swank.debug.LispVariable;
 import org.lispdev.swank.internal.LispParser;
   public synchronized void sendCompileString(String expr, String file,
       String dir, int offset, String pckg, SwankCompileStringRunnable callBack)
   {
-    System.out.println(file);
-    System.out.println(dir);
+    Trace.SWANK.trace(file);
+    Trace.SWANK.trace(dir);
     dir = swank.translateLocalFilePath(dir);
     String msg =
         "(swank:compile-string-for-emacs \""

File src/org/lispdev/swank/SwankInterfaceCore.java

 import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.ListenerList;
 import org.lispdev.log.Log;
+import org.lispdev.log.Trace;
 import org.lispdev.swank.internal.LispParser;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable;
 import org.lispdev.swank.runnables.SwankDebugReturnRunnable;
     try
     {
       lispEngine = implementation.start();
-      System.out.println("----------------lispEngine:" + lispEngine);
+      Trace.SWANK.trace("----------------lispEngine:" + lispEngine);
     }
     catch(IOException e3)
     {
 
     if( echoSocket != null && echoSocket.isConnected() )
     {
-      System.out.println("----------------connected");
+      Trace.SWANK.trace("----------------connected");
       connected = true;
     }
     else
     {
-      System.out.println("----------------not connected");
+      Trace.SWANK.trace("----------------not connected");
       connected = false;
     }
     if( implementation.startReplThread() )
             "COMMON-LISP-USER", "t", 2000);
       if( res == null )
       {
-        System.out.println("------------could not start repl thread");
+        Trace.SWANK.trace("------------could not start repl thread");
       }
     }
     return connected;
   {
     connected = false;
     signalListeners(new LispNode(), SwankEvent.DISCONNECT);
-    System.out.println("*disconnect");
+    Trace.SWANK.trace("*disconnect");
     if( lispEngine != null )
     {
       lispEngine.destroy();
   private synchronized boolean sendRaw(String message)
   {
     // message = message + "\n";
-    System.out.println("-->" + message);
+    Trace.SWANK.trace("-->" + message);
     try
     {
       if( out != null )
       }
       catch(UnsupportedEncodingException e)
       {
-        System.out.println("Could not load UTF-8 character set"
-            + " -- something seriously wrong....");
-        e.printStackTrace();
+        Log.logException("Could not load UTF-8 character set"
+            + " -- something seriously wrong....",e);
         throw new IllegalStateException("Could not initialize swank listener"
             + " -- UTF-8 character set not available.", e);
       }
             nread = in.read(lbuf, 0, lbuf.length);
             if( nread < 0 )
             {
-              System.out.println("Connection closed");
+              Trace.SWANK.trace("Connection closed");
               signalListeners(new LispNode(), SwankEvent.DISCONNECT);
               connected = false;
               return;
               int n = in.read(rbuf, nread, length - nread);
               if( n < 0 )
               {
-                System.out.println("Connection closed");
+                Trace.SWANK.trace("Connection closed");
                 signalListeners(new LispNode(), SwankEvent.DISCONNECT);
                 connected = false;
                 return;
 
             // Reify the string...
             reply = String.copyValueOf(rbuf, 0, nread);
-            System.out.println("<--" + reply);
-            System.out.flush();
+            Trace.SWANK.trace("<--" + reply);
             if( reply.contains("open-dedicated-output-stream") )
             {
               StringTokenizer tokens = new StringTokenizer(reply, " )");
                 try
                 {
                   String token = tokens.nextToken();
-                  System.out.println(token);
+                  Trace.SWANK.trace(token);
                   int tmp = Integer.parseInt(token);
-                  System.out.println("secondary:" + tmp);
+                  Trace.SWANK.trace("secondary:" + tmp);
                   secondary = new Socket("localhost", tmp);
                   displayListener =
                       new DisplayListenerThread(secondary.getInputStream(),
             }
             else
             {
-              // System.out.println("parsing");
               handle(LispParser.parse(reply.substring(1)));
             }
           } // if
           return;
         }
       } // while
-      System.out.println("Done listening");
+      Trace.SWANK.trace("Done listening");
     }
 
   } // class
           int nread = in.read(cbuf, 0, 1);
           if( nread < 0 )
           {
-            System.out.println("Display input pipe closed.");
+            Trace.SWANK.trace("Display input pipe closed.");
             connected = false;
             return;
           }
                 }
                 else lines += 1;
               }
-              System.out.print("]");
-              System.out.print(curr);
+              Trace.SWANK.trace("]"+curr);
               runFilters(curr);
               if( curr.toLowerCase()
                 .contains(implementation.fatalErrorString()) )