Commits

sk  committed c041c67

Moved around files.

  • Participants
  • Parent commits 12dafcd

Comments (0)

Files changed (33)

File META-INF/MANIFEST.MF

 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Export-Package: org.lispdev.swank,
+ org.lispdev.swank.debug,
  org.lispdev.swank.infos,
  org.lispdev.swank.runnables
    <extension
          point="org.eclipse.debug.core.launchConfigurationTypes">
       <launchConfigurationType
-            delegate="org.lispdev.swank.BaseLocalLispLaunchDelegate"
+            delegate="org.lispdev.swank.debug.BaseLocalLispLaunchDelegate"
             id="org.lispdev.swank.baseLocalLaunchConfigurationType"
             modes="profile"
             name="Local Lisp"

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

-package org.lispdev.swank;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
-import org.lispdev.log.Log;
-
-public class BaseLocalLispLaunchDelegate extends LaunchConfigurationDelegate
-{
-  public final static String ID =
-    "org.lispdev.swank.baseLocalLaunchConfigurationType";
-  public final static String ATTR_EXE = "path-to-executable-string";
-  public final static String ATTR_SWANK = "path-to-swank-loader.lisp";
-  public final static String ATTR_CMD_PARAMS = "command-line-params-list";
-  public final static String ATTR_ENV = ILaunchManager.ATTR_ENVIRONMENT_VARIABLES;
-  public final static String ATTR_PORT = "port-int";
-  public final static String ATTR_EXT = "lisp-extensions-path-string";
-  public final static String ATTR_START_REPL_THREAD = "start-repl-thread";
-  //for now to folder containing lisp-extensions folder: see basicStartup
-  //function in SwankInterface
-
-  protected static LispProcess launch(ILaunchConfiguration config,
-      ILaunch launch, IRunnableDriver r) throws CoreException
-  {
-    final String exe = config.getAttribute(ATTR_EXE, "");
-    File cmd = new File(exe);
-    if( !cmd.exists() )
-    {
-      Log.abort("Lisp executable "+exe+" does not exist", null);
-    }
-    if( !cmd.canExecute() )
-    {
-      Log.abort("File " + exe + " is not executable", null);
-    }
-    final String swankDir = config.getAttribute(ATTR_SWANK, "");
-    File swankf = new File(swankDir,"swank-loader.lisp");
-    if( !swankf.exists() )
-    {
-      Log.abort("Swank was not found in folder "+swankDir, null);
-    }
-    final int port = config.getAttribute(ATTR_PORT, -1);
-    if( port < AvailablePortFinder.MIN_PORT_NUMBER
-        || port > AvailablePortFinder.MAX_PORT_NUMBER )
-    {
-      Log.abort("Port is outside of available range", null);
-    }
-    if( !AvailablePortFinder.available(port) )
-    {
-      Log.abort("Port "+port+" is not available", null);
-    }
-    @SuppressWarnings("rawtypes")
-    final LocalLispImplementation implem =
-      new LocalLispImplementation(exe, swankDir,
-          config.getAttribute(ATTR_CMD_PARAMS, new ArrayList()),
-          config.getAttribute(ATTR_ENV, new HashMap()),
-          port, config.getAttribute(ATTR_START_REPL_THREAD, false));
-    final String ext = config.getAttribute(ATTR_EXT, "");
-    final File extf = new File(ext);
-    if( !extf.isDirectory() )
-    {
-      Log.abort("Extensions directory "+ext+" does not exist", null);
-    }
-    final SwankInterface s = new SwankInterface(ext,implem,r);
-    //s.connect();
-
-    LispProcess p = new LispProcess(launch, "swank", null, s);
-    launch.addProcess(p);
-    launch.addDebugTarget(new LispDebugTarget(launch, p));
-    return p;
-  }
-
-  @Override
-  public void launch(ILaunchConfiguration configuration, String mode,
-      ILaunch launch, IProgressMonitor monitor) throws CoreException
-  {
-    Assert.isLegal(ILaunchManager.PROFILE_MODE.equals(mode), "Wrong mode");
-    launch(configuration,launch,new TestRunnableDriver());
-  }
-
-}

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

-package org.lispdev.swank;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.lispdev.swank.runnables.SwankRunnable;
-
-/**
- * The structure that is initialized when {@link SwankEvent#DEBUG} is received
- * from {@link SwankRunnable#result} using {@link LispImplementation#getDebugInfo}
- */
-public class DebugInfo
-{
-  public final String thread;
-  public final int level;
-  /**
-   * the condition to debug
-   */
-  public final String condition;
-  public final List<SwankDebugRestart> restarts =
-    new ArrayList<SwankDebugRestart>();
-  public final List<String> frames = new ArrayList<String>();
-
-  public DebugInfo(String thread, int lvl, String condition)
-  {
-    this.thread = thread;
-    level = lvl;
-    this.condition = condition;
-  }
-
-  public void addRestart(String name, String description)
-  {
-    restarts.add(new SwankDebugRestart(capitalizeString(name), description));
-  }
-
-  private static String capitalizeString(String string)
-  {
-    char[] chars = string.toLowerCase().toCharArray();
-    boolean found = false;
-    for(int i = 0; i < chars.length; i++)
-    {
-      if( !found && Character.isLetter(chars[i]) )
-      {
-        chars[i] = Character.toUpperCase(chars[i]);
-        found = true;
-      }
-      else if( Character.isWhitespace(chars[i]) || chars[i] == '-' )
-      { // You can add other chars here
-        found = false;
-      }
-    }
-    return String.valueOf(chars);
-  }
-
-  public void addFrame(String frame)
-  {
-    frames.add(frame);
-  }
-
-  public static class SwankDebugRestart
-  {
-    public final String name;
-    public final String description;
-
-    public SwankDebugRestart(String name, String description)
-    {
-      this.name = name;
-      this.description = description;
-    }
-  }
-
-  @Override
-  public int hashCode()
-  {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + ((condition == null) ? 0 : condition.hashCode());
-    result = prime * result + level;
-    result = prime * result + ((thread == null) ? 0 : thread.hashCode());
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object obj)
-  {
-    if( this == obj ) return true;
-    if( obj == null ) return false;
-    if( getClass() != obj.getClass() ) return false;
-    DebugInfo other = (DebugInfo)obj;
-    if( condition == null )
-    {
-      if( other.condition != null ) return false;
-    }
-    else if( !condition.equals(other.condition) ) return false;
-    if( level != other.level ) return false;
-    if( thread == null )
-    {
-      if( other.thread != null ) return false;
-    }
-    else if( !thread.equals(other.thread) ) return false;
-    return true;
-  }
-}

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

 package org.lispdev.swank;
 
