]> gitweb.factorcode.org Git - factor.git/commitdiff
removed unnecessary top-level-continuation stuff
authorSlava Pestov <slava@factorcode.org>
Tue, 24 Aug 2004 19:27:37 +0000 (19:27 +0000)
committerSlava Pestov <slava@factorcode.org>
Tue, 24 Aug 2004 19:27:37 +0000 (19:27 +0000)
TODO.FACTOR.txt
library/combinators.factor
library/init.factor
library/inspect-vocabularies.factor
library/interpreter.factor
library/list-namespaces.factor
library/platform/jvm/compiler.factor
library/platform/jvm/words.factor
library/platform/native/words.factor

index f1393db0785dcd1b76a4996837fed84e62905548..235c5561cdbba72a6dca97d9e01539f376702e39 100644 (file)
@@ -3,9 +3,7 @@
   (and don't hang when this happends!)\r
 - >lower, >upper for strings\r
 - telnetd should use multitasking\r
-- telnetd error handling\r
 - accept multi-line input in listener\r
-- telnetd: send errors on socket\r
 \r
 + docs:\r
 \r
 \r
 + misc:\r
 \r
-- worddef>list ==> word-parameter\r
 - alist -vs- assoc terminology\r
-- unique,\r
 - dissolve builtins vocabulary\r
-- ifte* combinator\r
 - 'cascading' styles\r
 - jedit ==> jedit-word, jedit takes a file name\r
 - some way to run httpd from command line\r
index 8bb87f793328765e63ac8c9c64443a05510efedc..5e2f418451be8236721544a30c62ba52a16dd25c 100644 (file)
@@ -95,6 +95,13 @@ USE: stack
         2drop
     ] ifte ; interpret-only
 
+: 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
+
 : interleave ( X list -- )
     #! Evaluate each element of the list with X on top of the
     #! stack. When done, X is popped off the stack.
index af60b400558a4cdef6bfce3b6351e848680dac6b..7bcdb1338deffe07da1e427c8d6f3c046f82d3d6 100644 (file)
@@ -87,9 +87,6 @@ USE: words
     #! Parse command line arguments.
     parse-switches run-files ;
 
-: init-toplevel ( -- )
-    [ "top-level-continuation" set ] callcc0 ;
-
 : (word-of-the-day) ( -- word )
     vocabs random-element words dup [
         random-element
@@ -112,13 +109,4 @@ USE: words
     word-of-the-day
     room.
 
-    init-toplevel
-
-    [
-        interpreter-loop
-    ] [
-        [
-            default-error-handler
-            "top-level-continuation" get call
-        ] when*
-    ] catch ;
+    interpreter-loop ;
index 9956eea3d0fa018e2713bc4b18e7a240f7f9f45e..c5b83e4ab4d8aae731abe0c235185540b11d7977 100644 (file)
@@ -41,7 +41,7 @@ USE: unparser
     2dup = [
         2drop f ! Don't say that a word uses itself
     ] [
-        worddef>list tree-contains?
+        word-parameter tree-contains?
     ] ifte ;
 
 : usages-in-vocab ( of vocab -- usages )
index 8e4cab26c8b2da8cb6451a722a6b05fb53c8b989..38ec813ae1838e9d5daab5ee8072ff30513dd010 100644 (file)
@@ -29,6 +29,7 @@ IN: interpreter
 USE: arithmetic
 USE: combinators
 USE: continuations
+USE: errors
 USE: kernel
 USE: lists
 USE: logic
@@ -90,9 +91,12 @@ USE: vectors
 : exit ( -- )
     "quit-flag" on ;
 
+: eval-catch ( str -- )
+    [ eval ] [ default-error-handler ] catch ;
+
 : interpret ( -- )
     print-prompt read dup [
-        dup history+ eval
+        dup history+ eval-catch
     ] [
         drop exit
     ] ifte ;
index febd2c120d82786d8c0d2d989ba3aa1ec42391a0..8cdd0e4438386536ce86f6535b4c2a350b81e23f 100644 (file)
@@ -64,6 +64,11 @@ USE: stack
     #! Append an object to the currently constructing list.
     "list-buffer" cons@ ;
 
+: unique, ( obj -- )
+    #! Append an object to the currently constructing list, only
+    #! if the object does not already occur in the list.
+    "list-buffer" unique@ ;
+
 : list, ( list -- )
     #! Append each element to the currently constructing list.
     [ , ] each ;
index 3b95cb9304c7f98911ce00529f7e1bbf254c1737..c723bfe6eab266c25eaf1a0a6f8b0f1f5e219531 100644 (file)
@@ -56,7 +56,7 @@ USE: words
 : compiled>compound ( word -- def )
     #! Convert a compiled word definition into the compound
     #! definition which compiles to it.
-    dup worddef>list <compound> ;
+    dup word-parameter <compound> ;
 
 : decompile ( word -- )
     #! Decompiles a word; from now on, it will be interpreted
index d0a63d3e18ab9926502eadd35d82984031dc90d1..994f86cf2cb7bed92f9bccc70c6958cbe0c92af4 100644 (file)
@@ -92,7 +92,7 @@ USE: stack
 : defined? ( obj -- ? )
     dup word? [ worddef ] [ drop f ] ifte ;
 
-: worddef>list ( worddef -- list )
+: word-parameter ( worddef -- list )
     worddef interpreter swap
     [ "factor.FactorInterpreter" ] "factor.FactorWordDefinition"
     "toList" jinvoke ;
@@ -101,7 +101,7 @@ USE: stack
     dup [ dup car comment? [ cdr skip-docs ] when ] when ;
 
 : compound>list ( worddef -- list )
-    worddef>list dup [ skip-docs ] when ;
+    word-parameter dup [ skip-docs ] when ;
 
 : define-compound ( word def -- )
     #! Define a compound word at runtime.
index aacac94ebc25f4858646ebc28ee2414fb83c7e22..47e6c954f22aa2db69c5e9fb3121b21e867f44fd 100644 (file)
@@ -50,7 +50,6 @@ USE: stack
 
 ! Various features not supported by native Factor.
 : comment? drop f ;
-: worddef>list word-parameter ;
 
 : word ( -- word )
     global [ "last-word" get ] bind ;