?? EJECT ??
  PROCEDURE [INLINE] rfp$move_data_to_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 a user specified field into the
{    network wired buffers.
{
{    buffer_list: (input,output) This parameter specifies the list of buffers to move
{      the data into.
{
{    data: (input,output) This parameter specifies the pointer to the user data.
{      Upon exit this parameter points to the byte beyond the last byte placed
{      in the buffer.
{
{    buffer_count: (input) This parameter specifies the number of wired buffers.
{
{    current_buffer: (input,output) This parameter specifies the first buffer to
{      receive the data.  Upon exit this parameter points to the next buffer
{      to receive data.
{
{    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,
        room_in_buffer: rft$bytes_transferred;

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

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

