;
; coRoutine.sh
;
; Basic coroutine handling
;
;  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:
;
;  coRout_create
;  coRout_switch
;  coRout_destroy
;  coRout_end

		[	:LNOT::DEF:coRoutine__dfn
		GBLL	coRoutine__dfn

; --- coRout_create ---
;
; On entry:	R0 == pointer to coroutine
;		R1 == R10 value to pass to coroutine
;		R2 == R12 value to pass to coroutine
;		R3 == size of stack to pass (0 for default)
;
; On exit:	R0 == coroutine handle
;		May return an error
;
; Use:		Creates a new coroutine.  It may be given control using
;		coRout_switch.  Its registers are on entry:
;
;		R0 == its coroutine handle
;		R10 == value passed to coRout_create in R1
;		R12 == value passed to coRout_create in R2
;		R13 == pointer to the stack created for it

		IMPORT	coRout_create

; --- coRout_switch ---
;
; On entry:	R0 == coroutine to switch to, or 0 for main
;
; On exit:	--
;
; Use:		Switches context to another coroutine.

		IMPORT	coRout_switch

; --- coRout_destroy ---
;
; On entry:	R0 == coroutine handle to destroy
;
; On exit:	--
;
; Use:		Destroys a coroutine.

		IMPORT	coRout_destroy

; --- coRout_end ---
;
; On entry:	--
;
; On exit:	Doesn't.
;
; Use:		Terminates the current coroutine.

		IMPORT	coRout_end

		]

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

		END
