]> gitweb.factorcode.org Git - factor.git/commitdiff
Java Factor no longer exists
authorSlava Pestov <slava@factorcode.org>
Wed, 17 Nov 2004 04:04:51 +0000 (04:04 +0000)
committerSlava Pestov <slava@factorcode.org>
Wed, 17 Nov 2004 04:04:51 +0000 (04:04 +0000)
97 files changed:
Factor.manifest [deleted file]
build.xml
factor/Cons.java
factor/FactorArray.java
factor/FactorCompoundDefinition.java
factor/FactorCompoundDefinition.java.new [deleted file]
factor/FactorDomainException.java [deleted file]
factor/FactorInterpreter.java [deleted file]
factor/FactorJava.java [deleted file]
factor/FactorLib.java
factor/FactorNamespace.java [deleted file]
factor/FactorObject.java [deleted file]
factor/FactorParsingDefinition.java
factor/FactorReader.java
factor/FactorShuffleDefinition.java [deleted file]
factor/FactorStackException.java [deleted file]
factor/FactorSymbolDefinition.java
factor/FactorUndefinedWordException.java [deleted file]
factor/FactorWord.java
factor/FactorWordDefinition.java
factor/jedit/EditWordDialog.java
factor/jedit/ExternalFactor.java
factor/jedit/FactorAsset.java
factor/jedit/FactorPlugin.java
factor/jedit/FactorPlugin.props
factor/jedit/FactorShell.java
factor/jedit/FactorSideKickParser.java
factor/jedit/FactorStream.java
factor/jedit/FactorWordRenderer.java
factor/jedit/WordPreview.java
factor/parser/Bar.java
factor/parser/Base.java
factor/parser/BeginVector.java
factor/parser/Bra.java
factor/parser/CharLiteral.java
factor/parser/ComplexLiteral.java
factor/parser/Def.java
factor/parser/Defer.java
factor/parser/EndVector.java
factor/parser/F.java
factor/parser/In.java
factor/parser/Ine.java
factor/parser/Ket.java
factor/parser/LineComment.java
factor/parser/NoParsing.java
factor/parser/PushWord.java
factor/parser/Shuffle.java [deleted file]
factor/parser/StackComment.java
factor/parser/StringLiteral.java
factor/parser/Symbol.java
factor/parser/T.java
factor/parser/Use.java
factor/primitives/Call.java [deleted file]
factor/primitives/Coerce.java [deleted file]
factor/primitives/Define.java [deleted file]
factor/primitives/Execute.java [deleted file]
factor/primitives/Ifte.java [deleted file]
factor/primitives/InterpreterGet.java [deleted file]
factor/primitives/JInvoke.java [deleted file]
factor/primitives/JNew.java [deleted file]
factor/primitives/JVarGet.java [deleted file]
factor/primitives/JVarGetStatic.java [deleted file]
factor/primitives/JVarSet.java [deleted file]
factor/primitives/JVarSetStatic.java [deleted file]
factor/primitives/Restack.java [deleted file]
factor/primitives/Unstack.java [deleted file]
library/platform/jvm/arithmetic.factor [deleted file]
library/platform/jvm/boot-mini.factor [deleted file]
library/platform/jvm/boot-sumo.factor [deleted file]
library/platform/jvm/boot.factor [deleted file]
library/platform/jvm/combinators.factor [deleted file]
library/platform/jvm/cons.factor [deleted file]
library/platform/jvm/cross-compiler.factor [deleted file]
library/platform/jvm/debugger.factor [deleted file]
library/platform/jvm/errors.factor [deleted file]
library/platform/jvm/files.factor [deleted file]
library/platform/jvm/init.factor [deleted file]
library/platform/jvm/kernel.factor [deleted file]
library/platform/jvm/math-types.factor [deleted file]
library/platform/jvm/namespaces.factor [deleted file]
library/platform/jvm/parser.factor [deleted file]
library/platform/jvm/prettyprint.factor [deleted file]
library/platform/jvm/processes.factor [deleted file]
library/platform/jvm/random.factor [deleted file]
library/platform/jvm/real-math.factor [deleted file]
library/platform/jvm/regexp.factor [deleted file]
library/platform/jvm/sbuf.factor [deleted file]
library/platform/jvm/stack.factor [deleted file]
library/platform/jvm/stack2.factor [deleted file]
library/platform/jvm/stream.factor [deleted file]
library/platform/jvm/strings.factor [deleted file]
library/platform/jvm/threads.factor [deleted file]
library/platform/jvm/unparser.factor [deleted file]
library/platform/jvm/vectors.factor [deleted file]
library/platform/jvm/vocabularies.factor [deleted file]
library/platform/jvm/words.factor [deleted file]
library/tools/cross-compiler.factor

diff --git a/Factor.manifest b/Factor.manifest
deleted file mode 100644 (file)
index f874bfe..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Main-Class: factor.FactorInterpreter
index b227a06d0f2f9ab6ce4751dc0c10aafca9f898fd..36d8a3874a9c0c7c084b4054cbe7c8ccec465a5a 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -2,11 +2,13 @@
 
 <project name=" Factor" default="dist" basedir=".">
 
-       <target name="init">
-               <available property="jedit" classname="org.gjt.sp.jedit.jEdit" />
-       </target>
+       <path id="jedit-classpath">
+               <pathelement location="${user.home}/.jedit/jars/ErrorList.jar" />
+               <pathelement location="${user.home}/.jedit/jars/SideKick.jar" />
+               <pathelement location="${user.home}/.jedit/jars/Console.jar" />
+       </path>
 
-       <target name="compile" depends="init">
+       <target name="compile">
                <javac
                        srcdir="."
                        destdir="."
                        includeJavaRuntime="yes"
                        debug="true"
                        optimize="true"
+                       classpathref="jedit-classpath"
                >
                <include name="**/*.java"/>
-               <exclude name="factor/jedit/*.java"/>
-               </javac>
-       </target>
-
-       <path id="jedit-classpath">
-               <pathelement location="${user.home}/.jedit/jars/ErrorList.jar" />
-               <pathelement location="${user.home}/.jedit/jars/SideKick.jar" />
-               <pathelement location="${user.home}/.jedit/jars/Console.jar" />
-       </path>
-
-       <target name="compile-jedit" depends="init" if="jedit">
-               <javac
-                       classpathref="jedit-classpath"
-                       debug="true"
-                       deprecation="on"
-                       destdir="."
-                       optimize="true"
-                       srcdir=".">
-                       <include name="factor/jedit/*.java"/>
                </javac>
        </target>
 
-       <target name="dist" depends="compile,compile-jedit">
+       <target name="dist" depends="compile">
                <jar
                        jarfile="Factor.jar"
-                       manifest="Factor.manifest"
                        compress="true"
                >
                        <fileset dir=".">
                                <include name="factor/**/*.bsh"/>
                                <include name="factor/**/*.txt"/>
                                <include name="*.xml"/>
-                               <include name="library/**/*.factor"/>
-                               <include name="library/**/*.txt"/>
-                               <include name="library/**/*.png"/>
-                               <include name="org/**/*.class"/>
-                               <include name="*.factor"/>
                                <include name="doc/**/*.html"/>
                                <include name="doc/**/*.png"/>
                                <include name="doc/*.html"/>
-                               <include name="Factor.manifest"/>
                        </fileset>
                </jar>
        </target>
index 54c08163331ee4f26df796a76c28122a41e9a22b..4d678a6be0467ca5fa68e7422449d346d93aacd7 100644 (file)
@@ -32,10 +32,8 @@ package factor;
 /**
  * Used to build up linked lists.
  */
-public class Cons implements PublicCloneable, FactorExternalizable
+public class Cons implements FactorExternalizable
 {
-       public static int COUNT;
-
        public Object car;
        public Object cdr;
 
@@ -44,20 +42,6 @@ public class Cons implements PublicCloneable, FactorExternalizable
        {
                this.car = car;
                this.cdr = cdr;
-
-               COUNT++;
-       } //}}}
-
-       //{{{ car() method
-       public Object car(Class clas) throws Exception
-       {
-               return FactorJava.convertToJavaType(car,clas);
-       } //}}}
-
-       //{{{ cdr() method
-       public Object cdr(Class clas) throws Exception
-       {
-               return FactorJava.convertToJavaType(cdr,clas);
        } //}}}
 
        //{{{ next() method
@@ -66,24 +50,6 @@ public class Cons implements PublicCloneable, FactorExternalizable
                return (Cons)cdr;
        } //}}}
 
-       //{{{ get() method
-       public Object get(int index)
-       {
-               return _get(index).car;
-       } //}}}
-
-       //{{{ _get() method
-       public Cons _get(int index)
-       {
-               Cons iter = this;
-               while(index != 0)
-               {
-                       iter = (Cons)iter.cdr;
-                       index--;
-               }
-               return iter;
-       } //}}}
-
        //{{{ contains() method
        public boolean contains(Object obj)
        {
@@ -119,47 +85,6 @@ public class Cons implements PublicCloneable, FactorExternalizable
                return size;
        } //}}}
 
