?? EJECT ??
  PROCEDURE [INLINE] rfp$move_data_from_wired_buffs(VAR buffer_list: rft$buffer_list;
                                                    VAR pva: ^CELL;
                                                        buffer_count: rft$buffer_count;
                                                    VAR current_buffer: rft$buffer_count;
                                                    VAR byte_count: rft$bytes_transferred);

{    The purpose of this routine is to move data from the network wired buffers into
{    the specified user data field.
{
{    buffer_list: (input,output) This parameter specifies the list of buffers to move
{      the data from.
{
{    data: (input,output) This parameter specifies the pointer of the user buffer
{      to recieve the data.  Upon exit this parameter points to the byte beyond the
{      last byte written to the buffer.
{
{    buffer_count: (input) This parameter specifies the number of wired buffers.
{
{    current_buffer: (input,output) This parameter specifies the first buffer to
{      move the data from.  Upon exit this parameter points to the next buffer
{      to move the data from.
{
{    byte_count: (input,output) This parameter specifies the number of bytes to move.
{      Upon exit this parameter specifies the number of bytes that were not moved.


    VAR
        buffer_ptr: ^CELL,
        data_in_buffer: rft$bytes_transferred;

    WHILE  (byte_count > 0) AND
           (buffer_list[current_buffer].byte_count > 0)  DO
      data_in_buffer := buffer_list[current_buffer].byte_count;
      IF  data_in_buffer > byte_count  THEN
        data_in_buffer := byte_count;
      IFEND;
      buffer_ptr := i#ptr(buffer_list[current_buffer].current_offset, buffer_list[current_buffer].buffer);
      i#move(buffer_ptr, pva, data_in_buffer);
      pva := i#ptr(data_in_buffer, pva);
      buffer_list[current_buffer].byte_count := buffer_list[current_buffer].byte_count - data_in_buffer;
      buffer_list[current_buffer].current_offset := buffer_list[current_buffer].current_offset +
        data_in_buffer;
      IF  buffer_list[current_buffer].byte_count = 0  THEN
        current_buffer := (current_buffer MOD buffer_count) + 1;
      IFEND;
      byte_count := byte_count - data_in_buffer;
    WHILEND;

  PROCEND rfp$move_data_from_wired_buffs;
?? PUSH (LISTEXT := ON) ??
*copyc i#move
*copyc i#ptr
*copyc rft$r1_interface_defs
*copyc rft$external_interface
?? POP ??