+import org.lispdev.swank.debug.LispDebugTarget;
+import org.lispdev.swank.debug.LispVariable;
+import org.lispdev.swank.infos.DebugInfo;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable;
 import org.lispdev.swank.runnables.SwankDebugReturnRunnable;
+import org.lispdev.swank.runnables.SwankDebugRunnable;
 import org.lispdev.swank.runnables.SwankPresentationRunnable;
 import org.lispdev.swank.runnables.SwankReadStringRunnable;
 import org.lispdev.swank.runnables.SwankRunnable;

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

-package org.lispdev.swank;
-
-import org.eclipse.debug.core.model.DebugElement;
-
-public class LispDebugElement extends DebugElement
-{
-  public static final String MODEL_ID = "org.lispdev.debug.model";
-
-  public LispDebugElement(LispDebugTarget target)
-  {
-    super(target);
-  }
-
-  public ISwank getSwank()
-  {
-    return ((LispDebugTarget)getDebugTarget()).getSwank();
-  }
-
-  @Override
-  public String getModelIdentifier()
-  {
-    return MODEL_ID;
-  }
-
-}

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

-package org.lispdev.swank;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IThread;
-
-public class LispDebugTarget extends LispDebugElement implements IDebugTarget
-{
-  private final ILaunch launch;
-  private final LispProcess process;
-  private final List<IThread> threads = new ArrayList<IThread>();
-  private final LispThread thread;
-  private boolean terminated = false;
-
-  public LispDebugTarget(ILaunch launch, LispProcess process)
-  {
-    super(null);
-    this.launch = launch;
-    this.process = process;
-    thread = new LispThread(this);
-    threads.add(thread);
-  }
-
-  @Override
-  public ISwank getSwank()
-  {
-    if( process != null )
-    {
-      return process.getSwank();
-    }
-    return null;
-  }
-
-  @Override
-  public ILaunch getLaunch()
-  {
-    return launch;
-  }
-
-  @Override
-  public String getName() throws DebugException
-  {
-    return "swank";
-  }
-
-  @Override
-  public IProcess getProcess()
-  {
-    return process;
-  }
-
-  @Override
-  public IThread[] getThreads() throws DebugException
-  {
-    //process.getSwank()
-    return threads.toArray(new IThread[threads.size()]);
-  }
-
-  public LispThread getMainThread()
-  {
-    return thread;
-  }
-
-  @Override
-  public boolean hasThreads() throws DebugException
-  {
-    return true;
-  }
-
-  @Override
-  public boolean supportsBreakpoint(IBreakpoint breakpoint)
-  {
-    return false;
-  }
-
-  @Override
-  public boolean canTerminate()
-  {
-    return process.canTerminate();
-  }
-
-  @Override
-  public boolean isTerminated()
-  {
-    return terminated || process.isTerminated();
-  }
-
-  @Override
-  public void terminate() throws DebugException
-  {
-    terminated = true;
-  }
-
-  @Override
-  public boolean canResume()
-  {
-    return !isTerminated() && isSuspended();
-  }
-
-  @Override
-  public boolean canSuspend()
-  {
-    return !isTerminated() && !isSuspended();
-  }
-
-  @Override
-  public boolean isSuspended()
-  {
-    return !isTerminated() && thread.isSuspended();
-  }
-
-  @Override
-  public void resume() throws DebugException
-  {
-    thread.resume();
-  }
-
-  @Override
-  public void suspend() throws DebugException
-  {
-    thread.suspend();
-  }
-
-  @Override
-  public void breakpointAdded(IBreakpoint breakpoint)
-  {
-  }
-
-  @Override
-  public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta)
-  {
-  }
-
-  @Override
-  public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta)
-  {
-  }
-
-  @Override
-  public boolean canDisconnect()
-  {
-    return false;
-  }
-
-  @Override
-  public void disconnect() throws DebugException
-  {
-  }
-
-  @Override
-  public boolean isDisconnected()
-  {
-    return false;
-  }
-
-  @Override
-  public IMemoryBlock getMemoryBlock(long startAddress, long length)
-      throws DebugException
-  {
-    return null;
-  }
-
-  @Override
-  public boolean supportsStorageRetrieval()
-  {
-    return false;
-  }
-
-  @Override
-  public IDebugTarget getDebugTarget()
-  {
-    return this;
-  }
-}

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

 import java.io.IOException;
 
 import org.lispdev.log.Log;
