mirror of
https://github.com/nineties/planckforth
synced 2024-12-26 21:58:42 +01:00
Add input stream stack
This commit is contained in:
parent
81f07797dc
commit
9be13d26ce
1 changed files with 26 additions and 0 deletions
26
bootstrap.fs
26
bootstrap.fs
|
@ -1429,3 +1429,29 @@ W/O stdout_ file>fam c!
|
|||
|
||||
\ do nothing
|
||||
:noname drop success ; stdout_ file>flush !
|
||||
|
||||
( === Input Stream === )
|
||||
|
||||
\ input stream stack
|
||||
struct
|
||||
cell% field input>next
|
||||
cell% field input>file
|
||||
cell% field input>lineno
|
||||
end-struct input%
|
||||
|
||||
variable input-streams
|
||||
0 input-streams !
|
||||
|
||||
: push-input-stream ( file -- )
|
||||
input% %allot \ addr
|
||||
swap over input>file !
|
||||
0 over input>lineno !
|
||||
input-streams @ over input>next !
|
||||
input-streams !
|
||||
;
|
||||
|
||||
: pop-input-stream ( -- )
|
||||
input-streams @ input-streams !
|
||||
;
|
||||
|
||||
stdin_ push-input-stream
|
||||
|
|
Loading…
Reference in a new issue