/*******************************************************************************
* YORKTOWN ADVANCED SGML PARSER (YASP)                                         *
*         An SGML Parser conforming to International Standard ISO 8879 --      *
*         Standard Generalized Markup Language                                 *
*------------------------------------------------------------------------------*
* Written 1987 - 1993 by                                                       *
*         Pierre G. Richard                                                    *
*         IBM T.J. Watson Research Center                                      *
*         Yorktown Heights, New York                                           *
*         petrus@watson.ibm.com                                                *
*------------------------------------------------------------------------------*
* FUNCTION NAME    = YASP / Header File                                        *
* STATUS           = Version 0, Release 1, Level 16 and up                     *
* COMPONENT NAME   = gtype.h                                                   *
* DESCRIPTIVE NAME = SGML Classification of the character set.                 *
* DATE_WR          = 03/08/1987                                                *
* AUTHOR           = Pierre G. Richard - PETRUS at YKTVMX                      *
*                                                                              *
* FUNCTIONAL DESCRIPTION =                                                     *
* IMPLEMENTATION NOTES =                                                       *
* CHANGE HISTORY =                                                             *
*******************************************************************************/
/* All the following values define Sgml Classes on the char code set */

#define S_NONSGML          0x0  /* UNUSED + unsignificant shunned */

/* Name character */
#define S_DIGIT            0x1
#define S_LETTER           0x2
#define S_SPECIAL          0x4
#define S_NMSTRT           0x8
#define S_NMCHAR          0x10

/* Function character */
#define S_SSPCHAR         0x20   /* RE, RS, SPACE */
#define S_FUNCHAR         0x40   /* Inert Function Character */
#define S_MSICHAR         0x80
#define S_MSOCHAR        0x100
#define S_MSSCHAR        0x200
#define S_SEPCHAR        0x400

#define S_SGML           0x800   /* SGML Character, at least DATACHAR */

/* These values are used temporary, only while building the gtype table */
#define S_SHUNNABLE       0x80   /* (redefines MSICHAR) Can be SHUNNED */
#define S_CONTROLS       0x100   /* (redefines MSOCHAR) Shunnable Controls */
#define S_SHUNNED       0x1000   /* Shunned Character */

/*----------------+
|Macro Definitions|
+----------------*/

/* Other macros could be defined if needed              */
/* Examples:                                            */
/*   is_nsgml_shunned(c)                                */
/*          ((GA(gtype))[c] & (SQ_SHUNNED & S_NONSGML)) */
/*   make_it_nmstrt(c) ((GA(gtype))[c] =                */
/*          ((GA(gtype))[c] & (S_NOTHING)) | S_NMSTRT;  */

#define is_blank(c)     ((c==GA(SPACE_char))||((GA(gtype))[c] & (S_SEPCHAR)))
#define is_separator(c) ((GA(gtype))[c] & (S_SSPCHAR | S_SEPCHAR))
#define is_nonsgml(c)   (!(GA(gtype))[c])
#define is_namestrt(c)  ((GA(gtype))[c] & (S_LETTER | S_NMSTRT))
#define is_gistrt(c)    ((GA(gtype))[c] & (S_LETTER | S_NMSTRT))
#define is_name(c)      ((GA(gtype))[c] &\
   (S_LETTER | S_NMSTRT | S_DIGIT | S_NMCHAR))
#define is_digit(c)     ((GA(gtype))[c] & (S_DIGIT))
#define is_funchar(c)   ((GA(gtype))[c] & (S_FUNCHAR))
#define is_ms_char(c)   ((GA(gtype))[c] & (S_MSICHAR | S_MSOCHAR | S_MSSCHAR))
#define is_msrchar(c)   ((GA(gtype))[c] & (S_MSOCHAR | S_MSSCHAR))
#define is_msichar(c)   ((GA(gtype))[c] & (S_MSICHAR))
#define is_msochar(c)   ((GA(gtype))[c] & (S_MSOCHAR))
#define is_msschar(c)   ((GA(gtype))[c] & (S_MSSCHAR))
#define is_sepchar(c)   ((GA(gtype))[c] & (S_SEPCHAR))
#define is_sspchar(c)   ((GA(gtype))[c] & (S_SSPCHAR))
#define is_mindata(c)   ((GA(gtype))[c] &\
   (S_SSPCHAR | S_LETTER | S_DIGIT | S_SPECIAL))
/* following is mindata, w/o S_SSPCHAR */
#define is_minldat(c)   ((GA(gtype))[c] & (S_LETTER | S_DIGIT | S_SPECIAL))
#define is_fctchar(c)   ((GA(gtype))[c] &\
   (S_SSPCHAR | S_SEPCHAR | S_FUNCHAR | S_MSICHAR | S_MSOCHAR | S_MSSCHAR))
/******************************************************************************/
