Anonymous avatar Anonymous committed 5cae555

Added loading of project. Doesn't work yet, since need asdf-extensions.

Comments (0)

Files changed (6)

src/org/lispdev/swank/ISwank.java

 
 import org.lispdev.swank.debug.LispDebugTarget;
 import org.lispdev.swank.debug.LispVariable;
+import org.lispdev.swank.runnables.SwankCompilationRunnable;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable;
 import org.lispdev.swank.runnables.SwankDebugReturnRunnable;
 import org.lispdev.swank.runnables.SwankDebugRunnable;
 
   public LispVariable[] getFrameLocals(int frameNum, String threadId,
       LispDebugTarget target);
+  public void sendLoadASDF(String asdfile, SwankCompilationRunnable callback);
 
   /*
    * To be used only in LispImplementation:

src/org/lispdev/swank/LispImplementation.java

 import org.lispdev.swank.debug.LispVariable;
 import org.lispdev.swank.debug.LispVariable.IInspectCmd;
 import org.lispdev.swank.debug.LispVariable.InspectInfo;
-import org.lispdev.swank.runnables.SwankCompileStringRunnable.CompileMessage;
-import org.lispdev.swank.runnables.SwankCompileStringRunnable.CompileStringInfo;
+import org.lispdev.swank.runnables.SwankCompilationRunnable.CompilationInfo;
+import org.lispdev.swank.runnables.SwankCompilationRunnable.CompileMessage;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable.DebugActivateInfo;
 import org.lispdev.swank.runnables.SwankDebugReturnRunnable.DebugReturnInfo;
 import org.lispdev.swank.runnables.SwankDebugRunnable.DebugInfo;
   <--(:return (:ok (:swank-compilation-unit nil (t) (0.007))) 2)
 
    */
-  public CompileStringInfo getCompileStringInfo(LispNode n)
+  public CompilationInfo getCompilationInfo(LispNode n)
   {
     LispNode res = n.getf(":return").getf(":ok").getf(":swank-compilation-unit");
-    CompileStringInfo info = new CompileStringInfo();
+    CompilationInfo info = new CompilationInfo();
     for(LispNode ni : res.get(0).getParams())
     {
       LispNode loc = ni.getf(":location");
       if( !loc.getf(":error").value.equals("") )
       {
         m = new CompileMessage(ni.getf(":message").value,
-            ni.getf(":short-message").value, ni.getf(":severity").value,
-            loc.getf(":error").value);
+            ni.getf(":short-message").value,
+            severityToString(ni.getf(":severity")), loc.getf(":error").value);
       }
       else
       {
         m = new CompileMessage(ni.getf(":message").value,
-            ni.getf(":short-message").value, ni.getf(":severity").value,
+            ni.getf(":short-message").value,
+            severityToString(ni.getf(":severity")),
             loc.getf(":buffer").value, loc.getf(":position").value);
       }
       info.messages.add(m);
     return info;
   }
 
