Loading n2o.fs +2 −2 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ $20 value hash-size# scope{ n2o :noname ( -- ) : help ( -- ) \U help [cmd1 .. cmdn] \G help: print commands or details about specified command ?cr ?nextarg IF Loading @@ -96,7 +96,7 @@ scope{ n2o s" \O " ['] .usage search-help ." === Commands ===" cr s" \U " ['] .usage search-help THEN ; is help THEN ; }scope Loading net2o-addr.fs +5 −5 Original line number Diff line number Diff line Loading @@ -60,8 +60,8 @@ gen-table $freeze punch-addrs $@ bounds ?DO I @ .n2o:dispose-addr cell +LOOP punch-addrs $off defers extra-dispose ; is extra-dispose :noname ( addr u -- o ) \G create a new address object from string n2o:new-addr n:>o nest-cmd-loop o n:o> ; is new-addr : new-addr ( addr u -- o ) \G create a new address object from string n2o:new-addr n:>o nest-cmd-loop o n:o> ; also net2o-base : o-genaddr ( o -- ) >o \G create new address string from object Loading Loading @@ -100,8 +100,8 @@ previous : .nat-addrs ( -- ) punch-addrs $@ bounds ?DO I @ .addr cr cell +LOOP ; :noname ( addr u -- ) new-addr >o o .addr n2o:dispose-addr o> ; is .addr$ : .addr$ ( addr u -- ) new-addr >o o .addr n2o:dispose-addr o> ; User dest-0key> \ pointer to dest-0key User dest-0key< \ pointer to obtained dest-0key Loading Loading @@ -161,7 +161,7 @@ User dest-0key< \ pointer to obtained dest-0key : .my-addrs ( -- ) my-addr[] [: .addr cr ;] $[]o-map ; :noname addrs-off !my-addrs !my-addr$ ; is !my-addr : !my-addr ( -- ) addrs-off !my-addrs !my-addr$ ; \ merge addresses Loading net2o-cmd.fs +18 −13 Original line number Diff line number Diff line Loading @@ -376,14 +376,14 @@ Defer .n-name ' noop is .n-name : cmdsig ( -- addr ) last-2o 3 cells + ; : net2o' ( "name" -- ) ' >body @ ; Defer net2o:words Forward net2o:words : inherit-table ( addr u "name" -- ) ' dup IS gen-table execute $! ; Vocabulary net2o-base Defer do-req> Forward do-req> : do-nest ( addr u flag -- ) dup >r validated or! nest-cmd-loop Loading Loading @@ -456,7 +456,6 @@ comp: drop cmdsig @ IF ')' parse 2drop EXIT THEN pf@ ; +net2o: end-with ( o:object -- ) \g end scope do-req> n:o> ; :noname o IF req? @ 0< IF end-with req? off THEN THEN ; is do-req> +net2o: oswap ( o:nest o:current -- o:current o:nest ) do-req> n:oswap ; +net2o: tru ( -- f:true ) \g true flag literal Loading @@ -478,6 +477,10 @@ comp: drop cmdsig @ IF ')' parse 2drop EXIT THEN string@ $> 2drop ; }scope also net2o-base : do-req> o IF req? @ 0< IF end-with req? off THEN THEN ; previous gen-table $freeze gen-table $@ inherit-table reply-table Loading Loading @@ -578,7 +581,7 @@ previous 1 packets2 +! ELSE dest-addr 64@ [ cell 4 = ] [IF] 0<> - [THEN] dup 0 r> 2! u>= THEN ; : cmd-loop ( addr u -- ) : cmd-exec ( addr u -- ) string-stack $off object-stack $off nest-stack $off Loading @@ -595,8 +598,6 @@ previous [: outflag @ >r cmdreset init-reply do-cmd-loop r> outflag ! cmd-send? ;] cmdlock c-section ; ' cmd-loop is cmd-exec \ nested commands User neststart# Loading Loading @@ -711,7 +712,15 @@ $10 net2o: push' ( #cmd -- ) \g push command into answer packet +net2o: error-id ( $:errorid -- ) \g error-id string $> $error-id $! ; :noname ( start -- ) gen-table $freeze : ]nest ( -- ) ]nest$ push-$ push' nest ; }scope also net2o-base : net2o:words ( start -- ) token-table $@ 2 pick cells safe/string bounds U+DO I @ ?dup-IF dup >net2o-sig 2>r >net2o-name Loading @@ -719,13 +728,9 @@ $10 net2o: push' ( #cmd -- ) \g push command into answer packet 2 pick ulit, 2r> 2swap [: type type ;] $tmp $, token ELSE 2drop rdrop rdrop THEN THEN 1+ cell +LOOP drop ; IS net2o:words gen-table $freeze cell +LOOP drop ; : ]nest ( -- ) ]nest$ push-$ push' nest ; }scope previous 0 [IF] Local Variables: Loading net2o-connect.fs +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ \ You should have received a copy of the GNU Affero General Public License \ along with this program. If not, see <http://www.gnu.org/licenses/>. Defer >invitations Forward >invitations scope{ net2o-base \ nat traversal functions Loading net2o-connected.fs +2 −3 Original line number Diff line number Diff line Loading @@ -401,13 +401,12 @@ also net2o-base pings new-request false gen-punchload gen-punch ; previous :noname ( addr u -- ) : punch-reply ( addr u -- ) outflag @ >r cmdbuf-o @ >r [: cmd0! cmdreset init-reply also net2o-base [ also net2o-base ] $, nest end-code ;] catch r> cmdbuf-o ! r> outflag ! throw ; is punch-reply r> cmdbuf-o ! r> outflag ! throw ; : 0-resend? ( -- n ) resend0 @ IF Loading Loading
n2o.fs +2 −2 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ $20 value hash-size# scope{ n2o :noname ( -- ) : help ( -- ) \U help [cmd1 .. cmdn] \G help: print commands or details about specified command ?cr ?nextarg IF Loading @@ -96,7 +96,7 @@ scope{ n2o s" \O " ['] .usage search-help ." === Commands ===" cr s" \U " ['] .usage search-help THEN ; is help THEN ; }scope Loading
net2o-addr.fs +5 −5 Original line number Diff line number Diff line Loading @@ -60,8 +60,8 @@ gen-table $freeze punch-addrs $@ bounds ?DO I @ .n2o:dispose-addr cell +LOOP punch-addrs $off defers extra-dispose ; is extra-dispose :noname ( addr u -- o ) \G create a new address object from string n2o:new-addr n:>o nest-cmd-loop o n:o> ; is new-addr : new-addr ( addr u -- o ) \G create a new address object from string n2o:new-addr n:>o nest-cmd-loop o n:o> ; also net2o-base : o-genaddr ( o -- ) >o \G create new address string from object Loading Loading @@ -100,8 +100,8 @@ previous : .nat-addrs ( -- ) punch-addrs $@ bounds ?DO I @ .addr cr cell +LOOP ; :noname ( addr u -- ) new-addr >o o .addr n2o:dispose-addr o> ; is .addr$ : .addr$ ( addr u -- ) new-addr >o o .addr n2o:dispose-addr o> ; User dest-0key> \ pointer to dest-0key User dest-0key< \ pointer to obtained dest-0key Loading Loading @@ -161,7 +161,7 @@ User dest-0key< \ pointer to obtained dest-0key : .my-addrs ( -- ) my-addr[] [: .addr cr ;] $[]o-map ; :noname addrs-off !my-addrs !my-addr$ ; is !my-addr : !my-addr ( -- ) addrs-off !my-addrs !my-addr$ ; \ merge addresses Loading
net2o-cmd.fs +18 −13 Original line number Diff line number Diff line Loading @@ -376,14 +376,14 @@ Defer .n-name ' noop is .n-name : cmdsig ( -- addr ) last-2o 3 cells + ; : net2o' ( "name" -- ) ' >body @ ; Defer net2o:words Forward net2o:words : inherit-table ( addr u "name" -- ) ' dup IS gen-table execute $! ; Vocabulary net2o-base Defer do-req> Forward do-req> : do-nest ( addr u flag -- ) dup >r validated or! nest-cmd-loop Loading Loading @@ -456,7 +456,6 @@ comp: drop cmdsig @ IF ')' parse 2drop EXIT THEN pf@ ; +net2o: end-with ( o:object -- ) \g end scope do-req> n:o> ; :noname o IF req? @ 0< IF end-with req? off THEN THEN ; is do-req> +net2o: oswap ( o:nest o:current -- o:current o:nest ) do-req> n:oswap ; +net2o: tru ( -- f:true ) \g true flag literal Loading @@ -478,6 +477,10 @@ comp: drop cmdsig @ IF ')' parse 2drop EXIT THEN string@ $> 2drop ; }scope also net2o-base : do-req> o IF req? @ 0< IF end-with req? off THEN THEN ; previous gen-table $freeze gen-table $@ inherit-table reply-table Loading Loading @@ -578,7 +581,7 @@ previous 1 packets2 +! ELSE dest-addr 64@ [ cell 4 = ] [IF] 0<> - [THEN] dup 0 r> 2! u>= THEN ; : cmd-loop ( addr u -- ) : cmd-exec ( addr u -- ) string-stack $off object-stack $off nest-stack $off Loading @@ -595,8 +598,6 @@ previous [: outflag @ >r cmdreset init-reply do-cmd-loop r> outflag ! cmd-send? ;] cmdlock c-section ; ' cmd-loop is cmd-exec \ nested commands User neststart# Loading Loading @@ -711,7 +712,15 @@ $10 net2o: push' ( #cmd -- ) \g push command into answer packet +net2o: error-id ( $:errorid -- ) \g error-id string $> $error-id $! ; :noname ( start -- ) gen-table $freeze : ]nest ( -- ) ]nest$ push-$ push' nest ; }scope also net2o-base : net2o:words ( start -- ) token-table $@ 2 pick cells safe/string bounds U+DO I @ ?dup-IF dup >net2o-sig 2>r >net2o-name Loading @@ -719,13 +728,9 @@ $10 net2o: push' ( #cmd -- ) \g push command into answer packet 2 pick ulit, 2r> 2swap [: type type ;] $tmp $, token ELSE 2drop rdrop rdrop THEN THEN 1+ cell +LOOP drop ; IS net2o:words gen-table $freeze cell +LOOP drop ; : ]nest ( -- ) ]nest$ push-$ push' nest ; }scope previous 0 [IF] Local Variables: Loading
net2o-connect.fs +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ \ You should have received a copy of the GNU Affero General Public License \ along with this program. If not, see <http://www.gnu.org/licenses/>. Defer >invitations Forward >invitations scope{ net2o-base \ nat traversal functions Loading
net2o-connected.fs +2 −3 Original line number Diff line number Diff line Loading @@ -401,13 +401,12 @@ also net2o-base pings new-request false gen-punchload gen-punch ; previous :noname ( addr u -- ) : punch-reply ( addr u -- ) outflag @ >r cmdbuf-o @ >r [: cmd0! cmdreset init-reply also net2o-base [ also net2o-base ] $, nest end-code ;] catch r> cmdbuf-o ! r> outflag ! throw ; is punch-reply r> cmdbuf-o ! r> outflag ! throw ; : 0-resend? ( -- n ) resend0 @ IF Loading