+import org.lispdev.swank.debug.LispDebugTarget;
+import org.lispdev.swank.debug.LispVariable;
 import org.lispdev.swank.infos.CompileStringInfo;
 import org.lispdev.swank.infos.CompileStringInfo.CompileMessage;
 import org.lispdev.swank.infos.DebugActivateInfo;
+import org.lispdev.swank.infos.DebugInfo;
+import org.lispdev.swank.infos.ReadStringInfo;
 import org.lispdev.swank.infos.WriteStringInfo;
 
 /**

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

-package org.lispdev.swank;
-
-import java.util.EmptyStackException;
-import java.util.Stack;
-
-/**
- * Quick and very dirty lisp parser. I wouldn't mind seeing it replaced.
- *
- * @author Tim Jasko
- *
- */
-public class LispParser
-{
-  public int parenBalance = 0;
-
-  public static LispNode parse(String code)
-  {
-    return new LispParser().parseCode(code);
-  }
-
-  public LispNode parseCode(String code)
-  {
-    int start = 0;
-    parenBalance = 0;
-
-    LispNode ret = new LispNode();
-    Stack<LispNode> s = new Stack<LispNode>();
-
-    LispNode curr = ret;
-    s.push(curr);
-
-    StringBuilder sb = new StringBuilder();
-    final int length = code.length();
-    int i = 0;
-    for(i = start; i < length; ++i)
-    {
-      final char c = code.charAt(i);
-      if( c == '(' )
-      {
-        ++parenBalance;
-        final LispNode next = new LispNode();
-        if( !sb.toString().equals("") )
-        {
-          curr.add(new LispNode(sb.toString()));
-          sb = new StringBuilder();
-        }
-        curr.add(next);
-        curr = next;
-        s.push(curr);
-      }
-      else if( c == ')' )
-      {
-        --parenBalance;
-        if( !sb.toString().equals("") )
-        {
-          curr.add(new LispNode(sb.toString()));
-          sb = new StringBuilder();
-        }
-
-        try
-        {
-          s.pop();
-        }
-        catch(EmptyStackException e)
-        {}
-        if( !s.empty() )
-        {
-          curr = s.peek();
-        }
-
-      }
-      else if( c == '"' )
-      {
-        char lit = '"';
-        do
-        {
-          ++i;
-          if( i < length )
-          {
-            lit = code.charAt(i);
-            if( lit == '\\' )
-            {
-              ++i;
-              if( i < length )
-              {
-                sb.append(code.charAt(i));
-              }
-            }
-            else if( lit != '"' )
-            {
-              sb.append(lit);
-            }
-          }
-        }
-        while( lit != '"' && i < length );
-        LispNode str = new LispNode(sb.toString());
-        str.isString = true;
-        curr.add(str);
-        sb = new StringBuilder();
-      }
-      else if( Character.isWhitespace(c) )
-      {
-        if( !sb.toString().equals("") )
-        {
-          curr.add(new LispNode(sb.toString()));
-          sb = new StringBuilder();
-        }
-      }
-      else
-      { // cannot parse code with comments
-        sb.append(c);
-      }
-
-    } // for
-    while( !s.empty() )
-    {
-      curr = s.peek();
-      s.pop();
-    }
-    return ret;
-  }
-
-}

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

-package org.lispdev.swank;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IStreamsProxy;
-
-public class LispProcess extends PlatformObject implements IProcess
-{
-
-  private final HashMap<String,String> attr = new HashMap<String,String>();
-  /**
-   * The name of the process
-   */
-  private final String fName;
-  /**
-   * The launch this process is contained in
-   */
-  private final ILaunch fLaunch;
-
-  private final ISwank fSwank;
-  /**
-   * This process's exit value
-   */
-  private final int fExitValue = 0;
-
-  public LispProcess(ILaunch launch, String name, Map<String,String> attributes,
-      ISwank swank)
-  {
-    fLaunch = launch;
-    fName = name;
-    if( attributes != null )
-    {
-      attr.putAll(attributes);
-    }
-    fSwank = swank;
-  }
-
-  @Override
-  public String getAttribute(String key)
-  {
-    return attr.get(key);
-  }
-
-  @Override
-  public int getExitValue() throws DebugException
-  {
-    if( isTerminated() )
-    {
-      return fExitValue;
-    }
-    throw new DebugException(
-        new Status(
-            IStatus.ERROR,
-            DebugPlugin.getUniqueIdentifier(),
-            DebugException.TARGET_REQUEST_FAILED,
-            "Exit value not available until process terminates.",
-            null));
-  }
-
-  @Override
-  public String getLabel()
-  {
-    return fName;
-  }
-
-  @Override
-  public ILaunch getLaunch()
-  {
-    return fLaunch;
-  }
-
-  @Override
-  public IStreamsProxy getStreamsProxy()
-  {
-    return null;
-  }
-
-  @Override
-  public void setAttribute(String key, String value)
-  {
-    attr.put(key, value);
-  }
-
-  @Override
-  public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
-  {
-    if( adapter.equals(IProcess.class) )
-    {
-      return this;
-    }
-    if( adapter.equals(IDebugTarget.class) )
-    {
-      ILaunch launch = getLaunch();
-      for( IDebugTarget t : launch.getDebugTargets() )
-      {
-        if( this.equals(t.getProcess()) )
-        {
-          return t;
-        }
-      }
-      return null;
-    }
-    if( adapter.equals(ILaunch.class) )
-    {
-      return getLaunch();
-    }
-    // CONTEXTLAUNCHING
-    if( adapter.equals(ILaunchConfiguration.class) )
-    {
-      return getLaunch().getLaunchConfiguration();
-    }
-    return super.getAdapter(adapter);
-  }
-
-  @Override
-  public boolean canTerminate()
-  {
-    return false;
-  }
-
-  @Override
-  public boolean isTerminated()
-  {
-    return false;
-  }
-
-  @Override
-  public void terminate() throws DebugException
-  {
-    fSwank.disconnect();
-  }
-
-  public ISwank getSwank()
-  {
-    return fSwank;
-  }
-}

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