+  private static String severityToString(LispNode severity)
+  {
+    String s = severity.value.toLowerCase();
+    if( s == null || s.equals("") )
+    {
+      return "";
+    }
+    if( s.contains("error") )
+    {
+      return CompileMessage.ERROR;
+    }
+    if( s.contains("warning") )
+    {
+      return CompileMessage.WARNING;
+    }
+    if( s.contains("note") )
+    {
+      return CompileMessage.INFO;
+    }
+    return "";
+  }
+
   /*
  <--(:write-string "\"abcde\"" :repl-result)
 

src/org/lispdev/swank/SwankInterface.java

 import org.lispdev.swank.debug.LispDebugTarget;
 import org.lispdev.swank.debug.LispVariable;
 import org.lispdev.swank.internal.LispParser;
-import org.lispdev.swank.runnables.SwankCompileStringRunnable;
+import org.lispdev.swank.runnables.SwankCompilationRunnable;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable;
 import org.lispdev.swank.runnables.SwankDebugReturnRunnable;
 import org.lispdev.swank.runnables.SwankDebugRunnable;
   // Compiling
 
   public synchronized void sendCompileString(String expr, String file,
-      String dir, int offset, String pckg, SwankCompileStringRunnable callBack)
+      String dir, int offset, String pckg, SwankCompilationRunnable callBack)
   {
     Trace.SWANK.trace(file);
     Trace.SWANK.trace(dir);
     swank.sendEvalRaw(msg, pckg, callBack);
   }
 
+  public synchronized void sendLoadASDF(String asdfile,
+      SwankCompilationRunnable callback)
+  {
+    asdfile = asdfile.replace("\\", "/");
+    asdfile = swank.translateLocalFilePath(asdfile);
+    String msg = "(swank:operate-on-system-for-emacs \"" + asdfile +
+      "\" \"LOAD-OP\")";
+    swank.sendEvalRaw(msg, callback);
+  }
+
   public synchronized void sendCompileFile(String filePath,
       SwankRunnable callBack)
   {

src/org/lispdev/swank/SwankInterfaceTest.java

 import org.lispdev.swank.debug.BaseLocalLispLaunchDelegate;
 import org.lispdev.swank.debug.LispProcess;
 import org.lispdev.swank.debug.LispVariable;
-import org.lispdev.swank.runnables.SwankCompileStringRunnable;
+import org.lispdev.swank.runnables.SwankCompilationRunnable;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable;
 import org.lispdev.swank.runnables.SwankDebugReturnRunnable;
 import org.lispdev.swank.runnables.SwankDebugRunnable;
   public void test_sendInspectFrameLocal()
   {
     final myBoolean started = new myBoolean(false);
-    final SwankCompileStringRunnable callBack = new SwankCompileStringRunnable(si.getLispImplementation()){
+    final SwankCompilationRunnable callBack = new SwankCompilationRunnable(si.getLispImplementation()){
       @Override
       public void run()
       {}
   boolean sendGetFrameLocationForTest(final String frame)
   {
     final myBoolean started = new myBoolean(false);
-    final SwankCompileStringRunnable callBack = new SwankCompileStringRunnable(si.getLispImplementation()){
+    final SwankCompilationRunnable callBack = new SwankCompilationRunnable(si.getLispImplementation()){
       @Override
       public void run()
       {}
   @Test
   public void test_xref()
   {
-    final SwankCompileStringRunnable callBack = new SwankCompileStringRunnable(si.getLispImplementation()){
+    final SwankCompilationRunnable callBack = new SwankCompilationRunnable(si.getLispImplementation()){
       @Override
       public void run()
       {
   @Test
   public void test_sendFindDefinition()
   {
-    final SwankCompileStringRunnable callBack = new SwankCompileStringRunnable(si.getLispImplementation()){
+    final SwankCompilationRunnable callBack = new SwankCompilationRunnable(si.getLispImplementation()){
       @Override
       public void run()
       {
   @Test
   public void test_sendDisassamble()
   {
-    final SwankCompileStringRunnable callBack = new SwankCompileStringRunnable(si.getLispImplementation()){
+    final SwankCompilationRunnable callBack = new SwankCompilationRunnable(si.getLispImplementation()){
       @Override
       public void run()
       {
   @Test
   public void test_compileString()
   {
-    final SwankCompileStringRunnable callBack = new SwankCompileStringRunnable(si.getLispImplementation()){
+    final SwankCompilationRunnable callBack = new SwankCompilationRunnable(si.getLispImplementation()){
       @Override
       public void run()
       {
         "`:not-documented` ) )", String.valueOf(callBack.getReturn()));
   }
 
-
 }

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

+package org.lispdev.swank.runnables;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.lispdev.swank.LispImplementation;
+
+public abstract class SwankCompilationRunnable extends SwankRunnable
+{
+
+  public SwankCompilationRunnable(LispImplementation implementation)
+  {
+    super(implementation);
+  }
+
+  @Override
+  synchronized public CompilationInfo getInfo()
+  {
+    return implem.getCompilationInfo(result());
+  }
+
+  /*
+   * three lists:
+   * - notes,
+   * - results    ; a result is of type (MEMBER T NIL :COMPLAINED)
+   * - durations  ;
+   *
+   * notes:
+   *   (list* :message (message condition)
+         :severity (severity condition)
+         :location (location condition)
+         :references (references condition)
+         (let ((s (short-message condition)))
+           (if s (list :short-message s)))))
+
+
+  -->(:emacs-rex (swank:compile-string-for-emacs "(defun g (x)
+    (z x))
+
+  (defun z (x)
+    (y x))
+  " "/home/sk/cusp/ws/org.lispdev.swank/test.lisp" 1
+  "/home/sk/cusp/ws/org.lispdev.swank/" 3) nil :repl-thread 2)
+  <--(:return (:ok
+  (:swank-compilation-unit
+    ((:message "undefined function: Y" :severity :style-warning
+      :location (:location (:buffer "/home/sk/cusp/ws/org.lispdev.swank/test.lisp")
+                           (:position 39) nil)
+      :references nil :short-message "undefined function: Y")
+     (:message "This function is undefined:
+    Y" :severity :style-warning :location (:error "No error location available")
+      :references nil :short-message "This function is undefined:
+    Y")) (:complained) (0.019))) 2)
+
+
+  -->(:emacs-rex (swank:compile-string-for-emacs "(defun g (x)
+    (+ 2 x))
+  " "/home/sk/cusp/ws/org.lispdev.swank/test.lisp" 1
+  "/home/sk/cusp/ws/org.lispdev.swank/" 3) nil :repl-thread 2)
+  <--(:return (:ok (:swank-compilation-unit nil (t) (0.007))) 2)
+
+   */
+  public static class CompilationInfo
+  {
+    public final List<CompileMessage> messages = new ArrayList<CompileMessage>();
+  }
+
+  public static class CompileMessage
+  {
+    public static final String WARNING = "warning";
+    public static final String ERROR = "error";
+    public static final String INFO = "info";
+    public final String message;
+    public final String severity;
+    public final String locationError;
+    public final String file;
+    public final String position;
+    public final String shortMessage;
+
+    public CompileMessage(String message, String shortMessage, String severity,
+        String file, String position)
+    {
+      this.message = message;
+      this.severity = severity;
+      this.locationError = null;
+      this.file = file;
+      this.position = position;
+      this.shortMessage = shortMessage;
+    }
+
+    public CompileMessage(String message, String shortMessage, String severity,
+        String locationError)
+    {
+      this.message = message;
+      this.severity = severity;
+      this.locationError = locationError;
+      this.file = null;
+      this.position = null;
+      this.shortMessage = shortMessage;
+    }
+  }
+
+}

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

