Commits

Anonymous committed efb12b1

Previously inspector was able to go only to second level. Now it can go to any depth.

  • Participants
  • Parent commits 70e5b49

Comments (0)

Files changed (3)

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

 
   public LispNode getInspectFrameLocal(String threadNum,
       String frameNum, String varNum, long timeout);
+  public LispNode inspectNthPart(String partNum, long timeout);
 
 }

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

     return res;
   }
 
+  /*
+inspect-nth-part
+   */
+  private static class InspectNthPart implements IInspectCmd
+  {
+    private final String n;
+    private final LispDebugTarget target;
+
+    /**
+     * @param target
+     * @param parent
+     * @param n
+     */
+    public InspectNthPart(LispDebugTarget target, String n)
+    {
+      this.n = n;
+      this.target = target;
+    }
+
+    @Override
+    public InspectInfo inspect(LispVariable parent)
+    {
+      LispNode r = target.getSwank().inspectNthPart(n, 500);
+      return getInspectInfo(target, parent, r);
+    }
+  }
+
+  /**
+   * @param target
+   * @param parent variable containing other variables described in n
+   * @param n contains information about variables in parent
+   */
+  private static InspectInfo getInspectInfo(final LispDebugTarget target,
+      final LispVariable parent, LispNode n)
+  {
+    InspectInfo res = new InspectInfo(n.getf(":title").value,
+        n.getf(":title").value);
+    LispNode c = n.getf(":content").get(0);
+    for(int j = 1; j < c.getParamsCount(); ++j )
+    {
+      if( c.get(j).value.startsWith(":") )
+      {
+        try
+        {
+          res.content.add(new LispVariable(target,
+              (LispValue)parent.getValue(),c.get(j-1).value,
+              c.get(j+1).getf(":value").value,
+              new InspectNthPart(target, c.get(j+1).get(2).value)));
+        }
+        catch(DebugException e)
+        {
+          e.printStackTrace();
+        }
+      }
+    }
+    return res;
+  }
+
 /*
 -->(:emacs-rex (swank:frame-locals-for-emacs 1) nil 0 4)
 <--(:return (:ok
         {
           LispNode r = swank.getInspectFrameLocal(thread, frame,
               String.valueOf(ii), 500);
-          InspectInfo res = new InspectInfo(r.getf(":title").value,
-              r.getf(":title").value);
-          LispNode c = r.getf(":content").get(0);
-          for(int j = 1; j < c.getParamsCount(); ++j )
-          {
-            if( c.get(j).value.startsWith(":") )
-            {
-              try
-              {
-                res.content.add(new LispVariable(target,
-                    (LispValue)parent.getValue(),c.get(j-1).value,
-                    c.get(j+1).getf(":value").value,null));
-              }
-              catch(DebugException e)
-              {
-                e.printStackTrace();
-              }
-            }
-          }
-          return res;
+          return getInspectInfo(target, parent, r);
         }
       };
       res[i] = new LispVariable(target, null, ni.getf(":name").value,

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

     swank.sendEvalRaw(msg, callBack);
   }
 
+  public synchronized LispNode inspectNthPart(String partNum, long timeout)
+  {
+    String msg = "(swank:inspect-nth-part " + partNum + ")";
+    return swank.sendEvalAndGrabRaw(msg, "nil", timeout);
+  }
+
   public synchronized void sendInspectorPop(SwankRunnable callBack)
   {
     String msg = "(swank:inspector-pop)";