-package org.lispdev.swank;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IRegisterGroup;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.debug.core.model.IVariable;
-
-public class LispStackFrame extends LispDebugElement implements IStackFrame
-{
-  /**
-   * index of the frame in SwankDebugInfo
-   */
-  private final int index;
-  private final String name;
-  private final LispThread thread;
-  private IVariable[] vars = null;
-
-  public LispStackFrame(LispThread thread, String name, int index)
-  {
-    super((LispDebugTarget)thread.getDebugTarget());
-    this.thread = thread;
-    this.name = name;
-    this.index = index;
-  }
-
-  @Override
-  public int getCharEnd() throws DebugException
-  {
-    return -1;
-  }
-
-  @Override
-  public int getCharStart() throws DebugException
-  {
-    return -1;
-  }
-
-  @Override
-  public int getLineNumber() throws DebugException
-  {
-    return 0;
-  }
-
-  @Override
-  public String getName() throws DebugException
-  {
-    return name;
-  }
-
-  @Override
-  public IRegisterGroup[] getRegisterGroups() throws DebugException
-  {
-    return new IRegisterGroup[0];
-  }
-
-  @Override
-  public IThread getThread()
-  {
-    return thread;
-  }
-
-  @Override
-  public IVariable[] getVariables() throws DebugException
-  {
-    if( vars == null )
-    {
-      vars = thread.getSwank().getFrameLocals(index,
-          thread.getThreadID(), (LispDebugTarget)getDebugTarget());
-    }
-    return vars;
-  }
-
-  @Override
-  public boolean hasRegisterGroups() throws DebugException
-  {
-    return false;
-  }
-
-  @Override
-  public boolean hasVariables() throws DebugException
-  {
-    return false;
-  }
-
-  @Override
-  public boolean canStepInto()
-  {
-    return getThread().canStepInto();
-  }
-
-  @Override
-  public boolean canStepOver()
-  {
-    return getThread().canStepOver();
-  }
-
-  @Override
-  public boolean canStepReturn()
-  {
-    return getThread().canStepReturn();
-  }
-
-  @Override
-  public boolean isStepping()
-  {
-    return getThread().isStepping();
-  }
-
-  @Override
-  public void stepInto() throws DebugException
-  {
-    getThread().stepInto();
-  }
-
-  @Override
-  public void stepOver() throws DebugException
-  {
-    getThread().stepOver();
-
-  }
-
-  @Override
-  public void stepReturn() throws DebugException
-  {
-    getThread().stepReturn();
-  }
-
-  @Override
-  public boolean canResume()
-  {
-    return getThread().canResume();
-  }
-
-  @Override
-  public boolean canSuspend()
-  {
-    return getThread().canSuspend();
-  }
-
-  @Override
-  public boolean isSuspended()
-  {
-    return getThread().isSuspended();
-  }
-
-  @Override
-  public void resume() throws DebugException
-  {
-    getThread().resume();
-  }
-
-  @Override
-  public void suspend() throws DebugException
-  {
-    getThread().suspend();
-  }
-
-  @Override
-  public boolean canTerminate()
-  {
-    return getThread().canTerminate();
-  }
-
-  @Override
-  public boolean isTerminated()
-  {
-    return getThread().isTerminated();
-  }
-
-  @Override
-  public void terminate() throws DebugException
-  {
-    getThread().terminate();
-  }
-
-}

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