-package org.lispdev.swank.runnables;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.lispdev.swank.LispImplementation;
-
-public abstract class SwankCompileStringRunnable extends SwankRunnable
-{
-
-  public SwankCompileStringRunnable(LispImplementation implementation)
-  {
-    super(implementation);
-  }
-
-  @Override
-  synchronized public CompileStringInfo getInfo()
-  {
-    return implem.getCompileStringInfo(result());
-  }
-
-  /*
-   * three lists:
-   * - notes,
-   * - results    ; a result is of type (MEMBER T NIL :COMPLAINED)
-   * - durations  ;
-   *
-   * notes:
-   *   (list* :message (message condition)
-         :severity (severity condition)
-         :location (location condition)
-         :references (references condition)
-         (let ((s (short-message condition)))
-           (if s (list :short-message s)))))
-
-
-  -->(:emacs-rex (swank:compile-string-for-emacs "(defun g (x)
-    (z x))
-
-  (defun z (x)
-    (y x))
-  " "/home/sk/cusp/ws/org.lispdev.swank/test.lisp" 1
-  "/home/sk/cusp/ws/org.lispdev.swank/" 3) nil :repl-thread 2)
-  <--(:return (:ok
-  (:swank-compilation-unit
-    ((:message "undefined function: Y" :severity :style-warning
-      :location (:location (:buffer "/home/sk/cusp/ws/org.lispdev.swank/test.lisp")
-                           (:position 39) nil)
-      :references nil :short-message "undefined function: Y")
-     (:message "This function is undefined:
-    Y" :severity :style-warning :location (:error "No error location available")
-      :references nil :short-message "This function is undefined:
-    Y")) (:complained) (0.019))) 2)
-
-
-  -->(:emacs-rex (swank:compile-string-for-emacs "(defun g (x)
-    (+ 2 x))
-  " "/home/sk/cusp/ws/org.lispdev.swank/test.lisp" 1
-  "/home/sk/cusp/ws/org.lispdev.swank/" 3) nil :repl-thread 2)
-  <--(:return (:ok (:swank-compilation-unit nil (t) (0.007))) 2)
-
-   */
-  public static class CompileStringInfo
-  {
-    public final List<CompileMessage> messages = new ArrayList<CompileMessage>();
-  }
-
-  public static class CompileMessage
-  {
-    public final String message;
-    public final String severity;
-    public final String locationError;
-    public final String file;
-    public final String position;
-    public final String shortMessage;
-
-    public CompileMessage(String message, String shortMessage, String severity,
-        String file, String position)
-    {
-      this.message = message;
-      this.severity = severity;
-      this.locationError = null;
-      this.file = file;
-      this.position = position;
-      this.shortMessage = shortMessage;
-    }
-
-    public CompileMessage(String message, String shortMessage, String severity,
-        String locationError)
-    {
-      this.message = message;
-      this.severity = severity;
-      this.locationError = locationError;
-      this.file = null;
-      this.position = null;
-      this.shortMessage = shortMessage;
-    }
-  }
-
-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.