-       //{{{ nappend() method
-       public static Cons nappend(Cons l1, Cons l2)
-       {
-               if(l1 == null)
-                       return l2;
-               if(l2 == null)
-                       return l1;
-               Cons last = l1;
-               while(last.cdr != null)
-                       last = last.next();
-               last.cdr = l2;
-               return l1;
-       } //}}}
-
-       //{{{ reverse() method
-       public static Cons reverse(Cons list)
-       {
-               Cons reversed = null;
-               while(list != null)
-               {
-                       reversed = new Cons(list.car,reversed);
-                       list = list.next();
-               }
-               return reversed;
-       } //}}}
-
-       //{{{ assoc() method
-       public static Object assoc(Cons assoc, Object key)
-       {
-               if(assoc == null)
-                       return null;
-               else
-               {
-                       Cons first = (Cons)assoc.car;
-                       if(FactorLib.equal(first.car,key))
-                               return first.cdr;
-                       else
-                               return assoc(assoc.next(),key);
-               }
-       } //}}}
-
        //{{{ elementsToString() method
        /**
         * Returns a whitespace separated string of the unparseObject() of each
@@ -257,43 +182,4 @@ public class Cons implements PublicCloneable, FactorExternalizable
                else
                        return car.hashCode();
        } //}}}
-
-       //{{{ clone() method
-       public Object clone()
-       {
-               if(cdr instanceof Cons)
-                       return new Cons(car,((Cons)cdr).clone());
-               else
-                       return new Cons(car,cdr);
-       } //}}}
-
-       //{{{ deepClone() method
-       public static Cons deepClone(Cons list)
-       {
-               if(list == null)
-                       return null;
-
-               Object ccar;
-               if(list.car instanceof PublicCloneable)
-                       ccar = ((PublicCloneable)list.car).clone();
-               else
-                       ccar = list.car;
-               if(list.cdr instanceof Cons)
-               {
-                       return new Cons(ccar,deepClone(list.next()));
-               }
-               else if(list.cdr == null)
-               {
-                       return new Cons(ccar,null);
-               }
-               else
-               {
-                       Object ccdr;
-                       if(list.cdr instanceof PublicCloneable)
-                               ccdr = ((PublicCloneable)list.cdr).clone();
-                       else
-                               ccdr = list.cdr;
-                       return new Cons(ccar,ccdr);
-               }
-       } //}}}
 }
index 8010940a9f33dbd5dd441f3ae811afe4ca9a0746..cfdcf666f22b27de27f0db71ff496110f6bada84 100644 (file)
@@ -35,130 +35,41 @@ package factor;
  */
 public class FactorArray implements FactorExternalizable, PublicCloneable
 {
-       public Object[] stack;
+       public Object[] array;
        public int top;
 
        //{{{ FactorArray constructor
        public FactorArray()
        {
-               stack = new Object[64];
+               array = new Object[64];
        } //}}}
 
        //{{{ FactorArray constructor
        public FactorArray(int size)
        {
-               stack = new Object[size];
+               array = new Object[size];
        } //}}}
-
+       
        //{{{ FactorArray constructor
        public FactorArray(Cons list)
        {
-               this();
+               this(list == null ? 0 : list.length());
 
-               if(list != null)
+               int i = 0;
+               while(list != null)
                {
-                       ensurePush(list.length());
-                       while(list != null)
-                       {
-                               push(list.car);
-                               list = list.next();
-                       }
+                       array[i++] = list.car;
+                       list = list.next();
                }
        } //}}}
 
        //{{{ FactorArray constructor
-       public FactorArray(Object[] stack, int top)
+       public FactorArray(Object[] array, int top)
        {
-               this.stack = stack;
+               this.array = array;
                this.top = top;
        } //}}}
 
-       //{{{ pop() method
-       public Object pop(Class clas) throws Exception
-       {
-               return FactorJava.convertToJavaType(pop(),clas);
-       } //}}}
-
-       //{{{ pop() method
-       public Object pop() throws FactorStackException
-       {
-               ensurePop(1);
-               Object returnValue = stack[--top];
-               stack[top] = null;
-               return returnValue;
-       } //}}}
-
-       //{{{ peek() method
-       public Object peek() throws FactorStackException
-       {
-               ensurePop(1);
-               return stack[top - 1];
-       } //}}}
-
-       //{{{ ensurePop() method
-       public void ensurePop(int amount) throws FactorStackException
-       {
-               if(amount > top)
-                       throw new FactorStackException(amount);
-       } //}}}
-
-       //{{{ push() method
-       public void push(Object o)
-       {
-               ensurePush(1);
-               stack[top++] = o;
-       } //}}}
-
-       //{{{ pushAll() method
-       public void pushAll(Object[] array)
-       {
-               ensurePush(array.length);
-               System.arraycopy(array,0,stack,top,array.length);
-               top += array.length;
-       } //}}}
-
-       //{{{ ensureCapacity() method
-       private void ensureCapacity(int index)
-       {
-               if(index >= stack.length)
-               {
-                       Object[] newStack = new Object[index * 2 + 1];
-                       System.arraycopy(stack,0,newStack,0,top);
-                       stack = newStack;
-               }
-       } //}}}
-
-       //{{{ ensurePush() method
-       public void ensurePush(int amount)
-       {
-               ensureCapacity(top + amount);
-       } //}}}
-
-       //{{{ get() method
-       public Object get(int index)
-       {
-               return stack[index];
-       } //}}}
-       
-       //{{{ set() method
-       public void set(Object value, int index)
-       {
-               ensureCapacity(index);
-               if(index >= top)
-               {
-                       for(int i = top; i < index; i++)
-                               stack[i] = null;
-                       top = index + 1;
-               }
-               stack[index] = value;
-       } //}}}
-       
-       //{{{ getCapacity() method
-       public int getCapacity()
-       {
-               return stack.length;
-       } //}}}
-       
        //{{{ toString() method
        /**
         * Returns elementsToString() enclosed with [ and ].
@@ -168,38 +79,22 @@ public class FactorArray implements FactorExternalizable, PublicCloneable
                StringBuffer buf = new StringBuffer("{ ");
                for(int i = 0; i < top; i++)
                {
-                       buf.append(FactorReader.unparseObject(stack[i]));
+                       buf.append(FactorReader.unparseObject(array[i]));
                        buf.append(' ');
                }
 
                return buf.append("}").toString();
        } //}}}
-       
-       //{{{ toList() method
-       public Cons toList()
-       {
-               Cons first = null, last = null;
-               for(int i = 0; i < top; i++)
-               {
-                       Cons cons = new Cons(stack[i],null);
-                       if(first == null)
-                               first = cons;
-                       else
-                               last.cdr = cons;
-                       last = cons;
-               }
-               return first;
-       } //}}}
 
        //{{{ clone() method
        public Object clone()
        {
-               if(stack == null)
+               if(array == null)
                        return new FactorArray();
                else
                {
-                       Object[] newArray = new Object[stack.length];
-                       System.arraycopy(stack,0,newArray,0,top);
+                       Object[] newArray = new Object[array.length];
+                       System.arraycopy(array,0,newArray,0,top);
                        return new FactorArray(newArray,top);
                }
        } //}}}
@@ -210,7 +105,7 @@ public class FactorArray implements FactorExternalizable, PublicCloneable
                int hashCode = 0;
                for(int i = 0; i < Math.min(top,4); i++)
                {
-                       Object obj = stack[i];
+                       Object obj = array[i];
                        if(obj != null)
                                hashCode ^= obj.hashCode();
                }
@@ -228,7 +123,7 @@ public class FactorArray implements FactorExternalizable, PublicCloneable
                                return false;
                        for(int i = 0; i < top; i++)
                        {
-                               if(!FactorLib.equal(stack[i],a.stack[i]))
+                               if(!FactorLib.equal(array[i],a.array[i]))
                                        return false;
                        }
                        
index d7cbfacfe0c7d080422305cdbc7cf86bfa52a781..70a77e8f5c1bc3bc9987ce2e18d836b55b8d5007 100644 (file)
@@ -47,19 +47,6 @@ public class FactorCompoundDefinition extends FactorWordDefinition
        public FactorCompoundDefinition(FactorWord word, Cons definition)
        {
                super(word);
-               fromList(definition);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               interp.call(endOfDocs);
-       } //}}}
-
-       //{{{ fromList() method
-       public void fromList(Cons definition)
-       {
                this.definition = definition;
                if(definition == null)
                        endOfDocs = null;
diff --git a/factor/FactorCompoundDefinition.java.new b/factor/FactorCompoundDefinition.java.new
deleted file mode 100644 (file)
index fe1ebe3..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
-* $Id$
-*
-* Copyright (C) 2003, 2004 Slava Pestov.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* 1. Redistributions of source code must retain the above copyright notice,
-*    this list of conditions and the following disclaimer.
-*
-* 2. Redistributions in binary form must reproduce the above copyright notice,
-*    this list of conditions and the following disclaimer in the documentation
-*    and/or other materials provided with the distribution.
-*
-* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-* DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-package factor;
-
-import factor.compiler.*;
-import factor.db.Workspace;
-import factor.db.PersistenceException;
-import java.lang.reflect.*;
-import java.io.FileOutputStream;
-import java.util.*;
-import org.objectweb.asm.*;
-
-/**
- * : name ... ;
- */
-public class FactorCompoundDefinition extends FactorWordDefinition
-{
-       private static int compileCount;
-
-       public Cons definition;
-       private Cons endOfDocs;
-
-       //{{{ FactorCompoundDefinition constructor
-       /**
-        * A new definition.
-        */
-       public FactorCompoundDefinition(FactorWord word, Cons definition,
-               FactorInterpreter interp) throws PersistenceException
-       {
-               super(word,interp.workspace);
-               fromList(definition,interp);
-
-               if(interp.workspace != null)
-                       interp.workspace.put(this);
-       } //}}}
-
-       //{{{ FactorCompoundDefinition constructor
-       /**
-        * A blank definition, about to be unpickled.
-        */
-       public FactorCompoundDefinition(Workspace workspace, long id)
-       {
-               super(workspace,id);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               interp.call(word,endOfDocs);
-       } //}}}
-
-       //{{{ getClassName() method
-       private static String getClassName(String name)
-       {
-               return FactorJava.getSanitizedName(name)
-                       + "_" + (compileCount++);
-       } //}}}
-
-       //{{{ compile() method
-       /**
-        * Compile the given word, returning a new word definition.
-        */
-       FactorWordDefinition compile(FactorInterpreter interp,
-               RecursiveState recursiveCheck) throws Exception
-       {
-               // Each word has its own class loader
-               FactorClassLoader loader = new FactorClassLoader(
-                       interp.workspace);
-
-               StackEffect effect = getStackEffect(interp,
-                       new RecursiveState());
-
-               if(effect.inR != 0 || effect.outR != 0)
-                       throw new FactorCompilerException("Compiled code cannot manipulate call stack frames");
-
-               String className = getClassName(word.name);
-
-               ClassWriter cw = new ClassWriter(true);
-               cw.visit(ACC_PUBLIC, className,
-                       "factor/compiler/CompiledDefinition",
-                       null, null);
-
-               compileConstructor(cw,className);
-
-               FactorCompiler compiler = compileEval(interp,cw,loader,
-                       className,effect,recursiveCheck);
-
-               // Generate auxiliary methods
-               compiler.generateAuxiliary(cw);
-
-               // Generate fields for storing literals and
-               // word references
-               compiler.generateFields(cw);
-
-               compileToList(interp,compiler,cw);
-
-               compileGetStackEffect(cw,effect);
-
-               // gets the bytecode of the class, and loads it
-               // dynamically
-               byte[] code = cw.toByteArray();
-
-               if(interp.dump)
-               {
-                       FileOutputStream fos = new FileOutputStream(
-                               className + ".class");
-                       try
-                       {
-                               fos.write(code);
-                       }
-                       finally
-                       {
-                               fos.close();
-                       }
-               }
-
-               String javaClassName = className.replace('/','.');
-               word.setCompiledInfo(compiler.loader,javaClassName);
-
-               Class compiledWordClass = loader.addClass(
-                       javaClassName,code,0,code.length);
-
-               return CompiledDefinition.create(interp,word,compiledWordClass);
-       } //}}}
-
-       //{{{ compileConstructor() method
-       private void compileConstructor(ClassVisitor cw, String className)
-       {
-               // creates a MethodWriter for the constructor
-               CodeVisitor mw = cw.visitMethod(ACC_PUBLIC,
-                       "<init>",
-                       "(Lfactor/FactorWord;)V",
-                       null, null);
-               // pushes the 'this' variable
-               mw.visitVarInsn(ALOAD, 0);
-               // pushes the word parameter
-               mw.visitVarInsn(ALOAD, 1);
-               // invokes the super class constructor
-               mw.visitMethodInsn(INVOKESPECIAL,
-                       "factor/compiler/CompiledDefinition", "<init>",
-                       "(Lfactor/FactorWord;)V");
-               mw.visitInsn(RETURN);
-               mw.visitMaxs(0,0);
-       } //}}}
-
-       //{{{ compileToList() method
-       private void compileToList(FactorInterpreter interp,
-               FactorCompiler compiler, ClassVisitor cw)
-       {
-               // creates a MethodWriter for the toList() method
-               CodeVisitor mw = cw.visitMethod(ACC_PUBLIC,
-                       "toList",
-                       "(Lfactor/FactorInterpreter;)Lfactor/Cons;",
-                       null, null);
-               // push unparsed string representation of this word and parse it
-               compiler.generateParse(mw,toList(interp),1);
-               mw.visitTypeInsn(CHECKCAST,"factor/Cons");
-               mw.visitInsn(ARETURN);
-               mw.visitMaxs(0,0);
-       } //}}}
-
-       //{{{ compileGetStackEffect() method
-       private void compileGetStackEffect(ClassVisitor cw, StackEffect effect)
-       {
-               // creates a MethodWriter for the getStackEffect() method
-               CodeVisitor mw = cw.visitMethod(ACC_PUBLIC,
-                       "getStackEffect",
-                       "(Lfactor/compiler/RecursiveState;"
-                       + "Lfactor/compiler/FactorCompiler;)V",
-                       null, null);
-
-               mw.visitVarInsn(ALOAD,2);
-               mw.visitTypeInsn(NEW,"factor/compiler/StackEffect");
-               mw.visitInsn(DUP);
-               mw.visitLdcInsn(new Integer(effect.inD));
-               mw.visitLdcInsn(new Integer(effect.outD));
-               mw.visitLdcInsn(new Integer(effect.inR));
-               mw.visitLdcInsn(new Integer(effect.outR));
-               mw.visitMethodInsn(INVOKESPECIAL,"factor/compiler/StackEffect",
-                       "<init>","(IIII)V");
-               mw.visitMethodInsn(INVOKEVIRTUAL,"factor/compiler/FactorCompiler",
-                       "apply","(Lfactor/compiler/StackEffect;)V");
-               mw.visitInsn(RETURN);
-               mw.visitMaxs(0,0);
-       } //}}}
-
-       //{{{ compileEval() method
-       /**
-        * Write the definition of the eval() method in the compiled word.
-        * Local 0 -- this
-        * Local 1 -- interpreter
-        */
-       protected FactorCompiler compileEval(FactorInterpreter interp,
-               ClassWriter cw, FactorClassLoader loader,
-               String className, StackEffect effect,
-               RecursiveState recursiveCheck)
-               throws Exception
-       {
-               cw.visitField(ACC_PRIVATE | ACC_STATIC, "initialized", "Z",
-                       null, null);
-
-               // creates a MethodWriter for the 'eval' method
-               CodeVisitor mw = cw.visitMethod(ACC_PUBLIC,
-                       "eval", "(Lfactor/FactorInterpreter;)V",
-                       null, null);
-
-               // eval() method calls core
-               mw.visitVarInsn(ALOAD,1);
-
-               compileDataStackToJVMStack(effect,mw);
-
-               mw.visitMethodInsn(INVOKESTATIC,className,"core",
-                       effect.getCorePrototype());
-
-               compileJVMStackToDataStack(effect,mw);
-
-               mw.visitInsn(RETURN);
-               mw.visitMaxs(0,0);
-
-               // generate core
-               FactorCompiler compiler = new FactorCompiler(interp,word,
-                       className,loader);
-               compiler.init(1,effect.inD,effect.inR,"core");
-               compiler.compileCore(endOfDocs,cw,effect,recursiveCheck);
-
-               return compiler;
-       } //}}}
-
-       //{{{ compileDataStackToJVMStack() method
-       private void compileDataStackToJVMStack(StackEffect effect,
-               CodeVisitor mw)
-       {
-               if(effect.inD != 0)
-               {
-                       mw.visitVarInsn(ALOAD,1);
-                       mw.visitFieldInsn(GETFIELD,
-                               "factor/FactorInterpreter", "datastack",
-                               "Lfactor/FactorArrayStack;");
-
-                       // ensure the stack has enough elements
-                       mw.visitInsn(DUP);
-                       mw.visitIntInsn(BIPUSH,effect.inD);
-                       mw.visitMethodInsn(INVOKEVIRTUAL,
-                               "factor/FactorArrayStack", "ensurePop",
-                               "(I)V");
-
-                       // datastack.stack -> 2
-                       mw.visitInsn(DUP);
-                       mw.visitFieldInsn(GETFIELD,
-                               "factor/FactorArrayStack", "stack",
-                               "[Ljava/lang/Object;");
-                       mw.visitVarInsn(ASTORE,2);
-                       // datastack.top-args.length -> 3
-                       mw.visitInsn(DUP);
-                       mw.visitFieldInsn(GETFIELD,
-                               "factor/FactorArrayStack", "top",
-                               "I");
-                       mw.visitIntInsn(BIPUSH,effect.inD);
-                       mw.visitInsn(ISUB);
-
-                       // datastack.top -= args.length
-                       mw.visitInsn(DUP_X1);
-                       mw.visitFieldInsn(PUTFIELD,
-                               "factor/FactorArrayStack", "top",
-                               "I");
-
-                       mw.visitVarInsn(ISTORE,3);
-
-                       for(int i = 0; i < effect.inD; i++)
-                       {
-                               mw.visitVarInsn(ALOAD,2);
-                               mw.visitVarInsn(ILOAD,3);
-                               mw.visitInsn(AALOAD);
-                               if(i != effect.inD - 1)
-                                       mw.visitIincInsn(3,1);
-                       }
-               }
-       } //}}}
-
-       //{{{ compileJVMStackToDataStack() method
-       private void compileJVMStackToDataStack(StackEffect effect,
-               CodeVisitor mw)
-       {
-               if(effect.outD == 1)
-               {
-                       // ( datastack )
-                       mw.visitVarInsn(ALOAD,1);
-                       mw.visitFieldInsn(GETFIELD,
-                               "factor/FactorInterpreter", "datastack",
-                               "Lfactor/FactorArrayStack;");
-
-                       mw.visitInsn(SWAP);
-                       mw.visitMethodInsn(INVOKEVIRTUAL,
-                               "factor/FactorArrayStack", "push",
-                               "(Ljava/lang/Object;)V");
-               }
-       } //}}}
-
-       //{{{ fromList() method
-       public void fromList(Cons definition, FactorInterpreter interp)
-       {
-               this.definition = definition;
-               if(definition == null)
-                       endOfDocs = null;
-               else
-               {
-                       endOfDocs = definition;
-                       while(endOfDocs != null
-                               && endOfDocs.car instanceof FactorDocComment)
-                               endOfDocs = endOfDocs.next();
-               }
-       } //}}}
-
-       //{{{ toList() method
-       public Cons toList(FactorInterpreter interp)
-       {
-               return definition;
-       } //}}}
-}
diff --git a/factor/FactorDomainException.java b/factor/FactorDomainException.java
deleted file mode 100644 (file)
index df3f432..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor;
-
-public class FactorDomainException extends FactorRuntimeException
-{
-       public FactorDomainException(Object arg, Class clas)
-       {
-               super("Cannot turn " + arg + " into " + clas);
-       }
-}
diff --git a/factor/FactorInterpreter.java b/factor/FactorInterpreter.java
deleted file mode 100644 (file)
index 5afab63..0000000
+++ /dev/null
@@ -1,615 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor;
-
-import factor.parser.*;
-import factor.primitives.*;
-import java.io.*;
-
-public class FactorInterpreter implements FactorObject, Runnable
-{
-       public static final String VERSION = "0.69";
-
-       public static final Cons DEFAULT_USE = new Cons("builtins",
-               new Cons("syntax",new Cons("scratchpad",null)));
-       public static final String DEFAULT_IN = "scratchpad";
-
-       // command line arguments are stored here.
-       public Cons args;
-
-       // boot.factor sets these.
-       public boolean interactive = true;
-       public Throwable error;
-       public boolean dump = false;
-       public boolean verboseCompile = false;
-       public boolean mini = false;
-       // if this is false and an error occurs, bail out.
-       public boolean startupDone = false;
-
-       public Cons callframe;
-       public FactorArray callstack = new FactorArray();
-       public FactorArray datastack = new FactorArray();
-       public FactorArray namestack = new FactorArray();
-       public FactorArray catchstack = new FactorArray();
-
-       /**
-        * Maps vocabulary names to vocabularies.
-        */
-       public FactorNamespace vocabularies;
-
-       /**
-        * Vocabulary search path for interactive parser.
-        */
-       public Cons use = DEFAULT_USE;
-
-       /**
-        * Vocabulary to define new words in.
-        */
-       public String in = DEFAULT_IN;
-
-       /**
-        * Most recently defined word.
-        */
-       public FactorWord last;
-
-       public FactorNamespace global = new FactorNamespace();
-
-       private FactorNamespace interpNamespace;
-
-       private Cons compiledExceptions;
-
-       //{{{ main() method
-       public static void main(String[] args) throws Exception
-       {
-               FactorInterpreter interp = new FactorInterpreter();
-               interp.init(args);
-               interp.run();
-       } //}}}
-
-       //{{{ init() method
-       public void init(FactorInterpreter interp) throws Exception
-       {
-               this.args = interp.args;
-               this.interactive = interp.interactive;
-               this.dump = interp.dump;
-               this.verboseCompile = interp.verboseCompile;
-               this.callframe = interp.callframe;
-               this.callstack = (FactorArray)interp.callstack.clone();
-               this.datastack = (FactorArray)interp.datastack.clone();
-               this.namestack = (FactorArray)interp.namestack.clone();
-               this.catchstack = (FactorArray)interp.catchstack.clone();
-               this.vocabularies = interp.vocabularies;
-               this.use = interp.use;
-               this.in = interp.in;
-               this.last = interp.last;
-               this.global = interp.global;
-               this.startupDone = true;
-       } //}}}
-
-       //{{{ init() method
-       public void init(String[] args) throws Exception
-       {
-               for(int i = 0; i < args.length; i++)
-               {
-                       String arg = args[i];
-                       // this switch forces minimal libraries to be loaded
-                       if(arg.equals("-no-mini"))
-                       {
-                               mini = false;
-                               args[i] = null;
-                       }
-                       else if(arg.equals("-mini"))
-                       {
-                               mini = true;
-                               args[i] = null;
-                       }
-               }
-
-               this.args = Cons.fromArray(args);
-
-               vocabularies = new FactorNamespace();
-               initBuiltinDictionary();
-               initNamespace();
-               topLevel();
-
-               runBootstrap();
-       } //}}}
-
-       //{{{ initBuiltinDictionary() method
-       private void initBuiltinDictionary() throws Exception
-       {
-               vocabularies.setVariable("builtins",new FactorNamespace());
-               vocabularies.setVariable("combinators",new FactorNamespace());
-               vocabularies.setVariable("syntax",new FactorNamespace());
-
-               /* comments */
-               FactorWord lineComment = define("syntax","!");
-               lineComment.parsing = new LineComment(lineComment,false);
-               FactorWord stackComment = define("syntax","(");
-               stackComment.parsing = new StackComment(stackComment);
-               FactorWord docComment = define("syntax","#!");
-               docComment.parsing = new LineComment(docComment,true);
-
-               /* strings */
-               FactorWord str = define("syntax","\"");
-               str.parsing = new StringLiteral(str,true);
-               FactorWord ch = define("syntax","CHAR:");
-               ch.parsing = new CharLiteral(ch);
-
-               /* constants */
-               FactorWord t = define("syntax","t");
-               t.parsing = new T(t);
-               FactorWord f = define("syntax","f");
-               f.parsing = new F(f);
-               FactorWord complex = define("syntax","#{");
-               complex.parsing = new ComplexLiteral(complex,"}");
-
-               /* lists */
-               FactorWord bra = define("syntax","[");
-               bra.parsing = new Bra(bra);
-               FactorWord ket = define("syntax","]");
-               ket.parsing = new Ket(bra,ket);
-               FactorWord bar = define("syntax","|");
-               bar.parsing = new Bar(bar);
-
-               /* vectors */
-               FactorWord beginVector = define("syntax","{");
-               beginVector.parsing = new BeginVector(beginVector);
-               FactorWord endVector = define("syntax","}");
-               endVector.parsing = new EndVector(beginVector,endVector);
-
-               /* word defs */
-               FactorWord def = define("syntax",":");
-               def.parsing = new Def(def);
-               def.getNamespace().setVariable("doc-comments",Boolean.TRUE);
-               FactorWord ine = define("syntax",";");
-               ine.parsing = new Ine(def,ine);
-               FactorWord shuffle = define("syntax","~<<");
-               shuffle.parsing = new Shuffle(shuffle,">>~");
-               FactorWord symbol = define("syntax","SYMBOL:");
-               symbol.parsing = new Symbol(symbol);
-
-               /* reading numbers with another base */
-               FactorWord bin = define("syntax","BIN:");
-               bin.parsing = new Base(bin,2);
-               FactorWord oct = define("syntax","OCT:");
-               oct.parsing = new Base(oct,8);
-               FactorWord hex = define("syntax","HEX:");
-               hex.parsing = new Base(hex,16);
-
-               /* vocabulary parsing words */
-               FactorWord noParsing = define("syntax","POSTPONE:");
-               noParsing.parsing = new NoParsing(noParsing);
-               FactorWord defer = define("syntax","DEFER:");
-               defer.parsing = new Defer(defer);
-               FactorWord in = define("syntax","IN:");
-               in.parsing = new In(in);
-               FactorWord use = define("syntax","USE:");
-               use.parsing = new Use(use);
-
-               FactorWord pushWord = define("syntax","\\");
-               pushWord.parsing = new PushWord(pushWord);
-
-               FactorWord interpreterGet = define("builtins","interpreter");
-               interpreterGet.def = new InterpreterGet(interpreterGet);
-               interpreterGet.inline = true;
-
-               // primitives used by 'expand' and 'map'
-               FactorWord restack = define("builtins","restack");
-               restack.def = new Restack(restack);
-               FactorWord unstack = define("builtins","unstack");
-               unstack.def = new Unstack(unstack);
-
-               // reflection primitives
-               FactorWord jinvoke = define("builtins","jinvoke");
-               jinvoke.def = new JInvoke(jinvoke,false);
-               jinvoke.inline = true;
-               FactorWord jinvokeStatic = define("builtins","jinvoke-static");
-               jinvokeStatic.def = new JInvoke(jinvokeStatic,true);
-               jinvokeStatic.inline = true;
-               FactorWord jnew = define("builtins","jnew");
-               jnew.def = new JNew(jnew);
-               jnew.inline = true;
-               FactorWord jvarGet = define("builtins","jvar-get");
-               jvarGet.def = new JVarGet(jvarGet);
-               jvarGet.inline = true;
-               FactorWord jvarGetStatic = define("builtins","jvar-static-get");
-               jvarGetStatic.def = new JVarGetStatic(jvarGetStatic);
-               jvarGetStatic.inline = true;
-               FactorWord jvarSet = define("builtins","jvar-set");
-               jvarSet.def = new JVarSet(jvarSet);
-               jvarSet.inline = true;
-               FactorWord jvarSetStatic = define("builtins","jvar-static-set");
-               jvarSetStatic.def = new JVarSetStatic(jvarSetStatic);
-               jvarSetStatic.inline = true;
-               FactorWord coerce = define("builtins","coerce");
-               coerce.def = new Coerce(coerce);
-               coerce.inline = true;
-
-               // definition
-               FactorWord define = define("builtins","define");
-               define.def = new Define(define);
-
-               // combinators
-               FactorWord execute = define("words","execute");
-               execute.def = new Execute(execute);
-               FactorWord call = define("combinators","call");
-               call.def = new Call(call);
-               call.inline = true;
-               FactorWord ifte = define("combinators","ifte");
-               ifte.def = new Ifte(ifte);
-               ifte.inline = true;
-       } //}}}
-
-       //{{{ initNamespace() method
-       private void initNamespace() throws Exception
-       {
-               global.setVariable("interpreter",this);
-
-               global.setVariable("verbose-compile",
-                       new FactorNamespace.VarBinding(
-                               getClass().getField("verboseCompile"),
-                               this));
-
-               global.setVariable("startup-done",
-                       new FactorNamespace.VarBinding(
-                               getClass().getField("startupDone"),
-                               this));
-
-               String[] boundFields = {
-                       "global",
-                       "vocabularies",
-                       "args",
-                       "dump",
-                       "interactive",
-                       "in",
-                       "last",
-                       "use"
-               };
-
-               for(int i = 0; i < boundFields.length; i++)
-               {
-                       String name = boundFields[i];
-                       global.setVariable(name,
-                               new FactorNamespace.VarBinding(
-                                       getClass().getField(name),
-                                       this));
-               }
-       } //}}}
-
-       //{{{ getNamespace() method
-       public FactorNamespace getNamespace()
-               throws Exception
-       {
-               if(interpNamespace == null)
-                       interpNamespace = new FactorNamespace(this);
-
-               return interpNamespace;
-       } //}}}
-
-       //{{{ runBootstrap() method
-       private void runBootstrap() throws Exception
-       {
-               String initFile = "/library/platform/jvm/boot.factor";
-               FactorReader parser = new FactorReader(
-                       initFile,
-                       new BufferedReader(
-                       new InputStreamReader(
-                       getClass().getResourceAsStream(
-                       initFile))),
-                       this);
-                
-               call(parser.parse());
-
-               run();
-       } //}}}
-
-       //{{{ run() method
-       /**
-        * Runs the top-level loop until there is no more code to execute.
-        */
-       public void run()
-       {
-               for(;;)
-               {
-                       try
-                       {
-                               if(callframe == null)
-                               {
-                                       if(callstack.top == 0)
-                                               break;
-
-                                       callframe = (Cons)callstack.pop();
-                                       continue;
-                               }
-
-                               Object eval = callframe.car;
-                               callframe = callframe.next();
-                               eval(eval);
-                       }
-                       catch(Throwable e)
-                       {
-                               if(handleError(e))
-                                       return;
-                       }
-               }
-
-               callframe = null;
-       } //}}}
-
-       //{{{ handleError() method
-       private boolean handleError(Throwable e)
-       {
-               error = FactorJava.unwrapException(e);
-               if(!startupDone)
-               {
-                       error.printStackTrace();
-                       topLevel();
-                       return true;
-               }
-               
-               datastack.push(error);
-               try
-               {
-                       FactorWord throwWord = searchVocabulary(
-                               "errors","throw");
-                       if(throwWord == null)
-                               throw new NullPointerException();
-                       eval(throwWord);
-                       return false;
-               }
-               catch(Throwable e2)
-               {
-                       System.err.println("Exception when calling throw:");
-                       e.printStackTrace();
-                       topLevel();
-
-                       return true;
-               }
-       } //}}}
-
-       //{{{ createCompiledCallframe() method
-       private Cons createCompiledCallframe(FactorWord word)
-       {
-               return new Cons(new FactorWord(null,"#<compiled>"),word);
-       } //}}}
-
-       //{{{ compiledException() method
-       /**
-        * Called by compiled words to give the user a meaningful call stack
-        * trace in the case of an exception.
-        */
-       public void compiledException(FactorWord word, Throwable t)
-       {
-               compiledExceptions = new Cons(createCompiledCallframe(word),
-                       this.compiledExceptions);
-       } //}}}
-
-       //{{{ call() method
-       /**
-        * Pushes the given list of code onto the callstack.
-        */
-       public void call(Cons code)
-       {
-               // tail call optimization
-               if(callframe != null)
-                       callstack.push(callframe);
-
-               callframe = code;
-       } //}}}
-
-       //{{{ eval() method
-       /**
-        * Evaluates a word.
-        */
-       public void eval(Object obj) throws Exception
-       {
-               if(obj instanceof FactorWord)
-               {
-                       try
-                       {
-                               FactorWordDefinition d = ((FactorWord)obj).def;
-                               if(d == null)
-                               {
-                                       throw new FactorUndefinedWordException(
-                                               ((FactorWord)obj).name);
-                               }
-                               else
-                                       d.eval(this);
-                       }
-                       catch(Exception e)
-                       {
-                               callstack.push(callframe);
-                               /* callframe = createCompiledCallframe(
-                                       (FactorWord)obj); */
-                               while(compiledExceptions != null)
-                               {
-                                       callstack.push(compiledExceptions.car);
-                                       compiledExceptions = compiledExceptions
-                                               .next();
-                               }
-                               throw e;
-                       }
-               }
-               else
-                       datastack.push(obj);
-       } //}}}
-
-       //{{{ getVariable() method
-       /**
-        * Return the value of a variable, by searching the namestack
-        * in order.
-        */
-       public Object getVariable(String name) throws Exception
-       {
-               for(int i = namestack.top - 1; i >= 0; i--)
-               {
-                       FactorNamespace namespace = FactorJava.toNamespace(
-                               namestack.stack[i]);
-                       if(namespace.isDefined(name))
-                               return namespace.getVariable(name);
-               }
-
-               return null;
-       } //}}}
-
-       //{{{ isUninterned() method
-       /**
-        * Words whose name begin with #: but are not #: themselves are not
-        * in any vocabulary.
-        */
-       public static boolean isUninterned(String name)
-       {
-               return (name.startsWith("#:") && name.length() > 2);
-       } //}}}
-
-       //{{{ getVocabulary() method
-       public FactorNamespace getVocabulary(String name)
-       {
-               Object value = vocabularies.getVariable(name);
-               if(value instanceof FactorNamespace)
-                       return (FactorNamespace)value;
-               else
-                       return null;
-       } //}}}
-
-       //{{{ defineVocabulary() method
-       public void defineVocabulary(String name)
-       {
-               Object value = vocabularies.getVariable(name);
-               if(value == null)
-               {
-                       value = new FactorNamespace();
-                       vocabularies.setVariable(name,value);
-               }
-       } //}}}
-
-       //{{{ searchVocabulary() method
-       /**
-        * Search in the given vocabulary for the given word.
-        */
-       public FactorWord searchVocabulary(String vname, String name)
-       {
-               if(isUninterned(name))
-                       return new FactorWord(null,name);
-
-               try
-               {
-                       FactorNamespace v = getVocabulary(vname);
-                       if(v != null)
-                       {
-                               Object word = v.getVariable(name);
-                               if(word instanceof FactorWord)
-                                       return (FactorWord)word;
-                               else
-                                       return null;
-                       }
-                       else
-                               return null;
-               }
-               catch(Exception e)
-               {
-                       // should not happen!
-                       throw new RuntimeException(e);
-               }
-       } //}}}
-
-       //{{{ searchVocabulary() method
-       /**
-        * Search through the given vocabulary list for the given word.
-        */
-       public FactorWord searchVocabulary(Cons vocabulary, String name)
-       {
-               if(isUninterned(name))
-                       return new FactorWord(null,name);
-
-               while(vocabulary != null)
-               {
-                       FactorWord word = searchVocabulary(
-                               (String)vocabulary.car,name);
-                       if(word != null)
-                               return word;
-
-                       vocabulary = vocabulary.next();
-               }
-
-               return null;
-       } //}}}
-
-       //{{{ define() method
-       /**
-        * Define a word in the given vocabulary if it doesn't exist already.
-        */
-       public FactorWord define(String vocabulary, String name)
-       {
-               if(isUninterned(name))
-                       return new FactorWord(null,name);
-
-               FactorNamespace v = getVocabulary(vocabulary);
-               if(v == null)
-               {
-                       v = new FactorNamespace();
-                       vocabularies.setVariable(vocabulary,v);
-               }
-               Object value = v.getVariable(name);
-               if(value instanceof FactorWord)
-                       return (FactorWord)value;
-               else
-               {
-                       // save to same workspace as vocabulary,
-                       // or no workspace if vocabulary is builtins
-                       FactorWord word = new FactorWord(
-                               vocabulary,name,null);
-                       v.setVariable(name,word);
-                       return word;
-               }
-       } //}}}
-
-       //{{{ topLevel() method
-       /**
-        * Returns the parser to the top level context.
-        */
-       public void topLevel()
-       {
-               callstack.top = 0;
-               datastack.top = 0;
-               namestack.top = 0;
-               namestack.push(global);
-               catchstack.top = 0;
-               // DEFER: the word
-               define("kernel","toplevel");
-               define("errors","default-error-handler");
-               catchstack.push(new Cons(searchVocabulary("errors",
-                       "default-error-handler"),
-                       new Cons(searchVocabulary("kernel","toplevel"),
-                       null)));
-               callframe = null;
-       } //}}}
-}
diff --git a/factor/FactorJava.java b/factor/FactorJava.java
deleted file mode 100644 (file)
index b65a262..0000000
+++ /dev/null
@@ -1,637 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor;
-
-import factor.math.*;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.*;
-import java.math.BigInteger;
-
-/**
- * A few methods for converting between Java types at runtime.
- * Note that the compiler incorporates calls to some of these methods in
- * generated bytecode.
- */
-public class FactorJava
-{
-       public static final Class[] EMPTY_ARRAY = new Class[0];
-
-       //{{{ getSanitizedName() method
-       public static String getSanitizedName(String name)
-       {
-               StringBuffer sanitizedName = new StringBuffer();
-               for(int i = 0; i < name.length(); i++)
-               {
-                       char ch = name.charAt(i);
-                       if(!Character.isJavaIdentifierStart(ch))
-                               sanitizedName.append("_");
-                       else
-                               sanitizedName.append(ch);
-               }
-               return sanitizedName.toString();
-       } //}}}
-
-       //{{{ classNameToClassList() method
-       public static Class[] classNameToClassList(Cons classes)
-               throws Exception
-       {
-               if(classes == null)
-                       return EMPTY_ARRAY;
-
-               Class[] _classes = new Class[classes.length()];
-               int i = 0;
-               while(classes != null)
-               {
-                       _classes[i] = toClass(classes.car);
-                       i++;
-                       classes = classes.next();
-               }
-
-               return _classes;
-       } //}}}
-
-       //{{{ toNumber() method
-       public static Number toNumber(Object arg)
-               throws FactorDomainException
-       {
-               if(arg instanceof Number)
-                       return (Number)arg;
-               else if(arg instanceof Character)
-                       return new Integer((int)((Character)arg).charValue());
-               else if(arg instanceof String)
-               {
-                       Number num = NumberParser.parseNumber((String)arg,10);
-                       if(num != null)
-                               return num;
-               }
-
-               throw new FactorDomainException(arg,Number.class);
-       } //}}}
-
-       //{{{ toString() method
-       public static String toString(Object arg)
-       {
-               if(arg == null)
-                       return null;
-               else if(arg instanceof String)
-                       return (String)arg;
-               else
-                       return String.valueOf(arg);
-       } //}}}
-
-       //{{{ toCharSequence() method
-       public static CharSequence toCharSequence(Object arg)
-       {
-               if(arg instanceof CharSequence)
-                       return ((CharSequence)arg);
-               else
-                       return toString(arg);
-       } //}}}
-       
-       //{{{ toBoolean() method
-       public static boolean toBoolean(Object arg)
-       {
-               if(Boolean.FALSE.equals(arg) || arg == null)
-                       return false;
-               else
-                       return true;
-       } //}}}
-
-       //{{{ toByte() method
-       public static byte toByte(Object arg)
-               throws FactorDomainException
-       {
-               if(arg instanceof Number && !(arg instanceof Complex))
-                       return ((Number)arg).byteValue();
-               else if(arg instanceof Character)
-                       return (byte)(((Character)arg).charValue());
-               else if(arg instanceof String)
-                       return Byte.parseByte((String)arg);
-               else
-                       throw new FactorDomainException(arg,byte.class);
-       } //}}}
-
-       //{{{ toShort() method
-       public static short toShort(Object arg)
-               throws FactorDomainException
-       {
-               if(arg instanceof Number && !(arg instanceof Complex))
-                       return ((Number)arg).shortValue();
-               else if(arg instanceof Character)
-                       return (short)(((Character)arg).charValue());
-               else if(arg instanceof String)
-                       return Short.parseShort((String)arg);
-               else
-                       throw new FactorDomainException(arg,short.class);
-       } //}}}
-
-       //{{{ toChar() method
-       public static char toChar(Object arg)
-               throws FactorDomainException
-       {
-               if(arg instanceof Character)
-                       return ((Character)arg).charValue();
-               else if(arg == null)
-                       return '\0';
-               else if(arg instanceof String)
-               {
-                       String s = (String)arg;
-                       if(s.length() != 1)
-                               throw new FactorDomainException(arg,char.class);
-                       return s.charAt(0);
-               }
-               else if(arg instanceof Number)
-               {
-                       return (char)((Number)arg).intValue();
-               }
-               else
-                       throw new FactorDomainException(arg,char.class);
-       } //}}}
-
-       //{{{ toInt() method
-       public static int toInt(Object arg)
-               throws FactorDomainException
-       {
-               if(arg instanceof Number && !(arg instanceof Complex))
-                       return ((Number)arg).intValue();
-               else if(arg instanceof Character)
-                       return (int)(((Character)arg).charValue());
-               else if(arg instanceof String)
-                       return Integer.parseInt((String)arg);
-               else
-                       throw new FactorDomainException(arg,int.class);
-       } //}}}
-
-       //{{{ toLong() method
-       public static long toLong(Object arg)
-               throws FactorDomainException
-       {
-               if(arg instanceof Number && !(arg instanceof Complex))
-                       return ((Number)arg).longValue();
-               else if(arg instanceof Character)
-                       return (long)(((Character)arg).charValue());
-               else if(arg instanceof String)
-                       return Long.parseLong((String)arg);
-               else
-                       throw new FactorDomainException(arg,long.class);
-       } //}}}
-
-       //{{{ toFloat() method
-       public static float toFloat(Object arg)
-               throws FactorDomainException
-       {
-               if(arg instanceof Number && !(arg instanceof Complex))
-                       return ((Number)arg).floatValue();
-               else if(arg instanceof Character)
-                       return (float)(((Character)arg).charValue());
-               else if(arg instanceof String)
-                       return Float.parseFloat((String)arg);
-               else
-                       throw new FactorDomainException(arg,float.class);
-       } //}}}
-
-       //{{{ toDouble() method
-       public static double toDouble(Object arg)
-               throws FactorDomainException
-       {
-               if(arg instanceof Number && !(arg instanceof Complex))
-                       return ((Number)arg).doubleValue();
-               else if(arg instanceof Character)
-                       return (double)(((Character)arg).charValue());
-               else if(arg instanceof String)
-                       return Double.parseDouble((String)arg);
-               else
-                       throw new FactorDomainException(arg,double.class);
-       } //}}}
-
-       //{{{ toBigInteger() method
-       public static BigInteger toBigInteger(Object arg)
-               throws FactorDomainException
-       {
-               if(arg instanceof BigInteger)
-                       return (BigInteger)arg;
-               else if(arg instanceof Character)
-               {
-                       return BigInteger.valueOf(
-                               (long)(((Character)arg).charValue()));
-               }
-               else if(arg instanceof Number)
-                       return BigInteger.valueOf(((Number)arg).longValue());
-               else
-                       throw new FactorDomainException(arg,BigInteger.class);
-       } //}}}
-
-       //{{{ toClass() method
-       public static Class toClass(Object arg)
-               throws Exception
-       {
-               if(arg instanceof Class)
-                       return (Class)arg;
-               else if(arg instanceof Cons)
-               {
-                       Cons classSpec = (Cons)arg;
-                       if(classSpec.cdr != null)
-                       {
-                               throw new FactorException(
-                                       "Bad class spec: " + classSpec);
-                       }
-                       Class clazz = toClass(classSpec.car);
-                       if(clazz.isPrimitive())
-                       {
-                               return getClass("[" + javaClassToVMClass(clazz));
-                       }
-                       else
-                       {
-                               return getClass("[L" + clazz.getName() + ";");
-                       }
-               }
-               else
-               {
-                       return getClass((String)
-                               convertToJavaType(arg,String.class));
-               }
-       } //}}}
-
-       //{{{ toNamespace() method
-       public static FactorNamespace toNamespace(Object obj) throws Exception
-       {
-               if(obj instanceof FactorNamespace)
-                       return (FactorNamespace)obj;
-               else if(obj instanceof FactorObject)
-               {
-                       FactorNamespace ns = ((FactorObject)obj)
-                               .getNamespace();
-                       if(ns == null)
-                               throw new FactorRuntimeException(
-                                       obj + " has a null"
-                                       + " namespace");
-                       return ns;
-               }
-               else
-               {
-                       throw new FactorDomainException(obj,
-                               FactorObject.class);
-               }
-       } //}}}
-
-       //{{{ toBooleanArray() method
-       public static boolean[] toBooleanArray(Object arg)
-               throws FactorDomainException
-       {
-               if(arg == null)
-                       return new boolean[0];
-               else if(arg instanceof Cons)
-                       arg = toArray(arg,Object[].class);
-
-               try
-               {
-                       boolean[] returnValue = new boolean[
-                               Array.getLength(arg)];
-                       for(int i = 0; i < returnValue.length; i++)
-                       {
-                               returnValue[i] = toBoolean(
-                                       Array.get(arg,i));
-                       }
-                       return returnValue;
-               }
-               catch(IllegalArgumentException e)
-               {
-                       throw new FactorDomainException(arg,boolean[].class);
-               }
-       } //}}}
-
-       //{{{ toByteArray() method
-       public static byte[] toByteArray(Object arg)
-               throws FactorDomainException
-       {
-               if(arg == null)
-                       return new byte[0];
-               else if(arg instanceof Cons)
-                       arg = toArray(arg,Object[].class);
-               if(arg.getClass().isArray())
-               {
-                       try
-                       {
-                               byte[] returnValue = new byte[
-                                       Array.getLength(arg)];
-                               for(int i = 0; i < returnValue.length; i++)
-                               {
-                                       returnValue[i] = toByte(
-                                               Array.get(arg,i));
-                               }
-                               return returnValue;
-                       }
-                       catch(IllegalArgumentException e)
-                       {
-                               throw new FactorDomainException(arg,byte[].class);
-                       }
-               }
-               else
-               {
-                       try
-                       {
-                               return String.valueOf(arg).getBytes("UTF8");
-                       }
-                       catch(UnsupportedEncodingException e)
-                       {
-                               throw new RuntimeException(e);
-                       }
-               }
-       } //}}}
-
-       //{{{ toArray() method
-       public static Object[] toArray(Object arg)
-               throws FactorDomainException
-       {
-               return toArray(arg,Object[].class);
-       } //}}}
-
-       //{{{ toArray() method
-       public static Object[] toArray(Object arg, Class clas)
-               throws FactorDomainException
-       {
-               if(arg == null)
-               {
-                       return (Object[])Array.newInstance(
-                               clas.getComponentType(),0);
-               }
-               else if(arg instanceof Cons)
-               {
-                       Cons list = (Cons)arg;
-                       Object[] array = (Object[])
-                               Array.newInstance(
-                               clas.getComponentType(),
-                               list.length());
-                       list.toArray(array);
-                       return array;
-               }
-               else if(arg.getClass().isArray())
-               {
-                       if(arg.getClass() == clas)
-                               return (Object[])arg;
-                       else
-                       {
-                               Object[] _arg = (Object[])arg;
-                               Object[] array = (Object[])
-                                       Array.newInstance(
-                                       clas.getComponentType(),
-                                       _arg.length);
-                               System.arraycopy(arg,0,array,0,
-                                       _arg.length);
-                               return array;
-                       }
-               }
-               else
-                       throw new FactorDomainException(arg,Object[].class);
-       } //}}}
-
-       //{{{ convertToJavaType() method
-       public static Object convertToJavaType(Object arg, Class clas)
-               throws Exception
-       {
-               if(clas.isPrimitive())
-                       clas = getBoxingType(clas);
-
-               if(clas == Object.class)
-                       return arg;
-               else if(clas == Number.class)
-               {
-                       return toNumber(arg);
-               }
-               else if(clas == String.class)
-               {
-                       return toString(arg);
-               }
-               else if(clas == CharSequence.class)
-               {
-                       return toCharSequence(arg);
-               }
-               else if(clas == Boolean.class)
-               {
-                       if(arg instanceof Boolean)
-                               return arg;
-                       else
-                               return Boolean.valueOf(toBoolean(arg));
-               }
-               else if(clas == Byte.class)
-               {
-                       if(arg instanceof Byte)
-                               return arg;
-                       else
-                               return new Byte(toByte(arg));
-               }
-               else if(clas == Character.class)
-               {
-                       if(arg instanceof Character)
-                               return arg;
-                       return new Character(toChar(arg));
-               }
-               else if(clas == Integer.class)
-               {
-                       if(arg instanceof Integer)
-                               return arg;
-                       else
-                               return new Integer(toInt(arg));
-               }
-               else if(clas == Long.class)
-               {
-                       if(arg instanceof Long)
-                               return arg;
-                       else
-                               return new Long(toLong(arg));
-               }
-               else if(clas == Float.class)
-               {
-                       if(arg instanceof Float)
-                               return arg;
-                       else
-                               return new Float(toFloat(arg));
-               }
-               else if(clas == Double.class)
-               {
-                       if(arg instanceof Double)
-                               return arg;
-                       else
-                               return new Double(toDouble(arg));
-               }
-               else if(clas == BigInteger.class)
-               {
-                       if(arg instanceof BigInteger)
-                               return arg;
-                       else
-                               return toBigInteger(arg);
-               }
-               else if(clas == FactorNamespace.class)
-               {
-                       if(arg instanceof FactorNamespace)
-                               return arg;
-                       else
-                               return toNamespace(arg);
-               }
-               else if(clas == Class.class)
-               {
-                       return toClass(arg);
-               }
-               else if(clas.isArray())
-               {
-                       Class comp = clas.getComponentType();
-                       if(!comp.isPrimitive())
-                               return toArray(arg,clas);
-                       else if(comp == boolean.class)
-                               return toBooleanArray(arg);
-                       else if(comp == byte.class)
-                               return toByteArray(arg);
-               }
-
-               if(arg != null && !clas.isInstance(arg))
-                       throw new FactorDomainException(arg,clas);
-               else
-                       return arg;
-       } //}}}
-
-       //{{{ fromBoolean() method
-       public static Object fromBoolean(boolean b)
-       {
-               return (b ? Boolean.TRUE : null);
-       } //}}}
-
-       //{{{ convertFromJavaType() method
-       public static Object convertFromJavaType(Object arg)
-       {
-               if(Boolean.FALSE.equals(arg))
-                       return null;
-               else
-                       return arg;
-       } //}}}
-
-       //{{{ javaClassToVMClass() method
-       public static String javaClassToVMClass(Class clazz)
-       {
-               String name = clazz.getName();
-
-               if(clazz.isArray())
-                       return clazz.getName().replace('.','/');
-               else if(name.equals("boolean"))
-                       return "Z";
-               else if(name.equals("byte"))
-                       return "B";
-               else if(name.equals("char"))
-                       return "C";
-               else if(name.equals("double"))
-                       return "D";
-               else if(name.equals("float"))
-                       return "F";
-               else if(name.equals("int"))
-                       return "I";
-               else if(name.equals("long"))
-                       return "J";
-               else if(name.equals("short"))
-                       return "S";
-               else if(name.equals("void"))
-                       return "V";
-               else
-                       return "L" + clazz.getName().replace('.','/') + ";";
-       } //}}}
-
-       //{{{ getBoxingType() method
-       public static Class getBoxingType(Class clazz)
-       {
-               if(clazz == Boolean.TYPE)
-                       return Boolean.class;
-               else if(clazz == Byte.TYPE)
-                       return Byte.class;
-               else if(clazz == Character.TYPE)
-                       return Character.class;
-               else if(clazz == Double.TYPE)
-                       return Double.class;
-               else if(clazz == Float.TYPE)
-                       return Float.class;
-               else if(clazz == Integer.TYPE)
-                       return Integer.class;
-               else if(clazz == Long.TYPE)
-                       return Long.class;
-               else if(clazz == Short.TYPE)
-                       return Short.class;
-               else
-                       return null;
-       } //}}}
-
-       //{{{ javaSignatureToVMSignature() method
-       public static String javaSignatureToVMSignature(Class[] args,
-               Class returnType)
-       {
-               StringBuffer buf = new StringBuffer("(");
-               for(int i = 0; i < args.length; i++)
-               {
-                       buf.append(javaClassToVMClass(args[i]));
-               }
-               buf.append(")");
-               buf.append(javaClassToVMClass(returnType));
-               return buf.toString();
-       } //}}}
-
-       //{{{ getClass() method
-       public static Class getClass(String name) throws ClassNotFoundException
-       {
-               if(name.equals("boolean"))
-                       return Boolean.TYPE;
-               else if(name.equals("byte"))
-                       return Byte.TYPE;
-               else if(name.equals("char"))
-                       return Character.TYPE;
-               else if(name.equals("double"))
-                       return Double.TYPE;
-               else if(name.equals("float"))
-                       return Float.TYPE;
-               else if(name.equals("int"))
-                       return Integer.TYPE;
-               else if(name.equals("long"))
-                       return Long.TYPE;
-               else if(name.equals("short"))
-                       return Short.TYPE;
-               else
-                       return Class.forName(name);
-       } //}}}
-
-       //{{{ unwrapException() method
-       public static Throwable unwrapException(Throwable e)
-       {
-               if(e instanceof InvocationTargetException)
-               {
-                       return unwrapException(
-                               ((InvocationTargetException)e)
-                               .getTargetException());
-               }
-               else if(e.getCause() != null)
-                       return unwrapException(e.getCause());
-               else
-                       return e;
-       } //}}}
-}
index 59dfda749bd627a6ec6a35426e0b45447f6bb98e..8b3b5f460afe686fe2274b7fa2528ea805036032 100644 (file)
@@ -37,33 +37,23 @@ import java.io.*;
  */
 public class FactorLib
 {
-       //{{{ branch3() method
-       public static Object branch3(float x, float y,
-               Object o1, Object o2, Object o3)
+       //{{{ toNumber() method
+       public static Number toNumber(Object arg)
        {
-               if(x > y)
-                       return o1;
-               else if(x == y)
-                       return o2;
-               else
-                       return o3;
-       } //}}}
+               if(arg instanceof Number)
+                       return (Number)arg;
+               else if(arg instanceof Character)
+                       return new Integer((int)((Character)arg).charValue());
+               else if(arg instanceof String)
+               {
+                       Number num = NumberParser.parseNumber((String)arg,10);
+                       if(num != null)
+                               return num;
+               }
 
-       //{{{ error() method
-       public static void error(Object obj) throws Throwable
-       {
-               if(obj instanceof Throwable)
-                       throw (Throwable)obj;
-               else
-                       throw new FactorRuntimeException(String.valueOf(obj));
+               throw new NumberFormatException(String.valueOf(arg));
        } //}}}
 
-       //{{{ eq() method
-       public static boolean eq(Object o1, Object o2)
-       {
-               return o1 == o2;
-       } //}}}
-       
        //{{{ equal() method
        public static boolean equal(Object o1, Object o2)
        {
@@ -127,31 +117,6 @@ public class FactorLib
                        return o1.equals(o2);
        } //}}}
 
-       //{{{ exec() method
-       public static int exec(String[] args, String dir) throws Exception
-       {
-               int exitCode = -1;
-
-               try
-               {
-                       Process process = Runtime.getRuntime().exec(args,
-                               null,new File(dir));
-                       process.getInputStream().close();
-                       process.getOutputStream().close();
-                       process.getErrorStream().close();
-                       exitCode = process.waitFor();
-               }
-               catch(Exception e)
-               {
-                       e.printStackTrace();
-                       // this needs to be handled better
-                       /* stack.push(MiscUtilities.throwableToString(e));
-                       Console.print(stack,namespace); */
-               }
-
-               return exitCode;
-       } //}}}
-
        //{{{ objectsEqual() method
        /**
         * Returns if two objects are equal. This correctly handles null
@@ -161,90 +126,4 @@ public class FactorLib
        {
                return (o1 == null ? o2 == null : o1.equals(o2));
        } //}}}
-
-       //{{{ copy() method
-       /**
-        * Copies the contents of an input stream to an output stream.
-        */
-       public static void copy(InputStream in, OutputStream out)
-               throws IOException
-       {
-               try
-               {
-                       byte[] buf = new byte[4096];
-
-                       int count;
-
-                       for(;;)
-                       {
-                               count = in.read(buf,0,buf.length);
-                               if(count == -1 || count == 0)
-                                       break;
-
-                               out.write(buf,0,count);
-                       }
-               }
-               finally
-               {
-                       in.close();
-                       out.close();
-               }
-       } //}}}
-
-       //{{{ readLine() method
-       /**
-        * Reads a line of text from the given input stream.
-        */
-       public static String readLine(InputStream in) throws IOException
-       {
-               StringBuffer buf = new StringBuffer();
-               int b;
-               while((b = in.read()) != -1)
-               {
-                       if(b == '\r')
-                       {
-                               if(in.markSupported()/*  && in.available() >= 1 */)
-                               {
-                                       in.mark(1);
-                                       b = in.read();
-                                       if(b != '\n')
-                                               in.reset();
-                               }
-                               break;
-                       }
-                       else if(b == '\n')
-                               break;
-                       buf.append((char)b);
-               }
-
-               /* EOF? */
-               if(b == -1 && buf.length() == 0)
-                       return null;
-               else
-                       return buf.toString();
-       } //}}}
-
-       //{{{ readCount() method
-       public static String readCount(int count, InputStream in)
-               throws IOException
-       {
-               byte[] bytes = new byte[count];
-               int offset = 0;
-               int read = 0;
-               while((read = in.read(bytes,offset,count - offset)) > 0)
-                       offset += read;
-               return new String(bytes,0,offset,"ASCII");
-       } //}}}
-
-       //{{{ readCount() method
-       public static String readCount(int count, Reader in)
-               throws IOException
-       {
-               char[] chars = new char[count];
-               int offset = 0;
-               int read = 0;
-               while((read = in.read(chars,offset,count - offset)) > 0)
-                       offset += read;
-               return new String(chars,0,offset);
-       } //}}}
 }
diff --git a/factor/FactorNamespace.java b/factor/FactorNamespace.java
deleted file mode 100644 (file)
index 1d456b0..0000000
+++ /dev/null
@@ -1,463 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.TreeMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * A namespace is a list of name/value bindings. A namespace can optionally
- * have a bound object, in which case every public field of the
- * object will be accessible through the namespace. Additionally, static fields
- * from arbitrary classes can be imported into the namespace.
- */
-public class FactorNamespace implements PublicCloneable, FactorObject
-{
-       private static FactorWord NULL = new FactorWord(null,"#<represent-f>");
-       private static FactorWord CHECK_PARENT = new FactorWord(null,"#<check-parent>");
-
-       public Object obj;
-       protected Map words;
-       private Class constraint;
-
-       //{{{ createConstrainedNamespace() method
-       /**
-        * Used for dictionary.
-        */
-       public static FactorNamespace createConstrainedNamespace(
-               Class constraint) throws Exception
-       {
-               FactorNamespace namespace = new FactorNamespace(null,null);
-               namespace.constraint = constraint;
-               return namespace;
-       } //}}}
-
-       //{{{ FactorNamespace constructor
-       public FactorNamespace()
-       {
-               this.words = new TreeMap();
-       } //}}}
-
-       //{{{ FactorNamespace constructor
-       public FactorNamespace(Object obj) throws Exception
-       {
-               this(null,obj);
-       } //}}}
-
-       //{{{ FactorNamespace constructor
-       /**
-        * Cloning constructor.
-        */
-       public FactorNamespace(Map words, Object obj)
-       {
-               this.words = new TreeMap();
-
-               // used by clone()
-               if(words != null)
-               {
-                       Iterator iter = words.entrySet().iterator();
-                       while(iter.hasNext())
-                       {
-                               Map.Entry entry = (Map.Entry)iter.next();
-                               Object key = entry.getKey();
-                               Object value = entry.getValue();
-                               if(value instanceof VarBinding)
-                               {
-                                       VarBinding b = (VarBinding)value;
-                                       if(b.instance != null)
-                                               continue;
-                               }
-
-                               this.words.put(key,value);
-                       }
-               }
-
-               this.obj = obj;
-       } //}}}
-
-       //{{{ getNamespace() method
-       public FactorNamespace getNamespace()
-       {
-               return this;
-       } //}}}
-
-       //{{{ getThis() method
-       /**
-        * Returns the object bound to this namespace, or null.
-        */
-       public Object getThis()
-       {
-               return obj;
-       } //}}}
-
-       //{{{ importVars() method
-       /**
-        * Defines a variable bound to a Java field.
-        */
-       public synchronized void importVars(String clazz, Cons vars)
-               throws Exception
-       {
-               Class clas = Class.forName(clazz);
-               while(vars != null)
-               {
-                       String field = (String)vars.car(String.class);
-                       vars = vars.next();
-                       String word = (String)vars.car(String.class);
-
-                       setVariable(word,new VarBinding(
-                               clas.getField(field),
-                               null));
-
-                       vars = vars.next();
-               }
-       } //}}}
-
-       //{{{ isDefined() method
-       public synchronized boolean isDefined(String name)
-       {
-               Object o = words.get(name);
-               if(o instanceof VarBinding)
-                       return true;
-               else if(o == NULL)
-                       return true;
-               else if(o == CHECK_PARENT)
-                       return false;
-               else if(o == null)
-               {
-                       // lazily instantiate object field binding
-                       if(obj == null)
-                               return false;
-                       else
-                       {
-                               lazyFieldInit(name);
-                               return isDefined(name);
-                       }
-               }
-               else
-                       return true;
-       } //}}}
-
-       //{{{ getVariable() method
-       public synchronized Object getVariable(String name)
-       {
-               Object o = words.get(name);
-               if(o instanceof VarBinding)
-                       return ((VarBinding)o).get();
-               else if(o == NULL)
-                       return null;
-               else if(o == CHECK_PARENT)
-               {
-                       // we know this is not a field binding
-                       return null;
-               }
-               else if(o == null)
-               {
-                       // lazily instantiate object field binding
-                       if(obj == null)
-                               return null;
-                       else
-                       {
-                               lazyFieldInit(name);
-                               return getVariable(name);
-                       }
-               }
-               else
-                       return o;
-       } //}}}
-
-       //{{{ setVariable() method
-       public synchronized void setVariable(String name, Object value)
-       {
-               if(name == null)
-                       throw new NullPointerException();
-
-               Object o = words.get(name);
-               if(o instanceof VarBinding && !(value instanceof VarBinding))
-                       ((VarBinding)o).set(value);
-               else if(o == null)
-               {
-                       // lazily instantiate object field binding
-                       if(obj == null)
-                       {
-                               if(value == null)
-                                       words.put(name,NULL);
-                               else
-                                       words.put(name,value);
-                       }
-                       else
-                       {
-                               lazyFieldInit(name);
-                               setVariable(name,value);
-                       }
-               }
-               else if(value == null)
-                       words.put(name,NULL);
-               else
-               {
-                       if(constraint != null)
-                       {
-                               if(!constraint.isAssignableFrom(
-                                       value.getClass()))
-                               {
-                                       throw new RuntimeException(
-                                               "Can only store "
-                                               + constraint
-                                               + " in " + this);
-                               }
-                       }
-                       words.put(name,value);
-               }
-       } //}}}
-
-       //{{{ lazyFieldInit() method
-       protected void lazyFieldInit(String name)
-       {
-               try
-               {
-                       Field f = obj.getClass().getField(name);
-                       if(!Modifier.isStatic(f.getModifiers()))
-                       {
-                               words.put(name,new VarBinding(f,obj));
-                               return;
-                       }
-               }
-               catch(Exception e)
-               {
-               }
-
-               // not a field, don't check again
-               words.put(name,CHECK_PARENT);
-       } //}}}
-
-       //{{{ initAllFields() method
-       private void initAllFields()
-       {
-               if(obj != null)
-               {
-                       try
-                       {
-                               Field[] fields = obj.getClass().getFields();
-                               for(int i = 0; i < fields.length; i++)
-                               {
-                                       Field f = fields[i];
-                                       if(Modifier.isStatic(f.getModifiers()))
-                                               continue;
-                                       words.put(f.getName(),
-                                               new VarBinding(f,obj));
-                               }
-                       }
-                       catch(Exception e)
-                       {
-                       }
-               }
-       } //}}}
-
-       //{{{ toVarList() method
-       /**
-        * Returns a list of variable names.
-        */
-       public synchronized Cons toVarList()
-       {
-               initAllFields();
-
-               Cons first = null;
-               Cons last = null;
-               Iterator iter = words.keySet().iterator();
-               while(iter.hasNext())
-               {
-                       String key = (String)iter.next();
-                       if(words.get(key) != CHECK_PARENT)
-                       {
-                               Cons cons = new Cons(key,null);
-                               if(first == null)
-                                       first = last = cons;
-                               else
-                               {
-                                       last.cdr = cons;
-                                       last = cons;
-                               }
-                       }
-               }
-
-               return first;
-       } //}}}
-
-       //{{{ toValueList() method
-       /**
-        * Returns a list of variable values.
-        */
-       public synchronized Cons toValueList()
-       {
-               initAllFields();
-
-               Cons first = null;
-               Cons last = null;
-               Cons vars = toVarList();
-               while(vars != null)
-               {
-                       String key = (String)vars.car;
-                       Cons cons = new Cons(getVariable(key),null);
-                       if(first == null)
-                               first = last = cons;
-                       else
-                       {
-                               last.cdr = cons;
-                               last = cons;
-                       }
-                       vars = vars.next();
-               }
-
-               return first;
-       } //}}}
-
-       //{{{ toVarValueList() method
-       /**
-        * Returns a list of pairs of variable names, and their values.
-        */
-       public synchronized Cons toVarValueList()
-       {
-               initAllFields();
-
-               Cons first = null;
-               Cons last = null;
-               Cons vars = toVarList();
-               while(vars != null)
-               {
-                       String key = (String)vars.car;
-
-                       Object value = getVariable(key);
-                       Cons cons = new Cons(new Cons(key,value),null);
-                       if(first == null)
-                               first = last = cons;
-                       else
-                       {
-                               last.cdr = cons;
-                               last = cons;
-                       }
-                       vars = vars.next();
-               }
-
-               return first;
-       } //}}}
-
-       //{{{ VarBinding class
-       /**
-        * This is messy.
-        */
-       public static class VarBinding
-       {
-               private Field field;
-               private Object instance;
-
-               public VarBinding(Field field, Object instance)
-                       throws FactorRuntimeException
-               {
-                       this.field = field;
-                       this.instance = instance;
-               }
-
-               public Object get()
-               {
-                       try
-                       {
-                               return FactorJava.convertFromJavaType(
-                                       field.get(instance));
-                       }
-                       catch(Exception e)
-                       {
-                               throw new RuntimeException(e);
-                       }
-               }
-
-               public void set(Object value)
-               {
-                       try
-                       {
-                               field.set(instance,FactorJava.convertToJavaType(
-                                       value,field.getType()));
-                       }
-                       catch(Exception e)
-                       {
-                               throw new RuntimeException(e);
-                       }
-               }
-       } //}}}
-
-       //{{{ toString() method
-       public String toString()
-       {
-               initAllFields();
-
-               String str = getClass().getName() + ", " + words.size()
-                       + " items";
-
-               if(obj == null)
-                       return str;
-               else
-                       return str + ", bound: " + obj;
-       } //}}}
-
-       //{{{ clone() method
-       public FactorNamespace clone(Object rebind)
-       {
-               if(rebind.getClass() != obj.getClass())
-                       throw new RuntimeException("Cannot rebind to different type");
-
-               try
-               {
-                       return new FactorNamespace(words,rebind);
-               }
-               catch(Exception e)
-               {
-                       throw new InternalError();
-               }
-       } //}}}
-
-       //{{{ clone() method
-       public Object clone()
-       {
-               if(obj != null)
-                       throw new RuntimeException("Cannot clone namespace that's bound to an object");
-
-               try
-               {
-                       return new FactorNamespace(new TreeMap(words),null);
-               }
-               catch(Exception e)
-               {
-                       throw new InternalError();
-               }
-       } //}}}
-}
diff --git a/factor/FactorObject.java b/factor/FactorObject.java
deleted file mode 100644 (file)
index d6d455f..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor;
-
-public interface FactorObject
-{
-       FactorNamespace getNamespace() throws Exception;
-}
index 6652bbeb9c648757a88ce594f547598851770a6c..8fb0af87544744e1f08d8b4c87ce45b88589122e 100644 (file)
@@ -36,8 +36,6 @@ import java.io.IOException;
  */
 public abstract class FactorParsingDefinition
 {
-       public static final String ENCODING = "UTF8";
-
        public FactorWord word;
 
        //{{{ FactorParsingDefinition constructor
@@ -45,13 +43,11 @@ public abstract class FactorParsingDefinition
         * A new definition.
         */
        public FactorParsingDefinition(FactorWord word)
-               throws Exception
        {
                this.word = word;
        } //}}}
 
-       public abstract void eval(FactorInterpreter interp, FactorReader reader)
-               throws Exception;
+       public abstract void eval(FactorReader reader) throws Exception;
 
        //{{{ toString() method
        public String toString()
index d30d82bf828a777f1c73b7391e7faafa12786faf..baa90bdc5d15efb60df081f5ecb49b2b668b33bc 100644 (file)
@@ -38,7 +38,7 @@ import java.util.*;
  */
 public class FactorReader
 {
-       private FactorInterpreter interp;
+       private VocabularyLookup lookup;
        private FactorScanner scanner;
        private Cons states;
 
@@ -48,43 +48,9 @@ public class FactorReader
        private FactorWord toplevel = new FactorWord(null,"#<EOF>");
        private boolean alwaysDocComments;
 
-       // if interactive, use interp.use & interp.in instead of below two
-       private boolean interactive;
        private Cons use;
        private String in;
-
        private int base = 10;
-       
-       //{{{ parseObject() method
-       /**
-        * Parse the given string. It must be a single literal object.
-        * The object is returned.
-        */
-       public static Object parseObject(String input, FactorInterpreter interp)
-               throws Exception
-       {
-               try
-               {
-                       FactorReader parser = new FactorReader(
-                               "parseObject()",
-                               new BufferedReader(new StringReader(input)),
-                               true,false,interp);
-                       Cons parsed = parser.parse();
-                       if(parsed.cdr != null)
-                       {
-                               // not a single literal
-                               throw new FactorParseException("parseObject()",
-                                       1,"Not a literal: " + input);
-                       }
-                       return parsed.car;
-               }
-               catch(IOException io)
-               {
-                       // can't happen!
-                       throw new FactorParseException("parseObject()",1,
-                               io.toString());
-               }
-       } //}}}
 
        //{{{ getUnreadableString() method
        public static String getUnreadableString(String str)
@@ -138,66 +104,6 @@ public class FactorReader
                return buf.toString();
        } //}}}
 
-       //{{{ getVocabularyDeclaration() method
-       /**
-        * Return a string of USE: declarations for the given object.
-        */
-       public static String getVocabularyDeclaration(Object obj)
-       {
-               StringBuffer buf = new StringBuffer();
-               Set vocabs = getAllVocabularies(obj);
-               Iterator iter = vocabs.iterator();
-               while(iter.hasNext())
-               {
-                       String name = (String)iter.next();
-                       buf.append("USE: ").append(name).append('\n');
-               }
-               return buf.toString();
-       } //}}}
-
-       //{{{ getAllVocabularies() method
-       /**
-        * Return a set of all vocabularies referenced in the given quotation.
-        */
-       public static Set getAllVocabularies(Object obj)
-       {
-               Set set = new TreeSet();
-               getAllVocabularies(obj,set);
-               return set;
-       } //}}}
-
-       //{{{ getAllVocabularies() method
-       /**
-        * Return a set of all vocabularies referenced in the given quotation.
-        */
-       private static void getAllVocabularies(Object obj, Set set)
-       {
-               if(obj instanceof FactorWord)
-               {
-                       String vocab = ((FactorWord)obj).vocabulary;
-                       if(vocab != null)
-                               set.add(vocab);
-               }
-               else if(obj instanceof Cons)
-               {
-                       Cons quotation = (Cons)obj;
-
-                       while(quotation != null)
-                       {
-                               getAllVocabularies(quotation.car,set);
-                               if(quotation.car instanceof Cons)
-                                       getAllVocabularies((Cons)quotation.car,set);
-                               if(quotation.cdr instanceof Cons)
-                                       quotation = quotation.next();
-                               else
-                               {
-                                       getAllVocabularies(quotation.cdr,set);
-                                       return;
-                               }
-                       }
-               }
-       } //}}}
-
        //{{{ unparseObject() method
        public static String unparseObject(Object obj)
        {
@@ -232,9 +138,9 @@ public class FactorReader
        public FactorReader(
                String filename,
                BufferedReader in,
-               FactorInterpreter interp)
+               VocabularyLookup lookup)
        {
-               this(filename,in,false,false,interp);
+               this(filename,in,false,lookup);
        } //}}}
 
        //{{{ FactorReader constructor
@@ -242,27 +148,23 @@ public class FactorReader
                String filename,
                BufferedReader in,
                boolean alwaysDocComments,
-               boolean interactive,
-               FactorInterpreter interp)
+               VocabularyLookup lookup)
        {
-               this(new FactorScanner(filename,in),alwaysDocComments,
-                       interactive,interp);
+               this(new FactorScanner(filename,in),alwaysDocComments,lookup);
        } //}}}
 
        //{{{ FactorReader constructor
        public FactorReader(
                FactorScanner scanner,
                boolean alwaysDocComments,
-               boolean interactive,
-               FactorInterpreter interp)
+               VocabularyLookup lookup)
        {
-               this.interp = interp;
+               this.lookup = lookup;
                this.scanner = scanner;
                pushState(toplevel,null);
                this.alwaysDocComments = alwaysDocComments;
-               this.interactive = interactive;
-               this.in = FactorInterpreter.DEFAULT_IN;
-               this.use = FactorInterpreter.DEFAULT_USE;
+               this.in = DefaultVocabularyLookup.DEFAULT_IN;
+               this.use = DefaultVocabularyLookup.DEFAULT_USE;
        } //}}}
 
        //{{{ getScanner() method
