Fix stdin
parent
f63b9597bc
commit
eba4b990af
|
@ -159,9 +159,9 @@ M: unix io-multiplex ( ms/f -- )
|
||||||
! pipe to non-blocking, and read from it instead of the real
|
! pipe to non-blocking, and read from it instead of the real
|
||||||
! stdin. Very crufty, but it will suffice until we get native
|
! stdin. Very crufty, but it will suffice until we get native
|
||||||
! threading support at the language level.
|
! threading support at the language level.
|
||||||
TUPLE: stdin control size data ;
|
TUPLE: stdin control size data disposed ;
|
||||||
|
|
||||||
M: stdin dispose
|
M: stdin dispose*
|
||||||
[
|
[
|
||||||
[ control>> &dispose drop ]
|
[ control>> &dispose drop ]
|
||||||
[ size>> &dispose drop ]
|
[ size>> &dispose drop ]
|
||||||
|
@ -194,10 +194,10 @@ M: stdin refill
|
||||||
: data-read-fd ( -- fd ) "stdin_read" f dlsym *uint ;
|
: data-read-fd ( -- fd ) "stdin_read" f dlsym *uint ;
|
||||||
|
|
||||||
: <stdin> ( -- stdin )
|
: <stdin> ( -- stdin )
|
||||||
control-write-fd <fd> <output-port>
|
stdin new
|
||||||
size-read-fd <fd> init-fd <input-port>
|
control-write-fd <fd> <output-port> >>control
|
||||||
data-read-fd <fd>
|
size-read-fd <fd> init-fd <input-port> >>size
|
||||||
stdin boa ;
|
data-read-fd <fd> >>data ;
|
||||||
|
|
||||||
M: unix (init-stdio) ( -- )
|
M: unix (init-stdio) ( -- )
|
||||||
<stdin> <input-port>
|
<stdin> <input-port>
|
||||||
|
|
Loading…
Reference in New Issue