Commits

Anonymous committed 5cc9b0f

Intermidiate step in big swank refactoring - lispdev again works as before.

  • Participants
  • Parent commits cf43233

Comments (0)

Files changed (4)

File src/org/lispdev/repl/AbstractRepl.java

 import org.lispdev.swank.ISwank;
 import org.lispdev.swank.SwankDebugRunnable;
 import org.lispdev.swank.SwankEvent;
-import org.lispdev.swank.SwankRunnable;
+import org.lispdev.swank.runnables.SwankDebugActivateRunnable;
+import org.lispdev.swank.runnables.SwankDebugReturnRunnable;
+import org.lispdev.swank.runnables.SwankReadStringRunnable;
+import org.lispdev.swank.runnables.SwankRunnable;
 
 /**
  * Repl is a bridge between swank server events and user interface.
 
     public DisconnectRunnable(AbstractRepl r)
     {
+      super(swank.getLispImplementation());
       repl = r;
     }
 
       repl.disconnected();
     }
 
+    @Override
+    public Object getInfo()
+    {
+      return null;
+    }
+
   }
 
-  private class ReadRunnable extends SwankRunnable
+  private class ReadRunnable extends SwankReadStringRunnable
   {
     private final AbstractRepl repl;
 
     public ReadRunnable(AbstractRepl r)
     {
+      super(swank.getLispImplementation());
       repl = r;
     }
 
     @Override
     public void run()
     {
-      DebugInfo info = getInfo();
-      String key = info.thread + ":" + info.level;
-      Trace.DEBUG.trace("DebugInfoRunnable: "+ info.toString());
-      debugInfos.put(key, info);
+      Trace.DEBUG.trace("DebugInfoRunnable: "+ getInfo().toString());
+      debugInfos.put(getKey(), getInfo());
     }
   }
 
-  private class DebugRunnable extends SwankRunnable
+  private class DebugRunnable extends SwankDebugActivateRunnable
   {
     private final AbstractRepl repl;
 
     public DebugRunnable(AbstractRepl r)
     {
+      super(swank.getLispImplementation());
       repl = r;
     }
 
     }
   }
 
-  private class DebugStopRunnable extends SwankRunnable
+  private class DebugStopRunnable extends SwankDebugReturnRunnable
   {
     private final AbstractRepl repl;
 
     public DebugStopRunnable(AbstractRepl r)
     {
+      super(swank.getLispImplementation());
       repl = r;
     }
 
     }
   }
 
-  private final SwankDisplayRunnable displayRunnable =
-    new SwankDisplayRunnable(this);
-  private final ReadRunnable readRunnable =
-    new ReadRunnable(this);
-  private final DisconnectRunnable disconnectRunnable =
-    new DisconnectRunnable(this);
+  private final SwankDisplayRunnable displayRunnable;
+  private final ReadRunnable readRunnable;
+  private final DisconnectRunnable disconnectRunnable;
   private final DebugInfoRunnable debugInfoRunnable;
-  private final DebugRunnable debugRunnable =
-    new DebugRunnable(this);
-  private final DebugStopRunnable debugStopRunnable =
-    new DebugStopRunnable(this);
+  private final DebugRunnable debugRunnable;
+  private final DebugStopRunnable debugStopRunnable;
 
   public AbstractRepl(ISwank s)
   {
     swank = s;
+    displayRunnable = new SwankDisplayRunnable(this,swank.getLispImplementation());
+    readRunnable = new ReadRunnable(this);
+    disconnectRunnable = new DisconnectRunnable(this);
     debugInfoRunnable = new DebugInfoRunnable();
+    debugRunnable = new DebugRunnable(this);
+    debugStopRunnable = new DebugStopRunnable(this);
+
     pushState(new EvalState(this));
     swank.addListener(SwankEvent.WRITE_STRING, displayRunnable);
-    swank.addListener(SwankEvent.READ_STRING, readRunnable);
+    swank.addReadStringListener(readRunnable);
     swank.addListener(SwankEvent.DISCONNECT, disconnectRunnable);
-    swank.addListener(SwankEvent.DEBUG, debugInfoRunnable);
-    swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugRunnable);
-    swank.addListener(SwankEvent.DEBUG_RETURN, debugStopRunnable);
+    swank.addDebugListener(debugInfoRunnable);
+    swank.addDebugActivateListener(debugRunnable);
+    swank.addDebugReturnListener(debugStopRunnable);
   }
 
   public abstract void appendOut(String text);

File src/org/lispdev/repl/EvalState.java

     {
       repl.disconnecting();
     }
-    repl.swank.sendEval(cleanCommand, new EvalStateRunnable(repl));
+    repl.swank.sendEval(cleanCommand, new EvalStateRunnable(repl,repl.swank.getLispImplementation()));
 
     return false;
   }

File src/org/lispdev/repl/EvalStateRunnable.java

 package org.lispdev.repl;
 
-import org.lispdev.swank.SwankRunnable;
+import org.lispdev.swank.LispImplementation;
+import org.lispdev.swank.runnables.SwankRunnable;
 
 public class EvalStateRunnable extends SwankRunnable
 {
   private final AbstractRepl repl;
 
-  public EvalStateRunnable(AbstractRepl r)
+  public EvalStateRunnable(AbstractRepl r, LispImplementation implementation)
   {
+    super(implementation);
     repl = r;
   }
 
   }
 
   @Override
-  public SwankRunnable clone()
+  public Object getInfo()
   {
-    EvalStateRunnable re = new EvalStateRunnable(repl);
-    re.result = this.result;
-
-    return re;
+    return null;
   }
 }

File src/org/lispdev/repl/SwankDisplayRunnable.java

 package org.lispdev.repl;
 
-import org.lispdev.swank.SwankRunnable;
+import org.lispdev.swank.LispImplementation;
+import org.lispdev.swank.runnables.SwankRunnable;
 
 public class SwankDisplayRunnable extends SwankRunnable
 {
   private final AbstractRepl repl;
   private String presentation = null;
 
-  public SwankDisplayRunnable(AbstractRepl r)
+  public SwankDisplayRunnable(AbstractRepl r, LispImplementation implementation)
   {
+    super(implementation);
     repl = r;
   }
 
   }
 
   @Override
-  public SwankRunnable clone()
+  public Object getInfo()
   {
-    SwankDisplayRunnable re = new SwankDisplayRunnable(repl);
-    re.presentation = this.presentation;
-    re.result = this.result;
-
-    return re;
+    // TODO Auto-generated method stub
+    return null;
   }
 
 }