home *** CD-ROM | disk | FTP | other *** search
- \ lib/interactive.fth defines a local forth interpreter loop
-
- 0 pointer stack-buff
- variable exit-interact?
-
- : use-local-stack \ ( ??? -- )
- stack-buff
- ps-size 20 cells+ allocate abort" Can't allocate local stack" is stack-buff
- stack-buff 3 cells+ !
- sp0 @ stack-buff ! sp@ stack-buff cell+ !
- exit-interact? @ stack-buff 2 cells+ ! exit-interact? off
- stack-buff ps-size 16 cells+ sp0 !
- clear ;
- : use-old-stack \ ( ??? -- )
- stack-buff 2 cells+ @ exit-interact? !
- stack-buff @ sp0 ! stack-buff cell+ @ sp!
- stack-buff 3 cells+ @
- stack-buff free abort" Interact stack error"
- is stack-buff ;
- : interpret-line \ input-line ( -- ?? )
- 0. 0. 0 prompt 2drop 2drop drop \ Hack to make showstack work
- ??cr ." -ok- " tib 80 expect tib span @ evaluate ;
- : interact \ ( -- )
- use-local-stack
- begin interpret-line exit-interact? @ until
- use-old-stack ;
-