]> gitweb.factorcode.org Git - factor.git/commitdiff
remove JVM compiler stuff from library
authorSlava Pestov <slava@factorcode.org>
Tue, 16 Nov 2004 17:35:19 +0000 (17:35 +0000)
committerSlava Pestov <slava@factorcode.org>
Tue, 16 Nov 2004 17:35:19 +0000 (17:35 +0000)
16 files changed:
factor/jedit/FactorOptionPane.java [new file with mode: 0644]
library/combinators.factor
library/lists.factor
library/math/math-combinators.factor
library/platform/jvm/arithmetic.factor
library/platform/jvm/boot-mini.factor
library/platform/jvm/boot-sumo.factor
library/platform/jvm/combinators.factor
library/platform/jvm/compiler.factor [deleted file]
library/platform/jvm/init.factor
library/platform/jvm/kernel.factor
library/platform/jvm/stack2.factor
library/platform/jvm/test.factor [deleted file]
library/platform/jvm/threads.factor
library/platform/native/kernel.factor
library/test/test.factor

diff --git a/factor/jedit/FactorOptionPane.java b/factor/jedit/FactorOptionPane.java
new file mode 100644 (file)
index 0000000..7f1b837
--- /dev/null
@@ -0,0 +1,126 @@
+/* :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.jedit;
+
+import java.awt.event.*;
+import java.awt.Dimension;
+import javax.swing.*;
+import org.gjt.sp.jedit.browser.*;
+import org.gjt.sp.jedit.gui.RolloverButton;
+import org.gjt.sp.jedit.*;
+
+public class FactorOptionPane extends AbstractOptionPane
+{
+       //{{{ FactorOptionPane constructor
+       public FactorOptionPane()
+       {
+               super("factor");
+       } //}}} 
+       
+       //{{{ _init() method
+       protected void _init()
+       {
+               addComponent(jEdit.getProperty("options.factor.program"),
+                       createProgramField(jEdit.getProperty("factor.external.program")));
+               addComponent(jEdit.getProperty("options.factor.image"),
+                       createImageField(jEdit.getProperty("factor.external.image")));
+       } //}}}
+       
+       //{{{ _save() method
+       protected void _save()
+       {
+               jEdit.setProperty("factor.external.program",program.getText());
+               jEdit.setProperty("factor.external.image",image.getText());
+       } //}}}
+       
+       //{{{ Private members
+       private JTextField program;
+       private JTextField image;
+
+       //{{{ createProgramField() metnod
+       private JComponent createProgramField(String text)
+       {
+               program = new JTextField(text);
+               return createFieldAndButton(program);
+       } //}}}
+       
+       //{{{ createImageField() metnod
+       private JComponent createImageField(String text)
+       {
+               image = new JTextField(text);
+               return createFieldAndButton(image);
+       } //}}}
+       
+       //{{{ createFieldAndButton() metnod
+       private JComponent createFieldAndButton(JTextField field)
+       {
+               Box h = new Box(BoxLayout.X_AXIS);
+               Box v = new Box(BoxLayout.Y_AXIS);
+               v.add(Box.createGlue());
+               v.add(field);
+               Dimension size = field.getPreferredSize();
+               size.width = Integer.MAX_VALUE;
+               field.setMaximumSize(size);
+               v.add(Box.createGlue());
+               h.add(v);
+               h.add(Box.createHorizontalStrut(12));
+
+               JButton button = new RolloverButton(
+                       GUIUtilities.loadIcon("Open.png"));
+               button.setToolTipText(jEdit.getProperty("options.factor.choose"));
+               button.addActionListener(new ActionHandler(field));
+
+               h.add(button);
+               return h;
+       } //}}}
+
+       //{{{ ActionHandler class
+       class ActionHandler implements ActionListener
+       {
+               private JTextField field;
+               
+               ActionHandler(JTextField field)
+               {
+                       this.field = field;
+               }
+               
+               public void actionPerformed(ActionEvent evt)
+               {
+                       String[] paths = GUIUtilities.showVFSFileDialog(
+                               GUIUtilities.getView(FactorOptionPane.this),
+                               field.getText(),
+                               VFSBrowser.OPEN_DIALOG,
+                               false);
+                       if(paths == null)
+                               return;
+                       field.setText(paths[0]);
+               }
+       } //}}}
+}
index 8c06f0bdfdffe7602d9a0151a10b8661be83b073..c0fe2ac85284866c3a304c0b1b9780f5dfa59747 100644 (file)
@@ -31,13 +31,13 @@ USE: lists
 USE: stack
 
 : slip ( quot x -- x )
-    >r call r> ; inline interpret-only
+    >r call r> ; inline
 
 : 2slip ( quot x y -- x y )
-    >r >r call r> r> ; inline interpret-only
+    >r >r call r> r> ; inline
 
 : 3slip ( quot x y z -- x y z )
-    >r >r >r call r> r> r> ; inline interpret-only
+    >r >r >r call r> r> r> ; inline
 
 : keep ( a quot -- a )
     #! Execute the quotation with a on the stack, and restore a
@@ -80,14 +80,14 @@ USE: stack
         ] ifte
     ] [
         2drop
-    ] ifte ; interpret-only
+    ] ifte ;
 
 : ifte* ( cond true false -- )
     #! If the condition is not f, execute the 'true' quotation,
     #! with the condition on the stack. Otherwise, pop the
     #! condition and execute the 'false' quotation.
     pick [ drop call ] [ nip nip call ] ifte ;
-    inline interpret-only
+    inline
 
 : unless ( cond quot -- )
     #! Execute a quotation only when the condition is f. The
@@ -95,7 +95,7 @@ USE: stack
     #!
     #! In order to compile, the quotation must consume as many
     #! values as it produces.
-    [ ] swap ifte ; inline interpret-only
+    [ ] swap ifte ; inline
 
 : unless* ( cond quot -- )
     #! If cond is f, pop it off the stack and evaluate the
@@ -103,7 +103,7 @@ USE: stack
     #!
     #! In order to compile, the quotation must consume one less
     #! value than it produces.
-    over [ drop ] [ nip call ] ifte ; inline interpret-only
+    over [ drop ] [ nip call ] ifte ; inline
 
 : when ( cond quot -- )
     #! Execute a quotation only when the condition is not f. The
@@ -111,7 +111,7 @@ USE: stack
     #!
     #! In order to compile, the quotation must consume as many
     #! values as it produces.
-    [ ] ifte ; inline interpret-only
+    [ ] ifte ; inline
 
 : when* ( cond quot -- )
     #! If the condition is true, it is left on the stack, and
@@ -120,11 +120,11 @@ USE: stack
     #!
     #! In order to compile, the quotation must consume one more
     #! value than it produces.
-    over [ call ] [ 2drop ] ifte ; inline interpret-only
+    over [ call ] [ 2drop ] ifte ; inline
 
 : forever ( quot -- )
     #! The code is evaluated in an infinite loop. Typically, a
     #! continuation is used to escape the infinite loop.
     #!
     #! This combinator will not compile.
-    dup slip forever ; interpret-only
+    dup slip forever ;
index 747d3a7c7c8200492de91157c310bb7069b7ad22..f75f1150a520c80c6b9f8f6b925d61939aa0c395 100644 (file)
@@ -86,7 +86,7 @@ USE: vectors
         r> r> r> partition-iter
     ] [
         3drop
-    ] ifte ; inline interpret-only
+    ] ifte ; inline
 
 : partition ( ref list combinator -- list1 list2 )
     #! Compare each element in a proper list against a
@@ -96,7 +96,7 @@ USE: vectors
     #! The combinator must have stack effect:
     #! ( ref element -- ? )
     swap >r >r >r [ ] [ ] r> r> r> partition-iter ;
-    inline interpret-only
+    inline
 
 : sort ( list comparator -- sorted )
     #! Sort the elements in a proper list using a comparator.
@@ -113,7 +113,7 @@ USE: vectors
         cons append
     ] [
         drop
-    ] ifte ; inline interpret-only
+    ] ifte ; inline
 
 : num-sort ( list -- sorted )
     #! Sorts the list into ascending numerical order.
@@ -147,13 +147,13 @@ DEFER: tree-contains?
     2dup contains? [ nip ] [ cons ] ifte ;
 
 : (each) ( list quot -- list quot )
-    >r uncons r> tuck 2slip ; inline interpret-only
+    >r uncons r> tuck 2slip ; inline
 
 : each ( list quot -- )
     #! Push each element of a proper list in turn, and apply a
     #! quotation with effect ( X -- ) to each element.
     over [ (each) each ] [ 2drop ] ifte ;
-    inline interpret-only
+    inline
 
 : reverse ( list -- list )
     [ ] swap [ swons ] each ;
@@ -163,7 +163,7 @@ DEFER: tree-contains?
     #! return values of applying a quotation with effect
     #! ( X -- Y ) to each element into a new list.
     over [ (each) rot >r map r> swons ] [ drop ] ifte ;
-    inline interpret-only
+    inline
 
 : subset ( list quot -- list )
     #! Applies a quotation with effect ( X -- ? ) to each
@@ -175,7 +175,7 @@ DEFER: tree-contains?
         rot >r subset r> [ r> swons ] [ r> drop ] ifte
     ] [
         drop
-    ] ifte ; inline interpret-only
+    ] ifte ; inline
 
 : remove ( obj list -- list )
     #! Remove all occurrences of the object from the list.
index d1ee99fbe1a6b955a4c93dd5c476b1d24b986690..367e1dba331a7462792629e5cc88929f7843d122 100644 (file)
@@ -36,14 +36,14 @@ USE: stack
     #! In order to compile, the code must produce as many values
     #! as it consumes.
     tuck >r dup 0 <= [ r> 3drop ] [ pred slip r> times ] ifte ;
-    inline interpret-only
+    inline
 
 : (times) ( limit n quot -- )
     pick pick <= [
         3drop
     ] [
         rot pick succ pick 3slip (times)
-    ] ifte ; inline interpret-only
+    ] ifte ; inline
 
 : times* ( n quot -- )
     #! Evaluate a quotation n times, pushing the index at each
@@ -51,7 +51,7 @@ USE: stack
     #!
     #! In order to compile, the code must consume one more value
     #! than it produces.
-    0 swap (times) ; inline interpret-only
+    0 swap (times) ; inline
 
 : 2times-succ ( #{ a b } #{ c d } -- z )
     #! Lexicographically add #{ 0 1 } to a complex number.
index 55130dc862df7fc7d99e61cdb2497e20d5fb3d27..a6ed626879349c1cfb87b991eac8b940bdd057f4 100644 (file)
@@ -96,7 +96,7 @@ USE: stack
     "factor.FactorLib" "branch3" jinvoke-static ;
 
 : compare ( x y [ if x < y ] [ if x = y ] [ if x > y ] -- )
-    >=< call ; inline interpret-only
+    >=< call ; inline
 
 : bitand ( x y -- x&y )
     #! Bitwise and.
index 8949a0e33e907586ca35c07a178a351a94b4c808..56a6d5790cbf7d757fcf094c4a709950dbfffe83 100644 (file)
@@ -87,7 +87,6 @@ USE: parser
 "/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/compiler.factor"    run-resource ! compiler
 "/library/platform/jvm/debugger.factor"    run-resource ! debugger
 "/library/tools/debugger.factor"           run-resource ! debugger
 
index 5e2e9f682a05bf78b558116f087b373a5d936ffa..cff250600fdbc6d1c3f7f9e2b2a55a34a7f08f35 100644 (file)
@@ -93,11 +93,9 @@ USE: parser
 "/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/compiler.factor"    run-resource ! compiler
 "/library/platform/jvm/debugger.factor"    run-resource ! debugger
 "/library/tools/debugger.factor"           run-resource ! debugger
 "/library/test/test.factor"                run-resource ! test
-"/library/platform/jvm/test.factor"        run-resource ! test
 "/library/ansi.factor"                     run-resource ! ansi
 "/library/tools/telnetd.factor"            run-resource ! telnetd
 "/library/tools/inferior.factor"           run-resource ! inferior
index b2a13fc6359c1494c3669a0b7c4c959a29878532..1846d0a4e131de2dd8ca13a0c19ebf1db07fa1df 100644 (file)
@@ -40,4 +40,4 @@ USE: stack
     unit
     restack
         call
-    unstack ; interpret-only
+    unstack ;
diff --git a/library/platform/jvm/compiler.factor b/library/platform/jvm/compiler.factor
deleted file mode 100644 (file)
index c723bfe..0000000
+++ /dev/null
@@ -1,105 +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: compiler
-USE: combinators
-USE: lists
-USE: namespaces
-USE: stack
-USE: stdio
-USE: words
-
-: class-name ( class -- name )
-    [ ] "java.lang.Class" "getName" jinvoke ;
-
-: compile* ( word -- )
-    interpreter swap
-    [ "factor.FactorInterpreter" ] "factor.FactorWord" "compile"
-    jinvoke ;
-
-: compile ( word -- )
-    #! Compile a word.
-    intern dup worddef compiled? [
-        drop
-    ] [
-        compile*
-    ] ifte ;
-
-: compile-all ( -- )
-    #! Compile all words.
-    vocabs [ words [ compile ] each ] each ;
-
-: compiled>compound ( word -- def )
-    #! Convert a compiled word definition into the compound
-    #! definition which compiles to it.
-    dup word-parameter <compound> ;
-
-: decompile ( word -- )
-    #! Decompiles a word; from now on, it will be interpreted
-    #! again.
-    intern dup worddef compiled? [
-        dup compiled>compound redefine
-    ] [
-        drop
-    ] ifte ;
-
-: recompile ( word -- )
-    #! If a word is not compiled, behave like compile; otherwise
-    #! decompile the word and compile it again.
-    dup decompile compile ;
-
-: recompile-all ( -- )
-    #! Recompile all words in the dictionary.
-    vocabs [ words [ compile ] each ] each ;
-
-: effect ( word -- effect )
-    #! Push stack effect of a word.
-    interpreter swap worddef
-    [ "factor.FactorInterpreter" ] "factor.FactorWordDefinition"
-    "getStackEffect" jinvoke ;
-
-: effect>list ( effect -- list )
-    [ "inD" "outD" "inR" "outR" ]
-    [ dupd "factor.compiler.StackEffect" swap jvar-get ]
-    map nip ;
-
-: effect>typelist ( effect -- list )
-    [ "inDtypes" "outDtypes" "inRtypes" "outRtypes" ]
-    [
-        dupd "factor.compiler.StackEffect" swap jvar-get
-        array>list [ class-name ] map
-    ] map nip ;
-
-: balance ( code -- effect )
-    #! Push stack effect of a quotation.
-    no-name effect ;
-
-: balance>list ( quotation -- list )
-    balance effect>list ;
-
-: balance>typelist ( quotation -- list )
-    balance effect>typelist ;
index 4bf3fb8d9b7c353d5e88ce4486b0fd79c281d37c..f04dd0388e43980ce2afcffe340629fd431da998 100644 (file)
@@ -27,7 +27,6 @@
 
 IN: init
 USE: combinators
-USE: compiler
 USE: continuations
 USE: kernel
 USE: lists
@@ -64,7 +63,6 @@ USE: words
     ! Some flags are *on* by default, unless user specifies
     ! -no-<flag> CLI switch
     t "user-init" set
-    t "compile"   set
 
     init-stdio
     init-environment
@@ -72,10 +70,6 @@ USE: words
     "args" get parse-command-line
     run-user-init
 
-    "compile" get [
-        compile-all
-    ] when
-
     t "startup-done" set
     
     "interactive" get [ init-listener 1 exit* ] when ;
index 9d8ce95af00984be9940e275af99531f4b626e42..213308b6443ca40c24ffa542924da22284b8a308 100644 (file)
@@ -33,14 +33,7 @@ IN: words
 
 IN: kernel
 
-: inline ( -- )
-    #! Marks the most recently defined word to be inlined.
-    t word "factor.FactorWord" "inline" jvar-set ;
-
-: interpret-only ( -- )
-    #! Marks the most recently defined word as an interpret-only word;
-    #! attempting to compile it will raise an error.
-    t word "factor.FactorWord" "interpretOnly" jvar-set ;
+: inline ;
 
 : hashcode ( obj -- hashcode )
     #! If two objects are =, they must have equal hashcodes.
@@ -73,7 +66,6 @@ IN: kernel
 : toplevel ( -- )
     interpreter
     [ ] "factor.FactorInterpreter" "topLevel" jinvoke ;
-    interpret-only
 
 : exit* ( code -- )
     [ "int" ] "java.lang.System" "exit" jinvoke-static ;
index c148d666874c7a2afe8f44fe0a4d04bca4cc69da..f19a8a6cfed06c603156dc797a3ac1a832ff778b 100644 (file)
@@ -34,13 +34,13 @@ USE: vectors
     interpreter "factor.FactorInterpreter" "datastack" jvar-get ;
 
 : datastack ( -- datastack )
-    datastack* clone ; interpret-only
+    datastack* clone ;
 
 : set-datastack* ( datastack -- ... )
     interpreter "factor.FactorInterpreter" "datastack" jvar-set ;
 
 : set-datastack ( datastack -- ... )
-    clone set-datastack* ; interpret-only
+    clone set-datastack* ;
 
 : callstack* ( -- callstack )
     interpreter "factor.FactorInterpreter" "callstack" jvar-get ;
@@ -57,13 +57,13 @@ USE: vectors
     ! word.
     [ clone ] call
     dup vector-pop drop
-    dup vector-pop drop ; interpret-only
+    dup vector-pop drop ;
 
 : set-callstack* ( callstack -- ... )
     interpreter "factor.FactorInterpreter" "callstack" jvar-set ;
 
 : set-callstack ( callstack -- ... )
-    clone set-callstack* ; interpret-only
+    clone set-callstack* ;
 
 : clear ( -- )
     #! Clear the datastack. For interactive use only; invoking
diff --git a/library/platform/jvm/test.factor b/library/platform/jvm/test.factor
deleted file mode 100644 (file)
index 4302ab6..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-IN: test
-USE: combinators
-USE: compiler
-USE: namespaces
-USE: stdio
-USE: stack
-USE: test
-USE: words
-
-: must-compile ( word -- )
-    "compile" get [
-        "Checking if " write dup write " was compiled" print
-        dup compile
-        worddef compiled? assert
-    ] [
-        drop
-    ] ifte ;
index 70a3be6f177c18f3d8f90ac4f32e5a3a261ac117..119aca2bdf6ce595752fd668f55fd12c6764ee88 100644 (file)
@@ -54,7 +54,7 @@ USE: stack
     [ ] "factor.FactorInterpreter" jnew ;
 
 : fork* ( current new -- thread )
-    dup <thread> >r clone-interpreter r> ; interpret-only
+    dup <thread> >r clone-interpreter r> ;
 
 : fork ( -- ? )
     #! Spawn a new thread. In the original thread, push f.
@@ -63,7 +63,7 @@ USE: stack
         drop t
     ] [
         start-thread f
-    ] ifte ; interpret-only
+    ] ifte ;
 
 : in-thread ( quot -- )
     #! Execute a quotation in a new thread.
@@ -71,4 +71,4 @@ USE: stack
         [ call ] [ default-error-handler toplevel ] catch
     ] [
         drop
-    ] ifte ; interpret-only
+    ] ifte ;
index 06aaf46dee97b0fb021b03fb65bd1cce05f8bb0a..2b631604f2baaa61bd997d6bf21a9c0e5a68e0a0 100644 (file)
@@ -115,4 +115,3 @@ IN: kernel
 
 ! No compiler...
 : inline ;
-: interpret-only ;
index deb91a7940c205f33472d03525e91778496bd8b8..741f62a5e46261e7c60c3fff577c3df2b2ff0b32 100644 (file)
@@ -4,7 +4,6 @@
 
 IN: test
 USE: combinators
-USE: compiler
 USE: errors
 USE: kernel
 USE: lists