duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 5febd7d20590f533b394aa1d396320e0adbd89c0
parent 49c8ade18ebc987e12acbe4492f2394a73e5b773
Author: binarycat <binarycat@envs.net>
Date:   Tue, 12 Jul 2022 11:02:39 -0400

add with-stdin-file

Diffstat:
Mfs/cc/cc.fs | 2+-
Mfs/sys/file.fs | 4++++
Mfs/xcomp/bootlo.fs | 1+
3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/cc/cc.fs b/fs/cc/cc.fs @@ -10,4 +10,4 @@ require sys/xhere.fs xhere$ xhere[ parseast curunit _debug if dup printast nl> then ]xhere gennode ; -: cc<< ( -- ) word fopen dup [f<] to stdin cc1, fclose ; +: cc<< ( -- ) ['] cc1, word with-stdin-file ; diff --git a/fs/sys/file.fs b/fs/sys/file.fs @@ -32,3 +32,7 @@ $200 scratchpad$ filespad : .floaded floaded begin dup while dup 4 + stype nl> @ repeat drop ; : require word dup floaded? not if stype abort" required" else drop then ; +: with-stdin-file ( w str -- ) + to@ stdin >r fopen dup >r ( w fcursor ) + [f<] to stdin execute + r> fclose r> to stdin ; diff --git a/fs/xcomp/bootlo.fs b/fs/xcomp/bootlo.fs @@ -3,6 +3,7 @@ : to ['] ! [to] ; : to+ ['] +! [to] ; : to' ['] noop [to] ; +: to@ ['] @ [to] ; : compile ' litn ['] execute, execute, ; immediate : if compile (?br) here 4 allot ; immediate : ahead compile (br) here 4 allot ; immediate