retro/ilo editor port: now able to run code in a block!

FossilOrigin-Name: ea26b50243276e68a62cdf64db13d958aa7621539c8abe52a27c0361582f12c6
This commit is contained in:
crc 2022-07-25 13:14:27 +00:00
parent afc7a483c4
commit 5c104a8f15

View file

@ -111,7 +111,34 @@ data store limits.
~~~ ~~~
~~~ ~~~
:run &block:buffer ; {{
'max-length var
'source var
'index var
'token d:create #65 allot
:eoi? &index &max-length &fetch bi@ gt? ;
:eow? &token fetch &token n:add fetch
[ #32 eq? ] [ #0 eq? ] bi or ;
:set-input
#0 &index store
[ &source store ] [ a:length &max-length store ] bi ;
:get-char
&source fetch &index fetch a:fetch
&token v:inc &index v:inc
&token fetch &token n:add store ;
:parse-word
#0 &token store
[ get-char eow? eoi? or ] until
&token dup v:dec ;
:count-words #1 swap [ #32 eq? &n:inc if ] a:for-each ;
:valid? dup a:length n:-zero? ;
:s:evaluate
&set-input &count-words bi
[ parse-word valid? [ a:to-string interpret ] &drop choose ] times ;
---reveal---
:run &block:buffer n:dec #1024 over store s:evaluate ;
}}
:use (block) set load run ; :use (block) set load run ;