@@ -274,48 +176,30 @@ public class FactorReader
        //{{{ getIn() method
        public String getIn()
        {
-               if(interactive)
-                       return interp.in;
-               else
-                       return in;
+               return in;
        } //}}}
 
        //{{{ setIn() method
-       public void setIn(String in) throws Exception
+       public void setIn(String in)
        {
-               if(interactive)
-                       interp.in = in;
-               else
-                       this.in = in;
-
-               if(interp.getVocabulary(in) == null)
-                       interp.defineVocabulary(in);
+               this.in = in;
        } //}}}
 
        //{{{ getUse() method
        public Cons getUse()
        {
-               if(interactive)
-                       return interp.use;
-               else
-                       return use;
+               return use;
        } //}}}
 
        //{{{ setUse() method
        public void setUse(Cons use)
        {
-               if(interactive)
-                       interp.use = use;
-               else
-                       this.use = use;
+               this.use = use;
        } //}}}
 
        //{{{ addUse() method
-       public void addUse(String name) throws Exception
+       public void addUse(String name)
        {
-               if(interp.getVocabulary(name) == null)
-                       error("Undefined vocabulary: " + name);
-
                setUse(new Cons(name,getUse()));
        } //}}}
 
@@ -338,16 +222,22 @@ public class FactorReader
                }
        } //}}}
 
