--
--	Inmos Libraries
--	Copyright (C) 1988, 1989, 1990, 1991, 1993  Inmos Limited
--
--	This library is free software; you can redistribute it and/or
--	modify it under the terms of the GNU Lesser General Public
--	License as published by the Free Software Foundation; either
--	version 2 of the License, or (at your option) any later version.
--
--	This library is distributed in the hope that it will be useful,
--	but WITHOUT ANY WARRANTY; without even the implied warranty of
--	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--	Lesser General Public License for more details.
--
--	You should have received a copy of the GNU Lesser General Public
--	License along with this library; if not, write to the Free Software
--	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
--

--** @module hostio

#COMMENT "Host i/o library, V1.00, 10/03/89"
#COMMENT "(c) Copyright INMOS Limited 1989"
#INCLUDE "hostio.inc"
#USE "spwrite"
--{{{  sp.puts
--* Write a line to the specified output stream.
--
-- A newline sequence is added to the end of the bytes to be written.
--
-- @param fs from server
-- @param ts to server
-- @param streamid the identification number of the stream to be
--   written to
-- @param data the line to be written ( without a terminating newline
--   sequence )
-- @param result equal to spr.ok if the line was successfully written;
--   otherwise takes on a value indicating what was wrong:
--   spr.bad.packet.size   too many bytes supplied, (SIZE data) >
--   sp.max.writebuffer.size >=spr.operation.failed  the write failed -
--   see hostio.inc or iserver documentation for further details
PROC sp.puts (CHAN OF SP fs, ts, VAL INT32 streamid, VAL []BYTE data,
              BYTE result)
  IF
    (SIZE data) > sp.max.writebuffer.size
      result := spr.bad.packet.size
    TRUE
      INT length.written:
      SEQ
        sp.write (fs, ts, streamid, data, length.written, result)
        sp.write (fs, ts, streamid, ['*n'], length.written, result)
:
--}}}  sp.puts
--{{{  so.puts
PROC so.puts (CHAN OF SP fs, ts, VAL INT32 streamid, VAL []BYTE data,
              BYTE result)

  sp.puts (fs, ts, streamid, data, result)
:
--}}}  so.puts
