# abcl-android-20110818a.diff 
# 
# 
#  NB:  this only gets ABCL to *compile* on Android, not *run*
#
#  As such it may not be very useful execpt as a stepping-stone to debugging.

diff --git a/src/org/armedbear/lisp/Java.java b/src/org/armedbear/lisp/Java.java
--- a/src/org/armedbear/lisp/Java.java
+++ b/src/org/armedbear/lisp/Java.java
@@ -35,10 +35,10 @@
 
 import static org.armedbear.lisp.Lisp.*;
 
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
+//import java.beans.BeanInfo;
+//import java.beans.IntrospectionException;
+//import java.beans.Introspector;
+//import java.beans.PropertyDescriptor;
 import java.lang.reflect.Array;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -1220,74 +1220,74 @@
         }
     };
 
-    private static final Primitive JGET_PROPERTY_VALUE = new pf__jget_property_value();
-    @DocString(name="%jget-propety-value", args="java-object property-name",
-    doc="Gets a JavaBeans property on JAVA-OBJECT.\n" +
-        "SYSTEM-INTERNAL: Use jproperty-value instead.")
-    private static final class pf__jget_property_value extends Primitive
-    {
-        pf__jget_property_value() 
-        {
-	    super("%jget-property-value", PACKAGE_JAVA, true,
-                  "java-object property-name");
-        }
+    // private static final Primitive JGET_PROPERTY_VALUE = new pf__jget_property_value();
+    // @DocString(name="%jget-propety-value", args="java-object property-name",
+    // doc="Gets a JavaBeans property on JAVA-OBJECT.\n" +
+    //     "SYSTEM-INTERNAL: Use jproperty-value instead.")
+    // private static final class pf__jget_property_value extends Primitive
+    // {
+    //     pf__jget_property_value() 
+    //     {
+    //         super("%jget-property-value", PACKAGE_JAVA, true,
+    //               "java-object property-name");
+    //     }
     	
-        @Override
-        public LispObject execute(LispObject javaObject, LispObject propertyName) {
-			try {
-				Object obj = javaObject.javaInstance();
-				PropertyDescriptor pd = getPropertyDescriptor(obj, propertyName);
-				Object value = pd.getReadMethod().invoke(obj);
-				if(value instanceof LispObject) {
-				    return (LispObject) value;
-				} else if(value != null) {
-				    return JavaObject.getInstance(value, true);
-				} else {
-				    return NIL;
-				}
-			} catch (Exception e) {
-                return error(new JavaException(e));
-			}
-        }
-    };
+    //     @Override
+    //     public LispObject execute(LispObject javaObject, LispObject propertyName) {
+    //     		try {
+    //     			Object obj = javaObject.javaInstance();
+    //     			PropertyDescriptor pd = getPropertyDescriptor(obj, propertyName);
+    //     			Object value = pd.getReadMethod().invoke(obj);
+    //     			if(value instanceof LispObject) {
+    //     			    return (LispObject) value;
+    //     			} else if(value != null) {
+    //     			    return JavaObject.getInstance(value, true);
+    //     			} else {
+    //     			    return NIL;
+    //     			}
+    //     		} catch (Exception e) {
+    //             return error(new JavaException(e));
+    //     		}
+    //     }
+    // };
     
-    private static final Primitive JSET_PROPERTY_VALUE = new pf__jset_property_value();
-    @DocString(name="%jset-propety-value", args="java-object property-name value",
-    doc="Sets a JavaBean property on JAVA-OBJECT.\n" +
-        "SYSTEM-INTERNAL: Use (setf jproperty-value) instead.")
-    private static final class pf__jset_property_value extends Primitive
-    {
-        pf__jset_property_value()
-        {
-	    super("%jset-property-value", PACKAGE_JAVA, true,
-                  "java-object property-name value");
-        }
+    // private static final Primitive JSET_PROPERTY_VALUE = new pf__jset_property_value();
+    // @DocString(name="%jset-propety-value", args="java-object property-name value",
+    // doc="Sets a JavaBean property on JAVA-OBJECT.\n" +
+    //     "SYSTEM-INTERNAL: Use (setf jproperty-value) instead.")
+    // private static final class pf__jset_property_value extends Primitive
+    // {
+    //     pf__jset_property_value()
+    //     {
+    //         super("%jset-property-value", PACKAGE_JAVA, true,
+    //               "java-object property-name value");
+    //     }
     	
-        @Override
-        public LispObject execute(LispObject javaObject, LispObject propertyName, LispObject value) {
-	    Object obj = null;
-	    try {
-		obj = javaObject.javaInstance();
-		PropertyDescriptor pd = getPropertyDescriptor(obj, propertyName);
-		Object jValue;
-		//TODO maybe we should do this in javaInstance(Class)
-		if(value instanceof JavaObject) {
-		    jValue = value.javaInstance();
-		} else {
-		    if(Boolean.TYPE.equals(pd.getPropertyType()) ||
-		       Boolean.class.equals(pd.getPropertyType())) {
-			jValue = value != NIL;
-		    } else {
-			jValue = value != NIL ? value.javaInstance() : null;
-		    }
-		}
-		pd.getWriteMethod().invoke(obj, jValue);
-		return value;
-	    } catch (Exception e) {
-            return error(new JavaException(e));
-	    }
-        }
-    };
+    //     @Override
+    //     public LispObject execute(LispObject javaObject, LispObject propertyName, LispObject value) {
+    //         Object obj = null;
+    //         try {
+    //     	obj = javaObject.javaInstance();
+    //     	PropertyDescriptor pd = getPropertyDescriptor(obj, propertyName);
+    //     	Object jValue;
+    //     	//TODO maybe we should do this in javaInstance(Class)
+    //     	if(value instanceof JavaObject) {
+    //     	    jValue = value.javaInstance();
+    //     	} else {
+    //     	    if(Boolean.TYPE.equals(pd.getPropertyType()) ||
+    //     	       Boolean.class.equals(pd.getPropertyType())) {
+    //     		jValue = value != NIL;
+    //     	    } else {
+    //     		jValue = value != NIL ? value.javaInstance() : null;
+    //     	    }
+    //     	}
+    //     	pd.getWriteMethod().invoke(obj, jValue);
+    //     	return value;
+    //         } catch (Exception e) {
+    //         return error(new JavaException(e));
+    //         }
+    //     }
+    // };
 
     private static final Primitive JRUN_EXCEPTION_PROTECTED = new pf_jrun_exception_protected();
     @DocString(name="jrun-exception-protected", args="closure",
@@ -1317,18 +1317,18 @@
         }
     };
 
