;
; idle.sh
;
; Idle event and alarm 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:
;
;  idle_handler
;  idle_removeHandler
;  idle_setAlarm
;  idle_removeAlarm
;  idle_removeAllAlarms
;  idle_init

		[	:LNOT::DEF:idle__dfn
		GBLL	idle__dfn

; --- idle_handler ---
;
; On entry:	R0 == how frequently to call
;		R1 == pointer to routine to call
;		R2 == R10 value to call routine with
;		R3 == R12 value to call routine with
;
; On exit:	May return an error
;
; Use:		Adds a routine to the idle handler list. Later added
;		routines are called first. The idle handing routine
;		may corrupt R10 and R12.

		IMPORT	idle_handler

; --- idle_removeHandler ---
;
; On entry:	R0 == How frequently it was called
;		R1 == pointer to routine called
;		R2 == R10 value routine is called with
;		R3 == R12 value routine is called with
;
; On exit:	--
;
; Use:		Removes a routine from the idle handler list.

		IMPORT	idle_removeHandler

; --- idle_setAlarm ---
;
; On entry:	R3 == Time to call
;		R1 == pointer to routine to call
;		R2 == R10 value to call routine with
;		R3 == R12 value to call routine with
;
; On exit:	May return an error
;
; Use:		Adds a alarm to be called. The idle handing routine
;		may corrupt R10 and R12.

		IMPORT	idle_setAlarm

; --- idle_removeAlarm ---
;
; On entry:	R0 == When it was to be called
;		R1 == pointer to routine called
;		R2 == R10 value routine is called with
;		R3 == R12 value routine is called with
;
; On exit:	--
;
; Use:		Removes a routine from the idle handler list. It has
;		no effect if it doesn't exist.

		IMPORT	idle_removeAlarm

; --- idle_removeAllAlarms ---
;
; On entry:	R0 == R10 value to look for
;
; On exit:	--
;
; Use:		Removes all alarms with the handle that was passed to them
;		to be put into R10.  You should not remove an alarm within
;		an alarm handler.


		IMPORT	idle_removeAllAlarms

; --- idle_init ---
;
; On entry:	--
;
; On exit:	--
;
; Use:		Initialises the idle system.

		IMPORT	idle_init

		]

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

		END
