Paste: eval server

Author: blei
Mode: factor
Date: Sat, 14 Aug 2010 10:01:33
Plain Text |
USING: accessors arrays continuations debugger eval io
io.encodings.utf8 io.servers.connection kernel ;
IN: eval-server

: execute-string ( string -- )
    [ 1array [ parse-string call ] with-datastack drop ]
    [ nip print-error ] recover ;

: <eval-server> ( -- threaded-server )
    utf8 <threaded-server>
        "eval-server" >>name
        9999 >>insecure
        [ [ execute-string flush ] each-line ] >>handler ;

: start-eval-server ( -- )
    <eval-server> start-server ;

MAIN: start-eval-server

Annotation: only read one line

Author: blei
Mode: factor
Date: Sat, 14 Aug 2010 10:30:50
Plain Text |
: <eval-server> ( -- threaded-server )
    utf8 <threaded-server>
        "eval-server" >>name
        9999 >>insecure
        [ readln execute-string flush ] >>handler ;

Annotation: untested,

Author: erg
Mode: factor
Date: Fri, 3 Sep 2010 22:59:39
Plain Text |
USING: accessors arrays continuations debugger eval fry io
io.encodings.utf8 io.servers.connection kernel namespaces
threads ;
IN: eval-server

: execute-string ( string -- )
    [ 1array [ parse-string call ] with-datastack drop ]
    [ nip print-error ] recover ;

: <eval-server> ( -- threaded-server )
    utf8 <threaded-server>
        "eval-server" >>name
        9999 >>insecure
        [ [ execute-string flush ] each-line ] >>handler ;

SYMBOL: eval-server

: start-eval-server ( -- )
    <eval-server> [ eval-server set-global ] [ '[ _ start-server ] in-thread ] bi ;

: stop-eval-server ( -- )
    eval-server get-global stop-server ;

MAIN: start-eval-server

New Annotation

Summary:
Author:
Mode:
Body: