/* TBI CATAGORY A                                                        */
/*                                                                       */
/*                      RESTRICTED RIGHTS LEGEND                         */
/*                                                                       */
/* Use, duplication, or disclosure by the Government is subject to       */
/* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in  */
/* Technical Data and Computer Software clause at 252.227-7013.          */
/*                                                                       */
/*                    TEXAS INSTRUMENTS INCORPORATED.                    */
/*                            P.O. BOX 149149                            */
/*                         AUSTIN, TEXAS 78714-9149                      */
/*                              MS 2151                                  */
/*                                                                       */
/*  Copyright (C) 1987,1988,1989,1990 Texas Instruments Incorporated.    */
/*  All rights reserved.                                                 */
/*                                                                       */


/* Error codes. */


#define NO_APPLICATION_NAME -1
#define TRAP_CHANNEL_OUT_OF_RANGE -2
#define NO_TRAP_TABLE -3
#define MICRONET_INITIALIZE_FAILED -4

extern Handle trap_table;
extern Handle trap_index;
extern unsigned short trap_channel;
extern tb_init();
extern void tb_command();

extern void handle_traps(message_from_mx);
extern void init_trap_patches();

struct server_data
{
    short message;
	short count;
	short trap_channel;
};

#define AppParmHandle (*((struct server_data ***) 0xaec))

extern void traphandler();

#define MIN_TRAP_CHANNEL  9
#define MAX_TRAP_CHANNEL 15
#define DRIVER_TRAP_CHANNEL 8

#define OUR_LAUNCH_MESSAGE 3

/* Some definitions that were left out of the mpw include files. */

pascal void
DisposRgn(handle)
	 RgnHandle handle;
	 extern 0xa8d9;

/*  clm 9/27/89 - this definition is now in the mpw cincludes  */
/*
pascal void
NSetTrapAddress(addr, trap, type)
	 Ptr addr;
	 short trap;
	 unsigned char type;
	 extern;
*/

/* clm 9/27/89 - this definition is now in the mpw cincludes  */
/*
pascal long
NGetTrapAddress(trap, type)
	 short trap;
	 unsigned char type;
	 extern;
*/

/* Internal functions that call the rom trap code. */

pascal void BeginUpdateInternal(theWindow)
	 WindowPtr theWindow;
	 extern;
	 
pascal Boolean GetNextEventInternal(eventMask,theEvent)
	short eventMask;
	EventRecord *theEvent;
	extern;

pascal Boolean WaitNextEventInternal(mask,event,sleep,mouseRgn)
	unsigned short mask;
	EventRecord *event;
	unsigned long sleep;
	RgnHandle mouseRgn;
	extern;

pascal Boolean EventAvailInternal(eventMask,theEvent)
	short eventMask;
	EventRecord *theEvent;
	extern;

pascal void BeginUpdateInternalInit()
	 extern;
	 
pascal void GetNextEventInternalInit()
	extern;

pascal void WaitNextEventInternalInit()
	extern;

pascal void EventAvailInternalInit()
	extern;

struct window_update_region
{
	struct window_update_region **next;
	WindowRecord *window;
	RgnHandle update_region;
};

struct window_update_region **
find_window_update_region();

