/*
 * nopoll.h
 *
 * [Generated from nopoll, 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 __nopoll_h
#define __nopoll_h

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

/*----- Overview ----------------------------------------------------------*
 *
 * Functions provided:
 *
 *  nopoll_open
 *  nopoll_close
 *  nopoll_init
 *  nopoll_process
 */

/* --- nopoll_open --- *
 *
 * On entry:	R0 == a window handle to take over
 *
 * On exit:	--
 *
 * Use:		Sets up the window with the given handle to be a nonpolling
 *		dialogue box.  The window must already be open on the screen.
 *		This call will force it to be painted on the screen, and
 *		then start faking events for it.
 */

extern routine nopoll_open;

/* --- nopoll_close --- *
 *
 * On entry:	R0 == return value for nopoll_process (can be anything)
 *
 * On exit:	--
 *
 * Use:		Tells nopoll that the nonpolling window has been killed,
 *		and hence that polling can return to normal again.  You can
 *		specify a return value to give from nopoll_process (if that
 *		system is being used).
 */

extern routine nopoll_close;

/* --- nopoll_init --- *
 *
 * On entry:	--
 *
 * On exit:	--
 *
 * Use:		Initialises nopoll so it can be used.
 */

extern routine nopoll_init;

/* --- nopoll_process --- *
 *
 * On entry:	--
 *
 * On exit:	R0 == value passed to nopoll_close
 *
 * Use:		Processes a nonpolling window until it calls nopoll_close.
 *		It then returns the value passed to nopoll_close in R0,
 *		which can be defined in any way you want.
 *
 *		Some notes on the use of this routine:
 *
 *		* It calls event_poll, so any functions that get called
 *		  after the normal event_poll don't get called.  Since the
 *		  Wimp isn't actually being polled at all, this isn't a
 *		  real problem as long as your handlers are registered at the
 *		  event filter level or higher (e.g. win event handlers or
 *		  even dbox handlers).
 *
 *		* It uses up an extra 256 bytes of stack for a poll block.
 *		  If you think you might miss this stack space, then you'd
 *		  better not use this routine.
 *
 *		* It isn't reentrant, but then again, nor is the rest of the
 *		  nopoll system -- you can only have one nonpolling box open
 *		  at a time.
 */

extern routine nopoll_process;

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

#endif
