/****************************************************************************/
/*                                                                          */
/*  RMX_EXC.H:      Prototypes and definitions for iRMX Exception Handlers  */
/*                                                                          */
/*  LAST UPDATE:    September 4, 1991 [10:06:09]                            */
/*                                                                          */
/*  DEPENDENCIES:   This  file  is  dependant   upon   three   user-defined */
/*                  definitions:                                            */
/*                                                                          */
/*      RMXOBJ      Should define the  type  being  used  for  iRMX  object */
/*                  tokens  (selectors).  Acceptable  types  are  "unsigned */
/*                  short",  "short" and "selector" (default). Irregardless */
/*                  of the type used, remember that object tokens cannot be */
/*                  modified. Remember too that if you wish to make use  of */
/*                  the  "selector"  data type, you must activate this data */
/*                  type prior to including this file.                      */
/*                                                                          */
/*      RMXSTR      Should define the type being  used  for  iRMX  strings. */
/*                  Normally, "char" should be used (and is the default).   */
/*                                                                          */
/*      RMXRET      The definition for RMXRET should define the type  being */
/*                  used  for  iRMX return (status) codes. Acceptable types */
/*                  are "unsigned short and "short" (default).              */
/*                                                                          */
/****************************************************************************/

#ifndef _RMX_EXC_H
#define _RMX_EXC_H

/****************************************************************************/
/* Defaults for dependancy definitions                                      */
/****************************************************************************/

#ifndef RMXOBJ
#include <i86.h>
#define RMXOBJ selector
#endif

#ifndef RMXSTR
#define RMXSTR char
#endif

#ifndef RMXRET
#define RMXRET short
#endif

/****************************************************************************/
/* Precision data types                                                     */
/****************************************************************************/

#ifndef U8
#define U8     unsigned char
#endif

#ifndef U16
#define U16    unsigned short int
#endif

#ifndef U32
#define U32    unsigned long int
#endif

#ifndef NATIVE_WORD
#if _ARCHITECTURE_ < 386
#define NATIVE_WORD unsigned short    /* 16-bit machine */
#else
#define NATIVE_WORD unsigned long     /* 32-bit machine */
#endif
#endif

/****************************************************************************/
/* Exception handler definitions                                            */
/****************************************************************************/

#pragma noalign( _EXCP_HANDLER_ATTRIBS )

typedef struct _EXCP_HANDLER_ATTRIBS
    {
    void        (far *handler)( RMXRET status, U8 param_nr,
                                U16 primitive, U16 ndp_status );
    U8          mode;
    }                           EXCP_HANDLER_ATTRIBS;

#define ON_NO_EXCEPS            0
#define NO_EXCEPTIONS           0
#define ON_PROGRAMMER_EXCEPS    1
#define AVOIDABLE_EXCEPTIONS    1
#define ON_ENVIRONMENTAL_EXCEPS 2
#define UNAVOIDABLE_EXCEPTIONS  2
#define ON_ALL_EXCEPS           3
#define ALL_EXCEPTIONS          3

#pragma fixedparams( RQGETEXCEPTIONHANDLER, RQSETEXCEPTIONHANDLER )

void        RQGETEXCEPTIONHANDLER( EXCP_HANDLER_ATTRIBS *info_ptr,
                RMXRET *status );
void        RQSETEXCEPTIONHANDLER( EXCP_HANDLER_ATTRIBS *info_ptr,
                RMXRET *status );

#endif /* ndef _RMX_EXC_H */

