;
; xfer.xsave.sh
;
; Simplified saving with coroutines
;
;  1994-1998 Straylight
;

;----- Licensing note -------------------------------------------------------
;
; This file is part of Straylight's Sapphire library.
;
; Sapphire is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2, or (at your option)
; any later version.
;
; Sapphire 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 General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with Sapphire.  If not, write to the Free Software Foundation,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

;----- Overview -------------------------------------------------------------
;
; Functions provided:
;
;  xsave_save
;  xsave_send
;  xsave_done
;  xsave_failed
;  xsave_byte
;  xsave_word
;  xsave_string
;  xsave_block

		[	:LNOT::DEF:xsave__dfn
		GBLL	xsave__dfn

; --- xsave_save ---
;
; On entry:	R0 == pointer to saver routine
;		R1 == R10 value to pass to saver
;		R2 == R12 value to pass to saver
;		R3 == pointer to filename to save to
;		R4 == filetype of file to save
;
; On exit:	May return an error
;
; Use:		Calls a generalised saver routine to write data to a file.

		IMPORT	xsave_save

; --- xsave_send ---
;
; On entry:	R0 == pointer to saver routine
;		R1 == R10 value to pass to saver
;		R2 == R12 value to pass to saver
;
; On exit:	R0 == pointer to block to send
;		R1 == size of block
;		CS if this is the last block, else CC
;		May return an error
;
; Use:		Calls a generalised saver routine to write data to another
;		application, using RAM transfer.  Note that you must call
;		this routine from your send entry point throughout the
;		save operation.

		IMPORT	xsave_send

; --- xsave_done ---
;
; On entry:	--
;
; On exit:	--
;
; Use:		Tidies up after a successful save job.

		IMPORT	xsave_done

; --- xsave_failed ---
;
; On entry:	R0 == pointer to error block
;
; On exit:	--
;
; Use:		Tidies up a RAM transfer after an error.

		IMPORT	xsave_failed

; --- xsave_byte ---
;
; On entry:	R0 == byte to write in lowest 8 bits
;
; On exit:	May return an error
;
; Use:		Writes a single byte to the current output.

		IMPORT	xsave_byte

; --- xsave_word ---
;
; On entry:	R0 == word to write
;
; On exit:	May return an error
;
; Use:		Writes a single word to the current output.

		IMPORT	xsave_word

; --- xsave_string ---
;
; On entry:	R0 == pointer to a control-terminated string
;
; On exit:	May return an error
;
; Use:		Writes a control-terminated string to the current output.
;		The string is null terminated in the output file.

		IMPORT	xsave_string

; --- xsave_block ---
;
; On entry:	R0 == pointer to buffer to write
;		R1 == size of buffer to write
;
; On exit:	May return an error
;
; Use:		Writes out a block of data.  Data is buffered, so this is
;		fairly quick for reading small objects.  Large data blocks
;		are sent directly to avoid buffering overhead.

		IMPORT	xsave_block

		]

;----- That's all, folks ----------------------------------------------------

		END
