Commits

Anonymous committed ab7644d

Continue cleaning swank interface.

Comments (0)

Files changed (10)

src/org/lispdev/swank/LispImplementation.java

 import org.lispdev.swank.runnables.SwankCompileStringRunnable.CompileMessage;
 import org.lispdev.swank.runnables.SwankCompileStringRunnable.CompileStringInfo;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable.DebugActivateInfo;
+import org.lispdev.swank.runnables.SwankDebugReturnRunnable.DebugReturnInfo;
 import org.lispdev.swank.runnables.SwankDebugRunnable.DebugInfo;
 import org.lispdev.swank.runnables.SwankReadStringRunnable.ReadStringInfo;
 import org.lispdev.swank.runnables.SwankWriteStringRunnable.WriteStringInfo;
   public DebugActivateInfo getDebugActivateInfo(LispNode n)
   {
     if( n == null || n.getParamsCount() < 3
-        || n.get(0).value.equals(":debug-activate"))
+        || !n.get(0).value.equals(":debug-activate"))
     {
-      Log.logError("DebugActivate info has wrong structure");
+      Log.logError("DebugActivate info has wrong structure: " +
+          String.valueOf(n));
       return null;
     }
     DebugActivateInfo res = new DebugActivateInfo(n.get(1).value,
     return res;
   }
 
+  /*
+   * (:debug-return thread level stepping)
+  <--(:debug-return 1 1 t)
+   */
+  public DebugReturnInfo getDebugReturnInfo(LispNode n)
+  {
+    if( n == null || n.getParamsCount() < 4
+        || !n.get(0).value.equals(":debug-return"))
+    {
+      Log.logError("Incorrect structure of debug-return result: " +
+          String.valueOf(n));
+    }
+    DebugReturnInfo res = new DebugReturnInfo(n.get(1).value, n.get(2).asInt(),
+        n.get(3).value.equals("t"));
+    return res;
+  }
+
 /*
   -->(:emacs-rex (swank:swank-macroexpand-1
   "(do-primes (p 0 19) (format t \"~d \" p))") nil :repl-thread 4)
         n.getParamsCount() > 2 && n.get(2).value.equals(":repl-result"));
     return res;
   }
+
 }

src/org/lispdev/swank/runnables/SwankCompileStringRunnable.java

   @Override
   synchronized public CompileStringInfo getInfo()
   {
-    return implem.getCompileStringInfo(result);
+    return implem.getCompileStringInfo(result());
   }
 
   /*

src/org/lispdev/swank/runnables/SwankDebugActivateRunnable.java

   @Override
   synchronized public DebugActivateInfo getInfo()
   {
-    return implem.getDebugActivateInfo(result);
+    return implem.getDebugActivateInfo(result());
   }
 
+  synchronized public String getKey()
+  {
+    DebugActivateInfo info = getInfo();
+    return info.thread + ":" + info.level;
+  }
+
+
   public static class DebugActivateInfo
   {
     public final int level;

src/org/lispdev/swank/runnables/SwankDebugReturnRunnable.java

   }
 
   @Override
-  synchronized public Object getInfo()
+  synchronized public DebugReturnInfo getInfo()
   {
-    // TODO Auto-generated method stub
-    return null;
+    return implem.getDebugReturnInfo(result());
   }
 
+  synchronized public String getKey()
+  {
+    DebugReturnInfo info = getInfo();
+    return info.thread + ":" + info.level;
+  }
+
+  public static class DebugReturnInfo
+  {
+    public final String thread;
+    public final int level;
+    public final boolean stepping;
+
+    public DebugReturnInfo(String thread, int level, boolean stepping)
+    {
+      this.thread = thread;
+      this.level = level;
+      this.stepping = stepping;
+    }
+  }
 }

src/org/lispdev/swank/runnables/SwankDebugRunnable.java

   @Override
   synchronized public DebugInfo getInfo()
   {
-    return implem.getDebugInfo(result);
+    return implem.getDebugInfo(result());
   }
 
   synchronized public String getKey()

src/org/lispdev/swank/runnables/SwankMacroExpandRunnable.java

   @Override
   synchronized public String getInfo()
   {
-    return implem.getMacroExpandInfo(result);
+    return implem.getMacroExpandInfo(result());
   }
 
 }

src/org/lispdev/swank/runnables/SwankPresentationRunnable.java

   @Override
   synchronized public PresentationInfo getInfo()
   {
-    WriteStringInfo tmp = implem.getWriteString(result);
+    WriteStringInfo tmp = implem.getWriteString(result());
     PresentationInfo res = new PresentationInfo(id, tmp.text, tmp.result);
     return res;
   }

src/org/lispdev/swank/runnables/SwankReadStringRunnable.java

   @Override
   synchronized public ReadStringInfo getInfo()
   {
-    return implem.getReadStringInfo(result);
+    return implem.getReadStringInfo(result());
   }
 
   /**

src/org/lispdev/swank/runnables/SwankRunnable.java

  */
 public abstract class SwankRunnable implements Runnable
 {
-  protected LispNode result;
+  private LispNode result;
   protected SwankEvent event;
   final protected LispImplementation implem;
 
     this.result = result;
   }
 
+  public LispNode result()
+  {
+    return result;
+  }
+
   public void setEvent(SwankEvent event)
   {
     this.event = event;

src/org/lispdev/swank/runnables/SwankWriteStringRunnable.java

   @Override
   synchronized public WriteStringInfo getInfo()
   {
-    return implem.getWriteString(result);
+    return implem.getWriteString(result());
   }
 
   public static class WriteStringInfo