+       //{{{ searchVocabulary() method
+       public FactorWord searchVocabulary(Cons use, String word)
+               throws Exception
+       {
+               return lookup.searchVocabulary(use,word);
+       } //}}}
+
        //{{{ intern() method
        public FactorWord intern(String name, boolean define)
                throws Exception
        {
                if(define)
-                       return interp.define(getIn(),name);
+                       return lookup.define(getIn(),name);
                else
                {
-                       FactorWord word = interp.searchVocabulary(
-                               getUse(),name);
+                       FactorWord word = searchVocabulary(getUse(),name);
                        if(word == null)
                                error("Undefined: " + name);
                        return word;
@@ -433,7 +323,7 @@ public class FactorReader
 
                        if(word.parsing != null)
                        {
-                               word.parsing.eval(interp,this);
+                               word.parsing.eval(this);
                                return false;
                        }
                        append(word);
@@ -529,26 +419,15 @@ public class FactorReader
 
                ParseState(FactorWord start, Object arg)
                {
+                       docComment = start.docComment;
                        warnUndefined = true;
                        this.start = start;
                        this.arg = arg;
-                       try
-                       {
-                               this.docComment
-                                       = (start.getNamespace()
-                                       .getVariable("doc-comments")
-                                       != null);
-                       }
-                       catch(Exception e)
-                       {
-                               throw new RuntimeException(e);
-                       }
                }
 
                void append(Object obj) throws FactorParseException
                {
-                       boolean docComment = (this.docComment
-                               || alwaysDocComments);
+                       boolean docComment = (this.docComment || alwaysDocComments);
                        // In a doc comment context, first object is always
                        // a word, then followed by doc comments, then followed
                        // by code.
diff --git a/factor/FactorShuffleDefinition.java b/factor/FactorShuffleDefinition.java
deleted file mode 100644 (file)
index a9be0d1..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor;
-
-import java.util.*;
-
-/**
- * ~<< name ... -- >>~
- */
-public class FactorShuffleDefinition extends FactorWordDefinition
-{
-       public static final int FROM_R_MASK = (1<<15);
-       public static final int TO_R_MASK = (1<<16);
-       public static final int SPECIFIER = FROM_R_MASK | TO_R_MASK;
-
-       /**
-        * Elements to consume from stacks.
-        */
-       private int consumeD;
-       private int consumeR;
-
-       /**
-        * Permutation for elements on stack.
-        */
-       private int[] shuffleD;
-       private int shuffleDstart;
-       private int shuffleDlength;
-       private int[] shuffleR;
-       private int shuffleRstart;
-       private int shuffleRlength;
-
-       //{{{ FactorShuffleDefinition constructor
-       public FactorShuffleDefinition(FactorWord word, Cons definition)
-               throws FactorException
-       {
-               super(word);
-               fromList(definition);
-       } //}}}
-
-       //{{{ FactorShuffleDefinition constructor
-       public FactorShuffleDefinition(FactorWord word,
-               int consumeD, int consumeR,
-               int[] shuffleD, int shuffleDlength,
-               int[] shuffleR, int shuffleRlength)
-       {
-               super(word);
-
-               this.consumeD = consumeD;
-               this.consumeR = consumeR;
-               this.shuffleD = shuffleD;
-               this.shuffleDlength = shuffleDlength;
-               this.shuffleR = shuffleR;
-               this.shuffleRlength = shuffleRlength;
-
-               init();
-       } //}}}
-
-       //{{{ init() method
-       private void init()
-       {
-               if(this.shuffleD != null && this.shuffleDlength == 0)
-                       this.shuffleD = null;
-               if(this.shuffleR != null && this.shuffleRlength == 0)
-                       this.shuffleR = null;
-               if(this.shuffleD != null)
-               {
-                       for(int i = 0; i < shuffleDlength; i++)
-                       {
-                               if(shuffleD[i] == i)
-                                       shuffleDstart++;
-                               else
-                                       break;
-                       }
-               }
-               if(this.shuffleR != null)
-               {
-                       for(int i = 0; i < shuffleRlength; i++)
-                       {
-                               if(shuffleR[i] == (i | FROM_R_MASK))
-                                       shuffleRstart++;
-                               else
-                                       break;
-                       }
-               }
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws FactorStackException
-       {
-               eval(interp,interp.datastack,interp.callstack);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp,
-               FactorArray datastack,
-               FactorArray callstack)
-               throws FactorStackException
-       {
-               if(datastack.top < consumeD)
-                       throw new FactorStackException(consumeD);
-
-               if(callstack.top < consumeR)
-                       throw new FactorStackException(consumeR);
-
-               Object[] temporaryD;
-               if(shuffleD != null)
-               {
-                       temporaryD = new Object[shuffleDlength];
-                       shuffle(datastack,callstack,datastack,consumeD,consumeR,
-                               shuffleD,temporaryD);
-               }
-               else
-                       temporaryD = null;
-
-               Object[] temporaryR;
-               if(shuffleR != null)
-               {
-                       temporaryR = new Object[shuffleRlength];
-                       shuffle(datastack,callstack,callstack,consumeD,consumeR,
-                               shuffleR,temporaryR);
-               }
-               else
-                       temporaryR = null;
-
-               datastack.top -= consumeD;
-               if(temporaryD != null)
-                       datastack.pushAll(temporaryD);
-
-               callstack.top -= consumeR;
-               if(temporaryR != null)
-                       callstack.pushAll(temporaryR);
-
-       } //}}}
-
-       //{{{ shuffle() method
-       private void shuffle(
-               FactorArray datastack,
-               FactorArray callstack,
-               FactorArray stack,
-               int consumeD,
-               int consumeR,
-               int[] shuffle,
-               Object[] temporary)
-               throws FactorStackException
-       {
-               for(int i = 0; i < temporary.length; i++)
-               {
-                       Object[] array;
-                       int top;
-                       int index = shuffle[i];
-                       int consume;
-                       if((index & FROM_R_MASK) == FROM_R_MASK)
-                       {
-                               array = callstack.stack;
-                               top = callstack.top;
-                               index = (index & ~FROM_R_MASK);
-                               consume = consumeR;
-                       }
-                       else
-                       {
-                               array = datastack.stack;
-                               top = datastack.top;
-                               consume = consumeD;
-                       }
-                       temporary[i] = array[top - consume + index];
-               }
-       } //}}}
-
-       //{{{ fromList() method
-       public void fromList(Cons definition)
-               throws FactorRuntimeException
-       {
-               String f = "--";
-
-               // 0 in consume map is last consumed, n is first consumed.
-               HashMap consumeMap = new HashMap();
-
-               while(definition != null)
-               {
-                       Object next = definition.car;
-                       if(f.equals(next.toString()))
-                       {
-                               definition = definition.next();
-                               break;
-                       }
-                       else if(next instanceof String
-                               || next instanceof Character)
-                       {
-                               String name = next.toString();
-                               int counter;
-                               if(name.startsWith("r:"))
-                               {
-                                       counter = (FactorShuffleDefinition
-                                               .FROM_R_MASK
-                                               | consumeR++);
-                                       name = name.substring(2);
-                               }
-                               else
-                                       counter = consumeD++;
-
-                               Object existing = consumeMap.put(name,
-                                       new Integer(counter));
-                               if(existing != null)
-                                       throw new FactorRuntimeException(
-                                               word + ": appears twice in shuffle LHS: "
-                                               + next);
-                       }
-                       else if(!(next instanceof FactorDocComment))
-                       {
-                               throw new FactorRuntimeException(
-                                       word + ": unexpected "
-                                       + FactorReader.unparseObject(
-                                       next));
-                       }
-                       definition = definition.next();
-               }
-
-               int consume = consumeMap.size();
-
-               if(definition != null)
-               {
-                       int[] shuffle = new int[definition.length()];
-
-                       int i = 0;
-                       while(definition != null)
-                       {
-                               if(definition.car instanceof String
-                                       || definition.car instanceof Character)
-                               {
-                                       String name = definition.car.toString();
-                                       boolean r = (name.startsWith("r:"));
-                                       if(r)
-                                               name = name.substring(2);
-
-                                       Integer _index = (Integer)
-                                               consumeMap.get(name);
-                                       if(_index == null)
-                                       {
-                                               throw new FactorRuntimeException(word +
-                                                       ": does not appear in shuffle LHS: "
-                                                       + definition.car);
-                                       }
-
-                                       int index = _index.intValue();
-
-                                       if(r)
-                                       {
-                                               shuffleRlength++;
-                                               shuffle[i++] = (index
-                                                       | FactorShuffleDefinition
-                                                       .TO_R_MASK);
-                                       }
-                                       else
-                                       {
-                                               shuffleDlength++;
-                                               shuffle[i++] = index;
-                                       }
-                               }
-                               else
-                               {
-                                       throw new FactorRuntimeException(
-                                               word + ": unexpected "
-                                               + FactorReader.unparseObject(
-                                               definition.car));
-                               }
-                               definition = definition.next();
-                       }
-
-                       shuffleD = new int[shuffleDlength];
-                       shuffleR = new int[shuffleRlength];
-
-                       int j = 0, k = 0;
-                       for(i = 0; i < shuffle.length; i++)
-                       {
-                               int index = shuffle[i];
-                               if((index & FactorShuffleDefinition.TO_R_MASK)
-                                       == FactorShuffleDefinition.TO_R_MASK)
-                               {
-                                       index = (index
-                                               & ~FactorShuffleDefinition.TO_R_MASK);
-                                       shuffleR[j++] = index;
-                               }
-                               else
-                                       shuffleD[k++] = index;
-                       }
-               }
-
-               init();
-       } //}}}
-
-       //{{{ toList() method
-       public Cons toList()
-       {
-               Cons list = null;
-
-               for(int i = 0; i < consumeD; i++)
-                       list = new Cons(String.valueOf((char)('A' + i)),list);
-
-               for(int i = 0; i < consumeR; i++)
-                       list = new Cons("r:" + (char)('A' + consumeD + i),list);
-
-               list = new Cons("--",list);
-
-               if(shuffleD != null)
-               {
-                       for(int i = 0; i < shuffleDlength; i++)
-                       {
-                               int index = shuffleD[i];
-                               if((index & FROM_R_MASK) == FROM_R_MASK)
-                               {
-                                       index &= ~FROM_R_MASK;
-                                       index += consumeD;
-                               }
-
-                               list = new Cons(String.valueOf(
-                                       (char)('A' + index)),
-                                       list);
-                       }
-               }
-
-               if(shuffleR != null)
-               {
-                       for(int i = 0; i < shuffleRlength; i++)
-                       {
-                               int index = shuffleR[i];
-                               if((index & FROM_R_MASK) == FROM_R_MASK)
-                               {
-                                       index &= ~FROM_R_MASK;
-                                       index += consumeD;
-                               }
-
-                               list = new Cons(
-                                       "r:" + (char)('A' + index),
-                                       list);
-                       }
-               }
-
-               return Cons.reverse(list);
-       } //}}}
-}
diff --git a/factor/FactorStackException.java b/factor/FactorStackException.java
deleted file mode 100644 (file)
index 6990166..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor;
-
-public class FactorStackException extends FactorRuntimeException
-{
-       public FactorStackException(int expected)
-       {
-               super("Expected " + expected);
-       }
-}
index ae8d832db70318d164ff449b85343c8c12420d96..d2a80dc321aef147b4446628c3ce06dde59078e3 100644 (file)
@@ -48,19 +48,6 @@ public class FactorSymbolDefinition extends FactorWordDefinition
                this.symbol = symbol;
        } //}}}
 
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               interp.datastack.push(symbol);
-       } //}}}
-
-       //{{{ fromList() method
-       public void fromList(Cons definition)
-       {
-               this.symbol = definition.car;
-       } //}}}
-
        //{{{ toList() method
        public Cons toList()
        {
diff --git a/factor/FactorUndefinedWordException.java b/factor/FactorUndefinedWordException.java
deleted file mode 100644 (file)
index 55a6f45..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor;
-
-public class FactorUndefinedWordException extends FactorRuntimeException
-{
-       public FactorUndefinedWordException(String word)
-       {
-               super(word + " not defined");
-       }
-}
index a461610dc717b5a6d9c10fc8aba0eee897d17866..07ddbbf84bc391859c74b347902127349eb00524 100644 (file)
@@ -34,7 +34,7 @@ import java.util.*;
 /**
  * An internalized symbol.
  */
-public class FactorWord implements FactorExternalizable, FactorObject
+public class FactorWord implements FactorExternalizable
 {
        private static int gensymCount = 0;
 
@@ -52,14 +52,9 @@ public class FactorWord implements FactorExternalizable, FactorObject
        public FactorParsingDefinition parsing;
 
        /**
-        * Should this word be inlined when compiling?
+        * Should the parser keep doc comments?
         */
-       public boolean inline;
-
-       /**
-        * Raise an error if an attempt is made to compile this word?
-        */
-       public boolean interpretOnly;
+       public boolean docComment;
 
        /**
         * For text editor integration.
@@ -68,8 +63,6 @@ public class FactorWord implements FactorExternalizable, FactorObject
        public int line;
        public int col;
 
-       private FactorNamespace namespace;
-
        //{{{ FactorWord constructor
        /**
         * Do not use this constructor unless you're writing a packages
@@ -96,24 +89,6 @@ public class FactorWord implements FactorExternalizable, FactorObject
                this.name = name;
        } //}}}
 
-       //{{{ getNamespace() method
-       public FactorNamespace getNamespace()
-               throws Exception
-       {
-               if(namespace == null)
-                       namespace = new FactorNamespace(this);
-               return namespace;
-       } //}}}
-       
-       //{{{ gensym() method
-       /**
-        * Returns an un-internalized word with a unique name.
-        */
-       public synchronized static FactorWord gensym()
-       {
-               return new FactorWord(null,"#:GENSYM:" + (gensymCount++));
-       } //}}}
-
        //{{{ define() method
        public void define(FactorWordDefinition def)
        {
index 0df676b56810246dfffb4fd790bf926729a1885a..1366c78014ebabd228009c6496b81f1327ccbd70 100644 (file)
@@ -48,16 +48,6 @@ public abstract class FactorWordDefinition
                this.word = word;
        } //}}}
 
-       public abstract void eval(FactorInterpreter interp)
-               throws Exception;
-       
-       //{{{ fromList() method
-       public void fromList(Cons cons)
-               throws FactorRuntimeException
-       {
-               throw new FactorRuntimeException("Cannot unpickle " + this);
-       } //}}}
-
        //{{{ toList() method
        public Cons toList()
        {
index 231f8da61562388ec34ae4040f26055cbd6f88cc..cf9e29fea780798628c89f55e63323a31147b769 100644 (file)
@@ -88,8 +88,7 @@ public class EditWordDialog extends WordListDialog
                }
                catch(IOException e)
                {
-                       /* Don't care */
-                       Log.log(Log.ERROR,this,e);
+                       throw new RuntimeException(e);
                }
                dispose();
        } //}}}
index c8b1de4c8471beeeb3aaffe06b987d706cd1bca0..7214dfbf2d7479a97524ca73f01ad4841841a181 100644 (file)
@@ -29,7 +29,7 @@
 
 package factor.jedit;
 
-import factor.FactorInterpreter;
+import factor.*;
 import java.io.*;
 import java.net.Socket;
 import java.util.*;
@@ -38,16 +38,15 @@ import org.gjt.sp.util.Log;
 /**
  * Encapsulates a connection to an external Factor instance.
  */
-public class ExternalFactor
+public class ExternalFactor extends DefaultVocabularyLookup
 {
        //{{{ ExternalFactor constructor
        /**
         * We are given two streams that point to a bare REPL.
         */
-       public ExternalFactor(FactorInterpreter interp, InputStream in, OutputStream out)
+       public ExternalFactor(InputStream in, OutputStream out)
                throws IOException
        {
-               this.interp = interp;
                this.in = new DataInputStream(in);
                this.out = new DataOutputStream(out);
 
@@ -110,7 +109,7 @@ public class ExternalFactor
        public FactorStream openStream() throws IOException
        {
                Socket client = new Socket("localhost",streamServer);
-               return new FactorStream(client,interp);
+               return new FactorStream(client);
        } //}}}
 
        //{{{ close() method
@@ -134,7 +133,6 @@ public class ExternalFactor
        } //}}}
 
        //{{{ Private members
-       private FactorInterpreter interp;
        private DataInputStream in;
        private DataOutputStream out;
        
index 5080889a93160aa1abdc9b067b08affd85f61b4a..496e927fd2601c7b8ee8e42bc7d0780595b802fd 100644 (file)
@@ -62,7 +62,6 @@ public class FactorAsset extends Asset
        
        public String getLongString()
        {
-               return FactorWordRenderer.getWordHTMLString(
-                       FactorPlugin.getInterpreter(),word,def,false);
+               return FactorWordRenderer.getWordHTMLString(word,def,false);
        }
 }
index 91c650a059e21e0cd4d44516d82a1e7dfc422f93..4c75498215f30a0d90911617a6aa06815b2a6c7e 100644 (file)
@@ -40,7 +40,6 @@ import sidekick.*;
 
 public class FactorPlugin extends EditPlugin
 {
-       private static FactorInterpreter interp;
        private static ExternalFactor external;
 
        //{{{ getPluginPath() method
@@ -95,7 +94,6 @@ public class FactorPlugin extends EditPlugin
                        p.getErrorStream().close();
 
                        external = new ExternalFactor(
-                               getInterpreter(),
                                p.getInputStream(),
                                p.getOutputStream());
                }
@@ -118,38 +116,6 @@ public class FactorPlugin extends EditPlugin
                        external = null;
                }
        } //}}}
-
-       //{{{ newInterpreter() method
-       private static FactorInterpreter newInterpreter(String[] args)
-       {
-               try
-               {
-                       FactorInterpreter interp = new FactorInterpreter();
-                       interp.interactive = false;
-                       interp.init(args);
-                       return interp;
-               }
-               catch(Exception e)
-               {
-                       System.err.println("Failed to initialize interpreter:");
-                       e.printStackTrace();
-                       return null;
-               }
-       } //}}}
-
-       //{{{ getInterpreter() method
-       /**
-        * This can be called from the SideKick thread and must be thread safe.
-        */
-       public static synchronized FactorInterpreter getInterpreter()
-       {
-               if(interp == null)
-               {
-                       interp = newInterpreter(new String[] { "-jedit", "-no-compile" });
-               }
-
-               return interp;
-       } //}}}
        
        //{{{ getSideKickParser() method
        public static FactorSideKickParser getSideKickParser()
@@ -243,8 +209,15 @@ public class FactorPlugin extends EditPlugin
         */
        public static List getCompletions(String word, boolean anywhere)
        {
-               return getCompletions(interp.vocabularies.toVarList(),word,
-                       anywhere);
+               try
+               {
+                       return getCompletions(getExternalInstance().getVocabularies(),word,
+                               anywhere);
+               }
+               catch(Exception e)
+               {
+                       throw new RuntimeException(e);
+               }
        } //}}}
        
        //{{{ getCompletions() method
@@ -252,56 +225,57 @@ public class FactorPlugin extends EditPlugin
         * @param anywhere If true, matches anywhere in the word name are
         * returned; otherwise, only matches from beginning.
         */
-       public static List getCompletions(Cons use,
-               String word, boolean anywhere)
+       public static List getCompletions(Iterator use, String word, boolean anywhere)
        {
-               List completions = new ArrayList();
-               FactorInterpreter interp = FactorPlugin.getInterpreter();
-
-               while(use != null)
+               try
                {
-                       String vocab = (String)use.car;
-                       getCompletions(interp,vocab,word,completions,anywhere);
-                       use = use.next();
+                       List completions = new ArrayList();
+       
+                       while(use.hasNext())
+                       {
+                               String vocab = (String)use.next();
+                               getExternalInstance().getCompletions(
+                                       vocab,word,completions,anywhere);
+                       }
+                       
+                       Collections.sort(completions,
+                               new MiscUtilities.StringICaseCompare());
+       
+                       return completions;
+               }
+               catch(Exception e)
+               {
+                       throw new RuntimeException(e);
                }
-               
-               Collections.sort(completions,
-                       new MiscUtilities.StringICaseCompare());
-
-               return completions;
        } //}}}
-
+       
        //{{{ getCompletions() method
-       private static void getCompletions(FactorInterpreter interp,
-               String vocab, String word, List completions, boolean anywhere)
+       /**
+        * @param anywhere If true, matches anywhere in the word name are
+        * returned; otherwise, only matches from beginning.
+        */
+       public static List getCompletions(Cons use, String word, boolean anywhere)
        {
-               FactorNamespace v = interp.getVocabulary(vocab);
-               if(v == null)
-                       return;
-
-               Cons words = v.toValueList();
-
-               while(words != null)
+               try
                {
-                       FactorWord w = (FactorWord)words.car;
-                       if(w != null && w.name != null)
+                       List completions = new ArrayList();
+       
+                       while(use != null)
                        {
-                               if(!completions.contains(w))
-                               {
-                                       if(anywhere)
-                                       {
-                                               if(w.name.indexOf(word) != -1)
-                                                       completions.add(w);
-                                       }
-                                       else
-                                       {
-                                               if(w.name.startsWith(word))
-                                                       completions.add(w);
-                                       }
-                               }
+                               String vocab = (String)use.car;
+                               getExternalInstance().getCompletions(
+                                       vocab,word,completions,anywhere);
+                               use = use.next();
                        }
-
-                       words = words.next();
+                       
+                       Collections.sort(completions,
+                               new MiscUtilities.StringICaseCompare());
+       
+                       return completions;
+               }
+               catch(Exception e)
+               {
+                       throw new RuntimeException(e);
                }
        } //}}}
        
@@ -382,31 +356,37 @@ public class FactorPlugin extends EditPlugin
 
        //{{{ findAllWordsNamed() method
        private static FactorWord[] findAllWordsNamed(View view, String word)
+               throws Exception
        {
                ArrayList words = new ArrayList();
-               Cons vocabs = getInterpreter().vocabularies.toValueList();
-               while(vocabs != null)
+               Iterator vocabs = getExternalInstance().getVocabularies();
+               while(vocabs.hasNext())
                {
-                       FactorNamespace vocab = (FactorNamespace)vocabs.car;
-                       FactorWord w = (FactorWord)vocab.getVariable(word);
+                       Map vocab = (Map)vocabs.next();
+                       FactorWord w = (FactorWord)vocab.get(word);
                        if(w != null)
                                words.add(w);
-                       vocabs = vocabs.next();
                }
-               return (FactorWord[])words.toArray(
-                       new FactorWord[words.size()]);
+               return (FactorWord[])words.toArray(new FactorWord[words.size()]);
        } //}}}
 
        //{{{ insertUseDialog() method
        public static void insertUseDialog(View view, String word)
        {
-               FactorWord[] words = findAllWordsNamed(view,word);
-               if(words.length == 0)
-                       view.getToolkit().beep();
-               else if(words.length == 1)
-                       insertUse(view,words[0].vocabulary);
-               else
-                       new InsertUseDialog(view,getSideKickParser(),words);
+               try
+               {
+                       FactorWord[] words = findAllWordsNamed(view,word);
+                       if(words.length == 0)
+                               view.getToolkit().beep();
+                       else if(words.length == 1)
+                               insertUse(view,words[0].vocabulary);
+                       else
+                               new InsertUseDialog(view,getSideKickParser(),words);
+               }
+               catch(Exception e)
+               {
+                       throw new RuntimeException(e);
+               }
        } //}}}
 
        //{{{ insertUse() method
index edd0dcee5a07d157c8d570d138d3b0b4c5e6dc31..8f4a18e95cae18011c1f32d436ab563c758e4f7d 100644 (file)
@@ -47,7 +47,6 @@ factor.completion.plain=: <b>{0}</b>
 factor.completion.defer=DEFER: <b>{0}</b>
 factor.completion.parsing=PARSING: <b>{0}</b>
 factor.completion.stack=: <b>{0}</b> {1}
-factor.completion.shuffle=~&lt;&lt; <b>{0}</b> {1} &gt;&gt;~
 factor.completion.symbol=SYMBOL: <b>{0}</b>
 
 # Dialog boxes
index 4a22ed9a204508ff04a2331de4b69fcb76b2a138..264f199360768a2448774dd62d84d51d30d3ca5f 100644 (file)
@@ -194,8 +194,7 @@ public class FactorShell extends Shell
                        }
                        catch(IOException e)
                        {
-                               /* We don't care */
-                               Log.log(Log.ERROR,this,e);
+                               throw new RuntimeException(e);
                        }
 
                        stream = null;