-package org.lispdev.swank;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.IThread;
-
-public class LispThread extends LispDebugElement implements IThread
-{
-  private boolean suspended;
-  private DebugInfo debugInfo = null;
-
-  public LispThread(LispDebugTarget target)
-  {
-    super(target);
-  }
-
-  @Override
-  public IBreakpoint[] getBreakpoints()
-  {
-    return null;
-  }
-
-  @Override
-  public String getName() throws DebugException
-  {
-    return "Main thread";
-  }
-
-  @Override
-  public int getPriority() throws DebugException
-  {
-    return 0;
-  }
-
-  public String getThreadID()
-  {
-    if( isSuspended() && debugInfo != null )
-    {
-      return debugInfo.thread;
-    }
-    return null;
-  }
-
-  public DebugInfo getDebugInfo()
-  {
-    if( isSuspended() )
-    {
-      return debugInfo;
-    }
-    return null;
-  }
-
-  @Override
-  public IStackFrame[] getStackFrames() throws DebugException
-  {
-    if( isSuspended() && debugInfo != null )
-    {
-      IStackFrame[] res = new IStackFrame[debugInfo.frames.size()];
-      for( int i = 0; i < res.length; ++i )
-      {
-        res[i] = new LispStackFrame(this, debugInfo.frames.get(i), i);
-      }
-      return res;
-    }
-    return new IStackFrame[0];
-  }
-
-  @Override
-  public IStackFrame getTopStackFrame() throws DebugException
-  {
-    IStackFrame[] frames = getStackFrames();
-    if( frames.length > 0 )
-    {
-      return frames[0];
-    }
-    return null;
-  }
-
-  @Override
-  public boolean hasStackFrames() throws DebugException
-  {
-    return isSuspended();
-  }
-
-  @Override
-  public boolean canResume()
-  {
-    return isSuspended();
-  }
-
-  @Override
-  public boolean canSuspend()
-  {
-    return !isSuspended();
-  }
-
-  @Override
-  public boolean isSuspended()
-  {
-    return suspended && !isTerminated();
-  }
-
-  @Override
-  public void resume() throws DebugException
-  {
-    debugInfo = null;
-    suspended = false;
-    fireResumeEvent(1);
-  }
-
-  @Override
-  public void suspend() throws DebugException
-  {
-  }
-
-  @Override
-  public boolean canStepInto()
-  {
-    return false;
-  }
-
-  @Override
-  public boolean canStepOver()
-  {
-    return false;
-  }
-
-  @Override
-  public boolean canStepReturn()
-  {
-    return false;
-  }
-
-  @Override
-  public boolean isStepping()
-  {
-    return false;
-  }
-
-  @Override
-  public void stepInto() throws DebugException
-  {
-  }
-
-  @Override
-  public void stepOver() throws DebugException
-  {
-  }
-
-  @Override
-  public void stepReturn() throws DebugException
-  {
-  }
-
-  @Override
-  public boolean canTerminate()
-  {
-    return !isTerminated();
-  }
-
-  @Override
-  public boolean isTerminated()
-  {
-    return getDebugTarget().isTerminated();
-  }
-
-  @Override
-  public void terminate() throws DebugException
-  {
-  }
-
-  public void setSuspended(DebugInfo info)
-  {
-    debugInfo = info;
-    suspended = (info != null);
-    fireSuspendEvent(1);
-  }
-
-}

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

-package org.lispdev.swank;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IVariable;
-
-public class LispValue extends LispDebugElement implements IValue
-{
-  private final String value;
-
-  public LispValue(LispDebugTarget target, String value)
-  {
-    super(target);
-    this.value = value;
-  }
-
-  @Override
-  public String getReferenceTypeName() throws DebugException
-  {
-    return "lisp";
-  }
-
-  @Override
-  public String getValueString() throws DebugException
-  {
-    return value;
-  }
-
-  @Override
-  public boolean isAllocated() throws DebugException
-  {
-    return true;
-  }
-
-  @Override
-  public IVariable[] getVariables() throws DebugException
-  {
-    return new IVariable[0];
-  }
-
-  @Override
-  public boolean hasVariables() throws DebugException
-  {
-    return false;
-  }
-
-  @Override
-  public String toString()
-  {
-    return value;
-  }
-
-}

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

-package org.lispdev.swank;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IVariable;
-
-public class LispVariable extends LispDebugElement implements IVariable
-{
-  private final String name;
-  private final LispValue value;
-
-  public LispVariable(LispDebugTarget target, String name, String value)
-  {
-    super(target);
-    this.name = name;
-    this.value = new LispValue(target, value);
-  }
-
-  @Override
-  public void setValue(String expression) throws DebugException
-  {
-    throw new DebugException(new Status(IStatus.ERROR,SwankPlugin.PLUGIN_ID,
-        "Setting variable is not implemented"));
-  }
-
-  @Override
-  public void setValue(IValue value) throws DebugException
-  {
-    throw new DebugException(new Status(IStatus.ERROR,SwankPlugin.PLUGIN_ID,
-      "Setting variable is not implemented"));
-  }
-
-  @Override
-  public boolean supportsValueModification()
-  {
-    return false;
-  }
-
-  @Override
-  public boolean verifyValue(String expression) throws DebugException
-  {
-    return false;
-  }
-
-  @Override
-  public boolean verifyValue(IValue value) throws DebugException
-  {
-    return false;
-  }
-
-  @Override
-  public IValue getValue() throws DebugException
-  {
-    return value;
-  }
-
-  @Override
-  public String getName() throws DebugException
-  {
-    return name;
-  }
-
-  @Override
-  public String getReferenceTypeName() throws DebugException
-  {
-    return "lisp";
-  }
-
-  @Override
-  public boolean hasValueChanged() throws DebugException
-  {
-    return false;
-  }
-
-  @Override
-  public String toString()
-  {
-    return name + " = " + value;
-  }
-
-}

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

-package org.lispdev.swank;
-
-import org.lispdev.swank.runnables.SwankRunnable;
-
-/**
- * The structure is initialized when {@link SwankEvent#READ_STRING} is received
- * by its listeners from {@link SwankRunnable#result} using
- */
-public class ReadStringInfo
-{
-  public final String str1;
-  public final String str2;
-
-  public ReadStringInfo(String str1, String str2)
-  {
-    this.str1 = str1;
-    this.str2 = str2;
-  }
-
-}

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

