/*
 * event.h
 *
 * [Generated from event, 25 September 1996]
 */

#if !defined(__CC_NORCROFT) || !defined(__arm)
  #error You must use the Norcroft ARM Compiler for Sapphire programs
#endif

#pragma include_only_once
#pragma force_top_level

#ifndef __event_h
#define __event_h

#ifndef __sapphire_h
  #include "sapphire.h"
#endif

/*----- Overview ----------------------------------------------------------*
 *
 * Functions provided:
 *
 *  event_preFilter
 *  event_fakeHandler
 *  event_postFilter
 *  event_poll
 *  event_last
 *  event_init
 */

/* --- event_preFilter --- *
 *
 * On entry:	R0 == pointer to routine to call
 *		R1 == R12 value to call routine
 *
 * On exit:	May return an error
 *
 * Use:		Adds a routine to the pre-filter list. Later added
 *		routines are called first.
 */

extern routine event_preFilter;

/* --- event_fakeHandler --- *
 *
 * On entry:	R0 == pointer to routine to call
 *		R1 == R12 value to call routine
 *
 * On exit:	May return an error
 *
 * Use:		Adds a routine to the fake handler list. Later added
 *		routines are called first.
 */

extern routine event_fakeHandler;

/* --- event_postFilter --- *
 *
 * On entry:	R0 == pointer to routine to call
 *		R1 == R12 value to call routine
 *
 * On exit:	May return an error
 *
 * Use:		Adds a routine to the post-poll list. Later added
 *		routines are called first.
 */

extern routine event_postFilter;

/* --- event_poll --- *
 *
 * On entry:	R0 == event mask and flags
 *		R1 == pointer to block to use
 *		R2 == earliest time to return with NULL event
 *		R3 == optional pointer to poll word
 *
 * On exit:	R0 == reason code
 *		CS if the event was claimed, CC otherwise
 *
 * Use:		This call perform a Wimp_Poll, and dispatches events to
 *		interested parties.
 */

extern routine event_poll;

/* --- event_last --- *
 *
 * On entry:	--
 *
 * On exit:	R0 == last event code received from Wimp_Poll
 *		R1 == pointer to accompanying event data
 *
 * Use:		Allows you to read the full event information.  The event
 *		is the same one currently being or most recently dispatched
 *		to the postfilter list, i.e. fake events are also returned
 *		by this call.  If no event has yet been received, the return
 *		values are undefined.
 */

extern routine event_last;

/* --- event_init --- *
 *
 * On entry:	--
 *
 * On exit:	--
 *
 * Use:		Initialises the event system.
 */

extern routine event_init;

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

#endif
