mirror of
https://github.com/nineties/planckforth
synced 2024-12-26 21:58:42 +01:00
parent
6e58030b9a
commit
cb8252b648
1 changed files with 5 additions and 16 deletions
21
bootstrap.fs
21
bootstrap.fs
|
@ -2356,7 +2356,10 @@ need-defined (close)
|
|||
need-defined (write)
|
||||
need-defined (read)
|
||||
|
||||
: make-file ( c-addr fam fd -- file e)
|
||||
: open-file ( c-addr fam -- file e )
|
||||
2dup (open) dup -1 = if
|
||||
3drop 0 OPEN-FILE-ERROR exit
|
||||
then
|
||||
file% %allocate throw
|
||||
tuck file>fd !
|
||||
tuck file>fam !
|
||||
|
@ -2376,24 +2379,10 @@ need-defined (read)
|
|||
success
|
||||
;
|
||||
|
||||
: open-file ( c-addr fam -- file e )
|
||||
2dup (open) dup -1 = if
|
||||
3drop 0 OPEN-FILE-ERROR exit
|
||||
then
|
||||
make-file
|
||||
;
|
||||
|
||||
: close-file ( file -- e )
|
||||
file>fd @ (close) 0= if success else CLOSE-FILE-ERROR then
|
||||
;
|
||||
|
||||
s" <stdin>" R/O 0 make-file throw constant stdin
|
||||
s" <stdout>" W/O 1 make-file throw constant stdout
|
||||
s" <stderr>" W/O 2 make-file throw constant stderr
|
||||
|
||||
\ replace stdin_ with stdin
|
||||
stdin inputstreams @ input>file !
|
||||
|
||||
( === File Include === )
|
||||
|
||||
: included ( c-addr -- )
|
||||
|
@ -2452,7 +2441,7 @@ stdin inputstreams @ input>file !
|
|||
[if] [unless] [else] [then] defined?
|
||||
open-file close-file write-file flush-file
|
||||
read-file key-file read-line
|
||||
R/W W/O R/O EOF stdin stdout stderr
|
||||
R/W W/O R/O EOF
|
||||
|
||||
abort ABORTED-ERROR
|
||||
QUIT not-reachable NOT-REACHABLE
|
||||
|
|
Loading…
Reference in a new issue