-package org.lispdev.swank;
-
-import org.lispdev.swank.runnables.SwankRunnable;
-
-public abstract class SwankDebugRunnable extends SwankRunnable
-{
-  public SwankDebugRunnable(LispImplementation implementation)
-  {
-    super(implementation);
-  }
-
-  @Override
-  synchronized public DebugInfo getInfo()
-  {
-    return implem.getDebugInfo(result);
-  }
-
-  synchronized public String getKey()
-  {
-    DebugInfo info = getInfo();
-    return info.thread + ":" + info.level;
-  }
-}

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

-package org.lispdev.swank;
-
-import org.lispdev.swank.runnables.SwankRunnable;
-
-public abstract class SwankDisplayRunnable extends SwankRunnable
-{
-  public SwankDisplayRunnable(LispImplementation implementation)
-  {
-    super(implementation);
-  }
-
-  protected String presentation = null;
-
-  public void startPresentation(String presentation)
-  {
-    this.presentation = presentation;
-  }
-
-  public void endPresentation()
-  {
-    presentation = null;
-  }
-}

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

 import java.util.Hashtable;
 
 import org.eclipse.core.runtime.Assert;
+import org.lispdev.swank.debug.LispDebugTarget;
+import org.lispdev.swank.debug.LispVariable;
+import org.lispdev.swank.infos.DebugInfo;
+import org.lispdev.swank.internal.LispParser;
 import org.lispdev.swank.runnables.SwankCompileStringRunnable;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable;
 import org.lispdev.swank.runnables.SwankDebugReturnRunnable;
+import org.lispdev.swank.runnables.SwankDebugRunnable;
 import org.lispdev.swank.runnables.SwankMacroExpandRunnable;
 import org.lispdev.swank.runnables.SwankPresentationRunnable;
 import org.lispdev.swank.runnables.SwankReadStringRunnable;

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.swank.internal.LispParser;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable;
 import org.lispdev.swank.runnables.SwankDebugReturnRunnable;
+import org.lispdev.swank.runnables.SwankDebugRunnable;
 import org.lispdev.swank.runnables.SwankPresentationRunnable;
 import org.lispdev.swank.runnables.SwankReadStringRunnable;
 import org.lispdev.swank.runnables.SwankRunnable;

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

 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.lispdev.swank.debug.BaseLocalLispLaunchDelegate;
+import org.lispdev.swank.debug.LispProcess;
+import org.lispdev.swank.debug.LispVariable;
+import org.lispdev.swank.infos.DebugInfo;
+import org.lispdev.swank.infos.ReadStringInfo;
 import org.lispdev.swank.runnables.SwankCompileStringRunnable;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable;
 import org.lispdev.swank.runnables.SwankDebugReturnRunnable;
+import org.lispdev.swank.runnables.SwankDebugRunnable;
 import org.lispdev.swank.runnables.SwankMacroExpandRunnable;
 import org.lispdev.swank.runnables.SwankPresentationRunnable;
 import org.lispdev.swank.runnables.SwankReadStringRunnable;

File src/org/lispdev/swank/debug/BaseLocalLispLaunchDelegate.java

+package org.lispdev.swank.debug;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
+import org.lispdev.log.Log;
+import org.lispdev.swank.AvailablePortFinder;
+import org.lispdev.swank.IRunnableDriver;
+import org.lispdev.swank.LocalLispImplementation;
+import org.lispdev.swank.SwankInterface;
+import org.lispdev.swank.TestRunnableDriver;
+
+public class BaseLocalLispLaunchDelegate extends LaunchConfigurationDelegate
+{
+  public final static String ID =
+    "org.lispdev.swank.baseLocalLaunchConfigurationType";
+  public final static String ATTR_EXE = "path-to-executable-string";
+  public final static String ATTR_SWANK = "path-to-swank-loader.lisp";
+  public final static String ATTR_CMD_PARAMS = "command-line-params-list";
+  public final static String ATTR_ENV = ILaunchManager.ATTR_ENVIRONMENT_VARIABLES;
+  public final static String ATTR_PORT = "port-int";
+  public final static String ATTR_EXT = "lisp-extensions-path-string";
+  public final static String ATTR_START_REPL_THREAD = "start-repl-thread";
+  //for now to folder containing lisp-extensions folder: see basicStartup
+  //function in SwankInterface
+
+  protected static LispProcess launch(ILaunchConfiguration config,
+      ILaunch launch, IRunnableDriver r) throws CoreException
+  {
+    final String exe = config.getAttribute(ATTR_EXE, "");
+    File cmd = new File(exe);
+    if( !cmd.exists() )
+    {
+      Log.abort("Lisp executable "+exe+" does not exist", null);
+    }
+    if( !cmd.canExecute() )
+    {
+      Log.abort("File " + exe + " is not executable", null);
+    }
+    final String swankDir = config.getAttribute(ATTR_SWANK, "");
+    File swankf = new File(swankDir,"swank-loader.lisp");
+    if( !swankf.exists() )
+    {
+      Log.abort("Swank was not found in folder "+swankDir, null);
+    }
+    final int port = config.getAttribute(ATTR_PORT, -1);
+    if( port < AvailablePortFinder.MIN_PORT_NUMBER
+        || port > AvailablePortFinder.MAX_PORT_NUMBER )
+    {
+      Log.abort("Port is outside of available range", null);
+    }
+    if( !AvailablePortFinder.available(port) )
+    {
+      Log.abort("Port "+port+" is not available", null);
+    }
+    @SuppressWarnings("rawtypes")
+    final LocalLispImplementation implem =
+      new LocalLispImplementation(exe, swankDir,
+          config.getAttribute(ATTR_CMD_PARAMS, new ArrayList()),
+          config.getAttribute(ATTR_ENV, new HashMap()),
+          port, config.getAttribute(ATTR_START_REPL_THREAD, false));
+    final String ext = config.getAttribute(ATTR_EXT, "");
+    final File extf = new File(ext);
+    if( !extf.isDirectory() )
+    {
+      Log.abort("Extensions directory "+ext+" does not exist", null);
+    }
+    final SwankInterface s = new SwankInterface(ext,implem,r);
+    //s.connect();
+
+    LispProcess p = new LispProcess(launch, "swank", null, s);
+    launch.addProcess(p);
+    launch.addDebugTarget(new LispDebugTarget(launch, p));
+    return p;
+  }
+
+  @Override
+  public void launch(ILaunchConfiguration configuration, String mode,
+      ILaunch launch, IProgressMonitor monitor) throws CoreException
+  {
+    Assert.isLegal(ILaunchManager.PROFILE_MODE.equals(mode), "Wrong mode");
+    launch(configuration,launch,new TestRunnableDriver());
+  }
+
+}