-    static PropertyDescriptor getPropertyDescriptor(Object obj, LispObject propertyName) throws IntrospectionException {
-        String prop = ((AbstractString) propertyName).getStringValue();
-        BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
-        for(PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
-        	if(pd.getName().equals(prop)) {
-        		return pd;
-        	}
-        }
-        error(new LispError("Property " + prop + " not found in " + obj));
+    // static PropertyDescriptor getPropertyDescriptor(Object obj, LispObject propertyName) throws IntrospectionException {
+    //     String prop = ((AbstractString) propertyName).getStringValue();
+    //     BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
+    //     for(PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
+    //     	if(pd.getName().equals(prop)) {
+    //     		return pd;
+    //     	}
+    //     }
+    //     error(new LispError("Property " + prop + " not found in " + obj));
 
-        return null; // not reached
-    }
+    //     return null; // not reached
+    // }
     
     private static Class classForName(String className) {
 	return classForName(className, JavaClassLoader.getPersistentInstance());
diff --git a/src/org/armedbear/lisp/java/swing/REPLConsole.java b/src/org/armedbear/lisp/java/swing/REPLConsole.java
deleted file mode 100644
--- a/src/org/armedbear/lisp/java/swing/REPLConsole.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * ConsoleDocument.java
- *
- * Copyright (C) 2008-2009 Alessio Stalla
- *
- * $Id$
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- * As a special exception, the copyright holders of this library give you
- * permission to link this library with independent modules to produce an
- * executable, regardless of the license terms of these independent
- * modules, and to copy and distribute the resulting executable under
- * terms of your choice, provided that you also meet, for each linked
- * independent module, the terms and conditions of the license of that
- * module.  An independent module is a module which is not derived from
- * or based on this library.  If you modify this library, you may extend
- * this exception to your version of the library, but you are not
- * obligated to do so.  If you do not wish to do so, delete this
- * exception statement from your version.
- */
-
-package org.armedbear.lisp.java.swing;
-
-import java.awt.Window;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.lang.RuntimeException;
-import java.io.Reader;
-import java.io.Writer;
-
-import javax.swing.JFrame;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.SwingUtilities;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.DefaultStyledDocument;
-import javax.swing.text.JTextComponent;
-import org.armedbear.lisp.Function;
-import org.armedbear.lisp.Interpreter;
-import org.armedbear.lisp.LispObject;
-import org.armedbear.lisp.LispThread;
-import org.armedbear.lisp.SpecialBindingsMark;
-import org.armedbear.lisp.Stream;
-import org.armedbear.lisp.Symbol;
-import org.armedbear.lisp.TwoWayStream;
-
-import static org.armedbear.lisp.Lisp.*;
-
-public class REPLConsole extends DefaultStyledDocument {
-
-  private StringBuffer inputBuffer = new StringBuffer();
-	
-  private Reader reader = new Reader() {
-
-      @Override
-      public void close() throws RuntimeException {}
-
-      @Override
-      public synchronized int read(char[] cbuf, int off, int len) throws RuntimeException {
-        try {
-          int length = Math.min(inputBuffer.length(), len);
-          while(length <= 0) {
-            wait();
-            length = Math.min(inputBuffer.length(), len);
-          }
-          inputBuffer.getChars(0, length, cbuf, off);
-          inputBuffer.delete(0, length);
-          return length;
-        } catch (InterruptedException e) {
-          throw new RuntimeException(e);
-        }
-      }
-    };
-	
-  private Writer writer = new Writer() {
-	    
-      @Override
-      public void close() throws RuntimeException {}
-
-      @Override
-      public void flush() throws RuntimeException {}
-
-      @Override
-      public void write(final char[] cbuf, final int off, final int len) throws RuntimeException {
-        try {
-          final int insertOffs;
-          synchronized(reader) {
-            if(inputBuffer.toString().matches("^\\s*$")) {
-              int length = inputBuffer.length();
-              inputBuffer.delete(0, length);
-            }
-            insertOffs = getLength() - inputBuffer.length();
-            reader.notifyAll();
-          }
-          Runnable r = new Runnable() {
-              public void run() {
-                synchronized(reader) {
-                  try {
-                    superInsertString(insertOffs,
-                                      new String(cbuf, off, len),
-                                      null);
-                  } catch(Exception e) {
-                    assert(false); //BadLocationException should not happen here
-                  }
-                }
-              }
-            };
-          SwingUtilities.invokeAndWait(r);
-        }  catch (Exception e) {
-          throw new RuntimeException(e);
-        }
-      }
-    };
-	
-  private boolean disposed = false;
-  private final Thread replThread;
-	
-  public REPLConsole(LispObject replFunction) {
-    final LispObject replWrapper = makeReplWrapper(new Stream(Symbol.SYSTEM_STREAM, new BufferedReader(reader)),
-                                                   new Stream(Symbol.SYSTEM_STREAM, new BufferedWriter(writer)),
-                                                   replFunction);
-    replThread = new Thread("REPL-thread-" + System.identityHashCode(this)) {
-        public void run() {
-          while(true) {
-            replWrapper.execute();
-            yield();
-          }
-        }
-      };
-    replThread.start();
-  }
-
-  @Override
-  public void insertString(int offs, String str, AttributeSet a)
-    throws BadLocationException {
-    synchronized(reader) {
-      int bufferStart = getLength() - inputBuffer.length();
-      if(offs < bufferStart) {
-        throw new BadLocationException("Can only insert after " + bufferStart, offs);
-      }
-      superInsertString(offs, str, a);
-      inputBuffer.insert(offs - bufferStart, str);
-      if(processInputP(inputBuffer, str)) {
-        reader.notifyAll();
-      }
-    }
-  }
-	
-  protected void superInsertString(int offs, String str, AttributeSet a)
-    throws BadLocationException {
-    super.insertString(offs, str, a);
-  }
-	
-  /**
-   * Guaranteed to run with exclusive access to the buffer.
-   * @param sb NB sb MUST NOT be destructively modified!!
-   * @return
-   */
-  protected boolean processInputP(StringBuffer sb, String str) {
-    if(str.indexOf("\n") == -1) {
-      return false;
-    }
-    int parenCount = 0;
-    int len = sb.length();
-    for(int i = 0; i < len; i++) {
-      char c = sb.charAt(i);
-      if(c == '(') {
-        parenCount++;
-      } else if(c == ')') {
-        parenCount--;
-        if(parenCount == 0) {
-          return true;
-        }
-      }
-    }
-    return parenCount <= 0;
-  }
-	
-  @Override
-  public void remove(int offs, int len) throws BadLocationException {
-    synchronized(reader) {
-      int bufferStart = getLength() - inputBuffer.length();
-      if(offs < bufferStart) {
-        throw new BadLocationException("Can only remove after " + bufferStart, offs);
-      }
-      super.remove(offs, len);
-      inputBuffer.delete(offs - bufferStart, offs - bufferStart + len);
-    }
-  }
-	
-  public Reader getReader() {
-    return reader;
-  }
-	
-  public Writer getWriter() {
-    return writer;
-  }
-	
-  public void setupTextComponent(final JTextComponent txt) {
-    addDocumentListener(new DocumentListener() {
-
-        //			@Override
-        public void changedUpdate(DocumentEvent e) {
-        }
-
-        // @Override
-        public void insertUpdate(DocumentEvent e) {
-          int len = getLength();
-          if(len - e.getLength() == e.getOffset()) { //The insert was at the end of the document
-            txt.setCaretPosition(getLength());
-          }
-        }
-
-        // @Override
-        public void removeUpdate(DocumentEvent e) {
-        }
-      });
-    txt.setCaretPosition(getLength());
-  }
-	
-  public void dispose() {
-    disposed = true;
-    for(DocumentListener listener : getDocumentListeners()) {
-      removeDocumentListener(listener);
-    }
-    try {
-      reader.close();
-      writer.close();
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-    replThread.interrupt(); //really?
-  }
-	
-  private final LispObject debuggerHook = new Function() {
-	    
-      @Override
-      public LispObject execute(LispObject condition, LispObject debuggerHook) {
-        if(disposed) {
-          return PACKAGE_SYS.findSymbol("%DEBUGGER-HOOK-FUNCTION").execute(condition, debuggerHook);
-        } else {
-          return NIL;
-        }
-      }
-	    
-    };
-	
-  public LispObject makeReplWrapper(final Stream in, final Stream out, final LispObject fn) {
-    return new Function() {	
-      @Override
-      public LispObject execute() {
-        SpecialBindingsMark lastSpecialBinding = LispThread.currentThread().markSpecialBindings();
-        try {
-          TwoWayStream ioStream = new TwoWayStream(in, out);
-          LispThread.currentThread().bindSpecial(Symbol.DEBUGGER_HOOK, debuggerHook);
-          LispThread.currentThread().bindSpecial(Symbol.STANDARD_INPUT, in);
-          LispThread.currentThread().bindSpecial(Symbol.STANDARD_OUTPUT, out);
-          LispThread.currentThread().bindSpecial(Symbol.ERROR_OUTPUT, out);
-          LispThread.currentThread().bindSpecial(Symbol.TERMINAL_IO, ioStream);
-          LispThread.currentThread().bindSpecial(Symbol.DEBUG_IO, ioStream);
-          LispThread.currentThread().bindSpecial(Symbol.QUERY_IO, ioStream);
-          return fn.execute();
-        } finally {
-          LispThread.currentThread().resetSpecialBindings(lastSpecialBinding);
-        }
-      }
-	    
-    };
-  }
-	
-  public void disposeOnClose(final Window parent) {
-    parent.addWindowListener(new WindowAdapter() {
-        @Override
-        public void windowClosing(WindowEvent e) {
-          dispose();
-          parent.removeWindowListener(this);
-        }
-      });
-  }
-	
-  public static void main(String[] args) {
-    LispObject repl = null;
-    try {		
-      repl = Interpreter.createInstance().eval("#'top-level::top-level-loop");
-    } catch (Throwable e) {
-      e.printStackTrace();
-      System.exit(1);  // Ok. We haven't done anything useful yet.
-    }
-    final REPLConsole d = new REPLConsole(repl);
-    final JTextComponent txt = new JTextArea(d);
-    d.setupTextComponent(txt);
-    JFrame f = new JFrame();
-    f.add(new JScrollPane(txt));
-    d.disposeOnClose(f);
-    f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
-    f.pack();
-    f.setVisible(true);
-  }
-	
-}
diff --git a/src/org/armedbear/lisp/scripting/AbclScriptEngine.java b/src/org/armedbear/lisp/scripting/AbclScriptEngine.java
deleted file mode 100644
--- a/src/org/armedbear/lisp/scripting/AbclScriptEngine.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * AbclScriptEngine.java
- *
- * Copyright (C) 2008 Alessio Stalla
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-package org.armedbear.lisp.scripting;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.util.Map;
-
-import javax.script.*;
-
-import org.armedbear.lisp.*;
-
-
-public class AbclScriptEngine extends AbstractScriptEngine implements Invocable, Compilable {
-
-    private Interpreter interpreter;
-    /**
-     * The function used to evaluate a string of code.
-     */
-    private Function evalScript;
-    /**
-     * The function used to evaluate a Lisp function.
-     */
-    private Function evalFunction;
-    /**
-     * The function used to compile Lisp code.
-     */
-    private Function compileScript;
-    /**
-     * The function used to evaluate a compiled script.
-     */
-    Function evalCompiledScript;
-
-    protected AbclScriptEngine() {
-	interpreter = Interpreter.getInstance();
-	if(interpreter == null) {
-	    interpreter = Interpreter.createInstance();
-	}
-	loadFromClasspath("/org/armedbear/lisp/scripting/lisp/packages.lisp");
-	loadFromClasspath("/org/armedbear/lisp/scripting/lisp/abcl-script.lisp");
-	loadFromClasspath("/org/armedbear/lisp/scripting/lisp/config.lisp");
-	if(getClass().getResource("/abcl-script-config.lisp") != null) {
-            //TODO: find a way to log this if wanted
-            //System.out.println("ABCL: loading configuration from " + getClass().getResource("/abcl-script-config.lisp"));
-	    loadFromClasspath("/abcl-script-config.lisp");
-	}
-	((Function) interpreter.eval("#'abcl-script:configure-abcl")).execute(new JavaObject(this));
-        //System.out.println("ABCL: configured");
-	evalScript = (Function) this.findSymbol("EVAL-SCRIPT", "ABCL-SCRIPT").getSymbolFunction();
-	compileScript = (Function) this.findSymbol("COMPILE-SCRIPT", "ABCL-SCRIPT").getSymbolFunction();
-	evalCompiledScript = (Function) this.findSymbol("EVAL-COMPILED-SCRIPT", "ABCL-SCRIPT").getSymbolFunction();
-	evalFunction = (Function) this.findSymbol("EVAL-FUNCTION", "ABCL-SCRIPT").getSymbolFunction();
-    }
-    
-    public Interpreter getInterpreter() {
-	return interpreter;
-    }
-
-    public void setStandardInput(InputStream stream, LispThread thread) {
-	thread.setSpecialVariable(Symbol.STANDARD_INPUT, new Stream(Symbol.SYSTEM_STREAM, stream,	Symbol.CHARACTER, true));
-    }
-    
-    public void setStandardInput(InputStream stream) {
-	setStandardInput(stream, LispThread.currentThread());
-    }
-    
-    public void setInterpreter(Interpreter interpreter) {
-	this.interpreter = interpreter;
-    }
-
-    public static String escape(String s) {
-	StringBuffer b = new StringBuffer();
-	int len = s.length();
-	char c;
-	for (int i = 0; i < len; ++i) {
-	    c = s.charAt(i);
-	    if (c == '\\' || c == '"') {
-		b.append('\\');
-	    }
-	    b.append(c);
-	}
-	return b.toString();
-    }
-
-	public LispObject loadFromClasspath(String classpathResource) {
-		InputStream istream = getClass().getResourceAsStream(classpathResource);
-		Stream stream = new Stream(Symbol.SYSTEM_STREAM, istream, Symbol.CHARACTER);
-		return load(stream);
-	}
-
-    public LispObject load(Stream stream) {
-        Symbol keyword_verbose = Lisp.internKeyword("VERBOSE");
-        Symbol keyword_print = Lisp.internKeyword("PRINT");
-        /*
-         * load (filespec &key (verbose *load-verbose*) (print *load-print*)
-         * (if-does-not-exist t) (external-format :default)
-         */
-        return Symbol.LOAD.getSymbolFunction().execute
-            (new LispObject[] { stream, keyword_verbose, Lisp.NIL,
-                                keyword_print, Lisp.NIL,
-                                Keyword.IF_DOES_NOT_EXIST, Lisp.T,
-                                Keyword.EXTERNAL_FORMAT, Keyword.DEFAULT });
-    }
-
-	public LispObject load(String filespec) {
-		return load(filespec, true);
-	}
-
-	public LispObject load(String filespec, boolean compileIfNecessary) {
-		if (isCompiled(filespec) || !compileIfNecessary) {
-			return interpreter.eval("(load \"" + escape(filespec) + "\")");
-		} else {
-			return compileAndLoad(filespec);
-		}
-	}
-
-	public static boolean isCompiled(String filespec) {
-		if (filespec.endsWith(".abcl")) {
-			return true;
-		}
-		File source;
-		File compiled;
-		if (filespec.endsWith(".lisp")) {
-			source = new File(filespec);
-			compiled = new File(filespec.substring(0, filespec.length() - 5)
-					+ ".abcl");
-		} else {
-			source = new File(filespec + ".lisp");
-			compiled = new File(filespec + ".abcl");
-		}
-		if (!source.exists()) {
-			throw new IllegalArgumentException("The source file " + filespec + " cannot be found");
-		}
-		return compiled.exists()
-				&& compiled.lastModified() >= source.lastModified();
-	}
-
-	public LispObject compileFile(String filespec) {
-		return interpreter.eval("(compile-file \"" + escape(filespec) + "\")");
-	}
-
-	public LispObject compileAndLoad(String filespec) {
-		return interpreter.eval("(load (compile-file \"" + escape(filespec)	+ "\"))");
-	}
-
-	public static boolean functionp(LispObject obj) {
-		return obj instanceof Function;
-	}
-
-	public JavaObject jsetq(String symbol, Object value) {
-		Symbol s = findSymbol(symbol);
-		JavaObject jo;
-		if (value instanceof JavaObject) {
-			jo = (JavaObject) value;
-		} else {
-			jo = new JavaObject(value);
-		}
-		s.setSymbolValue(jo);
-		return jo;
-	}
-
-	public Symbol findSymbol(String name, String pkg) {
-		Cons values = (Cons) (interpreter.eval("(cl:multiple-value-list (find-symbol (symbol-name '#:"
-											   + escape(name) + ")" + (pkg == null ? "" : " :" + escape(pkg))
-											   + "))"));
-		if(values.cadr() == Lisp.NIL) {
-			return null;
-		} else {
-			return (Symbol) values.car();
-		}
-	}
-
-	public Symbol findSymbol(String name) {
-		//Known bug: doesn't handle escaped ':' e.g. |a:b|
-		int i = name.indexOf(':');
-		if(i < 0) { 
-			return findSymbol(name, null);
-		} else {
-		    if((i < name.length() - 1) && (name.charAt(i + 1) == ':')) {
-			return findSymbol(name.substring(i + 2), name.substring(0, i));
-		    } else {
-			return findSymbol(name.substring(i + 1), name.substring(0, i));
-		    }
-		}
-	}
-	
-	public Function findFunction(String name) {
-		return (Function) interpreter.eval("#'" + name);
-	}
-
-	@Override
-	public Bindings createBindings() {
-		return new SimpleBindings();
-	}
-
-    private static LispObject makeBindings(Bindings bindings) {
-		if (bindings == null || bindings.size() == 0) {
-			return Lisp.NIL;
-		}
-		LispObject[] argList = new LispObject[bindings.size()];
-		int i = 0;
-		for (Map.Entry<String, Object> entry : bindings.entrySet()) {
-			argList[i++] = Symbol.CONS.execute(new SimpleString(entry.getKey()),
-							   JavaObject.getInstance(entry.getValue(), true));
-		}
-		return Symbol.LIST.getSymbolFunction().execute(argList);
-	}
-
-    Object eval(Function evaluator, LispObject code, ScriptContext ctx) throws ScriptException {
-	LispObject retVal = null;
-	    Stream outStream = new Stream(Symbol.SYSTEM_STREAM, ctx.getWriter());
-	    Stream inStream  = new Stream(Symbol.SYSTEM_STREAM, ctx.getReader());
-	    retVal = evaluator.execute(makeBindings(ctx.getBindings(ScriptContext.GLOBAL_SCOPE)),
-				       makeBindings(ctx.getBindings(ScriptContext.ENGINE_SCOPE)),
-				       inStream, outStream,
-				       code, new JavaObject(ctx));
-	    return retVal.javaInstance();
-    }
-	
-	@Override
-	public Object eval(String code, ScriptContext ctx) throws ScriptException {
-		return eval(evalScript, new SimpleString(code), ctx);
-	}
-
-	private static String toString(Reader reader) throws IOException {
-		StringWriter w = new StringWriter();
-		int i;
-		i = reader.read();
-		while (i != -1) {
-			w.write(i);
-			i = reader.read();
-		}
-		return w.toString();
-	}
-	
-	@Override
-	public Object eval(Reader code, ScriptContext ctx) throws ScriptException {
-		try {
-			return eval(toString(code), ctx);
-		} catch (IOException e) {
-			return new ScriptException(e);
-		}
-	}
-
-	@Override
-	public ScriptEngineFactory getFactory() {
-		return new AbclScriptEngineFactory();
-	}
-	
-	public <T> T getInterface(Class<T> clasz) {
-		try {
-			return getInterface(eval("(cl:find-package '#:ABCL-SCRIPT-USER)"), clasz);
-		} catch (ScriptException e) {
-			throw new Error(e);
-		}
-	}
-
-	@SuppressWarnings("unchecked")
-	public <T> T getInterface(Object thiz, Class<T> clasz) {
-	    Symbol s = findSymbol("jmake-proxy", "JAVA");
-	    JavaObject iface = new JavaObject(clasz);
-	    return (T) ((JavaObject) s.execute(iface, (LispObject) thiz)).javaInstance();
-	}
-	
-    public Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException {
-	Symbol s;
-	if(name.indexOf(':') >= 0) {
-	    s = findSymbol(name);
-	} else {
-	    s = findSymbol(name, "ABCL-SCRIPT-USER");
-	}
-	if(s != null) {
-	    LispObject f = s.getSymbolFunction();
-	    if(f != null && f instanceof Function) {
-		LispObject functionAndArgs = Lisp.NIL.push(f);
-		for(int i = 0; i < args.length; ++i) {
-		    functionAndArgs = functionAndArgs.push(JavaObject.getInstance(args[i], true));
-		}
-		functionAndArgs = functionAndArgs.reverse();
-		return eval(evalFunction, functionAndArgs, getContext());
-	    } else {
-		throw new NoSuchMethodException(name);
-	    }
-	} else {
-	    throw new NoSuchMethodException(name);
-	}
-    }
-
-    public Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException {
-	throw new UnsupportedOperationException("Common Lisp does not have methods in the Java sense. Use invokeFunction instead.");
-    }
-
-    public class AbclCompiledScript extends CompiledScript {
-
-	private LispObject function;
-	
-	public AbclCompiledScript(LispObject function) {
-	    this.function = function;
-	}
-	
-	@Override
-	public Object eval(ScriptContext context) throws ScriptException {
-	    return AbclScriptEngine.this.eval(evalCompiledScript, function, context);
-	}
-	
-	@Override
-	public ScriptEngine getEngine() {
-	    return AbclScriptEngine.this;
-	}
-	
-    }
-
-	
-	@Override
-	public CompiledScript compile(String script) throws ScriptException {
-		try {
-		    Function f = (Function) compileScript.execute(new SimpleString(script));
-		    return new AbclCompiledScript(f);
-		} catch(ClassCastException e) {
-			throw new ScriptException(e);
-		}
-	}
-
-	@Override
-	public CompiledScript compile(Reader script) throws ScriptException {
-		try {
-			return compile(toString(script));
-		} catch (IOException e) {
-			throw new ScriptException(e);
-		}
-	}
-
-}
diff --git a/src/org/armedbear/lisp/scripting/AbclScriptEngineFactory.java b/src/org/armedbear/lisp/scripting/AbclScriptEngineFactory.java
deleted file mode 100644
--- a/src/org/armedbear/lisp/scripting/AbclScriptEngineFactory.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * AbclScriptEngineFactory.java
- *
- * Copyright (C) 2008 Alessio Stalla
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-package org.armedbear.lisp.scripting;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-
-public class AbclScriptEngineFactory implements ScriptEngineFactory {
-
-    private static AbclScriptEngine THE_ONLY_ONE_ENGINE = null;
-	
-    public String getEngineName() {
-	return "ABCL Script";
-    }
-
-    public String getEngineVersion() {
-	return "0.1";
-    }
-
-    public List<String> getExtensions() {
-	List<String> extensions = new ArrayList<String>(1);
-	extensions.add("lisp");
-	return Collections.unmodifiableList(extensions);
-    }
-
-    public String getLanguageName() {
-	return "ANSI Common Lisp";
-    }
-
-    public String getLanguageVersion() {
-	return "ANSI X3.226:1994";
-    }
-
-    public static String escape(String raw) {
-	StringBuilder sb = new StringBuilder();
-	int len = raw.length();
-	char c;
-	for(int i = 0; i < len; ++i) {
-	    c = raw.charAt(i);
-	    if(c != '"') {
-		sb.append(c);
-	    } else {
-		sb.append("\\\"");
-	    }
-	}
-	return sb.toString();
-    }
-	
-    public String getMethodCallSyntax(String obj, String method, String... args) {
-	StringBuilder sb = new StringBuilder();
-	sb.append("(jcall \"");
-	sb.append(method);
-	sb.append("\" ");
-	sb.append(obj);
-	for(String arg : args) {
-	    sb.append(" ");
-	    sb.append(arg);
-	}
-	sb.append(")");
-	return sb.toString();
-    }
-    
-    public List<String> getMimeTypes() {
-	return Collections.unmodifiableList(new ArrayList<String>());
-    }
-
-    public List<String> getNames() {
-	List<String> names = new ArrayList<String>(1);
-	names.add("ABCL");
-	names.add("cl");
-	names.add("Lisp");
-	names.add("Common Lisp");
-	return Collections.unmodifiableList(names);
-    }
-
-    public String getOutputStatement(String str) {
-	return "(cl:print \"" + str + "\")";
-    }
-
-    public Object getParameter(String key) {
-	// TODO Auto-generated method stub
-	return null;
-    }
-
-    public String getProgram(String... statements) {
-	StringBuilder sb = new StringBuilder();
-	sb.append("(cl:progn");
-	for(String stmt : statements) {
-	    sb.append("\n\t");
-	    sb.append(stmt);
-	}
-	sb.append(")");
-	return sb.toString();
-    }
-    
-    public synchronized ScriptEngine getScriptEngine() {
-        if (THE_ONLY_ONE_ENGINE == null) {
-            THE_ONLY_ONE_ENGINE = new AbclScriptEngine();
-        }
-	return THE_ONLY_ONE_ENGINE;
-    }
-
-}
diff --git a/src/org/armedbear/lisp/scripting/lisp/abcl-script.lisp b/src/org/armedbear/lisp/scripting/lisp/abcl-script.lisp
deleted file mode 100644
--- a/src/org/armedbear/lisp/scripting/lisp/abcl-script.lisp
+++ /dev/null
@@ -1,143 +0,0 @@
-;;; abcl-script.lisp
-;;;
-;;; Copyright (C) 2008 Alessio Stalla
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License
-;;; as published by the Free Software Foundation; either version 2
-;;; of the License, or (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-;;;
-;;; As a special exception, the copyright holders of this library give you
-;;; permission to link this library with independent modules to produce an
-;;; executable, regardless of the license terms of these independent
-;;; modules, and to copy and distribute the resulting executable under
-;;; terms of your choice, provided that you also meet, for each linked
-;;; independent module, the terms and conditions of the license of that
-;;; module.  An independent module is a module which is not derived from
-;;; or based on this library.  If you modify this library, you may extend
-;;; this exception to your version of the library, but you are not
-;;; obligated to do so.  If you do not wish to do so, delete this
-;;; exception statement from your version.
-
-(in-package :abcl-script)
-
-(defconstant +global-scope+
-  (jfield "javax.script.ScriptContext" "GLOBAL_SCOPE"))
-
-(defconstant +engine-scope+
-  (jfield "javax.script.ScriptContext" "ENGINE_SCOPE"))
-
-(defconstant +put-binding+ (jmethod "javax.script.Bindings"
-				    "put"
-				    "java.lang.String"
-				    "java.lang.Object"))
-
-(defconstant +get-bindings+ (jmethod "javax.script.ScriptContext"
-				     "getBindings"
-				     "int"))
-
-(defun generate-bindings (bindings)
-  (let ((*package* (find-package :abcl-script-user)))
-    (mapcar (lambda (binding) (list (read-from-string (car binding))
-				    (cdr binding)))
-	    bindings)))
-
-(defun generate-special-declarations (bindings)
-  (let ((*package* (find-package :abcl-script-user)))
-    `(declare (special
-	       ,@(mapcar (lambda (binding) (read-from-string (car binding)))
-			 bindings)))))
-
-(defun generate-java-bindings (bindings-list actual-bindings java-bindings)
-  (loop :for binding  :in actual-bindings
-	:for jbinding :in bindings-list
-	:collect `(jcall +put-binding+
-		   ,java-bindings ,(car jbinding) ,(car binding))))
-
-(defmacro eval-in-script-context ((global-bindings engine-bindings stdin stdout script-context)
-				  body)
-  "Sets up a context in which to evaluate a piece of code coming from Java through the JSR-223 methods."
-  (let ((actual-global-bindings (gensym))
-	(actual-engine-bindings (gensym)))
-    `(let ((*package* (find-package :abcl-script-user))
-	   (*standard-input* ,stdin)
-	   (*standard-output* ,stdout)
-	   (,actual-global-bindings (generate-bindings ,global-bindings))
-	   (,actual-engine-bindings (generate-bindings ,engine-bindings)))
-       (eval `(let (,@,actual-global-bindings)
-		(let (,@,actual-engine-bindings)
-		  ,(generate-special-declarations ,global-bindings)
-		  ,(generate-special-declarations ,engine-bindings)
-		  (prog1
-		      (progn ,@,body)
-		    (finish-output *standard-output*)
-		    ,@(generate-java-bindings
-		       ,global-bindings 
-		       ,actual-global-bindings
-		       (jcall +get-bindings+ ,script-context +global-scope+))
-		    ,@(generate-java-bindings
-		       ,engine-bindings 
-		       ,actual-engine-bindings
-		       (jcall +get-bindings+ ,script-context +engine-scope+)))))))))
-  
-(defun eval-function (global-bindings engine-bindings stdin stdout function-and-args script-context)
-  (eval-in-script-context (global-bindings engine-bindings stdin stdout script-context)
-    `((funcall ,@(mapcar (lambda (arg) `(quote ,arg))
-			 function-and-args)))))
-
-(defun eval-script (global-bindings engine-bindings stdin stdout
-		    code-string script-context)
-  (eval-in-script-context (global-bindings engine-bindings stdin stdout script-context)
-    `((with-input-from-string (str ,code-string)
-	(sys::load-returning-last-result str)))))
-
-(defun eval-compiled-script (global-bindings engine-bindings stdin stdout
-			     function script-context)
-  (eval-in-script-context (global-bindings engine-bindings stdin stdout script-context)
-    `((funcall ,function))))
-
-(defun compile-script (code-string)
-  (let* ((tmp-file (jstatic (jmethod "java.io.File" "createTempFile" "java.lang.String" "java.lang.String")
-			    nil "abcl-src-file-" ".lisp"))
-	 (tmp-file-path (jcall (jmethod "java.io.File" "getAbsolutePath") tmp-file)))
-    (jcall (jmethod "java.io.File" "deleteOnExit") tmp-file) ;to be really-really-really sure...
-    (unwind-protect
-	 (progn
-	   (with-open-file (stream tmp-file-path :direction :output)
-	     (princ "(in-package :abcl-script-user)" stream)
-	     (princ code-string stream)
-	     (finish-output stream))
-	   (let ((compiled-file (compile-file tmp-file-path)))
-	     (jcall (jmethod "java.io.File" "deleteOnExit")
-		    (jnew (jconstructor "java.io.File" "java.lang.String")
-			  (namestring compiled-file)))
-	     (lambda ()
-	       (let ((*package* (find-package :abcl-script-user)))
-		 (sys::load-returning-last-result compiled-file)))))
-      (delete-file tmp-file-path))))
-
-;;Java interface implementation - TODO
-
-(defvar *interface-implementation-map* (make-hash-table :test #'equal))
-
-(defun find-java-interface-implementation (interface)
-  (gethash interface *interface-implementation-map*))
-
-(defun register-java-interface-implementation (interface implementation &optional lisp-this)
-  (setf (gethash interface *interface-implementation-map*)
-	(jmake-proxy interface implementation lisp-this)))
-
-(defun remove-java-interface-implementation (interface)
-  (remhash interface *interface-implementation-map*))
-
-;Let's load it so asdf package is already defined when loading config.lisp
-(require 'asdf)
\ No newline at end of file
diff --git a/src/org/armedbear/lisp/scripting/lisp/config.lisp b/src/org/armedbear/lisp/scripting/lisp/config.lisp
deleted file mode 100644
--- a/src/org/armedbear/lisp/scripting/lisp/config.lisp
+++ /dev/null
@@ -1,54 +0,0 @@
-;;; config.lisp
-;;;
-;;; Copyright (C) 2008 Alessio Stalla
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License
-;;; as published by the Free Software Foundation; either version 2
-;;; of the License, or (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-;;;
-;;; As a special exception, the copyright holders of this library give you
-;;; permission to link this library with independent modules to produce an
-;;; executable, regardless of the license terms of these independent
-;;; modules, and to copy and distribute the resulting executable under
-;;; terms of your choice, provided that you also meet, for each linked
-;;; independent module, the terms and conditions of the license of that
-;;; module.  An independent module is a module which is not derived from
-;;; or based on this library.  If you modify this library, you may extend
-;;; this exception to your version of the library, but you are not
-;;; obligated to do so.  If you do not wish to do so, delete this
-;;; exception statement from your version.
-
-
-(in-package :abcl-script)
-
-(defparameter *launch-swank-at-startup* nil)
-
-(defparameter *swank-dir* nil)
-
-(defparameter *swank-port* 4005)
-
-(defparameter *use-throwing-debugger* t)
-
-(defun configure-abcl (abcl-script-engine)
-  (when *use-throwing-debugger*
-    (setf *debugger-hook* #'sys::%debugger-hook-function))
-  (when *launch-swank-at-startup*
-    (unless *swank-dir*
-      (error "Swank directory not specified, please set *swank-dir*"))
-    (pushnew *swank-dir* asdf:*central-registry* :test #'equal)
-    (asdf:oos 'asdf:load-op :swank)
-    (threads:make-thread (lambda () (funcall (find-symbol
-					  (symbol-name '#:create-server)
-					  :swank)
-					 :port *swank-port*))
-		     :name "ABCL script - Swank thread")))
diff --git a/src/org/armedbear/lisp/scripting/lisp/packages.lisp b/src/org/armedbear/lisp/scripting/lisp/packages.lisp
deleted file mode 100644
--- a/src/org/armedbear/lisp/scripting/lisp/packages.lisp
+++ /dev/null
@@ -1,51 +0,0 @@
-;;; packages.lisp
-;;;
-;;; Copyright (C) 2008 Alessio Stalla
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License
-;;; as published by the Free Software Foundation; either version 2
-;;; of the License, or (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-;;;
-;;; As a special exception, the copyright holders of this library give you
-;;; permission to link this library with independent modules to produce an
-;;; executable, regardless of the license terms of these independent
-;;; modules, and to copy and distribute the resulting executable under
-;;; terms of your choice, provided that you also meet, for each linked
-;;; independent module, the terms and conditions of the license of that
-;;; module.  An independent module is a module which is not derived from
-;;; or based on this library.  If you modify this library, you may extend
-;;; this exception to your version of the library, but you are not
-;;; obligated to do so.  If you do not wish to do so, delete this
-;;; exception statement from your version.
-
-(defpackage :abcl-script
-  (:use :cl :java)
-  (:export 
-   #:compile-script
-   #:*compile-using-temp-files*
-   #:configure-abcl
-   #:eval-compiled-script
-   #:eval-function
-   #:eval-script
-   #:define-java-interface-implementation
-   #:find-java-interface-implementation
-   #:*launch-swank-at-startup*
-   #:register-java-interface-implementation
-   #:remove-java-interface-implementation
-   #:+standard-debugger-hook+
-   #:*swank-dir*
-   #:*swank-port*
-   #:*use-throwing-debugger*))
-
-(defpackage :abcl-script-user
-  (:use :cl :ext :java :abcl-script))
\ No newline at end of file
