/*
 * xload.h
 *
 * [Generated from xload, 08 November 1995]
 */

#pragma include_only_once
#pragma force_top_level

#ifndef __xload_h
#define __xload_h

/*----- Overview ----------------------------------------------------------*
 *
 * Functions provided:
 *
 *  xload_file
 *  xload_initBuf
 *  xload_killBuf
 *  xload_extend
 *  xload_doneBuf
 *  xload_done
 *  xload_failed
 *  xload_byte
 *  xload_word
 *  xload_block
 */

/* --- xload_file --- *
 *
 * On entry:	R0 == pointer to loader routine
 *		R1 == R10 value to pass to loader
 *		R2 == R12 value to pass to loader
 *		R3 == pointer to leafname of file (passed to loader in R0)
 *		R4 == pointer to filename to load from
 *		R5 == whether the file is safe (passed to loader in R1)
 *
 * On exit:	May return an error
 *
 * Use:		Calls a generalised loader routine to read data from a file.
 */

extern routine xload_file;

/* --- xload_initBuf --- *
 *
 * On entry:	R0 == pointer to loader routine
 *		R1 == R10 value to pass to loader
 *		R2 == R12 value to pass to loader
 *		R3 == pointer to leafname of file (passed to loader in R0)
 *
 * On exit:	R0 == pointer to load buffer
 *		R1 == size of load buffer
 *		May return an error
 *
 * Use:		Starts a RAM transfer and starts up a generalised load
 *		routine.
 */

extern routine xload_initBuf;

/* --- xload_killBuf --- *
 *
 * On entry:	--
 *
 * On exit:	--
 *
 * Use:		Does a buffer destroy for a failed load operation.
 */

extern routine xload_killBuf;

/* --- xload_extend --- *
 *
 * On entry:	R1 == size of last buffer used for receiving
 *
 * On exit:	R0 == pointer to new buffer
 *		R1 == size of new buffer
 *		May return an error
 *
 * Use:		Performs a buffer extent operation during an xload RAM
 *		transfer.
 */

extern routine xload_extend;

/* --- xload_doneBuf --- *
 *
 * On entry:	R1 == total size of data received
 *
 * On exit:	R0 corrupted
 *		May return an error
 *
 * Use:		Handles the last bufferful of a RAM load.
 */

extern routine xload_doneBuf;

/* --- xload_done --- *
 *
 * On entry:	--
 *
 * On exit:	--
 *
 * Use:		Tidies up after a successful load job.
 */

extern routine xload_done;

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

extern routine xload_failed;

/* --- xload_byte --- *
 *
 * On entry:	--
 *
 * On exit:	CC if data read OK, and
 *		  R0 == byte read
 *		else CC if end-of-file, and
 *		  R0 corrupted
 *		May return an error
 *
 * Use:		Reads a byte from the current input.
 */

extern routine xload_byte;

/* --- xload_word --- *
 *
 * On entry:	--
 *
 * On exit:	CC if data read OK, and
 *		  R0 == word read
 *		else CS if end-of-file and
 *		  R0 corrupted
 *		May return an error
 *
 * Use:		Reads a word from the current input.
 */

extern routine xload_word;

/* --- xload_block --- *
 *
 * On entry:	R0 == pointer to buffer to read
 *		R1 == size of buffer to read
 *
 * On exit:	R0, R1 preserved
 *		R2 == number of bytes read
 *		CC if more data available, CS for end-of-file
 *		May return an error
 *
 * Use:		Reads in a block of data.  Data is buffered, so this is
 *		fairly quick for reading small objects.  Large data blocks
 *		are read directly to avoid buffering overhead.
 */

extern routine xload_block;

/*----- That's all, folks -------------------------------------------------*/

#endif