File src/org/lispdev/swank/debug/LispDebugElement.java

+package org.lispdev.swank.debug;
+
+import org.eclipse.debug.core.model.DebugElement;
+import org.lispdev.swank.ISwank;
+
+public class LispDebugElement extends DebugElement
+{
+  public static final String MODEL_ID = "org.lispdev.debug.model";
+
+  public LispDebugElement(LispDebugTarget target)
+  {
+    super(target);
+  }
+
+  public ISwank getSwank()
+  {
+    return ((LispDebugTarget)getDebugTarget()).getSwank();
+  }
+
+  @Override
+  public String getModelIdentifier()
+  {
+    return MODEL_ID;
+  }
+
+}

File src/org/lispdev/swank/debug/LispDebugTarget.java

+package org.lispdev.swank.debug;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IMemoryBlock;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IThread;
+import org.lispdev.swank.ISwank;
+
+public class LispDebugTarget extends LispDebugElement implements IDebugTarget
+{
+  private final ILaunch launch;
+  private final LispProcess process;
+  private final List<IThread> threads = new ArrayList<IThread>();
+  private final LispThread thread;
+  private boolean terminated = false;
+
+  public LispDebugTarget(ILaunch launch, LispProcess process)
+  {
+    super(null);
+    this.launch = launch;
+    this.process = process;
+    thread = new LispThread(this);
+    threads.add(thread);
+  }
+
+  @Override
+  public ISwank getSwank()
+  {
+    if( process != null )
+    {
+      return process.getSwank();
+    }
+    return null;
+  }
+
+  @Override
+  public ILaunch getLaunch()
+  {
+    return launch;
+  }
+
+  @Override
+  public String getName() throws DebugException
+  {
+    return "swank";
+  }
+
+  @Override
+  public IProcess getProcess()
+  {
+    return process;
+  }
+
+  @Override
+  public IThread[] getThreads() throws DebugException
+  {
+    //process.getSwank()
+    return threads.toArray(new IThread[threads.size()]);
+  }
+
+  public LispThread getMainThread()
+  {
+    return thread;
+  }
+
+  @Override
+  public boolean hasThreads() throws DebugException
+  {
+    return true;
+  }
+
+  @Override
+  public boolean supportsBreakpoint(IBreakpoint breakpoint)
+  {
+    return false;
+  }
+
+  @Override
+  public boolean canTerminate()
+  {
+    return process.canTerminate();
+  }
+
+  @Override
+  public boolean isTerminated()
+  {
+    return terminated || process.isTerminated();
+  }
+
+  @Override
+  public void terminate() throws DebugException
+  {
+    terminated = true;
+  }
+
+  @Override
+  public boolean canResume()
+  {
+    return !isTerminated() && isSuspended();
+  }
+
+  @Override
+  public boolean canSuspend()
+  {
+    return !isTerminated() && !isSuspended();
+  }
+
+  @Override
+  public boolean isSuspended()
+  {
+    return !isTerminated() && thread.isSuspended();
+  }
+
+  @Override
+  public void resume() throws DebugException
+  {
+    thread.resume();
+  }
+
+  @Override
+  public void suspend() throws DebugException
+  {
+    thread.suspend();
+  }
+
+  @Override
+  public void breakpointAdded(IBreakpoint breakpoint)
+  {
+  }
+
+  @Override
+  public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta)
+  {
+  }
+
+  @Override
+  public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta)
+  {
+  }
+
+  @Override
+  public boolean canDisconnect()
+  {
+    return false;
+  }
+
+  @Override
+  public void disconnect() throws DebugException
+  {
+  }
+
+  @Override
+  public boolean isDisconnected()
+  {
+    return false;
+  }
+
+  @Override
+  public IMemoryBlock getMemoryBlock(long startAddress, long length)
+      throws DebugException
+  {
+    return null;
+  }
+
+  @Override
+  public boolean supportsStorageRetrieval()
+  {
+    return false;
+  }
+
+  @Override
+  public IDebugTarget getDebugTarget()
+  {
+    return this;
+  }
+}

File src/org/lispdev/swank/debug/LispProcess.java

