Vocabulary
io.ports.private

Inputs
dstan object
n-remainingan object
portan object
n-readan object


Outputs
n-totalan object


Definition


:: read-loop ( dst n-remaining port n-read -- n-total )
n-remaining port read-step :> ( n-buffered ptr ) ptr [
dst ptr n-buffered memcpy
n-remaining n-buffered fixnum-fast
:> n-remaining' n-read n-buffered fixnum+fast
:> n-read' n-buffered dst <displaced-alien>
:> dst' dst' n-remaining' port n-read' read-loop
] [ n-read ] if ; inline recursive