;
; save.sh
;
; Saving data to other applications
;
;  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:
;
;  save

		[	:LNOT::DEF:save__dfn
		GBLL	save__dfn

; --- save ---
;
; On entry:	R0 == window handle to send to
;		R1 == icon handle to send to
;		R2 == estimated size of the data
;		R3 == file type of data to send and flag:
;		      bit 31: use R8 as below
;		R4 == pointer to name of file (may be full path)
;		R5 == address of handler block
;		R6 == value to pass handlers in R10
;		R7 == value to pass handlers in R12
;		R8 == pointer to extra handler block (only if bit 31 of R3)
;
; On exit:	--
;
; Use:		Starts a save operation to another application.  The extra
;		handler is used by systems like saveas which need to be
;		aware of data transfer start/end conditions without
;		interfering with the normal entry table.  This will not
;		normally concern applications however.

		IMPORT	save

;----- The save handler -----------------------------------------------------

		^	0
sEntry__save	#	4			;Write to a file
						;Entry:
						;  R0 == pointer to file name
						;  R1 == 0 if file unsafe,
						;        non-0 if safe
						;Exit:
						;  --

sEntry__send	#	4			;Send a block of data
						;Entry:
						;  R2 == 0 for first call,
						;        or R2 from previous
						;Exit:
						;  R0 == pointer to block
						;  R1 == size of block
						;  R2 == value to pass to
						;        next call
						;  CS if this is the last one

sEntry__success	#	4			;Data transfer has finished
						;Entry:
						;  R0 == pointer to filename
						;  R1 == safeness flag
						;Exit:
						;  --

sEntry__failed	#	4			;Data transfer failed
						;Entry:
						;  R0 == 0 or ptr to error
						;  R1 == 1
						;Exit:
						;  --

		]

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

		END