+package org.lispdev.swank.debug;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IStreamsProxy;
+import org.lispdev.swank.ISwank;
+
+public class LispProcess extends PlatformObject implements IProcess
+{
+
+  private final HashMap<String,String> attr = new HashMap<String,String>();
+  /**
+   * The name of the process
+   */
+  private final String fName;
+  /**
+   * The launch this process is contained in
+   */
+  private final ILaunch fLaunch;
+
+  private final ISwank fSwank;
+  /**
+   * This process's exit value
+   */
+  private final int fExitValue = 0;
+
+  public LispProcess(ILaunch launch, String name, Map<String,String> attributes,
+      ISwank swank)
+  {
+    fLaunch = launch;
+    fName = name;
+    if( attributes != null )
+    {
+      attr.putAll(attributes);
+    }
+    fSwank = swank;
+  }
+
+  @Override
+  public String getAttribute(String key)
+  {
+    return attr.get(key);
+  }
+
+  @Override
+  public int getExitValue() throws DebugException
+  {
+    if( isTerminated() )
+    {
+      return fExitValue;
+    }
+    throw new DebugException(
+        new Status(
+            IStatus.ERROR,
+            DebugPlugin.getUniqueIdentifier(),
+            DebugException.TARGET_REQUEST_FAILED,
+            "Exit value not available until process terminates.",
+            null));
+  }
+
+  @Override
+  public String getLabel()
+  {
+    return fName;
+  }
+
+  @Override
+  public ILaunch getLaunch()
+  {
+    return fLaunch;
+  }
+
+  @Override
+  public IStreamsProxy getStreamsProxy()
+  {
+    return null;
+  }
+
+  @Override
+  public void setAttribute(String key, String value)
+  {
+    attr.put(key, value);
+  }
+
+  @Override
+  public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+  {
+    if( adapter.equals(IProcess.class) )
+    {
+      return this;
+    }
+    if( adapter.equals(IDebugTarget.class) )
+    {
+      ILaunch launch = getLaunch();
+      for( IDebugTarget t : launch.getDebugTargets() )
+      {
+        if( this.equals(t.getProcess()) )
+        {
+          return t;
+        }
+      }
+      return null;
+    }
+    if( adapter.equals(ILaunch.class) )
+    {
+      return getLaunch();
+    }
+    // CONTEXTLAUNCHING
+    if( adapter.equals(ILaunchConfiguration.class) )
+    {
+      return getLaunch().getLaunchConfiguration();
+    }
+    return super.getAdapter(adapter);
+  }
+
+  @Override
+  public boolean canTerminate()
+  {
+    return false;
+  }
+
+  @Override
+  public boolean isTerminated()
+  {
+    return false;
+  }
+
+  @Override
+  public void terminate() throws DebugException
+  {
+    fSwank.disconnect();
+  }
+
+  public ISwank getSwank()
+  {
+    return fSwank;
+  }
+}

File src/org/lispdev/swank/debug/LispStackFrame.java

+package org.lispdev.swank.debug;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IRegisterGroup;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+import org.eclipse.debug.core.model.IVariable;
+
+public class LispStackFrame extends LispDebugElement implements IStackFrame
+{
+  /**
+   * index of the frame in SwankDebugInfo
+   */
+  private final int index;
+  private final String name;
+  private final LispThread thread;
+  private IVariable[] vars = null;
+
+  public LispStackFrame(LispThread thread, String name, int index)
+  {
+    super((LispDebugTarget)thread.getDebugTarget());
+    this.thread = thread;
+    this.name = name;
+    this.index = index;
+  }
+
+  @Override
+  public int getCharEnd() throws DebugException
+  {
+    return -1;
+  }
+
+  @Override
+  public int getCharStart() throws DebugException
+  {
+    return -1;
+  }
+
+  @Override
+  public int getLineNumber() throws DebugException
+  {
+    return 0;
+  }
+
+  @Override
+  public String getName() throws DebugException
+  {
+    return name;
+  }
+
+  @Override
+  public IRegisterGroup[] getRegisterGroups() throws DebugException
+  {
+    return new IRegisterGroup[0];
+  }
+
+  @Override
+  public IThread getThread()
+  {
+    return thread;
+  }
+
+  @Override
+  public IVariable[] getVariables() throws DebugException
+  {
+    if( vars == null )
+    {
+      vars = thread.getSwank().getFrameLocals(index,
+          thread.getThreadID(), (LispDebugTarget)getDebugTarget());
+    }
+    return vars;
+  }
+
+  @Override
+  public boolean hasRegisterGroups() throws DebugException
+  {
+    return false;
+  }
+
+  @Override
+  public boolean hasVariables() throws DebugException
+  {
+    return false;
+  }
+
+  @Override
+  public boolean canStepInto()
+  {
+    return getThread().canStepInto();
+  }
+
+  @Override
+  public boolean canStepOver()
+  {
+    return getThread().canStepOver();
+  }
+
+  @Override
+  public boolean canStepReturn()
+  {
+    return getThread().canStepReturn();
+  }
+
+  @Override
+  public boolean isStepping()
+  {
+    return getThread().isStepping();
+  }
+
+  @Override
+  public void stepInto() throws DebugException
+  {
+    getThread().stepInto();
+  }
+
+  @Override
+  public void stepOver() throws DebugException
+  {
+    getThread().stepOver();
+
+  }
+
+  @Override
+  public void stepReturn() throws DebugException
+  {
+    getThread().stepReturn();
+  }
+
+  @Override
+  public boolean canResume()
+  {
+    return getThread().canResume();
+  }
+
+  @Override
+  public boolean canSuspend()