mirror of
https://github.com/forth-ev/VolksForth.git
synced 2024-11-21 14:31:21 +00:00
Circular String Buffer
This commit is contained in:
parent
adde793779
commit
c3d3da6771
35
sources/generic/csb.fth
Normal file
35
sources/generic/csb.fth
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
( ----- 000 )
|
||||||
|
\\ Circular String Buffer cas 27jul20
|
||||||
|
Wil Baden, Costa Mesa, California
|
||||||
|
Forth Dimensions July 1996
|
||||||
|
( ----- 001 )
|
||||||
|
\ CSB load screen cas 27jul20
|
||||||
|
|
||||||
|
1 3 +thru
|
||||||
|
|
||||||
|
|
||||||
|
.( Circular Ring Buffer loaded. )
|
||||||
|
( ----- 002 )
|
||||||
|
\ Get-Buf >PAD cas 27jul20
|
||||||
|
|
||||||
|
1000 CONSTANT /CSB
|
||||||
|
CREATE CSB 0 , /CSB ALLOT
|
||||||
|
|
||||||
|
: GET-BUF ( n -- c_addr )
|
||||||
|
DUP CSB @ > IF /CSB CSB ! THEN
|
||||||
|
NEGATE CSB +!
|
||||||
|
CSB 2+ CSB @ + ;
|
||||||
|
|
||||||
|
: >PAD ( a u -- 'a u )
|
||||||
|
DUP GET-BUF SWAP
|
||||||
|
2DUP >R >R MOVE R> R> ;
|
||||||
|
( ----- 003 )
|
||||||
|
\ S" cas 27jul20
|
||||||
|
|
||||||
|
: S" ( "ccc<quote>" -- | c_addr u )
|
||||||
|
ASCII " PARSE
|
||||||
|
STATE @ IF
|
||||||
|
POSTPONE SLITERAL
|
||||||
|
ELSE
|
||||||
|
>PAD
|
||||||
|
THEN ; IMMEDIATE
|
Loading…
Reference in New Issue
Block a user