Loading client-tests.fs +2 −1 Original line number Diff line number Diff line Loading @@ -114,7 +114,8 @@ previous [: .time ." Download test: 1 text file and 2 photos" cr ;] $err net2o-code expect-reply !time .time s" Download test " $, type 1 lit, . pi float, f. cr ( see-me ) get-ip !time .time s" Download test " $, type 1 lit, . pi float, f. cr ( see-me ) get-ip 0 lit, file-id words push' cr endwith $400 blocksize! $400 blockalign! stat( request-stats ) "net2o.fs" "net2o.fs" >cache n2o:copy "data/2011-05-13_11-26-57-small.jpg" "photo000s.jpg" >cache n2o:copy Loading net2o-cmd.fs +23 −2 Original line number Diff line number Diff line Loading @@ -156,6 +156,9 @@ Defer gen-table : cmd@ ( -- u ) buf-state 2@ over + >r p@+ r> over - buf-state 2! 64>n ; : >net2o-name ( addr -- addr' u ) [ 4 cell = ] [IF] 6 cells - [ELSE] 5 cells - [THEN] body> name>string ; : (net2o-see) ( addr -- ) @ dup 0<> IF [ 4 cell = ] [IF] 6 cells - [ELSE] 5 cells - [THEN] Loading Loading @@ -233,6 +236,7 @@ get-current also net2o-base definitions previous \ Command numbers preliminary and subject to change 0 net2o: dummy ( -- ) ; \ will be overwritten 0 net2o: end-cmd ( -- ) \ last command in buffer 0 buf-state ! ; +net2o: ulit ( "u" -- u ) \ unsigned literal Loading Loading @@ -464,12 +468,29 @@ also net2o-base definitions +net2o: ko ( error -- ) \ receive error message throw ; \ inspection +net2o: token ( $:token $:stack -- ) $> $> type '(' emit type ')' emit space ; \ stub dup set-current : net2o:words ( -- ) token-table $@ bounds U+DO I @ ?dup-IF >net2o-name 2dup type space $, s" -" $, token THEN cell +LOOP ; definitions +net2o: words ( -- ) net2o:words ; \ setup connection class gen-table $@ setup-table $! ' setup-table is gen-table 20 net2o: emit ( xc -- ) \ emit character on server log 24 net2o: emit ( xc -- ) \ emit character on server log 64>n xemit ; +net2o: type ( $:string -- ) \ type string on server log $> F type ; Loading Loading @@ -622,7 +643,7 @@ reply-table $@ fs-table $! ' fs-table is gen-table 10 net2o: <req-file ( -- ) fs-id @ ulit, file-id ; 20 net2o: open-file ( $:string mode -- ) \ open file with mode 24 net2o: open-file ( $:string mode -- ) \ open file with mode 64>n $> rot fs-open ; +net2o: close-file ( -- ) \ close file fs-close ; Loading net2o-dht.fs +1 −1 Original line number Diff line number Diff line Loading @@ -302,7 +302,7 @@ reply-table $@ dht-table $! ' dht-table is gen-table 10 net2o: <req-dht ( -- ) dht-hash $@ $, dht-id ; \ redefine <req 20 net2o: dht-host+ ( $:string -- ) $> d#host+ ; 24 net2o: dht-host+ ( $:string -- ) $> d#host+ ; +net2o: dht-tags+ ( $:string -- ) $> d#tags+ ; +net2o: dht-host- ( $:string -- ) $> d#host- ; +net2o: dht-tags- ( $:string -- ) $> d#tags- ; Loading Loading
client-tests.fs +2 −1 Original line number Diff line number Diff line Loading @@ -114,7 +114,8 @@ previous [: .time ." Download test: 1 text file and 2 photos" cr ;] $err net2o-code expect-reply !time .time s" Download test " $, type 1 lit, . pi float, f. cr ( see-me ) get-ip !time .time s" Download test " $, type 1 lit, . pi float, f. cr ( see-me ) get-ip 0 lit, file-id words push' cr endwith $400 blocksize! $400 blockalign! stat( request-stats ) "net2o.fs" "net2o.fs" >cache n2o:copy "data/2011-05-13_11-26-57-small.jpg" "photo000s.jpg" >cache n2o:copy Loading
net2o-cmd.fs +23 −2 Original line number Diff line number Diff line Loading @@ -156,6 +156,9 @@ Defer gen-table : cmd@ ( -- u ) buf-state 2@ over + >r p@+ r> over - buf-state 2! 64>n ; : >net2o-name ( addr -- addr' u ) [ 4 cell = ] [IF] 6 cells - [ELSE] 5 cells - [THEN] body> name>string ; : (net2o-see) ( addr -- ) @ dup 0<> IF [ 4 cell = ] [IF] 6 cells - [ELSE] 5 cells - [THEN] Loading Loading @@ -233,6 +236,7 @@ get-current also net2o-base definitions previous \ Command numbers preliminary and subject to change 0 net2o: dummy ( -- ) ; \ will be overwritten 0 net2o: end-cmd ( -- ) \ last command in buffer 0 buf-state ! ; +net2o: ulit ( "u" -- u ) \ unsigned literal Loading Loading @@ -464,12 +468,29 @@ also net2o-base definitions +net2o: ko ( error -- ) \ receive error message throw ; \ inspection +net2o: token ( $:token $:stack -- ) $> $> type '(' emit type ')' emit space ; \ stub dup set-current : net2o:words ( -- ) token-table $@ bounds U+DO I @ ?dup-IF >net2o-name 2dup type space $, s" -" $, token THEN cell +LOOP ; definitions +net2o: words ( -- ) net2o:words ; \ setup connection class gen-table $@ setup-table $! ' setup-table is gen-table 20 net2o: emit ( xc -- ) \ emit character on server log 24 net2o: emit ( xc -- ) \ emit character on server log 64>n xemit ; +net2o: type ( $:string -- ) \ type string on server log $> F type ; Loading Loading @@ -622,7 +643,7 @@ reply-table $@ fs-table $! ' fs-table is gen-table 10 net2o: <req-file ( -- ) fs-id @ ulit, file-id ; 20 net2o: open-file ( $:string mode -- ) \ open file with mode 24 net2o: open-file ( $:string mode -- ) \ open file with mode 64>n $> rot fs-open ; +net2o: close-file ( -- ) \ close file fs-close ; Loading
net2o-dht.fs +1 −1 Original line number Diff line number Diff line Loading @@ -302,7 +302,7 @@ reply-table $@ dht-table $! ' dht-table is gen-table 10 net2o: <req-dht ( -- ) dht-hash $@ $, dht-id ; \ redefine <req 20 net2o: dht-host+ ( $:string -- ) $> d#host+ ; 24 net2o: dht-host+ ( $:string -- ) $> d#host+ ; +net2o: dht-tags+ ( $:string -- ) $> d#tags+ ; +net2o: dht-host- ( $:string -- ) $> d#host- ; +net2o: dht-tags- ( $:string -- ) $> d#tags- ; Loading