index 72ad3902a7e06a72606a7b46a16faa661d62283d..ca18a5a1c8830c819c342952f4940f8ca7936e77 100644 (file)
@@ -40,7 +40,6 @@ import sidekick.*;
 
 public class FactorSideKickParser extends SideKickParser
 {
-       private FactorInterpreter interp;
        private WordPreview wordPreview;
        private Map previewMap;
 
@@ -55,17 +54,10 @@ public class FactorSideKickParser extends SideKickParser
        public FactorSideKickParser()
        {
                super("factor");
-               interp = FactorPlugin.getInterpreter();
                previewMap = new HashMap();
                worddefs = new HashMap();
        } //}}}
 
-       //{{{ getInterpreter() method
-       public FactorInterpreter getInterpreter()
-       {
-               return interp;
-       } //}}}
-
        //{{{ getWordDefinition() method
        /**
         * Check for a word definition from a parsed source file. If one is
@@ -143,7 +135,7 @@ public class FactorSideKickParser extends SideKickParser
                                new BufferedReader(new StringReader(text)),
                                errorSource);
                        FactorReader r = new FactorReader(scanner,
-                               false,false,interp);
+                               false,FactorPlugin.getExternalInstance());
 
                        Cons parsed = r.parse();
 
index a9881bb68ff3348f8e5cb5892fbb2ba81036925d..773f003343c8f29903c5151de7105e970af2de99 100644 (file)
@@ -30,7 +30,6 @@
 package factor.jedit;
 
 import factor.Cons;
-import factor.FactorInterpreter;
 import factor.FactorReader;
 import javax.swing.text.AttributeSet;
 import java.io.*;
@@ -46,9 +45,8 @@ public class FactorStream
        /**
         * We are given a socket that points to a bare REPL.
         */
-       public FactorStream(Socket socket, FactorInterpreter interp) throws IOException
+       public FactorStream(Socket socket) throws IOException
        {
-               this.interp = interp;
                this.socket = socket;
                this.in = new DataInputStream(socket.getInputStream());
                this.out = new DataOutputStream(socket.getOutputStream());
@@ -79,7 +77,7 @@ public class FactorStream
                        int len = in.readInt();
                        byte[] request = new byte[len];
                        in.readFully(request);
-                       return new WritePacket(new String(request,0,len),interp);
+                       return new WritePacket(new String(request,0,len));
                case -1:
                        return null;
                default:
@@ -114,7 +112,6 @@ public class FactorStream
        private Socket socket;
        private DataInputStream in;
        private DataOutputStream out;
-       private FactorInterpreter interp;
        //}}}
        
        //{{{ Packet class
@@ -132,13 +129,13 @@ public class FactorStream
        //{{{ WritePacket class
        public static class WritePacket extends Packet
        {
-               public WritePacket(String input, FactorInterpreter interp)
+               public WritePacket(String input)
                        throws Exception
                {
                        FactorReader parser = new FactorReader(
                                "parseObject()",
                                new BufferedReader(new StringReader(input)),
-                               true,false,interp);
+                               true,FactorPlugin.getExternalInstance());
                        Cons pair = parser.parse();
 
                        this.write = (String)pair.car;
index 8df13a843b3cad608f1dd9152f1b53adf39d5ebb..ae5372705b776ef5b2ed9810ef5680728f866c3e 100644 (file)
@@ -37,8 +37,8 @@ import org.gjt.sp.jedit.*;
 public class FactorWordRenderer extends DefaultListCellRenderer
 {
        //{{{ getWordHTMLString() method
-       public static String getWordHTMLString(FactorInterpreter interp,
-               FactorWord word, FactorWordDefinition def, boolean showIn)
+       public static String getWordHTMLString(FactorWord word,
+               FactorWordDefinition def, boolean showIn)
        {
                String prop = "factor.completion.plain";
                String stackEffect = null;
@@ -50,28 +50,13 @@ public class FactorWordRenderer extends DefaultListCellRenderer
                        else
                                prop = "factor.completion.defer";
                }
-               else if(def instanceof FactorShuffleDefinition)
-               {
-                       prop = "factor.completion.shuffle";
-                       StringBuffer buf = new StringBuffer();
-                       Cons d = def.toList(interp);
-                       while(d != null)
-                       {
-                               if(buf.length() != 0)
-                                       buf.append(' ');
-
-                               buf.append(d.car);
-                               d = d.next();
-                       }
-                       stackEffect = buf.toString();
-               }
                else if(def instanceof FactorSymbolDefinition)
                {
                        prop = "factor.completion.symbol";
                }
                else
                {
-                       Cons d = def.toList(interp);
+                       Cons d = def.toList();
                        if(d != null && d.car instanceof FactorDocComment)
                        {
                                FactorDocComment comment = (FactorDocComment)
@@ -129,8 +114,7 @@ public class FactorWordRenderer extends DefaultListCellRenderer
                        return this;
 
                FactorWord word = (FactorWord)value;
-               setText(getWordHTMLString(parser.getInterpreter(),
-                       word,
+               setText(getWordHTMLString(word,
                        parser.getWordDefinition(word),
                        showIn));
 
index cf2c885c554a1c274c6b465aef55e76c0c010fa9..0468832ae9003122a2d856ac04286a915ca1af5b 100644 (file)
@@ -31,6 +31,7 @@ package factor.jedit;
 
 import factor.*;
 import java.awt.event.*;
+import java.io.IOException;
 import java.util.*;
 import javax.swing.event.*;
 import javax.swing.Timer;
@@ -115,14 +116,21 @@ public class WordPreview implements ActionListener, CaretListener
                                return;
 
                        FactorParsedData fdata = (FactorParsedData)data;
-                       FactorInterpreter interp = fdata.parser
-                               .getInterpreter();
-                       FactorWord w = interp.searchVocabulary(fdata.use,word);
-                       if(w != null)
+
+                       try
+                       {
+                               FactorWord w = FactorPlugin.getExternalInstance()
+                                       .searchVocabulary(fdata.use,word);
+                               if(w != null)
+                               {
+                                       view.getStatus().setMessageAndClear(
+                                               FactorWordRenderer.getWordHTMLString(
+                                               w,fdata.parser.getWordDefinition(w),true));
+                               }
+                       }
+                       catch(IOException e)
                        {
-                               view.getStatus().setMessageAndClear(
-                                       FactorWordRenderer.getWordHTMLString(
-                                       interp,w,fdata.parser.getWordDefinition(w),true));
+                               throw new RuntimeException(e);
                        }
                }
        } //}}}
index 193c6c6e2789aaf14844cdf9add6eedc158671e0..a1ff0120bfacf79ca70da9fe6a54446e0280aea8 100644 (file)
@@ -38,12 +38,11 @@ public class Bar extends FactorParsingDefinition
         * A new definition.
         */
        public Bar(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
                FactorReader.ParseState state = reader.getCurrentState();
index 97fac331efa9161e0db76e2c8a5b1e4efb6c3797..c3131e81ccb659371142c8f7c2d6b4188dc7420c 100644 (file)
@@ -40,16 +40,15 @@ public class Base extends FactorParsingDefinition
         * A new definition.
         */
        public Base(FactorWord word, int base)
-               throws Exception
        {
                super(word);
                this.base = base;
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
-               Number num = FactorJava.toNumber(
+               Number num = FactorLib.toNumber(
                        reader.getScanner().next(true,false,base));
                reader.append(num);
        }
index 385a8004809f9d2170aeffb7e63be3cb339f04e2..13d0822dd0485e1efc73af083d85717a13914899 100644 (file)
@@ -38,12 +38,11 @@ public class BeginVector extends FactorParsingDefinition
         * A new definition.
         */
        public BeginVector(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
        {
                reader.pushState(word,null);
        }
index 14a209789274cf464ea4348571e1640ec3b6115c..10c941da506d6dedbe321292bb2ec5d77e54e877 100644 (file)
@@ -38,12 +38,11 @@ public class Bra extends FactorParsingDefinition
         * A new definition.
         */
        public Bra(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
        {
                reader.pushState(word,null);
        }
index 385d25af04aedf669aeabf0b39319184986ff211..9e28c83bc95675f68e9ad5d4181251477ded62a8 100644 (file)
@@ -39,12 +39,11 @@ public class CharLiteral extends FactorParsingDefinition
         * A new definition.
         */
        public CharLiteral(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws IOException, FactorParseException
        {
                FactorScanner scanner = reader.getScanner();
index e34ad46b34cad0622efc6d72eab52f3d803f1e35..77ca29f808691a1bb6768beced24ba43cb1e4b92 100644 (file)
@@ -41,19 +41,18 @@ public class ComplexLiteral extends FactorParsingDefinition
         * A new definition.
         */
        public ComplexLiteral(FactorWord word, String end)
-               throws Exception
        {
                super(word);
                this.end = end;
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
                // Read two numbers
-               Number real = FactorJava.toNumber(
+               Number real = FactorLib.toNumber(
                        reader.nextNonEOL(true,false));
-               Number imaginary = FactorJava.toNumber(
+               Number imaginary = FactorLib.toNumber(
                        reader.nextNonEOL(true,false));
 
                // Read the end
index 45a68d2df05c76bd06e35c322037b3dd418b04ef..b80d0b574d7ae07fa589e816af6f4775e2730521 100644 (file)
@@ -38,12 +38,11 @@ public class Def extends FactorParsingDefinition
         * A new definition.
         */
        public Def(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
                FactorWord newWord = reader.nextWord(true);
index ac8382fed1f266e61525336e2e048a675cd573c9..46418d603b6370dda094d785f13635efade1cdf7 100644 (file)
@@ -38,12 +38,11 @@ public class Defer extends FactorParsingDefinition
         * A new definition.
         */
        public Defer(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
                reader.nextWord(true);
index 7632d815eb496d6fe7ae3bc5d34c911f49bd282a..8aa7581787b0aa428f347744a0bef6c65bedaadf 100644 (file)
@@ -40,13 +40,12 @@ public class EndVector extends FactorParsingDefinition
         * A new definition.
         */
        public EndVector(FactorWord start, FactorWord end)
-               throws Exception
        {
                super(end);
                this.start = start;
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws FactorParseException
        {
                reader.append(new FactorArray(
index 4af66b9cfe7d8592693068705e746ef83730e5cc..4c96fd7248570285c0a6e47303da98338b42fdad 100644 (file)
@@ -38,12 +38,11 @@ public class F extends FactorParsingDefinition
         * A new definition.
         */
        public F(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws FactorParseException
        {
                reader.append(null);
index 1936d3380b60d075144b85cbc082b9a761df7b3e..c092c2216c097741e6af0e6b5926d9ea635cc9d7 100644 (file)
@@ -38,13 +38,12 @@ public class In extends FactorParsingDefinition
         * A new definition.
         */
        public In(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
        //{{{ eval() method
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
                String next = (String)reader.nextNonEOL(false,false);
index 544266ea0b9cf346c2bb1714788516e5107d5b7e..cb08072c7c8e77d89a5af0002e5a69b1ff570162 100644 (file)
@@ -40,13 +40,12 @@ public class Ine extends FactorParsingDefinition
         * A new definition.
         */
        public Ine(FactorWord start, FactorWord end)
-               throws Exception
        {
                super(end);
                this.start = start;
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
                FactorReader.ParseState state = reader.popState(start,word);
index d10df15b5e384f6290af517284a8edcafe756e01..2ff1fa92d0a6a55294c21126d8fd2deb163761eb 100644 (file)
@@ -40,13 +40,12 @@ public class Ket extends FactorParsingDefinition
         * A new definition.
         */
        public Ket(FactorWord start, FactorWord end)
-               throws Exception
        {
                super(end);
                this.start = start;
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws FactorParseException
        {
                reader.append(reader.popState(start,word).first);
index 3f5f6a3243d25a3bb2b403095cb850ef85deef0c..6412e166d10d86181158b5f4527a20bd1eee75f1 100644 (file)
@@ -41,13 +41,12 @@ public class LineComment extends FactorParsingDefinition
         * A new definition.
         */
        public LineComment(FactorWord word, boolean doc)
-               throws Exception
        {
                super(word);
                this.doc = doc;
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws IOException, FactorParseException
        {
                String comment = reader.getScanner().readUntilEOL();
index dfd3abe10683a41ed0c33f7c4bcea607721723f4..c17899dffab26e59eb0413bb795080a6dac4d482 100644 (file)
@@ -39,12 +39,11 @@ public class NoParsing extends FactorParsingDefinition
         * A new definition.
         */
        public NoParsing(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
                reader.append(reader.nextWord(false));
index 226dbe526dc4e33d71ab2a509928e28c5a616572..d78f3d4d10f0ef2f07f844c4ff0ae34f923142b2 100644 (file)
@@ -38,17 +38,16 @@ public class PushWord extends FactorParsingDefinition
         * A new definition.
         */
        public PushWord(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
                FactorWord word = reader.nextWord(false);
                reader.append(new Cons(word,null));
-               reader.append(interp.searchVocabulary(
+               reader.append(reader.searchVocabulary(
                        new Cons("lists",null),"car"));
        }
 }
diff --git a/factor/parser/Shuffle.java b/factor/parser/Shuffle.java
deleted file mode 100644 (file)
index f6c7e14..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.parser;
-
-import factor.*;
-
-public class Shuffle extends FactorParsingDefinition
-{
-       private String end;
-
-       //{{{ Shuffle constructor
-       /**
-        * A new definition.
-        */
-       public Shuffle(FactorWord word, String end)
-               throws Exception
-       {
-               super(word);
-               this.end = end;
-       } //}}}
-
-       public void eval(FactorInterpreter interp, FactorReader reader)
-               throws Exception
-       {
-               // Read the word name
-               FactorWord newWord = reader.nextWord(true);
-
-               // Read the definition
-               Cons first = null, last = null;
-               for(;;)
-               {
-                       String next = (String)reader.next(false,false);
-                       if(next.equals(end))
-                               break;
-                       Cons c = new Cons(next,null);
-                       if(last != null)
-                       {
-                               last.cdr = c;
-                               last = c;
-                       }
-                       else
-                               first = last = c;
-               }
-
-               reader.append(newWord.vocabulary);
-               reader.append(newWord.name);
-               reader.append(new FactorShuffleDefinition(newWord,first));
-               reader.append(reader.intern("define",false));
-       }
-}
index 78ef702aa8cad33bf1e03f03b9ea2534a3168e42..13971c1f78131dfc0d2d0448af679c4cf734cb2e 100644 (file)
@@ -39,13 +39,12 @@ public class StackComment extends FactorParsingDefinition
         * A new definition.
         */
        public StackComment(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
-               throws IOException, FactorParseException
+       public void eval(FactorReader reader)
+               throws Exception
        {
                String comment = reader.getScanner().readUntil( '(',')',false);
                reader.append(new FactorDocComment(comment,true));
index 8d81bab100c737dc59d21ddb267e35d08dd318d5..259813cdf44c88d572f291ed91915ec2303027db 100644 (file)
@@ -41,14 +41,13 @@ public class StringLiteral extends FactorParsingDefinition
         * A new definition.
         */
        public StringLiteral(FactorWord word, boolean escapes)
-               throws Exception
        {
                super(word);
                this.escapes = escapes;
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
-               throws IOException, FactorParseException
+       public void eval(FactorReader reader)
+               throws Exception
        {
                String literal = reader.getScanner()
                        .readUntil('"','"',escapes);
index 6f94797170d45fe4ab0227cd22bf217dab9f4933..f0e7c9b1732f9c6e9262e032d5dcae38523d7494 100644 (file)
@@ -38,12 +38,11 @@ public class Symbol extends FactorParsingDefinition
         * A new definition.
         */
        public Symbol(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
                FactorWord w = reader.nextWord(true);
index 2df155eb58bc701fde099f4b7a0cd30e5629fc05..8c760433e773ee711e2f3a54f3b733c3f6a68736 100644 (file)
@@ -38,13 +38,12 @@ public class T extends FactorParsingDefinition
         * A new definition.
         */
        public T(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
-       public void eval(FactorInterpreter interp, FactorReader reader)
-               throws FactorParseException
+       public void eval(FactorReader reader)
+               throws Exception
        {
                reader.append(Boolean.TRUE);
        }
index 201d51f8d05b6adc10ef6fe79daa4ab99a582e3d..767496f3ff98906f66d19f8f3dcdf5ebf08ee62c 100644 (file)
@@ -38,13 +38,12 @@ public class Use extends FactorParsingDefinition
         * A new definition.
         */
        public Use(FactorWord word)
-               throws Exception
        {
                super(word);
        } //}}}
 
        //{{{ eval() method
-       public void eval(FactorInterpreter interp, FactorReader reader)
+       public void eval(FactorReader reader)
                throws Exception
        {
                String next = (String)reader.nextNonEOL(false,false);
diff --git a/factor/primitives/Call.java b/factor/primitives/Call.java
deleted file mode 100644 (file)
index 93319f6..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.lang.reflect.*;
-import java.util.Map;
-
-public class Call extends FactorPrimitiveDefinition
-{
-       //{{{ Call constructor
-       /**
-        * A new definition.
-        */
-       public Call(FactorWord word)
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               interp.call((Cons)interp.datastack.pop());
-       } //}}}
-}
diff --git a/factor/primitives/Coerce.java b/factor/primitives/Coerce.java
deleted file mode 100644 (file)
index 9cd1304..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-
-public class Coerce extends FactorPrimitiveDefinition
-{
-       //{{{ Coerce constructor
-       /**
-        * A new definition.
-        */
-       public Coerce(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               FactorArray datastack = interp.datastack;
-               Class type = FactorJava.toClass(datastack.pop());
-               datastack.push(FactorJava.convertToJavaType(
-                       datastack.pop(),type));
-       } //}}}
-}
diff --git a/factor/primitives/Define.java b/factor/primitives/Define.java
deleted file mode 100644 (file)
index ced0549..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-
-public class Define extends FactorPrimitiveDefinition
-{
-       //{{{ Define constructor
-       /**
-        * A new definition.
-        */
-       public Define(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               Object def = interp.datastack.pop();
-               Object w = interp.datastack.pop();
-               Object vocab = interp.datastack.pop();
-               core(interp,vocab,w,def);
-       } //}}}
-
-       //{{{ core() method
-       public static void core(FactorInterpreter interp,
-               Object vocab, Object name, Object def)
-               throws Exception
-       {
-               FactorWordDefinition definition = (FactorWordDefinition)def;
-               FactorWord word = interp.searchVocabulary(
-                       FactorJava.toString(vocab),
-                       FactorJava.toString(name));
-               word.define(definition);
-               interp.last = word;
-       } //}}}
-}
diff --git a/factor/primitives/Execute.java b/factor/primitives/Execute.java
deleted file mode 100644 (file)
index 1fa74fd..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.lang.reflect.*;
-import java.util.Set;
-import org.objectweb.asm.*;
-
-public class Execute extends FactorPrimitiveDefinition
-{
-       //{{{ Execute constructor
-       /**
-        * A new definition.
-        */
-       public Execute(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               interp.eval(interp.datastack.pop());
-       } //}}}
-}
diff --git a/factor/primitives/Ifte.java b/factor/primitives/Ifte.java
deleted file mode 100644 (file)
index 0065a17..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-
-public class Ifte extends FactorPrimitiveDefinition
-{
-       //{{{ Ifte constructor
-       /**
-        * A new definition.
-        */
-       public Ifte(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               FactorArray datastack = interp.datastack;
-               Cons f = (Cons)datastack.pop();
-               Cons t = (Cons)datastack.pop();
-               Object cond = datastack.pop();
-               if(FactorJava.toBoolean(cond))
-                       interp.call(t);
-               else
-                       interp.call(f);
-       } //}}}
-}
diff --git a/factor/primitives/InterpreterGet.java b/factor/primitives/InterpreterGet.java
deleted file mode 100644 (file)
index 76f6492..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.util.Set;
-
-public class InterpreterGet extends FactorPrimitiveDefinition
-{
-       //{{{ InterpreterGet constructor
-       /**
-        * A new definition.
-        */
-       public InterpreterGet(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               interp.datastack.push(interp);
-       } //}}}
-}
diff --git a/factor/primitives/JInvoke.java b/factor/primitives/JInvoke.java
deleted file mode 100644 (file)
index ba74613..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.lang.reflect.*;
-import java.util.Map;
-
-public class JInvoke extends FactorPrimitiveDefinition
-{
-       public boolean staticMethod;
-
-       //{{{ JInvoke constructor
-       /**
-        * A new definition.
-        */
-       public JInvoke(FactorWord word, boolean staticMethod)
-               throws Exception
-       {
-               super(word);
-               this.staticMethod = staticMethod;
-       } //}}}
-
-       //{{{ checkStatic() method
-       private void checkStatic(Method method) throws FactorRuntimeException
-       {
-               if(staticMethod)
-               {
-                       if(!Modifier.isStatic(method.getModifiers()))
-                               throw new FactorRuntimeException(
-                                       "Use jinvoke with static methods");
-               }
-               else
-               {
-                       if(Modifier.isStatic(method.getModifiers()))
-                               throw new FactorRuntimeException(
-                                       "Use jinvoke-static with static methods");
-               }
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               FactorArray datastack = interp.datastack;
-               String name = FactorJava.toString(datastack.pop());
-               Class clazz = FactorJava.toClass(datastack.pop());
-               Cons args = (Cons)datastack.pop();
-               Class[] _args = FactorJava.classNameToClassList(args);
-               Method method = clazz.getMethod(name,_args);
-
-               checkStatic(method);
-
-               Object instance;
-               if(staticMethod)
-                       instance = null;
-               else
-               {
-                       instance = FactorJava.convertToJavaType(
-                               datastack.pop(),clazz);
-               }
-
-               Object[] params = new Object[_args.length];
-
-               try
-               {
-                       for(int i = params.length - 1; i >= 0; i--)
-                       {
-                               params[i] = FactorJava.convertToJavaType(
-                                       datastack.pop(),_args[i]);
-                       }
-
-                       if(method.getReturnType() == Void.TYPE)
-                               method.invoke(instance,params);
-                       else
-                       {
-                               datastack.push(FactorJava.convertFromJavaType(
-                                       method.invoke(instance,params)));
-                       }
-               }
-               catch(FactorStackException e)
-               {
-                       throw new FactorStackException(_args.length);
-               }
-       } //}}}
-}
diff --git a/factor/primitives/JNew.java b/factor/primitives/JNew.java
deleted file mode 100644 (file)
index ea368ac..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.lang.reflect.*;
-import java.util.Map;
-
-public class JNew extends FactorPrimitiveDefinition
-{
-       //{{{ JNew constructor
-       /**
-        * A new definition.
-        */
-       public JNew(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               FactorArray datastack = interp.datastack;
-               Class clazz = FactorJava.toClass(datastack.pop());
-               Cons args = (Cons)datastack.pop();
-               Class[] _args = FactorJava.classNameToClassList(args);
-               Constructor constructor = clazz.getConstructor(_args);
-
-               Object[] params = new Object[_args.length];
-               for(int i = params.length - 1; i >= 0; i--)
-               {
-                       params[i] = FactorJava.convertToJavaType(
-                               datastack.pop(),_args[i]);
-               }
-
-               datastack.push(constructor.newInstance(params));
-       } //}}}
-}
diff --git a/factor/primitives/JVarGet.java b/factor/primitives/JVarGet.java
deleted file mode 100644 (file)
index 91ead5e..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.lang.reflect.*;
-import java.util.Map;
-
-public class JVarGet extends FactorPrimitiveDefinition
-{
-       //{{{ JVarGet constructor
-       /**
-        * A new definition.
-        */
-       public JVarGet(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               FactorArray datastack = interp.datastack;
-               String fieldName = FactorJava.toString(datastack.pop());
-               Class clazz = FactorJava.toClass(datastack.pop());
-               Field field = clazz.getField(fieldName);
-               Object obj = FactorJava.convertToJavaType(datastack.pop(),
-                       clazz);
-               datastack.push(
-                       FactorJava.convertFromJavaType(
-                       field.get(obj)));
-       } //}}}
-}
diff --git a/factor/primitives/JVarGetStatic.java b/factor/primitives/JVarGetStatic.java
deleted file mode 100644 (file)
index 76775fb..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.lang.reflect.*;
-import java.util.Map;
-
-public class JVarGetStatic extends FactorPrimitiveDefinition
-{
-       //{{{ JVarGetStatic constructor
-       /**
-        * A new definition.
-        */
-       public JVarGetStatic(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               FactorArray datastack = interp.datastack;
-               String fieldName = FactorJava.toString(datastack.pop());
-               Class clazz = FactorJava.toClass(datastack.pop());
-               Field field = clazz.getField(fieldName);
-               datastack.push(
-                       FactorJava.convertFromJavaType(
-                       field.get(null)));
-       } //}}}
-}
diff --git a/factor/primitives/JVarSet.java b/factor/primitives/JVarSet.java
deleted file mode 100644 (file)
index cf62387..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.lang.reflect.*;
-import java.util.Map;
-
-public class JVarSet extends FactorPrimitiveDefinition
-{
-       //{{{ JVarSet constructor
-       /**
-        * A new definition.
-        */
-       public JVarSet(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               FactorArray datastack = interp.datastack;
-               String fieldName = FactorJava.toString(datastack.pop());
-               Class clazz = FactorJava.toClass(datastack.pop());
-               Field field = clazz.getField(fieldName);
-               Object obj = FactorJava.convertToJavaType(datastack.pop(),
-                       clazz);
-               Object value = FactorJava.convertToJavaType(datastack.pop(),
-                       field.getType());
-               field.set(obj,value);
-       } //}}}
-}
diff --git a/factor/primitives/JVarSetStatic.java b/factor/primitives/JVarSetStatic.java
deleted file mode 100644 (file)
index 204e5ff..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.lang.reflect.*;
-import java.util.Map;
-
-public class JVarSetStatic extends FactorPrimitiveDefinition
-{
-       //{{{ JVarSetStatic constructor
-       /**
-        * A new definition.
-        */
-       public JVarSetStatic(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               FactorArray datastack = interp.datastack;
-               String fieldName = FactorJava.toString(datastack.pop());
-               Class clazz = FactorJava.toClass(datastack.pop());
-               Field field = clazz.getField(fieldName);
-               Object value = FactorJava.convertToJavaType(datastack.pop(),
-                       field.getType());
-               field.set(null,value);
-       } //}}}
-}
diff --git a/factor/primitives/Restack.java b/factor/primitives/Restack.java
deleted file mode 100644 (file)
index 2deffd8..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.util.Set;
-
-public class Restack extends FactorPrimitiveDefinition
-{
-       //{{{ Restack constructor
-       /**
-        * A new definition.
-        */
-       public Restack(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               FactorArray datastack = interp.datastack;
-               Cons list = (Cons)datastack.pop(Cons.class);
-               interp.callstack.push(datastack);
-               interp.datastack = new FactorArray(list);
-       } //}}}
-}
diff --git a/factor/primitives/Unstack.java b/factor/primitives/Unstack.java
deleted file mode 100644 (file)
index 918b646..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* :folding=explicit:collapseFolds=1: */
-
-/*
- * $Id$
- *
- * Copyright (C) 2003, 2004 Slava Pestov.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package factor.primitives;
-
-import factor.*;
-import java.util.Set;
-
-public class Unstack extends FactorPrimitiveDefinition
-{
-       //{{{ Unstack constructor
-       /**
-        * A new definition.
-        */
-       public Unstack(FactorWord word)
-               throws Exception
-       {
-               super(word);
-       } //}}}
-
-       //{{{ eval() method
-       public void eval(FactorInterpreter interp)
-               throws Exception
-       {
-               Cons unstack = interp.datastack.toList();
-               interp.datastack = (FactorArray)interp.callstack.pop();
-               interp.datastack.push(unstack);
-       } //}}}
-}
diff --git a/library/platform/jvm/arithmetic.factor b/library/platform/jvm/arithmetic.factor
deleted file mode 100644 (file)
index a6ed626..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-! :folding=indent:collapseFolds=0:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: math
-USE: combinators
-USE: kernel
-USE: logic
-USE: stack
-
-: + ( a b -- a+b )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "add"
-    jinvoke-static ; inline
-
-: - ( a b -- a-b )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "subtract"
-    jinvoke-static ; inline
-
-: * ( a b -- a*b )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "multiply"
-    jinvoke-static ; inline
-
-: / ( a b -- a/b )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "divide"
-    jinvoke-static ; inline
-
-: /i ( a b -- a/b )
-    #! Truncating division.
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "_divide"
-    jinvoke-static ; inline
-
-: /f / >float ; inline
-
-: mod ( a b -- a%b )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "mod"
-    jinvoke-static ; inline
-
-: /mod ( a b -- a/b a%b )
-    2dup /i -rot mod ;
-
-: > ( a b -- boolean )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "greater"
-    jinvoke-static ; inline
-
-: >= ( a b -- boolean )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "greaterEqual"
-    jinvoke-static ; inline
-
-: < ( a b -- boolean )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "less"
-    jinvoke-static ; inline
-
-: <= ( a b -- boolean )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "lessEqual"
-    jinvoke-static ; inline
-
-: >=< ( x y obj1 obj2 obj3 -- obj )
-    ! If x > y, pushes obj1, if x = y, pushes obj2, else obj3.
-    [
-        "float" "float"
-        "java.lang.Object" "java.lang.Object"  "java.lang.Object"
-    ]
-    "factor.FactorLib" "branch3" jinvoke-static ;
-
-: compare ( x y [ if x < y ] [ if x = y ] [ if x > y ] -- )
-    >=< call ; inline
-
-: bitand ( x y -- x&y )
-    #! Bitwise and.
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "and"
-    jinvoke-static ; inline
-
-: bitor ( x y -- x|y )
-    #! Bitwise or.
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "or"
-    jinvoke-static ; inline
-
-: bitxor ( x y -- x^y )
-    #! Bitwise exclusive or.
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "xor"
-    jinvoke-static ; inline
-
-: bitnot ( x -- ~x )
-    #! Bitwise complement.
-    [ "java.lang.Number" ]
-    "factor.math.FactorMath" "not"
-    jinvoke-static ; inline
-
-: shift ( x by -- )
-    #! Shift 'by' bits to the left.
-    [ "java.lang.Number" "int" ]
-    "factor.math.FactorMath" "shift"
-    jinvoke-static ; inline
-
-: rem ( x y -- remainder )
-    [ "double" "double" ] "java.lang.Math" "IEEEremainder"
-    jinvoke-static ; inline
-
-: round ( x to -- y )
-    dupd rem - ;
-
-: gcd ( a b -- c )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.FactorMath" "gcd" jinvoke-static ;
-
-: float>bits ( f -- bignum )
-    [ "double" ]
-    "java.lang.Double" "doubleToRawLongBits"
-    jinvoke-static >bignum ;
diff --git a/library/platform/jvm/boot-mini.factor b/library/platform/jvm/boot-mini.factor
deleted file mode 100644 (file)
index 56a6d57..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-USE: parser
-
-!!! The standard library.
-"/library/platform/jvm/kernel.factor"       run-resource ! kernel
-"/library/platform/jvm/vectors.factor"      run-resource ! vectors
-"/library/platform/jvm/stack.factor"        run-resource ! stack
-"/library/logic.factor"                     run-resource ! logic
-"/library/platform/jvm/cons.factor"         run-resource ! lists
-"/library/cons.factor"                      run-resource ! lists
-"/library/combinators.factor"               run-resource ! combinators
-"/library/platform/jvm/combinators.factor"  run-resource ! combinators
-"/library/platform/jvm/math-types.factor"   run-resource ! arithmetic
-"/library/platform/jvm/arithmetic.factor"   run-resource ! arithmetic
-"/library/math/arithmetic.factor"           run-resource ! arithmetic
-"/library/vectors.factor"                   run-resource ! vectors
-"/library/platform/jvm/stack2.factor"       run-resource ! stack
-"/library/math/math-combinators.factor"     run-resource ! arithmetic
-"/library/vector-combinators.factor"        run-resource ! vectors
-"/library/lists.factor"                     run-resource ! lists
-"/library/assoc.factor"                     run-resource ! lists
-"/library/hashtables.factor"                run-resource ! hashtables
-"/library/platform/jvm/strings.factor"      run-resource ! strings
-"/library/platform/jvm/sbuf.factor"         run-resource ! strings
-"/library/strings.factor"                   run-resource ! strings
-"/library/platform/jvm/errors.factor"       run-resource ! errors
-"/library/platform/jvm/namespaces.factor"   run-resource ! namespaces
-"/library/namespaces.factor"                run-resource ! namespaces
-"/library/list-namespaces.factor"           run-resource ! namespaces
-"/library/sbuf.factor"                      run-resource ! strings
-"/library/math/namespace-math.factor"       run-resource ! arithmetic
-"/library/continuations.factor"             run-resource ! continuations
-"/library/errors.factor"                    run-resource ! errors
-"/library/platform/jvm/vocabularies.factor" run-resource ! vocabularies
-"/library/platform/jvm/words.factor"        run-resource ! words
-"/library/words.factor"                     run-resource ! words
-"/library/format.factor"                    run-resource ! format
-"/library/platform/jvm/random.factor"       run-resource ! random
-"/library/random.factor"                    run-resource ! random
-"/library/platform/jvm/regexp.factor"       run-resource ! regexp
-"/library/stream.factor"                    run-resource ! streams
-"/library/platform/jvm/stream.factor"       run-resource ! streams
-"/library/platform/jvm/files.factor"        run-resource ! files
-"/library/stdio.factor"                     run-resource ! stdio
-"/library/extend-stream.factor"             run-resource ! streams
-"/library/platform/jvm/unparser.factor"     run-resource ! unparser
-"/library/platform/jvm/parser.factor"       run-resource ! parser
-"/library/presentation.factor"              run-resource ! presentation
-
-!!! Math library.
-"/library/platform/jvm/real-math.factor" run-resource ! real-math
-"/library/math/constants.factor"         run-resource ! math
-"/library/math/math.factor"              run-resource ! math
-"/library/math/pow.factor"               run-resource ! math
-
-!!! Development tools.
-"/library/platform/jvm/processes.factor"   run-resource ! processes
-"/library/vocabulary-style.factor"         run-resource ! style
-"/library/prettyprint.factor"              run-resource ! prettyprint
-"/library/platform/jvm/prettyprint.factor" run-resource ! prettyprint
-"/library/tools/listener.factor"           run-resource ! listener
-"/library/tools/inspector.factor"          run-resource ! inspector
-"/library/tools/word-tools.factor"         run-resource ! inspector
-"/library/platform/jvm/debugger.factor"    run-resource ! debugger
-"/library/tools/debugger.factor"           run-resource ! debugger
-
-!!! Final initialization...
-"/library/init.factor"                     run-resource ! init
-"/library/platform/jvm/init.factor"        run-resource ! init
diff --git a/library/platform/jvm/boot-sumo.factor b/library/platform/jvm/boot-sumo.factor
deleted file mode 100644 (file)
index 1c9616a..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-USE: parser
-
-!!! The standard library.
-"/library/platform/jvm/kernel.factor"       run-resource ! kernel
-"/library/platform/jvm/vectors.factor"      run-resource ! vectors
-"/library/platform/jvm/stack.factor"        run-resource ! stack
-"/library/logic.factor"                     run-resource ! logic
-"/library/platform/jvm/cons.factor"         run-resource ! lists
-"/library/cons.factor"                      run-resource ! lists
-"/library/combinators.factor"               run-resource ! combinators
-"/library/platform/jvm/combinators.factor"  run-resource ! combinators
-"/library/platform/jvm/math-types.factor"   run-resource ! arithmetic
-"/library/platform/jvm/arithmetic.factor"   run-resource ! arithmetic
-"/library/math/arithmetic.factor"           run-resource ! arithmetic
-"/library/vectors.factor"                   run-resource ! vectors
-"/library/platform/jvm/stack2.factor"       run-resource ! stack
-"/library/math/math-combinators.factor"     run-resource ! arithmetic
-"/library/vector-combinators.factor"        run-resource ! vectors
-"/library/lists.factor"                     run-resource ! lists
-"/library/assoc.factor"                     run-resource ! lists
-"/library/hashtables.factor"                run-resource ! hashtables
-"/library/platform/jvm/strings.factor"      run-resource ! strings
-"/library/platform/jvm/sbuf.factor"         run-resource ! strings
-"/library/strings.factor"                   run-resource ! strings
-"/library/platform/jvm/errors.factor"       run-resource ! errors
-"/library/platform/jvm/namespaces.factor"   run-resource ! namespaces
-"/library/namespaces.factor"                run-resource ! namespaces
-"/library/list-namespaces.factor"           run-resource ! namespaces
-"/library/sbuf.factor"                      run-resource ! strings
-"/library/math/namespace-math.factor"       run-resource ! arithmetic
-"/library/continuations.factor"             run-resource ! continuations
-"/library/errors.factor"                    run-resource ! errors
-"/library/platform/jvm/vocabularies.factor" run-resource ! vocabularies
-"/library/platform/jvm/words.factor"        run-resource ! words
-"/library/words.factor"                     run-resource ! words
-"/library/format.factor"                    run-resource ! format
-"/library/platform/jvm/random.factor"       run-resource ! random
-"/library/random.factor"                    run-resource ! random
-"/library/platform/jvm/regexp.factor"       run-resource ! regexp
-"/library/stream.factor"                    run-resource ! streams
-"/library/platform/jvm/stream.factor"       run-resource ! streams
-"/library/platform/jvm/files.factor"        run-resource ! files
-"/library/stdio.factor"                     run-resource ! stdio
-"/library/extend-stream.factor"             run-resource ! streams
-"/library/platform/jvm/unparser.factor"     run-resource ! unparser
-"/library/platform/jvm/parser.factor"       run-resource ! parser
-"/library/presentation.factor"              run-resource ! presentation
-"/library/platform/jvm/threads.factor"      run-resource ! threads
-"/library/logging.factor"                   run-resource ! logging
-
-!!! Math library.
-"/library/platform/jvm/real-math.factor" run-resource ! real-math
-"/library/math/constants.factor"         run-resource ! math
-"/library/math/math.factor"              run-resource ! math
-"/library/math/pow.factor"               run-resource ! math
-"/library/math/trig-hyp.factor"          run-resource ! math
-"/library/math/arc-trig-hyp.factor"      run-resource ! math
-
-!!! Development tools.
-"/library/platform/jvm/processes.factor"   run-resource ! processes
-"/library/stdio-binary.factor"             run-resource ! stdio
-"/library/vocabulary-style.factor"         run-resource ! style
-"/library/prettyprint.factor"              run-resource ! prettyprint
-"/library/files.factor"                    run-resource ! files
-"/library/platform/jvm/prettyprint.factor" run-resource ! prettyprint
-"/library/tools/listener.factor"           run-resource ! listener
-"/library/tools/inspector.factor"          run-resource ! inspector
-"/library/tools/word-tools.factor"         run-resource ! inspector
-"/library/platform/jvm/debugger.factor"    run-resource ! debugger
-"/library/tools/debugger.factor"           run-resource ! debugger
-"/library/test/test.factor"                run-resource ! test
-"/library/ansi.factor"                     run-resource ! ansi
-"/library/tools/telnetd.factor"            run-resource ! telnetd
-
-!!! Java -> native VM image cross-compiler.
-"/library/tools/image.factor"                 run-resource ! cross-compiler
-"/library/tools/cross-compiler.factor"        run-resource ! cross-compiler
-"/library/platform/jvm/cross-compiler.factor" run-resource ! cross-compiler
-
-!!! Final initialization...
-"/library/init.factor"              run-resource ! init
-"/library/platform/jvm/init.factor" run-resource ! init
-
-!!! jEdit integration.
-"/library/jedit/jedit-local.factor"  run-resource ! jedit
-"/library/jedit/jedit-remote.factor" run-resource ! jedit
-"/library/jedit/jedit.factor"        run-resource ! jedit
-"/library/jedit/console.factor"      run-resource ! console
diff --git a/library/platform/jvm/boot.factor b/library/platform/jvm/boot.factor
deleted file mode 100644 (file)
index f2891f0..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-!!! Minimum amount of words needed to be able to read other
-!!! resources.
-
-USE: combinators
-
-IN: stack
-
-~<< dup A -- A A >>~
-~<< swap A B -- B A >>~
-
-IN: streams
-
-: <breader> ( reader -- breader )
-    #! Wrap a Reader in a BufferedReader.
-    [ "java.io.Reader" ] "java.io.BufferedReader" jnew ;
-
-: <ireader> ( inputstream -- breader )
-    #! Wrap a InputStream in an InputStreamReader.
-    [ "java.io.InputStream" ] "java.io.InputStreamReader" jnew ;
-
-: <rreader> ( path -- inputstream )
-    #! Create a Reader for reading the specified resource from
-    #! the classpath.
-    "factor.FactorInterpreter"
-    [ "java.lang.String" ]
-    "java.lang.Class" "getResourceAsStream" jinvoke
-    <ireader> <breader> ;
-
-IN: strings
-
-: cat2 ( str str -- str )
-    #! Concatenate two strings.
-    swap
-    [ "java.lang.String" ] "java.lang.String" "concat" jinvoke ;
-
-IN: parser
-
-: parse* ( parser -- list )
-    #! Reads until EOF.
-    [ ] "factor.FactorReader" "parse" jinvoke ;
-
-: <parser> ( filename reader -- parser )
-    #! Creates a parser with the default vocabularies:
-    #! IN: user
-    #! USE: user USE: builtins
-    interpreter
-    [
-        "java.lang.String"
-        "java.io.BufferedReader"
-        "factor.FactorInterpreter"
-    ]
-    "factor.FactorReader" jnew ;
-
-: parse-stream ( filename reader -- list )
-    #! Reads until end-of-file from the reader, building a parse
-    #! tree. The filename is used for error reporting.
-    <parser> parse* ;
-
-: parse-resource ( resource -- list )
-    dup <rreader> swap "resource:" swap cat2 swap parse-stream ;
-
-: run-resource ( path -- )
-    #! Reads and runs a source file from a resource path.
-    parse-resource call ;
-
-!!!
-
-IN: init DEFER: boot
-
-interpreter "factor.FactorInterpreter" "mini" jvar-get [
-    "/library/platform/jvm/boot-mini.factor" run-resource
-] [
-    "/library/platform/jvm/boot-sumo.factor" run-resource
-] ifte
-
-boot
diff --git a/library/platform/jvm/combinators.factor b/library/platform/jvm/combinators.factor
deleted file mode 100644 (file)
index 1846d0a..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: combinators
-USE: kernel
-USE: lists
-USE: stack
-
-! These are DEPRECATED!
-
-: expand ( list -- list )
-    #! Evaluates a quotation on a new stack, and pushes the
-    #! reversed stack onto the original stack.
-    #!
-    #! This combinator will not compile.
-    unit
-    restack
-        call
-    unstack ;
diff --git a/library/platform/jvm/cons.factor b/library/platform/jvm/cons.factor
deleted file mode 100644 (file)
index aae8c9c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: lists USE: kernel USE: stack
-
-: array>list ( array -- list )
-    #! Convert an array into a proper list.
-    [ [ "java.lang.Object" ] ] "factor.Cons" "fromArray"
-    jinvoke-static ;
-
-: car ( [ car | cdr ] -- car )
-    #! Push the head of a list.
-    "factor.Cons" "car" jvar-get ; inline
-
-: cdr ( [ car | cdr ] -- cdr )
-    #! Push the tail of a list. In a proper list, the tail is
-    #! always a cons cell or f; in an improper list, the tail
-    #! can be anything.
-    "factor.Cons" "cdr" jvar-get ; inline
-
-: cons ( car cdr -- [ car , cdr ] )
-    #! Push a new cons cell. If the cdr is f or a proper list,
-    #! has the effect of prepending the car to the cdr.
-    [ "java.lang.Object" "java.lang.Object" ] "factor.Cons" jnew
-    ; inline
-
-: cons? ( list -- boolean )
-    #! Test for cons cell type.
-    "factor.Cons" is ; inline
diff --git a/library/platform/jvm/cross-compiler.factor b/library/platform/jvm/cross-compiler.factor
deleted file mode 100644 (file)
index 5f9ff4a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-! :folding=none:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: image
-USE: combinators
-USE: kernel
-USE: lists
-USE: math
-USE: parser
-USE: stack
-USE: stdio
-USE: streams
-USE: strings
-USE: vectors
-USE: vectors
-USE: words
-
-: worddef, ( word -- )
-    dup compound-or-compiled? [
-        dup word-of-worddef swap compound>list compound,
-    ] [
-        drop
-    ] ifte ;
-
-: cross-compile ( quot -- )
-    [ dup worddef? [ worddef, ] [ drop ] ifte ] each ;
-
-: cross-compile-resource ( resource -- )
-    parse-resource cross-compile ;
diff --git a/library/platform/jvm/debugger.factor b/library/platform/jvm/debugger.factor
deleted file mode 100644 (file)
index 23cad04..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: errors
-USE: combinators
-USE: kernel
-USE: namespaces
-USE: prettyprint
-USE: stack
-USE: stdio
-
-: error. ( error -- str ) print ;
-
-: exception? ( exception -- boolean )
-    "java.lang.Throwable" is ;
-
-: print-stack-trace ( exception -- )
-    [ ] "java.lang.Throwable" "printStackTrace" jinvoke ;
-
-: :j ( -- )
-    #! Print the stack trace from the last exception.
-    "error" get dup exception? [
-        print-stack-trace
-    ] [
-        "Not an exception: " write .
-    ] ifte ;
diff --git a/library/platform/jvm/errors.factor b/library/platform/jvm/errors.factor
deleted file mode 100644 (file)
index 9b19d45..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: errors
-USE: kernel
-USE: stack
-USE: strings
-
-DEFER: save-error
-DEFER: rethrow
-
-: throw ( error -- )
-    #! Throw an error that will be caught by a surrounding
-    #! catch block.
-    dup save-error rethrow ;
-
-: catchstack* ( -- cs )
-    interpreter
-    "factor.FactorInterpreter" "catchstack" jvar-get ;
-
-: set-catchstack* ( cs -- )
-    interpreter
-    "factor.FactorInterpreter" "catchstack" jvar-set ;
-
-: catchstack ( -- cs ) catchstack* clone ;
-: set-catchstack ( cs -- ) clone set-catchstack* ;
diff --git a/library/platform/jvm/files.factor b/library/platform/jvm/files.factor
deleted file mode 100644 (file)
index f808306..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: files
-USE: combinators
-USE: kernel
-USE: lists
-USE: logic
-USE: stack
-USE: strings
-USE: namespaces
-
-: <file> ( path -- file )
-    dup "java.io.File" is not [
-        [ "java.lang.String" ] "java.io.File" jnew
-    ] when ;
-
-: delete ( file -- ? )
-    #! Delete a file.
-    <file> [ ] "java.io.File" "delete" jinvoke ;
-
-: exists? ( file -- boolean )
-    <file> [ ] "java.io.File" "exists" jinvoke ;
-
-: directory? ( file -- boolean )
-    <file> [ ] "java.io.File" "isDirectory" jinvoke ;
-
-: directory ( file -- listing )
-    <file> [ ] "java.io.File" "list" jinvoke array>list str-sort ;
-
-: rename ( from to -- ? )
-    ! Rename file 'from' to 'to'. These can be paths or
-    ! java.io.File instances.
-    <file> swap <file>
-    [ "java.io.File" ] "java.io.File" "renameTo"
-    jinvoke ;
-
-: file-length ( file -- size )
-    <file> [ ] "java.io.File" "length" jinvoke ;
-
-: cwd ( -- dir )
-    global [ "cwd" get ] bind ;
-
-: cd ( dir --)
-    global [ "cwd" set ] bind ;
-
-global [ "user.dir" system-property "cwd" set ] bind
diff --git a/library/platform/jvm/init.factor b/library/platform/jvm/init.factor
deleted file mode 100644 (file)
index f04dd03..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: init
-USE: combinators
-USE: continuations
-USE: kernel
-USE: lists
-USE: listener
-USE: namespaces
-USE: parser
-USE: stack
-USE: stdio
-USE: streams
-USE: strings
-USE: presentation
-USE: words
-
-: stdin ( -- stdin )
-    "java.lang.System" "in"  jvar-static-get
-    <ireader> <breader> ;
-
-: stdout ( -- stdout )
-    "java.lang.System" "out" jvar-static-get <owriter> ;
-
-: init-stdio ( -- )
-    #! Initialize standard input/output.
-    stdin stdout <char-stream> <stdio-stream> "stdio" set ;
-
-: init-environment ( -- )
-    #! Initialize OS-specific constants.
-    "user.home" system-property "~" set
-    "file.separator" system-property "/" set ;
-
-: boot ( -- )
-    #! The boot word is run by the intepreter when starting from
-    #! an object database.
-
-    ! Some flags are *on* by default, unless user specifies
-    ! -no-<flag> CLI switch
-    t "user-init" set
-
-    init-stdio
-    init-environment
-    init-search-path
-    "args" get parse-command-line
-    run-user-init
-
-    t "startup-done" set
-    
-    "interactive" get [ init-listener 1 exit* ] when ;
diff --git a/library/platform/jvm/kernel.factor b/library/platform/jvm/kernel.factor
deleted file mode 100644 (file)
index 213308b..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: words
-
-: word ( -- word )
-    ! Pushes most recently defined word.
-    interpreter "factor.FactorInterpreter" "last" jvar-get ;
-
-IN: kernel
-
-: inline ;
-
-: hashcode ( obj -- hashcode )
-    #! If two objects are =, they must have equal hashcodes.
-    [ ] "java.lang.Object" "hashCode" jinvoke ;
-
-: eq? ( a b -- ? )
-    #! Returns true if a and b are the same object.
-    [ "java.lang.Object" "java.lang.Object" ]
-    "factor.FactorLib" "eq" jinvoke-static ;
-
-: = ( a b -- ? )
-    #! Push t if a is isomorphic to b.
-    [ "java.lang.Object" "java.lang.Object" ]
-    "factor.FactorLib" "equal" jinvoke-static ;
-
-: class-of* ( obj -- class )
-    [ ] "java.lang.Object" "getClass" jinvoke ;
-
-: class-of ( obj -- class )
-    class-of* [ ] "java.lang.Class" "getName" jinvoke ;
-
-: is ( obj class -- boolean )
-    ! Like "instanceof" in Java.
-    [ "java.lang.Object" ] "java.lang.Class" "isInstance"
-    jinvoke ;
-
-: clone ( obj -- obj )
-    [ ] "factor.PublicCloneable" "clone" jinvoke ;
-
-: toplevel ( -- )
-    interpreter
-    [ ] "factor.FactorInterpreter" "topLevel" jinvoke ;
-
-: exit* ( code -- )
-    [ "int" ] "java.lang.System" "exit" jinvoke-static ;
-
-: garbage-collection ( -- )
-    [ ] "java.lang.System" "gc" jinvoke-static ;
-
-IN: math
-DEFER: >bignum
-
-IN: kernel
-
-: millis ( -- millis )
-    ! Pushes the current time, in milliseconds.
-    [ ] "java.lang.System" "currentTimeMillis" jinvoke-static
-    >bignum ;
-
-: system-property ( name -- value )
-    [ "java.lang.String" ] "java.lang.System" "getProperty"
-    jinvoke-static ;
-
-: java? t ;
-: native? f ;
-: version "factor.FactorInterpreter" "VERSION" jvar-static-get ;
-
-: jvm-runtime ( -- java.lang.Runtime )
-    #! Return the java.lang.Runtime object for the JVM
-    f "java.lang.Runtime" "getRuntime" jinvoke-static ;
-
-: free-memory ( -- int )
-  #! Return the free memory in the JVM.
-  jvm-runtime f "java.lang.Runtime" "freeMemory" jinvoke
-  >bignum ;
-
-: total-memory ( -- int )
-  #! Return the total memory available to the JVM.
-  jvm-runtime f "java.lang.Runtime" "totalMemory" jinvoke
-  >bignum ;
-
-: room free-memory total-memory ;
-
-: resource ( path -- url )
-    interpreter class-of*
-    [ "java.lang.String" ]
-    "java.lang.Class" "getResource" jinvoke ;
-
-: cpu "jvm" ;
diff --git a/library/platform/jvm/math-types.factor b/library/platform/jvm/math-types.factor
deleted file mode 100644 (file)
index 3e55933..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-! :folding=indent:collapseFolds=0:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: math
-USE: combinators
-USE: kernel
-USE: logic
-USE: stack
-
-: number? "java.lang.Number" is ; inline
-: >number "java.lang.Number" coerce ; inline
-
-: fixnum? "java.lang.Integer" is ; inline
-: >fixnum "int" coerce ; inline
-
-: bignum? "java.math.BigInteger" is ; inline
-: >bignum "java.math.BigInteger" coerce ; inline
-
-: ratio? "factor.math.Ratio" is ; inline
-
-: numerator ( x/y -- x )
-    dup ratio? [
-        "factor.math.Ratio" "numerator" jvar-get
-    ] [
-        >number
-    ] ifte ;
-
-: denominator ( x/y -- y )
-    dup ratio? [
-        "factor.math.Ratio" "denominator" jvar-get
-    ] [
-        >number drop 1
-    ] ifte ;
-
-: float? ( obj -- boolean )
-    dup  "java.lang.Float"  is
-    swap "java.lang.Double" is or ; inline
-: >float "double" coerce ; inline
-
-: complex? "factor.math.Complex" is ; inline
-
-: real ( complex -- real )
-    dup complex? [
-        "factor.math.Complex" "real" jvar-get
-    ] [
-        >number
-    ] ifte ;
-
-: imaginary ( complex -- imaginary )
-    dup complex? [
-        "factor.math.Complex" "imaginary" jvar-get
-    ] [
-        >number drop 0
-    ] ifte ;
-
-: rect> ( real imaginary -- complex )
-    [ "java.lang.Number" "java.lang.Number" ]
-    "factor.math.Complex" "valueOf" jinvoke-static ;
-
-: >rect ( complex -- real imaginary )
-    dup complex? [
-        dup
-        "factor.math.Complex" "real" jvar-get
-        swap
-        "factor.math.Complex" "imaginary" jvar-get
-    ] [
-        >number 0
-    ] ifte ;
diff --git a/library/platform/jvm/namespaces.factor b/library/platform/jvm/namespaces.factor
deleted file mode 100644 (file)
index 3de6e95..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: namespaces
-USE: combinators
-USE: kernel
-USE: lists
-USE: logic
-USE: stack
-USE: strings
-USE: vectors
-
-DEFER: namespace
-
-: namestack* ( -- stack )
-    #! Push the namespace stack.
-    interpreter
-    "factor.FactorInterpreter" "namestack" jvar-get ; inline
-
-: set-namestack* ( stack -- )
-    #! Set the namespace stack.
-    interpreter
-    "factor.FactorInterpreter" "namestack" jvar-set ; inline
-
-: >n ( namespace -- n:namespace )
-    #! Push a namespace on the namespace stack.
-    namestack* vector-push ; inline
-
-: n> ( n:namespace -- namespace )
-    #! Pop the top of the namespace stack.
-    namestack* vector-pop ; inline
-
-: namestack ( -- stack )
-    namestack* clone ; inline
-
-: set-namestack ( stack -- )
-    clone set-namestack* ; inline
-
-: global ( -- namespace )
-    interpreter "factor.FactorInterpreter" "global" jvar-get ;
-
-: set-global ( namespace -- )
-    interpreter "factor.FactorInterpreter" "global" jvar-set ;
-
-: get* ( variable namespace -- value )
-    #! Pushes the value of a variable in an explicitly-specified
-    #! namespace.
-    [ "java.lang.String" ]
-    "factor.FactorNamespace" "getVariable" jinvoke ; inline
-
-: get ( variable -- value )
-    #! Pushes the value of a variable.
-    interpreter
-    [ "java.lang.String" ]
-    "factor.FactorInterpreter" "getVariable" jinvoke ; inline
-
-: put* ( variable value namespace -- )
-    #! Sets the value of a variable in an explicitly-specified
-    #! namespace.
-    [ "java.lang.String" "java.lang.Object" ]
-    "factor.FactorNamespace" "setVariable" jinvoke ; inline
-
-: put ( variable value -- )
-    #! Set the value of a variable in the current namespace.
-    namespace put* ; inline
-
-: set ( value variable -- )
-    #! Set the value of a variable in the current namespace.
-    swap put ; inline
-
-: set* ( value variable namespace -- )
-    swapd put* ; inline
-
-: <namespace> ( -- namespace )
-    [ ] "factor.FactorNamespace" jnew ;
-
-: <objnamespace> ( object -- namespace )
-    [ "java.lang.Object" ] "factor.FactorNamespace" jnew ;
-
-: namespace-of ( obj -- namespace )
-    [ "java.lang.Object" ] "factor.FactorJava" "toNamespace"
-    jinvoke-static ;
-
-: bind ( namespace quot -- )
-    #! Execute a quotation with a namespace on the namestack.
-    swap namespace-of >n call n> drop ; inline
-
-: has-namespace? ( a -- boolean )
-    "factor.FactorObject" is ; inline
-
-: import ( class pairs -- )
-    #! Import some static variables from a Java class into the
-    #! current namespace.
-    namespace [ "java.lang.String" "factor.Cons" ]
-    "factor.FactorNamespace" "importVars"
-    jinvoke ;
-
-: namespace? ( a -- boolean )
-    "factor.FactorNamespace" is ; inline
-
-: this ( -- object )
-    ! Returns the object bound to the current namespace, or if
-    ! no object is bound, the namespace itself.
-    namespace dup
-    [ ] "factor.FactorNamespace" "getThis" jinvoke dup rot ?
-    ; inline
-
-: vars ( -- list )
-    namespace [ ] "factor.FactorNamespace" "toVarList"
-    jinvoke ;
-
-: vars-values ( -- list )
-    namespace [ ] "factor.FactorNamespace" "toVarValueList"
-    jinvoke ;
-
-: values ( -- list )
-    namespace [ ] "factor.FactorNamespace" "toValueList"
-    jinvoke ;
diff --git a/library/platform/jvm/parser.factor b/library/platform/jvm/parser.factor
deleted file mode 100644 (file)
index 415a6b8..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: parser
-USE: combinators
-USE: errors
-USE: namespaces
-USE: stack
-USE: streams
-USE: strings
-
-: parse-file ( file -- list )
-    dup <freader> parse-stream ;
-
-: run-file ( path -- )
-    parse-file call ;
-
-: parse-resource* ( resource -- list )
-    dup <rreader> swap "resource:" swap cat2 swap parse-stream ;
-
-: parse-resource ( resource -- list )
-     #! Override this to be slightly more useful for development.
-    global [ "resource-path" get ] bind dup [
-        swap cat2 parse-file
-    ] [
-        drop parse-resource*
-    ] ifte ;
-
-: <custom-parser> ( filename reader interactive docs -- parser )
-    interpreter
-    [
-        "java.lang.String"
-        "java.io.BufferedReader"
-        "boolean"
-        "boolean"
-        "factor.FactorInterpreter"
-    ]
-    "factor.FactorReader" jnew ;
-
-: interactive-parse-stream ( filename reader -- list )
-    #! Reads until end-of-file from the reader, building a parse
-    #! tree. The filename is used for error reporting.
-    #!
-    #! This form should be used by the outer interpreter only.
-    #! Its default vocabularies are:
-    #! global [ "use" get ] bind
-    #! global [ "in" get  ] bind
-    f t <custom-parser> parse* ;
-
-: (run-file) ( path -- )
-    dup <freader> interactive-parse-stream call ;
-
-: parse ( str -- list )
-    #! Parse a string using an interactive parser.
-    "<interactive>" swap <sreader> <breader> interactive-parse-stream ;
-
-: eval ( "X" -- X )
-    parse call ;
-
-: eval-catch ( str -- )
-    [ eval ] [ [ default-error-handler drop ] when* ] catch ;
-
-: parse-number* ( str base -- num )
-    #! Convert a string to a number. Return f if conversion
-    #! fails.
-    [ "java.lang.String" "int" ]
-    "factor.math.NumberParser"
-    "parseNumber"
-    jinvoke-static ;
-
-: parse-number 10 parse-number* ;
-
-: not-a-number "Not a number" throw ;
-
-: base> ( str base -- num )
-    #! Convert a string to a number. Throw an error if
-    #! conversion fails.
-    parse-number* [ not-a-number ] unless* ;
-
-: bin> 2 base> ;
-: oct> 8 base> ;
-: dec> 10 base> ;
-: hex> 16 base> ;
-: str>number dec> ;
diff --git a/library/platform/jvm/prettyprint.factor b/library/platform/jvm/prettyprint.factor
deleted file mode 100644 (file)
index 83d2335..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: prettyprint
-USE: combinators
-USE: lists
-USE: math
-USE: prettyprint
-USE: stack
-USE: stdio
-USE: unparser
-USE: words
-
-: prettyprint-:; ( indent word list -- indent )
-    over >r >r dup
-    >r dupd prettyprint-IN: prettyprint-: r>
-    prettyprint-word prettyprint-space
-    r>
-    prettyprint-list prettyprint-; r> prettyprint-plist ;
-
-: prettyprint-~<< ( indent -- indent )
-    "~<<" write prettyprint-space
-    tab-size + ;
-
-: prettyprint->>~ ( indent -- indent )
-    ">>~" write
-    tab-size - ;
-
-: prettyprint-~<<>>~ ( indent word list -- indent )
-    >r >r prettyprint-~<< r> prettyprint-word " " write r>
-    [ write " " write ] each
-    prettyprint->>~ ;
-
-: see ( word -- )
-    0 swap
-    dup worddef
-    [
-        [ compound-or-compiled? ] [ word-parameter prettyprint-:; ]
-        [ shuffle? ] [ word-parameter prettyprint-~<<>>~ ]
-        [ primitive? ] [ "PRIMITIVE: " write unparse write drop ]
-        [ symbol? ] [ "SYMBOL: " write drop unparse write ]
-        [ drop t ] [ 2drop "Not defined" write ]
-    ] cond prettyprint-newline ;
diff --git a/library/platform/jvm/processes.factor b/library/platform/jvm/processes.factor
deleted file mode 100644 (file)
index 991369d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: processes
-USE: files
-USE: kernel
-USE: streams
-USE: stack
-
-: exec ( args -- exitCode )
-    cwd
-    [
-        [ "java.lang.String" ] "java.lang.String"
-    ] "factor.FactorLib" "exec"
-    jinvoke-static ;
-
-: (pipe) ( args -- process )
-    jvm-runtime
-    [ [ "java.lang.String" ] ]
-    "java.lang.Runtime" "exec" jinvoke ;
-
-: close-stderr ( process -- )
-    [ ] "java.lang.Process" "getErrorStream" jinvoke
-    close-java-stream ;
-
-: pipe ( args -- stream )
-    #! Start a process, and return a stream for communicating
-    #! with it.
-    (pipe) dup close-stderr
-    dup [ ] "java.lang.Process" "getInputStream" jinvoke
-    swap [ ] "java.lang.Process" "getOutputStream" jinvoke
-    <byte-stream> ;
diff --git a/library/platform/jvm/random.factor b/library/platform/jvm/random.factor
deleted file mode 100644 (file)
index c5feab7..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-! :folding=indent:collapseFolds=0:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: random
-
-: random-angle ( -- theta )
-    [ ] "factor.math.FactorMath"
-    "randomAngle" jinvoke-static ;
-
-: random-boolean ( -- boolean )
-    [ ] "factor.math.FactorMath"
-    "randomBoolean" jinvoke-static ;
-
-: random-float ( min max scale -- random )
-    [ "int" "int" "float" ] "factor.math.FactorMath"
-    "randomFloat" jinvoke-static ;
-
-: random-int ( min max -- random )
-    [ "int" "int" ] "factor.math.FactorMath"
-    "randomInt" jinvoke-static ;
diff --git a/library/platform/jvm/real-math.factor b/library/platform/jvm/real-math.factor
deleted file mode 100644 (file)
index 393b03b..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-! :folding=indent:collapseFolds=0:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-!!! This file defines words that call methods in the
-!!! java.lang.Math class. These work with real arguments only,
-!!! and should not be called directly, use the words in the
-!!! 'math' vocabulary instead.
-
-IN: real-math
-USE: kernel
-USE: math
-USE: stack
-
-: facos ( x -- acos )
-    [ "double" ] "java.lang.Math" "acos"
-    jinvoke-static ; inline
-
-: fasin ( x -- asin )
-    [ "double" ] "java.lang.Math" "asin"
-    jinvoke-static ; inline
-
-: fatan ( x -- atan )
-    [ "double" ] "java.lang.Math" "atan"
-    jinvoke-static ; inline
-
-: fatan2 ( y x -- atan2 )
-    [ "double" "double" ] "java.lang.Math" "atan2"
-    jinvoke-static ; inline
-
-: fcos ( x -- cos )
-    [ "double" ] "java.lang.Math" "cos"
-    jinvoke-static ; inline
-
-: fexp ( x -- exp )
-    [ "double" ] "java.lang.Math" "exp"
-    jinvoke-static ; inline
-
-: fcosh ( x -- cosh )
-    fexp dup recip + 2 / ;
-
-: flog ( x -- exp )
-    [ "double" ] "java.lang.Math" "log"
-    jinvoke-static ; inline
-
-: fpow ( x y -- x^y )
-    [ "double" "double" ] "java.lang.Math" "pow"
-    jinvoke-static ; inline
-
-: fsin ( x -- sin )
-    [ "double" ] "java.lang.Math" "sin"
-    jinvoke-static ; inline
-
-: fsinh ( x -- cosh )
-    fexp dup recip - 2 / ;
-
-: fsqrt ( x -- sqrt x )
-    [ "double" ] "java.lang.Math" "sqrt"
-    jinvoke-static ; inline
diff --git a/library/platform/jvm/regexp.factor b/library/platform/jvm/regexp.factor
deleted file mode 100644 (file)
index 8a6635a..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: regexp
-USE: combinators
-USE: kernel
-USE: logic
-USE: lists
-USE: math
-USE: stack
-
-: <regex> ( pattern -- regex )
-    #! Compile the regex, if its not already compiled.
-    dup "java.util.regex.Pattern" is not [
-        [ "java.lang.String" ]
-        "java.util.regex.Pattern" "compile"
-        jinvoke-static
-    ] when ;
-
-: <matcher> ( string pattern -- matcher )
-    [ "java.lang.CharSequence" ]
-    "java.util.regex.Pattern" "matcher"
-    jinvoke ;
-
-: re-matches* ( matcher -- boolean )
-    [ ] "java.util.regex.Matcher" "matches"
-    jinvoke ;
-
-: re-matches ( input regex -- boolean )
-    <regex> <matcher> re-matches* ;
-
-: [re-matches] ( matcher code -- boolean )
-    #! If the matcher's re-matches* function returns true,
-    #! evaluate the code with the matcher at the top of the
-    #! stack. Otherwise, pop the matcher off the stack and
-    #! push f.
-    >r dup re-matches* r> [ drop f ] ifte ;
-
-: re-replace* ( replace matcher -- string )
-    [ "java.lang.String" ] "java.util.regex.Matcher"
-    "replaceAll" jinvoke ;
-
-: re-replace ( input regex replace -- string )
-    #! Replaces all occurrences of the regex in the input string
-    #! with the replace string.
-    -rot <regex> <matcher> re-replace* ;
-
-: re-split ( string split -- list )
-    <regex> [ "java.lang.CharSequence" ]
-    "java.util.regex.Pattern" "split" jinvoke array>list ;
-
-: group ( index match -- )
-    [ "int" ] "java.util.regex.Matcher" "group"
-    jinvoke ;
-
-: group-count ( matcher -- count )
-    [ ] "java.util.regex.Matcher" "groupCount"
-    jinvoke ;
-
-: groups* ( matcher -- list )
-    [
-        [
-            dup group-count [
-                succ over group swap
-            ] times* drop
-        ] cons expand
-    ] [re-matches] ;
-
-: groups ( input regex -- list )
-    <regex> <matcher> groups* ;
-
-: group1 ( string regex -- string )
-    groups dup [ car ] when ;
diff --git a/library/platform/jvm/sbuf.factor b/library/platform/jvm/sbuf.factor
deleted file mode 100644 (file)
index d4151a2..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-! :folding=indent:collapseFolds=0:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: strings
-USE: kernel
-USE: stack
-
-: sbuf? ( obj -- ? )
-    "java.lang.StringBuffer" is ;
-
-: <sbuf> ( capacity -- StringBuffer )
-    [ "int" ] "java.lang.StringBuffer" jnew ;
-
-: sbuf-append ( str buf -- )
-    [ "java.lang.String" ] "java.lang.StringBuffer" "append"
-    jinvoke drop ;
-
-: sbuf-nth ( index sbuf -- char )
-    [ "int" ] "java.lang.StringBuffer" "charAt" jinvoke ;
-
-: set-sbuf-nth ( char index sbuf -- )
-    swapd
-    [ "int" "char" ] "java.lang.StringBuffer" "setCharAt" jinvoke ;
-
-: sbuf-length ( sbuf -- length )
-    [ ] "java.lang.StringBuffer" "length" jinvoke ;
-
-: set-sbuf-length ( length sbuf -- )
-    [ "int" ] "java.lang.StringBuffer" "setLength" jinvoke ;
-
-: sbuf>str ( sbuf -- str )
-    >str ;
-
-: sbuf-reverse ( sbuf -- )
-    #! Destructively reverse a string buffer.
-    [ ] "java.lang.StringBuffer" "reverse" jinvoke drop ;
-
-: str>sbuf ( str -- sbuf )
-    dup str-length <sbuf> tuck sbuf-append ;
-
-: str-reverse ( str -- str )
-    str>sbuf dup sbuf-reverse sbuf>str ;
diff --git a/library/platform/jvm/stack.factor b/library/platform/jvm/stack.factor
deleted file mode 100644 (file)
index 114d154..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: stack
-USE: kernel
-USE: vectors
-
-~<< drop              A --             >>~
-~<< 2drop           A B --             >>~
-~<< 2dup            A B -- A B A B     >>~
-~<< dupd            A B -- A A B       >>~
-~<< 2dupd       A B C D -- A B A B C D >>~
-~<< nip             A B -- B           >>~
-~<< 2nip        A B C D -- C D         >>~
-~<< nop                 --             >>~ ! Does nothing!
-~<< over            A B -- A B A       >>~
-~<< 2over       A B C D -- A B C D A B >>~
-~<< pick          A B C -- A B C A     >>~ ! Not the Forth pick!
-~<< rot           A B C -- B C A       >>~
-~<< 2rot    A B C D E F -- C D E F A B >>~
-~<< -rot          A B C -- C A B       >>~
-~<< 2-rot   A B C D E F -- E F A B C D >>~
-~<< 2swap       A B C D -- C D A B     >>~
-~<< swapd         A B C -- B A C       >>~
-~<< 2swapd  A B C D E F -- C D A B E F >>~
-~<< transp        A B C -- C B A       >>~
-~<< 2transp A B C D E F -- E F C D A B >>~
-~<< tuck            A B -- B A B       >>~
-~<< 2tuck       A B C D -- C D A B C D >>~
-
-~<< 3drop         A B C --             >>~
-~<< 3dup          A B C -- A B C A B C >>~
-
-~<< >r        A -- r:A             >>~
-~<< r>      r:A -- A               >>~
-
-: apply-shuffle ( ds cs shuffle -- )
-    interpreter swap
-    [
-        "factor.FactorInterpreter"
-        "factor.FactorArray"
-        "factor.FactorArray"
-    ]
-    "factor.FactorShuffleDefinition" "eval" jinvoke ;
diff --git a/library/platform/jvm/stack2.factor b/library/platform/jvm/stack2.factor
deleted file mode 100644 (file)
index f19a8a6..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: stack
-USE: combinators
-USE: kernel
-USE: vectors
-
-: datastack* ( -- datastack )
-    interpreter "factor.FactorInterpreter" "datastack" jvar-get ;
-
-: datastack ( -- datastack )
-    datastack* clone ;
-
-: set-datastack* ( datastack -- ... )
-    interpreter "factor.FactorInterpreter" "datastack" jvar-set ;
-
-: set-datastack ( datastack -- ... )
-    clone set-datastack* ;
-
-: callstack* ( -- callstack )
-    interpreter "factor.FactorInterpreter" "callstack" jvar-get ;
-
-: callstack ( -- callstack )
-    callstack*
-    ! When 'clone' is interpreted, 'call' pushes a call frame
-    ! which is replaced by 'clone' due to tail call optimization.
-    ! When 'clone' is compiled, 'call' pushes a call frame, which
-    ! is not affected by 'clone'.
-    ! In both cases, the call stack has a frame from 'call' and
-    ! a frame from 'callstack', and we pop both off so that
-    ! callstack pushes the callstack as it was in the calling
-    ! word.
-    [ clone ] call
-    dup vector-pop drop
-    dup vector-pop drop ;
-
-: set-callstack* ( callstack -- ... )
-    interpreter "factor.FactorInterpreter" "callstack" jvar-set ;
-
-: set-callstack ( callstack -- ... )
-    clone set-callstack* ;
-
-: clear ( -- )
-    #! Clear the datastack. For interactive use only; invoking
-    #! this from a word definition will clobber any values left
-    #! on the data stack by the caller.
-    datastack* vector-clear ;
-
-: depth ( -- n )
-    #! Push the number of elements on the datastack.
-    datastack vector-length ;
diff --git a/library/platform/jvm/stream.factor b/library/platform/jvm/stream.factor
deleted file mode 100644 (file)
index 2afa5ad..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: streams
-USE: combinators
-USE: errors
-USE: kernel
-USE: lists
-USE: logic
-USE: namespaces
-USE: stack
-USE: strings
-
-: close-java-stream ( stream -- )
-    [
-        [ "java.io.InputStream" is ] [
-            [ ] "java.io.InputStream" "close" jinvoke
-        ]
-        [ "java.io.OutputStream" is ] [
-            [ ] "java.io.OutputStream" "close" jinvoke
-        ]
-        [ "java.io.Reader" is ] [
-            [ ] "java.io.Reader" "close" jinvoke
-        ]
-        [ "java.io.Writer" is ] [
-            [ ] "java.io.Writer" "close" jinvoke
-        ]
-    ] cond ;
-
-: fcopy ( from to -- )
-    #! Copy the contents of the byte-stream 'from' to the
-    #! byte-stream 'to'.
-    >r [ "in" get ] bind r>
-    [ "out" get ] bind
-    [ "java.io.InputStream" "java.io.OutputStream" ]
-    "factor.FactorLib" "copy" jinvoke-static ;
-
-! These are in separate words so that they can be compiled.
-! Do not call them directly.
-
-: <byte-stream>/freadln ( -- string )
-    "in" get
-    [ "java.io.InputStream" ] "factor.FactorLib" "readLine"
-    jinvoke-static ;
-
-: <eof-exception> ( -- ex )
-    [ ] "java.io.EOFException" jnew ;
-
-: >char/eof ( ch -- ch )
-    dup -1 = [ drop f ] [ >char ] ifte ;
-
-: <byte-stream>/fread1 ( -- string )
-    "in" get [ ] "java.io.InputStream" "read" jinvoke
-    >char/eof ;
-
-: <byte-stream>/fread# ( count -- string )
-    "in" get
-    [ "int" "java.io.InputStream" ]
-    "factor.FactorLib" "readCount"
-    jinvoke-static ;
-
-: <byte-stream>/fwrite ( string -- )
-    dup char? [
-        "out" get
-        [ "int" ] "java.io.OutputStream" "write" jinvoke
-    ] [
-        >bytes
-        "out" get
-        [ [ "byte" ] ] "java.io.OutputStream" "write" jinvoke
-    ] ifte ;
-
-: <byte-stream>/fflush ( -- )
-    "out" get [ ] "java.io.OutputStream" "flush" jinvoke ;
-
-: <byte-stream>/fclose ( -- )
-    "in" get  [ close-java-stream ] when* 
-    "out" get [ close-java-stream ] when* ;
-
-: <bin> ( in -- in )
-    [ "java.io.InputStream" ] "java.io.BufferedInputStream" jnew ;
-
-: <bout> ( out -- out )
-    [ "java.io.OutputStream" ] "java.io.BufferedOutputStream" jnew ;
-
-: <byte-stream> ( in out -- stream )
-    #! Creates a new stream for reading from the
-    #! java.io.InputStream in, and writing to the
-    #! java.io.OutputStream out. The streams are wrapped in
-    #! buffered streams.
-    <stream> [
-        "out" set
-        "in" set
-        ( -- string )
-        [ <byte-stream>/freadln ] "freadln" set
-        ( count -- string )
-        [ <byte-stream>/fread1  ] "fread1" set
-        ( count -- string )
-        [ <byte-stream>/fread#  ] "fread#" set
-        ( string -- )
-        [ <byte-stream>/fwrite  ] "fwrite" set
-        ( -- )
-        [ <byte-stream>/fflush  ] "fflush" set
-        ( -- )
-        [ <byte-stream>/fclose  ] "fclose" set
-    ] extend ;
-
-: <char-stream>/freadln ( -- string )
-    "in" get [ ] "java.io.BufferedReader" "readLine"
-    jinvoke ;
-
-: <char-stream>/fread1 ( -- string )
-    "in" get [ ] "java.io.Reader" "read" jinvoke
-    >char/eof ;
-
-: <char-stream>/fread# ( -- string )
-    "in" get
-    [ "int" "java.io.Reader" ]
-    "factor.FactorLib" "readCount"
-    jinvoke-static ;
-
-: <char-stream>/fwrite ( string -- )
-    "out" get [ "java.lang.String" ] "java.io.Writer" "write"
-    jinvoke ;
-
-: <char-stream>/fflush ( -- )
-    "out" get [ ] "java.io.Writer" "flush" jinvoke ;
-
-: <char-stream>/fclose ( -- )
-    "in" get  [ close-java-stream ] when* 
-    "out" get [ close-java-stream ] when* ;
-
-: <char-stream> ( in out -- stream )
-    #! Creates a new stream for reading from the
-    #! java.io.BufferedReader in, and writing to the
-    #! java.io.Reader out.
-    <stream> [
-        "out" set
-        "in" set
-        ( -- string )
-        [ <char-stream>/freadln ] "freadln" set
-        ( -- string )
-        [ <char-stream>/fread1  ] "fread1" set
-        ( count -- string )
-        [ <char-stream>/fread#  ] "fread#" set
-        ( string -- )
-        [ <char-stream>/fwrite  ] "fwrite" set
-        ( -- )
-        [ <char-stream>/fflush  ] "fflush" set
-        ( -- )
-        [ <char-stream>/fclose  ] "fclose" set
-    ] extend ;
-
-: <bwriter> ( writer -- bwriter )
-    [ "java.io.Writer" ] "java.io.BufferedWriter" jnew ;
-
-: <owriter> ( outputstream -- owriter )
-    [ "java.io.OutputStream" ] "java.io.OutputStreamWriter" jnew ;
-
-: <filecr> ( path -- stream )
-    [ "java.lang.String" ] "java.io.FileReader" jnew <breader>
-    f
-    <char-stream> ;
-
-: <filecw> ( path -- stream )
-    [ "java.lang.String" ] "java.io.FileWriter" jnew <bwriter>
-    f swap
-    <char-stream> ;
-
-: <filebr> ( path -- stream )
-    [ "java.lang.String" ] "java.io.FileInputStream" jnew <bin>
-    f
-    <byte-stream> ;
-
-: <filebw> ( path -- stream )
-    [ "java.lang.String" ] "java.io.FileOutputStream" jnew <bout>
-    f swap
-    <byte-stream> ;
-
-: <freader> ( file -- freader )
-    [ "java.lang.String" ] "java.io.FileReader" jnew <breader> ;
-
-: <sreader> ( string -- reader )
-    [ "java.lang.String" ] "java.io.StringReader" jnew ;
-
-: <server> ( port -- stream )
-    #! Starts listening on localhost:port. Returns a stream that
-    #! you can close with fclose, and accept connections from
-    #! with accept. No other stream operations are supported.
-    [ "int" ] "java.net.ServerSocket" jnew
-    <stream> [
-        "socket" set
-
-        ( -- )
-        [
-            "socket" get [ ] "java.net.ServerSocket" "close" jinvoke
-        ] "fclose" set
-    ] extend ;
-
-: socket-closed? ( socket -- ? )
-    [ ] "java.net.Socket" "isClosed" jinvoke ;
-
-: close-socket ( socket -- )
-    [ ] "java.net.Socket" "close" jinvoke ;
-
-: ?close-socket ( socket -- )
-    dup socket-closed? [ drop ] [ close-socket ] ifte ;
-
-: <socket-stream> ( socket -- stream )
-    #! Wraps a socket inside a byte-stream.
-    dup
-    dup
-    [ ] "java.net.Socket" "getInputStream"  jinvoke <bin>
-    swap
-    [ ] "java.net.Socket" "getOutputStream" jinvoke <bout>
-    <byte-stream> [
-        dup >str "client" set "socket" set
-
-        ! We "extend" byte-stream's fclose.
-        ( -- )
-        "fclose" get [
-            "socket" get ?close-socket
-        ] append "fclose" set
-    ] extend ;
-
-: <client> ( server port -- stream )
-    #! Open a TCP/IP socket to a port on the given server.
-    [ "java.lang.String" "int" ] "java.net.Socket" jnew
-    <socket-stream> ;
-
-: accept ( server -- client )
-    #! Accept a connection from a server socket.
-    [ "socket" get ] bind
-    [ ] "java.net.ServerSocket" "accept" jinvoke <socket-stream> ;
-
-: <resource-stream> ( path -- stream )
-    <rreader> f <char-stream> ;
diff --git a/library/platform/jvm/strings.factor b/library/platform/jvm/strings.factor
deleted file mode 100644 (file)
index 1e03765..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-! :folding=indent:collapseFolds=0:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: strings
-USE: combinators
-USE: kernel
-USE: logic
-USE: stack
-
-: char? ( obj -- boolean )
-    "java.lang.Character" is ;
-
-: >char ( obj -- char )
-    "char" coerce ; inline
-
-: string? ( obj -- ? )
-    dup char? swap "java.lang.String" is or ;
-
-: str-length ( str -- length )
-    [ ] "java.lang.String" "length" jinvoke ;
-
-: substring ( start end str -- str )
-    [ "int" "int" ] "java.lang.String" "substring"
-    jinvoke ;
-
-: >str ( obj -- string )
-    ! Returns the Java string representation of this object.
-    [ ] "java.lang.Object" "toString" jinvoke ;
-
-: >bytes ( string -- array )
-    ! Converts a string to an array of ASCII bytes. An exception
-    ! is thrown if the string contains non-ASCII characters.
-    "ASCII" swap
-    [ "java.lang.String" ] "java.lang.String" "getBytes"
-    jinvoke ;
-
-: str-nth ( index str -- char )
-    [ "int" ] "java.lang.String" "charAt" jinvoke ;
-
-: >lower ( str -- str )
-    [ ] "java.lang.String" "toLowerCase" jinvoke ;
-
-: >upper ( str -- str )
-    [ ] "java.lang.String" "toUpperCase" jinvoke ;
-
-: index-of* ( index string substring -- index )
-    dup char? [
-        -rot
-        ! Why is the first parameter an int and not a char?
-        [ "int" "int" ]
-        "java.lang.String" "indexOf"
-        jinvoke
-    ] [
-        -rot
-        [ "java.lang.String" "int" ]
-        "java.lang.String" "indexOf"
-        jinvoke
-    ] ifte ;
-
-: str-compare ( str1 str2 -- n )
-    swap [ "java.lang.String" ] "java.lang.String" "compareTo"
-    jinvoke ;
diff --git a/library/platform/jvm/threads.factor b/library/platform/jvm/threads.factor
deleted file mode 100644 (file)
index 119aca2..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: threads
-
-USE: combinators
-USE: continuations
-USE: errors
-USE: kernel
-USE: stack
-
-: <thread> ( runnable -- thread )
-    [ "java.lang.Runnable" ] "java.lang.Thread" jnew ;
-
-: current-thread ( -- thread )
-    [ ] "java.lang.Thread" "currentThread" jinvoke-static ;
-
-: start-thread ( thread -- )
-    [ ] "java.lang.Thread" "start" jinvoke ;
-
-: clone-interpreter ( interp1 interp2 -- )
-    #! Copy the state of interp1 into interp2.
-    [ "factor.FactorInterpreter" ]
-    "factor.FactorInterpreter"
-    "init" jinvoke ;
-
-: <interpreter> ( -- interpreter )
-    #! Clone the current interpreter. Note that it will be
-    #! pointing to exactly the same point of execution!
-    [ ] "factor.FactorInterpreter" jnew ;
-
-: fork* ( current new -- thread )
-    dup <thread> >r clone-interpreter r> ;
-
-: fork ( -- ? )
-    #! Spawn a new thread. In the original thread, push f.
-    #! In the new thread, push t.
-    interpreter <interpreter> fork* dup current-thread = [
-        drop t
-    ] [
-        start-thread f
-    ] ifte ;
-
-: in-thread ( quot -- )
-    #! Execute a quotation in a new thread.
-    fork [
-        [ call ] [ default-error-handler toplevel ] catch
-    ] [
-        drop
-    ] ifte ;
diff --git a/library/platform/jvm/unparser.factor b/library/platform/jvm/unparser.factor
deleted file mode 100644 (file)
index 6dde00b..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: unparser
-USE: kernel
-USE: strings
-USE: stack
-
-: unparse ( X -- "X" )
-    [ "java.lang.Object" ] "factor.FactorReader" "unparseObject"
-    jinvoke-static ;
-
-: >base ( num radix -- string )
-    #! Convert an integer to a string in a certain base.
-    swap [ "int" ] "java.math.BigInteger" "toString" jinvoke ;
-
-: >bin ( num -- string )
-    #! Convert a number to its binary representation.
-    2 >base ;
-
-: >oct ( num -- string )
-    #! Convert a number to its octal representation.
-    8 >base ;
-
-: >hex ( num -- string )
-    #! Convert a number to its hexadecimal representation.
-    16 >base ;
diff --git a/library/platform/jvm/vectors.factor b/library/platform/jvm/vectors.factor
deleted file mode 100644 (file)
index ecf1493..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003, 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: vectors
-USE: kernel
-USE: stack
-
-: <vector> ( size -- vector )
-    [ "int" ] "factor.FactorArray" jnew ;
-
-: vector? ( obj -- ? )
-    "factor.FactorArray" is ;
-
-: vector-length ( vector -- length )
-    "factor.FactorArray" "top" jvar-get ;
-
-: set-vector-length ( vector -- length )
-    "factor.FactorArray" "top" jvar-set ;
-
-: vector-nth ( index vector -- )
-    [ "int" ] "factor.FactorArray" "get" jinvoke ;
-
-: set-vector-nth ( value index vector -- )
-    [ "java.lang.Object" "int" ]
-    "factor.FactorArray" "set" jinvoke ;
diff --git a/library/platform/jvm/vocabularies.factor b/library/platform/jvm/vocabularies.factor
deleted file mode 100644 (file)
index 22b6c48..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: words
-USE: combinators
-USE: kernel
-USE: lists
-USE: logic
-USE: namespaces
-USE: stack
-
-: search ( name list -- word )
-    #! Look up a word in the list of vocabularies.
-    swap interpreter
-    [ "factor.Cons" "java.lang.String" ]
-    "factor.FactorInterpreter"
-    "searchVocabulary" jinvoke ;
-
-: create ( name vocab -- word )
-    #! Create a word in the vocabulary.
-    swap interpreter
-    [ "java.lang.String" "java.lang.String" ]
-    "factor.FactorInterpreter"
-    "define" jinvoke ;
diff --git a/library/platform/jvm/words.factor b/library/platform/jvm/words.factor
deleted file mode 100644 (file)
index b01cc5b..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2003 Slava Pestov.
-! Copyright (C) 2004 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: words
-USE: combinators
-USE: kernel
-USE: lists
-USE: logic
-USE: namespaces
-USE: stack
-USE: strings
-
-: worddef? ( obj -- boolean )
-    "factor.FactorWordDefinition" is ;
-
-: intern ( "word" -- word )
-    #! Returns the top of the stack if it already been interned.
-    dup string? [ "use" get search ] when ;
-
-: worddef ( word -- worddef )
-    dup worddef? [
-        intern dup [ [ "def" get ] bind ] when
-    ] unless ;
-
-: word-property ( word pname -- pvalue )
-    swap [ get ] bind ;
-
-: set-word-property ( word pvalue pname -- )
-    rot [ set ] bind ;
-
-: redefine ( word def -- )
-    swap [ "def" set ] bind ;
-
-: word? ( obj -- ? )
-    "factor.FactorWord" is ;
-
-: compiled? ( worddef -- ? )
-    "factor.compiler.CompiledDefinition" is ;
-
-: compound? ( worddef -- ? )
-    "factor.FactorCompoundDefinition" is ;
-
-: compound-or-compiled? ( worddef -- ? )
-    dup compiled? swap compound? or ;
-
-: symbol? ( worddef -- ? )
-    "factor.FactorSymbolDefinition" is ;
-
-: comment? ( obj -- ? )
-    "factor.FactorDocComment" is ;
-
-: gensym ( -- word )
-    [ ] "factor.FactorWord" "gensym" jinvoke-static ;
-
-: <compound> ( word def -- worddef )
-    swap intern swap interpreter
-    [ "factor.FactorWord" "factor.Cons" "factor.FactorInterpreter" ]
-    "factor.FactorCompoundDefinition"
-    jnew ;
-
-: no-name ( list -- word )
-    ! Generates an uninternalized word and gives it a compound
-    ! definition created from the given list.
-    >r gensym dup dup r> <compound> redefine ;
-
-: primitive? ( worddef -- boolean )
-    "factor.FactorPrimitiveDefinition" is ;
-
-: shuffle? ( worddef -- boolean )
-    "factor.FactorShuffleDefinition" is ;
-
-: word-of-worddef ( worddef -- word )
-    "factor.FactorWordDefinition" "word" jvar-get ;
-
-: defined? ( obj -- ? )
-    dup word? [ worddef ] [ drop f ] ifte ;
-
-: word-parameter ( worddef -- list )
-    worddef interpreter swap
-    [ "factor.FactorInterpreter" ] "factor.FactorWordDefinition"
-    "toList" jinvoke ;
-
-: skip-docs ( list -- list )
-    dup [ dup car comment? [ cdr skip-docs ] when ] when ;
-
-: compound>list ( worddef -- list )
-    word-parameter dup [ skip-docs ] when ;
-
-: define-compound ( word def -- )
-    #! Define a compound word at runtime.
-    >r dup >r [ "vocabulary" get "name" get ] bind r> r>
-    <compound> define ;
index 53c90c64fac5f0c1061bb8bf5436285a9a4e4f70..b29e82a2849d0f01209ac78477a55b14597e11dd 100644 (file)
@@ -183,6 +183,7 @@ DEFER: word-parameter
 DEFER: set-word-parameter
 DEFER: word-plist
 DEFER: set-word-plist
+DEFER: compiled?
 
 IN: unparser
 DEFER: (unparse-float)