retro.forth: some optimizations in the buffer: words

FossilOrigin-Name: e80f40e3c5dc07db1977fb1b7d0c1d735dd43caf3c71e953f9248d989513c9f9
This commit is contained in:
crc 2019-12-23 15:21:44 +00:00
parent 68661e309c
commit 1e8dd52ee0
3 changed files with 590 additions and 590 deletions

View file

@ -710,19 +710,19 @@ null) and other simple structures.
~~~
{{
:Buffer `0 ; data
:Ptr `0 ; data
:terminate (-) #0 @Ptr store ;
:Start `0 ; data
:End `0 ; data
:terminate (-) #0 @End store ;
---reveal---
:buffer:start (-a) @Buffer ;
:buffer:end (-a) @Ptr ;
:buffer:add (c-) buffer:end store &Ptr v:inc terminate ;
:buffer:get (-c) &Ptr v:dec buffer:end fetch terminate ;
:buffer:empty (-) buffer:start !Ptr terminate ;
:buffer:size (-n) buffer:end buffer:start - ;
:buffer:set (a-) !Buffer buffer:empty ;
:buffer:start (-a) @Start ;
:buffer:end (-a) @End ;
:buffer:add (c-) @End store &End v:inc terminate ;
:buffer:get (-c) &End v:dec @End fetch terminate ;
:buffer:empty (-) @Start !End terminate ;
:buffer:size (-n) @End @Start - ;
:buffer:set (a-) !Start buffer:empty ;
:buffer:preserve (q-)
@Buffer @Ptr [ &call dip !Buffer ] dip !Ptr ;
@Start @End [ &call dip !Start ] dip !End ;
}}
~~~

BIN
ngaImage

Binary file not shown.

File diff suppressed because it is too large Load diff