More module system hackery
parent
6368e3b4d1
commit
1e2dcfae12
|
@ -1,3 +1,3 @@
|
||||||
REQUIRE: crypto ;
|
REQUIRES: crypto ;
|
||||||
|
|
||||||
PROVIDE: aim { "net-bytes.factor" "aim.factor" } ;
|
PROVIDE: aim { "net-bytes.factor" "aim.factor" } ;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
USING: modules words ;
|
USING: kernel modules words ;
|
||||||
|
|
||||||
REQUIRE: aim cairo concurrency coroutines crypto dlists
|
REQUIRES: aim cairo concurrency coroutines crypto dlists
|
||||||
embedded gap-buffer httpd math postgresql process random-tester
|
embedded gap-buffer httpd math postgresql process random-tester
|
||||||
splay-trees sqlite units ;
|
splay-trees sqlite units ;
|
||||||
|
|
||||||
"x11" vocab [
|
"x11" vocab [
|
||||||
"factory" require
|
"factory" (require)
|
||||||
"x11" require
|
"x11" (require)
|
||||||
]
|
] when
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
! Copyright (C) 2006 Eduardo Cavazos.
|
! Copyright (C) 2006 Eduardo Cavazos.
|
||||||
|
|
||||||
|
REQUIRES: slate ;
|
||||||
|
|
||||||
USING: parser kernel hashtables namespaces sequences math io
|
USING: parser kernel hashtables namespaces sequences math io
|
||||||
math-contrib threads strings arrays prettyprint gadgets slate ;
|
math-contrib threads strings arrays prettyprint gadgets slate ;
|
||||||
|
|
||||||
|
@ -130,3 +132,5 @@ interesting get random-item set-rule 1000 sleep run-rule ;
|
||||||
: automata-gallery ( -- )
|
: automata-gallery ( -- )
|
||||||
<slate> dup self set open-window 1000 sleep init-interesting init-rule
|
<slate> dup self set open-window 1000 sleep init-interesting init-rule
|
||||||
random-interesting-gallery ;
|
random-interesting-gallery ;
|
||||||
|
|
||||||
|
PROVIDE: automata ;
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
! To run the demo do: USE: boids boids-go
|
! To run the demo do: USE: boids boids-go
|
||||||
|
|
||||||
|
REQUIRES: slate ;
|
||||||
|
|
||||||
USING: generic threads namespaces math kernel sequences arrays gadgets slate ;
|
USING: generic threads namespaces math kernel sequences arrays gadgets slate ;
|
||||||
|
|
||||||
IN: boids
|
IN: boids
|
||||||
|
@ -278,3 +280,5 @@ iterate-boids draw-boids 1 sleep run-boids ;
|
||||||
! : execute-with ( item [ word word ... ] -- results ... )
|
! : execute-with ( item [ word word ... ] -- results ... )
|
||||||
! [ over >r execute r> ] each drop ;
|
! [ over >r execute r> ] each drop ;
|
||||||
|
|
||||||
|
PROVIDE: boids ;
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@ USING: alien ;
|
||||||
|
|
||||||
"cairo" "libcairo" add-simple-library
|
"cairo" "libcairo" add-simple-library
|
||||||
|
|
||||||
PROVIDE: cairo { "/contrib/cairo/cairo.factor" } ;
|
PROVIDE: cairo { "cairo.factor" } ;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
REQUIRE: dlists ;
|
REQUIRES: dlists ;
|
||||||
|
|
||||||
PROVIDE: concurrency
|
PROVIDE: concurrency
|
||||||
{ "concurrency.factor" }
|
{ "concurrency.factor" }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
REQUIRE: math ;
|
REQUIRES: math ;
|
||||||
|
|
||||||
PROVIDE: crypto {
|
PROVIDE: crypto {
|
||||||
"common.factor"
|
"common.factor"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
REQUIRE: process concurrency x11 ;
|
REQUIRES: process concurrency x11 ;
|
||||||
|
|
||||||
PROVIDE: factory { "factory.factor" } ;
|
PROVIDE: factory { "factory.factor" } ;
|
||||||
|
|
|
@ -11,14 +11,13 @@ PROVIDE: httpd {
|
||||||
"callback-responder.factor"
|
"callback-responder.factor"
|
||||||
"prototype-js.factor"
|
"prototype-js.factor"
|
||||||
"html.factor"
|
"html.factor"
|
||||||
"embedded.factor"
|
|
||||||
"file-responder.factor"
|
"file-responder.factor"
|
||||||
"help-responder.factor"
|
"help-responder.factor"
|
||||||
"inspect-responder.factor"
|
"inspect-responder.factor"
|
||||||
"browser-responder.factor"
|
"browser-responder.factor"
|
||||||
"default-responders.factor"
|
"default-responders.factor"
|
||||||
"http-client.factor"
|
"http-client.factor"
|
||||||
|
} {
|
||||||
"test/html.factor"
|
"test/html.factor"
|
||||||
"test/http-client.factor"
|
"test/http-client.factor"
|
||||||
"test/httpd.factor"
|
"test/httpd.factor"
|
||||||
|
|
|
@ -3,5 +3,5 @@ USING: alien ;
|
||||||
"postgresql" "libpq" add-simple-library
|
"postgresql" "libpq" add-simple-library
|
||||||
|
|
||||||
PROVIDE: postgresql
|
PROVIDE: postgresql
|
||||||
{ "libpq" "postgresql" }
|
{ "libpq.factor" "postgresql.factor" }
|
||||||
{ "postgresql-test" } ;
|
{ "postgresql-test" } ;
|
||||||
|
|
|
@ -79,3 +79,5 @@ GL_LINES glBegin first2 glVertex2f first2 glVertex2f glEnd ;
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: reset-slate ( -- ) [ ] set-action reset-dlist ;
|
: reset-slate ( -- ) [ ] set-action reset-dlist ;
|
||||||
|
|
||||||
|
PROVIDE: slate ;
|
|
@ -31,7 +31,6 @@
|
||||||
IN: sqlite
|
IN: sqlite
|
||||||
USE: kernel
|
USE: kernel
|
||||||
USE: alien
|
USE: alien
|
||||||
USE: compiler
|
|
||||||
USE: errors
|
USE: errors
|
||||||
USE: strings
|
USE: strings
|
||||||
USE: namespaces
|
USE: namespaces
|
||||||
|
@ -258,6 +257,3 @@ END-STRUCT
|
||||||
|
|
||||||
: sqlite-map ( statement quot -- )
|
: sqlite-map ( statement quot -- )
|
||||||
[ ] (sqlite-map) ;
|
[ ] (sqlite-map) ;
|
||||||
|
|
||||||
|
|
||||||
{ "sqlite" } compile-vocabs
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#! "contrib/httpd/embedded.factor" run-file
|
#! "contrib/httpd/embedded.factor" run-file
|
||||||
#! "contrib/vim/load.factor" run-file
|
#! "contrib/vim/load.factor" run-file
|
||||||
|
|
||||||
REQUIRE: embedded ;
|
REQUIRES: embedded ;
|
||||||
|
|
||||||
USING: embedded io ;
|
USING: embedded io ;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
REQUIRE: concurrency ;
|
REQUIRES: concurrency ;
|
||||||
|
|
||||||
PROVIDE: x11 {
|
PROVIDE: x11 {
|
||||||
"rectangle.factor" "x.factor" "draw-string.factor" "concurrent-widgets.factor" "gl.factor"
|
"rectangle.factor" "x.factor" "draw-string.factor" "concurrent-widgets.factor" "gl.factor"
|
||||||
|
|
|
@ -117,7 +117,6 @@ vectors words ;
|
||||||
|
|
||||||
"/library/test/test.factor"
|
"/library/test/test.factor"
|
||||||
|
|
||||||
"/library/modules.factor"
|
|
||||||
"/library/threads.factor"
|
"/library/threads.factor"
|
||||||
|
|
||||||
"/library/io/server.factor"
|
"/library/io/server.factor"
|
||||||
|
@ -158,6 +157,7 @@ vectors words ;
|
||||||
"/library/io/buffer.factor"
|
"/library/io/buffer.factor"
|
||||||
|
|
||||||
"/library/cli.factor"
|
"/library/cli.factor"
|
||||||
|
"/library/modules.factor"
|
||||||
|
|
||||||
"/library/bootstrap/init.factor"
|
"/library/bootstrap/init.factor"
|
||||||
"/library/bootstrap/image.factor"
|
"/library/bootstrap/image.factor"
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
! Copyright (C) 2006 Slava Pestov.
|
! Copyright (C) 2006 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
IN: modules
|
IN: modules
|
||||||
USING: hashtables io kernel namespaces parser sequences words ;
|
USING: compiler hashtables io kernel namespaces parser sequences
|
||||||
|
words ;
|
||||||
|
|
||||||
TUPLE: module name files tests ;
|
TUPLE: module name files tests ;
|
||||||
|
|
||||||
|
@ -26,7 +27,7 @@ H{ } clone modules set-global
|
||||||
|
|
||||||
: module modules get hash ;
|
: module modules get hash ;
|
||||||
|
|
||||||
: require ( name -- )
|
: (require) ( name -- )
|
||||||
dup module [
|
dup module [
|
||||||
drop
|
drop
|
||||||
] [
|
] [
|
||||||
|
@ -34,6 +35,10 @@ H{ } clone modules set-global
|
||||||
module-def run-resource
|
module-def run-resource
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
|
: require ( name -- )
|
||||||
|
[ \ require on (require) ] with-scope
|
||||||
|
\ require get [ compile-all ] unless ;
|
||||||
|
|
||||||
: run-resources ( seq -- )
|
: run-resources ( seq -- )
|
||||||
bootstrapping? get
|
bootstrapping? get
|
||||||
[ parse-resource % ] [ run-resource ] ? each ;
|
[ parse-resource % ] [ run-resource ] ? each ;
|
||||||
|
@ -47,3 +52,5 @@ H{ } clone modules set-global
|
||||||
: reload-module ( name -- ) module load-module ;
|
: reload-module ( name -- ) module load-module ;
|
||||||
|
|
||||||
: test-module ( name -- ) module module-tests run-resources ;
|
: test-module ( name -- ) module module-tests run-resources ;
|
||||||
|
|
||||||
|
: test-modules ( -- ) modules hash-keys [ test-module ] each ;
|
||||||
|
|
|
@ -73,6 +73,8 @@ DEFER: PRIMITIVE: parsing
|
||||||
: PROVIDE:
|
: PROVIDE:
|
||||||
scan [ { { } { } } append first2 provide ] f ; parsing
|
scan [ { { } { } } append first2 provide ] f ; parsing
|
||||||
|
|
||||||
: REQUIRE:
|
: REQUIRE: scan require ; parsing
|
||||||
|
|
||||||
|
: REQUIRES:
|
||||||
string-mode on
|
string-mode on
|
||||||
[ string-mode off [ require ] each ] f ; parsing
|
[ string-mode off [ (require) ] each ] f ; parsing
|
||||||
|
|
Loading…
Reference in New Issue