diff --git a/README.SRC.txt b/README.SRC.txt index 731db554ef..50e0f76a38 100644 --- a/README.SRC.txt +++ b/README.SRC.txt @@ -16,8 +16,8 @@ inspection of source code, as well as stack effect checking. build.xml - Ant buildfile for Java interpreter. factor/ - source code for Factor interpreter written in Java. org/objectweb/asm/ - helper library for Java interpreter. -Factor.jar - compiled, stand-alone Java interpreter library/platform/jvm - JVM-specific Factor code +Factor.jar - compiled, stand-alone Java interpreter C interpreter ------------- @@ -27,21 +27,27 @@ of achieving the highest possible flexibility/lines of code ratio. It runs faster than the Java interpreter, and uses far less memory. +Makefile - Makefile for building C interpreter. native/ - source code for Factor interpreter written in C. -native/build.sh - build script for C interpreter. -native/f - compiled C interpreter - needs image to run -native/factor.image - cross-compiler output library/platform/native - C interpreter-specific code +f - compiled C interpreter - needs image to run +boot.image.le - image for x86 +boot.image.be - image for 32-bit SPARC and 32-bit PowerPC Notes on the C interpreter -------------------------- -At the moment it assumes little endian byte order, 32-bit -words. This pretty much means x86. +When you run the interpreter with a boot image, it loads a +bunch of files and saves a 'factor.image'. Run the +interpreter again with this image. -Very soon I will add image input and output in both byte -orders - this will allow Factor to run on powerpc and -sparc. +At the moment it assumes a 32-bit architecture. Your C +compiler's types must be as follows: + +short - signed 16 bits +long - signed 32 bits +long long - signed 64 bits +double -IEEE double precision 64-bit float Moving to 64-bits would require a few changes in the image cross-compiler, namely in the way it packs strings. diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 18833ec194..d9587eda36 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -58,6 +58,7 @@ to_c_string allots too much + native: +- eliminate usage of long long - is the profiler using correct stack depth? - read1 - sbuf-hashcode @@ -82,7 +83,6 @@ to_c_string allots too much + misc: - alist -vs- assoc terminology -- dissolve builtins vocabulary - 'cascading' styles - jedit ==> jedit-word, jedit takes a file name - some way to run httpd from command line diff --git a/build.xml b/build.xml index 4ee51f0313..0fdd9b1c2e 100644 --- a/build.xml +++ b/build.xml @@ -51,6 +51,7 @@ + diff --git a/doc/tutorial/numbers-game.factor b/doc/tutorial/numbers-game.factor new file mode 100644 index 0000000000..0cb72b4894 --- /dev/null +++ b/doc/tutorial/numbers-game.factor @@ -0,0 +1,39 @@ +! Numbers game example + +IN: numbers-game +USE: kernel +USE: math +USE: parser +USE: random +USE: stdio +USE: stack + +: read-number ( -- n ) read parse-number ; + +: guess-banner + "I'm thinking of a number between 0 and 100." print ; +: guess-prompt "Enter your guess: " write ; +: too-high "Too high" print ; +: too-low "Too low" print ; +: correct "Correct - you win!" print ; + +: inexact-guess ( actual guess -- ) + < [ too-high ] [ too-low ] ifte ; + +: judge-guess ( actual guess -- ? ) + 2dup = [ + correct f + ] [ + inexact-guess t + ] ifte ; + +: number-to-guess ( -- n ) 0 100 random-int ; + +: numbers-game-loop ( actual -- ) + dup guess-prompt read-number judge-guess [ + numbers-game-loop + ] [ + drop + ] ifte ; + +: numbers-game number-to-guess numbers-game-loop ; diff --git a/doc/tutorial/timesheet.factor b/doc/tutorial/timesheet.factor new file mode 100644 index 0000000000..e3803a70c1 --- /dev/null +++ b/doc/tutorial/timesheet.factor @@ -0,0 +1,74 @@ +! Contractor timesheet example + +IN: timesheet +USE: combinators +USE: errors +USE: format +USE: kernel +USE: lists +USE: math +USE: parser +USE: stack +USE: stdio +USE: strings +USE: unparser +USE: vectors + +! Adding a new entry to the time sheet. + +: measure-duration ( -- duration ) + millis + read drop + millis swap - 1000 /i 60 /i ; + +: add-entry-prompt ( -- duration description ) + "Start work on the task now. Press ENTER when done." print + measure-duration + "Please enter a description:" print + read ; + +: add-entry ( timesheet -- ) + add-entry-prompt cons swap vector-push ; + +! Printing the timesheet. + +: hh ( duration -- str ) 60 /i ; +: mm ( duration -- str ) 60 mod unparse 2 digits ; +: hh:mm ( millis -- str ) <% dup hh % ":" % mm % %> ; + +: print-entry ( duration description -- ) + dup write + 60 swap pad-string write + hh:mm print ; + +: print-timesheet ( timesheet -- ) + "TIMESHEET:" print + [ uncons print-entry ] vector-each ; + +! Displaying a menu + +: print-menu ( menu -- ) + terpri [ cdr car print ] each terpri + "Enter a letter between ( ) to execute that action." print ; + +: menu-prompt ( menu -- ) + read swap assoc dup [ + cdr call + ] [ + "Invalid input: " swap unparse cat2 throw + ] ifte ; + +: menu ( menu -- ) + dup print-menu menu-prompt ; + +! Main menu + +: main-menu ( timesheet -- ) + [ + [ "e" "(E)xit" drop ] + [ "a" "(A)dd entry" dup add-entry main-menu ] + [ "p" "(P)rint timesheet" dup print-timesheet main-menu ] + ] menu ; + +: timesheet-app ( -- ) + 10 main-menu ; diff --git a/factor/FactorInterpreter.java b/factor/FactorInterpreter.java index cbd61c7d4a..796c0c4969 100644 --- a/factor/FactorInterpreter.java +++ b/factor/FactorInterpreter.java @@ -35,7 +35,11 @@ import java.io.*; public class FactorInterpreter implements FactorObject, Runnable { - public static final String VERSION = "0.64"; + public static final String VERSION = "0.65"; + + 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; @@ -63,18 +67,12 @@ public class FactorInterpreter implements FactorObject, Runnable /** * Vocabulary search path for interactive parser. */ - public Cons use; + public Cons use = DEFAULT_USE; /** * Vocabulary to define new words in. */ - public String in; - - /** - * Kernel vocabulary. Re-created on each startup, contains - * primitives and parsing words. - */ - public FactorNamespace builtins; + public String in = DEFAULT_IN; /** * Most recently defined word. @@ -110,7 +108,6 @@ public class FactorInterpreter implements FactorObject, Runnable this.vocabularies = interp.vocabularies; this.use = interp.use; this.in = interp.in; - this.builtins = interp.builtins; this.last = interp.last; this.global = interp.global; this.startupDone = true; @@ -148,73 +145,71 @@ public class FactorInterpreter implements FactorObject, Runnable //{{{ initBuiltinDictionary() method private void initBuiltinDictionary() throws Exception { - builtins = new FactorNamespace(); - vocabularies.setVariable("builtins",builtins); - - in = "builtins"; - use = new Cons(in,null); + vocabularies.setVariable("builtins",new FactorNamespace()); + vocabularies.setVariable("combinators",new FactorNamespace()); + vocabularies.setVariable("syntax",new FactorNamespace()); /* comments */ - FactorWord lineComment = define("builtins","!"); + FactorWord lineComment = define("syntax","!"); lineComment.parsing = new LineComment(lineComment,false); - FactorWord stackComment = define("builtins","("); + FactorWord stackComment = define("syntax","("); stackComment.parsing = new StackComment(stackComment); - FactorWord docComment = define("builtins","#!"); + FactorWord docComment = define("syntax","#!"); docComment.parsing = new LineComment(docComment,true); /* strings */ - FactorWord str = define("builtins","\""); + FactorWord str = define("syntax","\""); str.parsing = new StringLiteral(str,true); - FactorWord ch = define("builtins","CHAR:"); + FactorWord ch = define("syntax","CHAR:"); ch.parsing = new CharLiteral(ch); /* constants */ - FactorWord t = define("builtins","t"); + FactorWord t = define("syntax","t"); t.parsing = new T(t); - FactorWord f = define("builtins","f"); + FactorWord f = define("syntax","f"); f.parsing = new F(f); - FactorWord complex = define("builtins","#{"); + FactorWord complex = define("syntax","#{"); complex.parsing = new ComplexLiteral(complex,"}"); /* lists */ - FactorWord bra = define("builtins","["); + FactorWord bra = define("syntax","["); bra.parsing = new Bra(bra); - FactorWord ket = define("builtins","]"); + FactorWord ket = define("syntax","]"); ket.parsing = new Ket(bra,ket); - FactorWord bar = define("builtins","|"); + FactorWord bar = define("syntax","|"); bar.parsing = new Bar(bar); /* vectors */ - FactorWord beginVector = define("builtins","{"); + FactorWord beginVector = define("syntax","{"); beginVector.parsing = new BeginVector(beginVector); - FactorWord endVector = define("builtins","}"); + FactorWord endVector = define("syntax","}"); endVector.parsing = new EndVector(beginVector,endVector); /* word defs */ - FactorWord def = define("builtins",":"); + FactorWord def = define("syntax",":"); def.parsing = new Def(def); def.getNamespace().setVariable("doc-comments",Boolean.TRUE); - FactorWord ine = define("builtins",";"); + FactorWord ine = define("syntax",";"); ine.parsing = new Ine(def,ine); - FactorWord shuffle = define("builtins","~<<"); + FactorWord shuffle = define("syntax","~<<"); shuffle.parsing = new Shuffle(shuffle,">>~"); /* reading numbers with another base */ - FactorWord bin = define("builtins","BIN:"); + FactorWord bin = define("syntax","BIN:"); bin.parsing = new Base(bin,2); - FactorWord oct = define("builtins","OCT:"); + FactorWord oct = define("syntax","OCT:"); oct.parsing = new Base(oct,8); - FactorWord hex = define("builtins","HEX:"); + FactorWord hex = define("syntax","HEX:"); hex.parsing = new Base(hex,16); /* vocabulary parsing words */ - FactorWord noParsing = define("builtins","POSTPONE:"); + FactorWord noParsing = define("syntax","POSTPONE:"); noParsing.parsing = new NoParsing(noParsing); - FactorWord defer = define("builtins","DEFER:"); + FactorWord defer = define("syntax","DEFER:"); defer.parsing = new Defer(defer); - FactorWord in = define("builtins","IN:"); + FactorWord in = define("syntax","IN:"); in.parsing = new In(in); - FactorWord use = define("builtins","USE:"); + FactorWord use = define("syntax","USE:"); use.parsing = new Use(use); FactorWord interpreterGet = define("builtins","interpreter"); @@ -258,12 +253,12 @@ public class FactorInterpreter implements FactorObject, Runnable define.def = new Define(define); // combinators - FactorWord execute = define("builtins","execute"); + FactorWord execute = define("words","execute"); execute.def = new Execute(execute); - FactorWord call = define("builtins","call"); + FactorWord call = define("combinators","call"); call.def = new Call(call); call.inline = true; - FactorWord ifte = define("builtins","ifte"); + FactorWord ifte = define("combinators","ifte"); ifte.def = new Ifte(ifte); ifte.inline = true; } //}}} @@ -289,7 +284,6 @@ public class FactorInterpreter implements FactorObject, Runnable "args", "dump", "interactive", - "builtins", "in", "last", "use" diff --git a/factor/FactorReader.java b/factor/FactorReader.java index 8a4f910bef..95485de782 100644 --- a/factor/FactorReader.java +++ b/factor/FactorReader.java @@ -38,10 +38,6 @@ import java.util.*; */ public class FactorReader { - public static final Cons DEFAULT_USE = new Cons("builtins", - new Cons("scratchpad",null)); - public static final String DEFAULT_IN = "scratchpad"; - private FactorInterpreter interp; private FactorScanner scanner; private Cons states; @@ -265,8 +261,8 @@ public class FactorReader pushState(toplevel,null); this.alwaysDocComments = alwaysDocComments; this.interactive = interactive; - this.in = DEFAULT_IN; - this.use = DEFAULT_USE; + this.in = FactorInterpreter.DEFAULT_IN; + this.use = FactorInterpreter.DEFAULT_USE; } //}}} //{{{ getScanner() method diff --git a/library/cross-compiler.factor b/library/cross-compiler.factor index 03193a2b63..895f06d55a 100644 --- a/library/cross-compiler.factor +++ b/library/cross-compiler.factor @@ -26,6 +26,7 @@ ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IN: cross-compiler +USE: combinators USE: kernel USE: lists USE: math diff --git a/library/files.factor b/library/files.factor new file mode 100644 index 0000000000..d5026d5917 --- /dev/null +++ b/library/files.factor @@ -0,0 +1,63 @@ +! :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: lists +USE: namespaces +USE: stack +USE: strings + +: set-mime-types ( assoc -- ) + "mime-types" global set* ; + +: mime-types ( -- assoc ) + "mime-types" global get* ; + +: file-extension ( filename -- extension ) + "." split cdr dup [ last ] when ; + +: mime-type ( filename -- mime-type ) + file-extension mime-types assoc [ "text/plain" ] unless* ; + +[ + [ "html" | "text/html" ] + [ "txt" | "text/plain" ] + + [ "gif" | "image/gif" ] + [ "png" | "image/png" ] + [ "jpg" | "image/jpeg" ] + [ "jpeg" | "image/jpeg" ] + + [ "jar" | "application/octet-stream" ] + [ "zip" | "application/octet-stream" ] + [ "tgz" | "application/octet-stream" ] + [ "tar.gz" | "application/octet-stream" ] + [ "gz" | "application/octet-stream" ] + + [ "factor" | "application/x-factor" ] +] set-mime-types diff --git a/library/httpd/file-responder.factor b/library/httpd/file-responder.factor index 0b9c8c7333..261139be3f 100644 --- a/library/httpd/file-responder.factor +++ b/library/httpd/file-responder.factor @@ -30,6 +30,7 @@ USE: combinators USE: html USE: kernel USE: lists +USE: files USE: namespaces USE: parser USE: regexp @@ -41,27 +42,6 @@ USE: strings USE: httpd USE: httpd-responder -!!! Support words. -: mime-types ( -- alist ) - [ - [ "html" | "text/html" ] - [ "txt" | "text/plain" ] - - [ "gif" | "image/gif" ] - [ "png" | "image/png" ] - [ "jpg" | "image/jpeg" ] - [ "jpeg" | "image/jpeg" ] - - [ "jar" | "application/octet-stream" ] - [ "zip" | "application/octet-stream" ] - [ "tgz" | "application/octet-stream" ] - [ "tar.gz" | "application/octet-stream" ] - [ "gz" | "application/octet-stream" ] - ] ; - -: mime-type ( filename -- mime-type ) - file-extension mime-types assoc [ "text/plain" ] unless* ; - !!! Serving files. : file-header ( filename -- header ) "200 Document follows" swap mime-type response ; @@ -72,7 +52,7 @@ USE: httpd-responder !!! Serving directories. : file>html ( filename -- ... ) "
  • entities "\">" over "
  • " ; diff --git a/library/httpd/quit-responder.factor b/library/httpd/quit-responder.factor index 40c0006940..cb77914d98 100644 --- a/library/httpd/quit-responder.factor +++ b/library/httpd/quit-responder.factor @@ -26,6 +26,7 @@ ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IN: quit-responder +USE: combinators USE: namespaces USE: stdio USE: stack diff --git a/library/init.factor b/library/init.factor index 7bcdb1338d..043ea07570 100644 --- a/library/init.factor +++ b/library/init.factor @@ -87,26 +87,10 @@ USE: words #! Parse command line arguments. parse-switches run-files ; -: (word-of-the-day) ( -- word ) - vocabs random-element words dup [ - random-element - ] [ - drop (word-of-the-day) ( empty vocab ) - ] ifte ; - -: word-of-the-day ( -- ) - #! Something to entertain the poor hacker. - (word-of-the-day) dup defined? [ - "WORD OF THE DAY: " print see - ] [ - drop word-of-the-day - ] ifte ; - : init-interpreter ( -- ) init-history print-banner - word-of-the-day room. interpreter-loop ; diff --git a/library/logic.factor b/library/logic.factor index 60c953127e..db93b48b67 100644 --- a/library/logic.factor +++ b/library/logic.factor @@ -25,7 +25,10 @@ ! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -IN: logic USE: kernel USE: stack +IN: logic +USE: combinators +USE: kernel +USE: stack : ? ( cond t f -- t/f ) #! Push t if cond is true, otherwise push f. diff --git a/library/platform/jvm/boot-sumo.factor b/library/platform/jvm/boot-sumo.factor index 38ab919c7b..f971951d84 100644 --- a/library/platform/jvm/boot-sumo.factor +++ b/library/platform/jvm/boot-sumo.factor @@ -73,6 +73,7 @@ USE: parser "/library/styles.factor" run-resource ! styles "/library/platform/jvm/threads.factor" run-resource ! threads "/library/logging.factor" run-resource ! logging +"/library/files.factor" run-resource ! files !!! Math library. "/library/platform/jvm/real-math.factor" run-resource ! real-math diff --git a/library/platform/jvm/boot.factor b/library/platform/jvm/boot.factor index 013573a9d5..f2891f0e48 100644 --- a/library/platform/jvm/boot.factor +++ b/library/platform/jvm/boot.factor @@ -28,6 +28,8 @@ !!! Minimum amount of words needed to be able to read other !!! resources. +USE: combinators + IN: stack ~<< dup A -- A A >>~ diff --git a/library/platform/jvm/cross-compiler.factor b/library/platform/jvm/cross-compiler.factor index d81cf75ccc..ebfb392b80 100644 --- a/library/platform/jvm/cross-compiler.factor +++ b/library/platform/jvm/cross-compiler.factor @@ -26,6 +26,7 @@ ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IN: cross-compiler +USE: combinators USE: kernel USE: lists USE: math diff --git a/library/platform/jvm/init.factor b/library/platform/jvm/init.factor index 9c84841413..282b73f087 100644 --- a/library/platform/jvm/init.factor +++ b/library/platform/jvm/init.factor @@ -83,4 +83,4 @@ USE: words t "startup-done" set - "interactive" get [ init-interpreter ] when ; + "interactive" get [ init-interpreter 1 exit* ] when ; diff --git a/library/platform/jvm/parser.factor b/library/platform/jvm/parser.factor index 8755de0790..be49b87a94 100644 --- a/library/platform/jvm/parser.factor +++ b/library/platform/jvm/parser.factor @@ -26,6 +26,7 @@ ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IN: parser +USE: combinators USE: errors USE: namespaces USE: stack diff --git a/library/platform/jvm/stack2.factor b/library/platform/jvm/stack2.factor index 417dfecef4..c148d66687 100644 --- a/library/platform/jvm/stack2.factor +++ b/library/platform/jvm/stack2.factor @@ -26,6 +26,7 @@ ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IN: stack +USE: combinators USE: kernel USE: vectors diff --git a/library/platform/jvm/stream.factor b/library/platform/jvm/stream.factor index c6f5ab3c66..5f2821a589 100644 --- a/library/platform/jvm/stream.factor +++ b/library/platform/jvm/stream.factor @@ -212,9 +212,6 @@ USE: strings [ "java.io.File" ] "java.io.File" "renameTo" jinvoke ; -: file-extension ( filename -- extension ) - ".*\\.(.*)" group1 ; - : ( string -- reader ) [ "java.lang.String" ] "java.io.StringReader" jnew ; diff --git a/library/platform/jvm/strings.factor b/library/platform/jvm/strings.factor index b93d9a7270..1e037658f8 100644 --- a/library/platform/jvm/strings.factor +++ b/library/platform/jvm/strings.factor @@ -26,6 +26,7 @@ ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IN: strings +USE: combinators USE: kernel USE: logic USE: stack diff --git a/library/platform/jvm/test.factor b/library/platform/jvm/test.factor index 2a4df6f9c3..4302ab67cd 100644 --- a/library/platform/jvm/test.factor +++ b/library/platform/jvm/test.factor @@ -1,4 +1,5 @@ IN: test +USE: combinators USE: compiler USE: namespaces USE: stdio diff --git a/library/platform/native/boot-stage2.factor b/library/platform/native/boot-stage2.factor index be1de3629f..89984a5b3e 100644 --- a/library/platform/native/boot-stage2.factor +++ b/library/platform/native/boot-stage2.factor @@ -98,6 +98,7 @@ USE: stdio "/library/random.factor" "/library/stdio-binary.factor" "/library/platform/native/prettyprint.factor" + "/library/files.factor" "/library/interpreter.factor" "/library/inspector.factor" "/library/inspect-vocabularies.factor" diff --git a/library/platform/native/debugger.factor b/library/platform/native/debugger.factor index 0f4699ef38..daa368480c 100644 --- a/library/platform/native/debugger.factor +++ b/library/platform/native/debugger.factor @@ -39,6 +39,7 @@ USE: stdio USE: strings USE: unparser USE: vectors +USE: words : expired-port-error ( obj -- ) "Expired port: " write . ; diff --git a/library/platform/native/parse-syntax.factor b/library/platform/native/parse-syntax.factor index a0972c9809..8ab770adf7 100644 --- a/library/platform/native/parse-syntax.factor +++ b/library/platform/native/parse-syntax.factor @@ -27,7 +27,7 @@ ! Parsing words. 'builtins' is a stupid vocabulary name now ! that it does not contain Java words anymore! -IN: builtins +IN: syntax USE: combinators USE: cross-compiler diff --git a/library/platform/native/profiler.factor b/library/platform/native/profiler.factor index aab8b89ed6..199a411314 100644 --- a/library/platform/native/profiler.factor +++ b/library/platform/native/profiler.factor @@ -26,6 +26,7 @@ ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IN: profiler +USE: combinators USE: kernel USE: lists USE: math diff --git a/library/platform/native/random.factor b/library/platform/native/random.factor index 1fc064de89..1bfb2162eb 100644 --- a/library/platform/native/random.factor +++ b/library/platform/native/random.factor @@ -26,6 +26,7 @@ ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IN: random +USE: combinators USE: kernel USE: math USE: stack diff --git a/library/platform/native/vocabularies.factor b/library/platform/native/vocabularies.factor index e9030a896b..7b222e7e65 100644 --- a/library/platform/native/vocabularies.factor +++ b/library/platform/native/vocabularies.factor @@ -26,6 +26,7 @@ ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IN: words +USE: combinators USE: lists USE: namespaces USE: stack diff --git a/library/stdio.factor b/library/stdio.factor index 55a6b5c86c..cb4c273117 100644 --- a/library/stdio.factor +++ b/library/stdio.factor @@ -26,6 +26,7 @@ ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IN: stdio +USE: combinators USE: errors USE: kernel USE: namespaces diff --git a/library/test/files.factor b/library/test/files.factor new file mode 100644 index 0000000000..fad63a77d4 --- /dev/null +++ b/library/test/files.factor @@ -0,0 +1,9 @@ +IN: scratchpad +USE: files +USE: test + +[ "txt" ] [ "foo.txt" file-extension ] unit-test +[ f ] [ "foobar" file-extension ] unit-test +[ "txt" ] [ "foo.bar.txt" file-extension ] unit-test +[ "text/plain" ] [ "foo.bar.txt" mime-type ] unit-test +[ "text/html" ] [ "index.html" mime-type ] unit-test diff --git a/library/test/test.factor b/library/test/test.factor index d1584e1584..65ee9ada20 100644 --- a/library/test/test.factor +++ b/library/test/test.factor @@ -73,6 +73,7 @@ USE: unparser "hashtables" "strings" "namespaces/namespaces" + "files" "format" "parser" "parse-number" diff --git a/library/vocabularies.factor b/library/vocabularies.factor index cffac64c5e..db0ba4c93b 100644 --- a/library/vocabularies.factor +++ b/library/vocabularies.factor @@ -66,10 +66,10 @@ USE: strings : init-search-path ( -- ) ! For files - "user" "file-in" set - [ "user" "builtins" ] "file-use" set + "scratchpad" "file-in" set + [ "builtins" "syntax" "scratchpad" ] "file-use" set ! For interactive - "user" "in" set + "scratchpad" "in" set [ "user" "arithmetic" @@ -95,6 +95,7 @@ USE: strings "streams" "stdio" "strings" + "syntax" "test" "threads" "trace"