/*******************************************************************************
* SMP00 Sample of an SGML Application Interfaced with the YASP Parser          *
*------------------------------------------------------------------------------*
* Written 1987 - 1993 by                                                       *
*         Pierre G. Richard                                                    *
*         IBM T.J. Watson Research Center                                      *
*         Yorktown Heights, New York                                           *
*         petrus@watson.ibm.com                                                *
*------------------------------------------------------------------------------*
* FUNCTION NAME    = YASP / Application  - Header file                         *
* STATUS           = N/A                                                       *
* COMPONENT NAME   = gendef.h                                                  *
* DESCRIPTIVE NAME = General Definitions to ensure portability                 *
* RELEASE          = N/A                                                       *
* DATE_WR          = 01/08/1988                                                *
* AUTHOR           = Pierre G. Richard - PETRUS at YKTVMX                      *
*                                                                              *
* FUNCTIONAL DESCRIPTION =                                                     *
* This file is application developper dependent.                               *
* All fields/values can be changed according to specific needs.                *
*                                                                              *
* Despite the portable way modules are written, it is sometimes necessary to   *
* take into account the peculiarities inherent to a given system and compiler: *
* bugs are one of those!  Therefore, source codes have a few specific          *
* pre-processor conditional statements.  They are activated by #DEFINEing      *
* a couple of system/compiler keywords taken in the following list:            *
*                                                                              *
*  System         =>      Compilers:                                           *
*                                                                              *
*  DOS_SYS                C2_00 | C6_00                                        *
*  OS2V1_SYS              C2_00 | C6_00                                        *
*  OS2V2_SYS              IBMCSET2                                             *
*  CMS_SYS                WATC | IBMC370                                       *
*  MVS_SYS                WATC | IBMC370                                       *
*  AIX_SYS                IBMCAIX | SUNACC | GNUCC                             *
*  NT_SYS                 MSVC                                                 *
*                                                                              *
* CHANGE HISTORY =                                                             *
* Number Date     Inits    Change & reason (brief)                             *
*      1 03/20/93 PETRUS   Systems and compilers are separate                  *
*      2 08/08/96 ESPERT   NT platforms and MSVC                               *
*                                                                              *
*******************************************************************************/

/*-----------------------------------------------------------------------------+
| Define system-dependent values                                               |
+-----------------------------------------------------------------------------*/
#if (defined(DOS_SYS) || defined(OS2V1_SYS) || defined(OS2V2_SYS) || defined(NT_SYS))
#define ENV_ROUTE(key) getenv(key)   /* Find file routes */
#define ROUTE_DLM ';'                /* Separator between routes */
#define SUBDIR_DLM '\\'              /* Separator between Subdir's */
#define DRIVE_DLM ':'                /* Drive separator */
#define EXT_DLM '.'                  /* Extension separator */
#define OPT_DLM_1 '-'                /* base option delimiter */
#define OPT_DLM_2 '/'                /* alternate option delimiter */

#elif (defined(CMS_SYS))
#define ENV_ROUTE(key) NULL          /* No such notion */
#define ROUTE_DLM '\0'               /* No such notion */
#define SUBDIR_DLM '\0'              /* No such notion */
#define DRIVE_DLM '.'                /* Drive separator */
#define EXT_DLM '.'                  /* Extension separator */
#define OPT_DLM_1 '-'                /* base option delimiter */
#define OPT_DLM_2 '/'                /* alternate option delimiter */

#elif (defined(AIX_SYS))
#define ENV_ROUTE(key) getenv(key)   /* Find file routes */
#define ROUTE_DLM ':'                /* Separator between routes */
#define SUBDIR_DLM '/'               /* Separator between Subdir's */
#define DRIVE_DLM '\0'               /* No such notion */
#define EXT_DLM '.'                  /* Extension separator */
#define OPT_DLM_1 '-'                /* base option delimiter */
#define OPT_DLM_2 '-'                /* No alternative */

#else
#error Unknown System
#endif

/*-----------------------------------------------------------------------------+
| Define compiler-dependent options                                            |
+-----------------------------------------------------------------------------*/
#if (defined(M_I86))            /* If IBM C for 80x86 */
#define LINT_ARGS                    /* force prototyping on C lib functions */
#ifdef C2_00
#define C_FCT _cdecl _far            /* C functions vs. Pascal functions */
#define P_FCT _pascal _near          /* Allow a pascal call/return prototype */
#else
#define C_FCT cdecl far              /* C functions vs. Pascal functions */
#define P_FCT pascal near            /* Allow a pascal call/return prototype */
#endif
#define NEAR_D near                  /* Allow near data */
#define FILESPEC_MAX   _MAX_PATH     /* FILENAME_MAX(stdio) too small: stdlib */
#define const                        /* Bad handling of const */

                                /* If CSET2 for 80386 */
#elif (defined(__IBMC__) && defined(__OS2__) && defined(__32BIT__))
#define _loadds                      /* Disable load_ds */
#define C_FCT                        /* No C functions */
#define P_FCT                        /* No P functions */
#define NEAR_D                       /* No notion of near data */
#define FILESPEC_MAX FILENAME_MAX    /* FILENAME_MAX from stdio */
#pragma strings (readonly)           /* strings are read-only */

#elif (defined(WATC))           /* If Waterloo-C for S370 */
#define _loadds                      /* Disable load_ds */
#define C_FCT                        /* No C functions */
#define P_FCT                        /* No P functions */
#define NEAR_D                       /* No notion of near data */
#define FILESPEC_MAX FILENAME_MAX    /* FILENAME_MAX from stdio */
#define const                        /* Bad handling of const */

#elif (defined(MSVC))           /* If Microsoft Visual C++ for NT */
#define YASP_API __declspec(dllimport) /* Prepare for DLL */

#else                           /* Other compilers... */
/*    (defined(IBMC370))        -- If IBM C for S370 */
/*    (defined(IBMCAIX))        -- If XLC for AIX V3 */
/*    (defined(SUNACC))         -- If ACC for SunOS */
/*    (defined(GNUCC))          -- If CC of GNU */
/*    ???                       -- and the unknown compiler */
#define _loadds                      /* Disable load_ds */
#define C_FCT                        /* No C functions */
#define P_FCT                        /* No P functions */
#define NEAR_D                       /* No notion of near data */
#define FILESPEC_MAX FILENAME_MAX    /* FILENAME_MAX from stdio */

#endif

/*-----------------------------------------------------------------------------+
|   general typedefs and constants                                             |
+-----------------------------------------------------------------------------*/
#define IS_BITON(i,selec)        ((i) & (selec))
#define SET_BITOFF(i,selec)      i &= ~(selec)
#define SET_BITON(i,selec)       i |=  (selec)

typedef unsigned char  uchar;
typedef unsigned short ushort;
typedef unsigned int   uint;
typedef unsigned long  ulong;
typedef unsigned char  boolean;

#define FALSE  0
#define TRUE   1
/*****************************************************************************/

