Commit 1cd6cd8b authored by bernd's avatar bernd

Added poll request

parent 81ad3e15
......@@ -449,8 +449,8 @@ also net2o-base definitions
: $, ( addr u -- ) string dup >r n>64 cmd,
r@ maxstring u>= !!stringfit!!
cmdbuf$ + r@ move r> cmdbuf# +! ;
: lit, ( u -- ) ulit cmd, ;
: slit, ( n -- ) slit n>zz cmd, ;
: lit, ( 64u -- ) ulit cmd, ;
: slit, ( 64n -- ) slit n>zz cmd, ;
: nlit, ( n -- ) n>64 slit, ;
: ulit, ( u -- ) u>64 lit, ;
: float, ( r -- ) flit cmdbuf$ + dup >r pf!+ r> - cmdbuf+ ;
......
......@@ -54,8 +54,7 @@ reply-table $@ inherit-table fs-table
$20 net2o: open-file ( $:string mode -- ) \ open file with mode
64>r $> 64r> fs-open ;
+net2o: file-type ( n -- ) \ choose file type
;
fs-class! ;
+net2o: close-file ( -- ) \ close file
fs-close ;
+net2o: set-size ( size -- ) \ set size attribute of current file
......@@ -73,7 +72,9 @@ $20 net2o: open-file ( $:string mode -- ) \ open file with mode
+net2o: set-form ( w h -- ) \ if file is a terminal, set size
term-h ! term-w ! ;
+net2o: get-form ( -- ) \ if file is a terminal, request size
term-w @ lit, term-h @ lit, set-form ;
term-w @ ulit, term-h @ ulit, set-form ;
+net2o: poll-request ( ulimit -- ) \ poll a file to check for size changes
poll! lit, set-size ;
gen-table $freeze
' context-table is gen-table
......
......@@ -56,4 +56,5 @@ s" Wrong revocation secret" throwcode !!not-my-revsk!!
s" krypto mem request too big" throwcode !!kr-size!!
s" secret storage size wrong" throwcode !!sec-size!!
s" host not found" throwcode !!host-notfound!!
s" too many revokes chained" throwcode !!maxlookup!!
\ No newline at end of file
s" too many revokes chained" throwcode !!maxlookup!!
s" file class denied" throwcode !!fileclass!!
\ No newline at end of file
......@@ -122,6 +122,13 @@ Create file-classes
here file-classes - cell/ Constant file-classes#
$1 Value fs-class-permit \ by default permit only files
: fs-class! ( n -- )
dup file-classes# u>= !!fileclass!!
1 over lshift fs-class-permit and 0= !!fileclass!!
cells file-classes + @ o cell- ! ;
\ id handling
: id>addr ( id -- addr remainder )
......@@ -155,13 +162,16 @@ here file-classes - cell/ Constant file-classes#
len +LOOP dest-back ! ;
: size! ( 64 -- )
64dup fs-size 64! fs-limit 64umin!
64dup fs-size 64! fs-limit 64umin! ;
: seek-off ( -- )
64#0 fs-seekto 64! 64#0 fs-seek 64! ;
: seekto! ( 64 -- )
fs-size 64@ 64umin fs-seekto 64umax! ;
: limit-min! ( 64 id -- )
fs-size 64@ 64umin fs-limit 64! ;
: init-limit! ( 64 id -- ) state-addr .fs-limit 64! ;
: poll! ( 64 -- 64 )
fs-limit 64! fs-poll 64dup size! ;
: file+ ( addr -- ) >r 1 r@ +!
r@ @ id>addr nip 0<= IF r@ off THEN rdrop ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment