updated modules.util to use manifests
parent
21d3d12ea1
commit
6169ab1010
|
|
@ -1,6 +1,7 @@
|
||||||
USING: accessors arrays delegate delegate.protocols
|
USING: accessors arrays delegate delegate.protocols
|
||||||
io.pathnames kernel locals sequences
|
io.pathnames kernel locals sequences
|
||||||
ui.frp vectors make strings ;
|
vectors make strings ;
|
||||||
|
EXCLUDE: ui.frp => , ;
|
||||||
IN: file-trees
|
IN: file-trees
|
||||||
|
|
||||||
TUPLE: walkable-vector vector father ;
|
TUPLE: walkable-vector vector father ;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
USING: modules.using ;
|
|
||||||
IN: modules.using.tests
|
|
||||||
USING: tools.test localhost::modules.test-server ;
|
|
||||||
[ "hello world" ] [ rpc-hello ] unit-test
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
USING: accessors assocs kernel lexer locals namespaces sequences
|
USING: accessors assocs kernel lexer locals namespaces sequences
|
||||||
vocabs vocabs.parser ;
|
vocabs vocabs.parser ;
|
||||||
IN: modules.util
|
IN: modules.util
|
||||||
SYNTAX: EXPORT-FROM: [let | v [ in get ] |
|
SYNTAX: EXPORT-FROM: [let | v [ current-vocab ] |
|
||||||
v vocab words>> ";" parse-tokens
|
v words>> ";" parse-tokens
|
||||||
[ load-vocab vocab-words [ clone v >>vocabulary ] assoc-map ] map
|
[ load-vocab vocab-words [ clone v name>> >>vocabulary ] assoc-map ] map
|
||||||
assoc-combine update ] ;
|
assoc-combine update ] ;
|
||||||
|
|
@ -25,7 +25,7 @@ MEMO: mem-do-rpc ( args word -- bytes ) do-rpc ; inline
|
||||||
: (service) ( -- ) serving-vocabs get-global empty? [ start-serving-vocabs ] when
|
: (service) ( -- ) serving-vocabs get-global empty? [ start-serving-vocabs ] when
|
||||||
current-vocab serving-vocabs get-global adjoin
|
current-vocab serving-vocabs get-global adjoin
|
||||||
"get-words" create-in
|
"get-words" create-in
|
||||||
in get [ vocab vocab-words [ stack-effect ] { } assoc-map-as ] curry
|
current-vocab name>> [ vocab vocab-words [ stack-effect ] { } assoc-map-as ] curry
|
||||||
(( -- words )) define-inline ;
|
(( -- words )) define-inline ;
|
||||||
|
|
||||||
SYNTAX: service \ do-rpc "executer" set (service) ;
|
SYNTAX: service \ do-rpc "executer" set (service) ;
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
USING: accessors compiler.units combinators fry generalizations io
|
USING: accessors compiler.units combinators fry generalizations io
|
||||||
io.encodings.binary io.sockets kernel namespaces
|
io.encodings.binary io.sockets kernel
|
||||||
parser sequences serialize vocabs vocabs.parser words ;
|
parser sequences serialize vocabs vocabs.parser words ;
|
||||||
IN: modules.rpc
|
IN: modules.rpc
|
||||||
|
|
||||||
DEFER: get-words
|
DEFER: get-words
|
||||||
|
|
||||||
: with-in-vocab ( vocab quot -- vocab ) over
|
: with-in-vocab ( vocab quot -- vocab ) over
|
||||||
[ '[ _ set-in @ ] in get swap dip set-in ] dip vocab ; inline
|
[ '[ _ set-current-vocab @ ] current-vocab name>> swap dip set-current-vocab ] dip vocab ; inline
|
||||||
|
|
||||||
: remote-quot ( addrspec vocabspec effect str -- quot )
|
: remote-quot ( addrspec vocabspec effect str -- quot )
|
||||||
'[ _ 5000 <inet> binary
|
'[ _ 5000 <inet> binary
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
QUALIFIED-WITH: modules.using m
|
||||||
|
IN: modules.using.tests
|
||||||
|
m:USING: tools.test localhost::modules.test-server ;
|
||||||
|
[ "hello world" ] [ rpc-hello ] unit-test
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
USING: modules.using modules.rpc-server help.syntax help.markup strings ;
|
USING: modules.rpc-server help.syntax help.markup strings ;
|
||||||
|
QUALIFIED-WITH: modules.using m
|
||||||
IN: modules
|
IN: modules
|
||||||
|
|
||||||
HELP: service
|
HELP: service
|
||||||
|
|
@ -6,7 +7,7 @@ HELP: service
|
||||||
{ $description "Starts a server for requests for remote procedure calls." } ;
|
{ $description "Starts a server for requests for remote procedure calls." } ;
|
||||||
|
|
||||||
ARTICLE: { "modules" "remote-loading" } "Using the remote-loading vocabulary"
|
ARTICLE: { "modules" "remote-loading" } "Using the remote-loading vocabulary"
|
||||||
"If loaded, starts serving vocabularies, accessable through a " { $link POSTPONE: USING: } " form" ;
|
"If loaded, starts serving vocabularies, accessable through a " { $link POSTPONE: m:USING: } " form" ;
|
||||||
|
|
||||||
HELP: USING:
|
HELP: USING:
|
||||||
{ $syntax "USING: rpc-server::module fetch-sever::module { module qualified-name } { module => word ... } ... ;" }
|
{ $syntax "USING: rpc-server::module fetch-sever::module { module qualified-name } { module => word ... } ... ;" }
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
USING: assocs kernel modules.remote-loading modules.rpc
|
USING: accessors assocs kernel modules.remote-loading modules.rpc
|
||||||
namespaces peg peg.ebnf peg-lexer sequences vocabs vocabs.parser
|
namespaces peg peg.ebnf peg-lexer sequences vocabs vocabs.parser
|
||||||
strings ;
|
strings ;
|
||||||
IN: modules.using
|
IN: modules.using
|
||||||
|
|
@ -9,9 +9,9 @@ IN: modules.using
|
||||||
: >partial-vocab ( words assoc -- assoc )
|
: >partial-vocab ( words assoc -- assoc )
|
||||||
[ dupd at [ no-word-error ] unless* ] curry { } map>assoc ;
|
[ dupd at [ no-word-error ] unless* ] curry { } map>assoc ;
|
||||||
|
|
||||||
: remote-load ( addr vocabspec -- voab ) [ "modules.remote-loading" remote-vocab (use+) ] dip get-vocab ;
|
: remote-load ( addr vocabspec -- voab ) [ "modules.remote-loading" remote-vocab use-vocab ] dip get-vocab ;
|
||||||
|
|
||||||
: load'em ( vocab words/? -- ) [ swap >partial-vocab ] when* use get push ;
|
: load'em ( vocab words/? -- ) [ swap >partial-vocab ] when* manifest get qualified-vocabs>> push ;
|
||||||
|
|
||||||
EBNF: modulize
|
EBNF: modulize
|
||||||
tokenpart = (!(':').)+ => [[ >string ]]
|
tokenpart = (!(':').)+ => [[ >string ]]
|
||||||
|
|
@ -30,7 +30,7 @@ qualified = modspec sym => [[ first2 >qualified ]]
|
||||||
unqualified = modspec => [[ vocab-words ]]
|
unqualified = modspec => [[ vocab-words ]]
|
||||||
words = ("=>" sym+ )? => [[ [ f ] [ second ] if-empty ]]
|
words = ("=>" sym+ )? => [[ [ f ] [ second ] if-empty ]]
|
||||||
long = "{" ( qualified | unqualified ) words "}" => [[ rest first2 load'em ignore ]]
|
long = "{" ( qualified | unqualified ) words "}" => [[ rest first2 load'em ignore ]]
|
||||||
short = modspec => [[ use+ ignore ]]
|
short = modspec => [[ use-vocab ignore ]]
|
||||||
wordSpec = long | short
|
wordSpec = long | short
|
||||||
using = wordSpec+ ";" => [[ drop ignore ]]
|
using = wordSpec+ ";" => [[ drop ignore ]]
|
||||||
;ON-BNF
|
;ON-BNF
|
||||||
Loading…
Reference in New Issue