read-loop ( dst n-remaining port n-read -- n-total )


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 [
n-read dst <displaced-alien> ptr n-buffered memcpy
n-remaining n-buffered fixnum-fast
:> n-remaining' n-read n-buffered fixnum+fast
:> n-read' dst n-remaining' port n-read' read-loop
] [ n-read ] if ; inline recursive