io.ports: fix bootstrap
Apparently can't use TYPED: or have HINTS: in the wrong place.db4
parent
9443f30b7d
commit
a67931b7c5
|
@ -7,7 +7,7 @@ io.buffers io.encodings io.encodings.ascii io.encodings.binary
|
||||||
io.encodings.private io.encodings.utf8 io.timeouts kernel libc
|
io.encodings.private io.encodings.utf8 io.timeouts kernel libc
|
||||||
locals math math.order namespaces sequences specialized-arrays
|
locals math math.order namespaces sequences specialized-arrays
|
||||||
specialized-arrays.instances.alien.c-types.uchar splitting
|
specialized-arrays.instances.alien.c-types.uchar splitting
|
||||||
strings summary system typed io.files ;
|
strings summary system io.files kernel.private ;
|
||||||
IN: io.ports
|
IN: io.ports
|
||||||
|
|
||||||
SYMBOL: default-buffer-size
|
SYMBOL: default-buffer-size
|
||||||
|
@ -46,12 +46,15 @@ M: input-port stream-read1
|
||||||
dup check-disposed
|
dup check-disposed
|
||||||
dup wait-to-read [ drop f ] [ buffer>> buffer-pop ] if ; inline
|
dup wait-to-read [ drop f ] [ buffer>> buffer-pop ] if ; inline
|
||||||
|
|
||||||
TYPED: read-step ( count: fixnum port: input-port -- count: fixnum ptr/f: c-ptr )
|
! TYPED: read-step ( count: fixnum port: input-port -- count: fixnum ptr/f: c-ptr )
|
||||||
|
: (read-step) ( count: fixnum port: input-port -- count: fixnum ptr/f: c-ptr )
|
||||||
{
|
{
|
||||||
{ [ over 0 = ] [ 2drop 0 f ] }
|
{ [ over 0 = ] [ 2drop 0 f ] }
|
||||||
{ [ dup wait-to-read ] [ 2drop 0 f ] }
|
{ [ dup wait-to-read ] [ 2drop 0 f ] }
|
||||||
[ buffer>> buffer-read-unsafe ]
|
[ buffer>> buffer-read-unsafe ]
|
||||||
} cond ;
|
} cond ;
|
||||||
|
: read-step ( count port -- count ptr/f )
|
||||||
|
(read-step) { fixnum c-ptr } declare ; inline
|
||||||
|
|
||||||
: prepare-read ( count stream -- count stream )
|
: prepare-read ( count stream -- count stream )
|
||||||
dup check-disposed [ 0 max >fixnum ] dip ; inline
|
dup check-disposed [ 0 max >fixnum ] dip ; inline
|
||||||
|
@ -60,10 +63,6 @@ M: input-port stream-read-partial-unsafe ( n dst port -- count )
|
||||||
[ swap ] dip prepare-read read-step
|
[ swap ] dip prepare-read read-step
|
||||||
[ swap [ memcpy ] keep ] [ 2drop 0 ] if* ;
|
[ swap [ memcpy ] keep ] [ 2drop 0 ] if* ;
|
||||||
|
|
||||||
HINTS: M\ input-port stream-read-unsafe
|
|
||||||
{ fixnum byte-array input-port }
|
|
||||||
{ fixnum string input-port } ;
|
|
||||||
|
|
||||||
:: read-loop ( n-remaining n-read port dst -- n-total )
|
:: read-loop ( n-remaining n-read port dst -- n-total )
|
||||||
n-remaining 0 > [
|
n-remaining 0 > [
|
||||||
n-remaining port read-step :> ( n-buffered ptr )
|
n-remaining port read-step :> ( n-buffered ptr )
|
||||||
|
@ -89,10 +88,6 @@ M:: input-port stream-read-unsafe ( n dst port -- count )
|
||||||
] if
|
] if
|
||||||
] [ 0 ] if ;
|
] [ 0 ] if ;
|
||||||
|
|
||||||
HINTS: M\ input-port stream-read-unsafe
|
|
||||||
{ fixnum byte-array input-port }
|
|
||||||
{ fixnum string input-port } ;
|
|
||||||
|
|
||||||
: read-until-step ( separators port -- string/f separator/f )
|
: read-until-step ( separators port -- string/f separator/f )
|
||||||
dup wait-to-read [ 2drop f f ] [ buffer>> buffer-until ] if ;
|
dup wait-to-read [ 2drop f f ] [ buffer>> buffer-until ] if ;
|
||||||
|
|
||||||
|
@ -237,3 +232,12 @@ M: object underlying-handle underlying-port handle>> ;
|
||||||
HINTS: decoder-read-until { string input-port utf8 } { string input-port ascii } ;
|
HINTS: decoder-read-until { string input-port utf8 } { string input-port ascii } ;
|
||||||
|
|
||||||
HINTS: decoder-readln { input-port utf8 } { input-port ascii } ;
|
HINTS: decoder-readln { input-port utf8 } { input-port ascii } ;
|
||||||
|
|
||||||
|
HINTS: M\ input-port stream-read-partial-unsafe
|
||||||
|
{ fixnum byte-array input-port }
|
||||||
|
{ fixnum string input-port } ;
|
||||||
|
|
||||||
|
HINTS: M\ input-port stream-read-unsafe
|
||||||
|
{ fixnum byte-array input-port }
|
||||||
|
{ fixnum string input-port } ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue