/*@ Produced by gnname.exe Sat Aug 14 11:29:50 1993 -- do not change directly */
/*-----------------------------------------------------------------------------+
| Delimiter String Table                                                       |
|                                                                              |
| This has not to be an exhaustive list: to speed up the                       |
| scanning, for some delimiters it is faster to work with                      |
| the string, rather than using the Delimiter Vector Structure.                |
+-----------------------------------------------------------------------------*/
typedef union {
   unsigned char *p;
   OFS ofs;
}DSTAB_ITM;

typedef DSTAB_ITM DSTAB[19];

/*-----------------------------------------------------------------------------+
| General Keyword                                                              |
|                                                                              |
| ALWDTAB is a list of all keywords (found in OCSMIN.H)                        |
| GNWDTAB is a list of keywords found in the prolog and instance               |
|                                                                              |
| Each keyword is preceded by a character that identify the                    |
| type of the keyword, according to the CHARID values.                         |
+-----------------------------------------------------------------------------*/
typedef struct {
   union {
      unsigned char *p;
      OFS ofs;
   }s;
}GNWD;

typedef struct {
   union {
      unsigned char *p;
      OFS ofs;
   }s;
   TK   token;
}EQTK;

typedef struct {
   int  gnwd_ofs;
   int  value;
}CHOICES;

#if (defined (WATC))
#define OPT X_OPT        /* WATC Compiler Bug? */
#endif
typedef struct {
   GNWD AND; GNWD ANY; GNWD APPINFO; GNWD ASN1; 
   GNWD ATTCAP; GNWD ATTCHCAP; GNWD ATTCNT; GNWD ATTLIST; 
   GNWD ATTSPLEN; GNWD AVGRPCAP; GNWD BASESET; GNWD BSEQLEN; 
   GNWD CAPACITY; GNWD CDATA; GNWD CHANGES; GNWD CHARSET; 
   GNWD COM; GNWD CONCUR; GNWD CONREF; GNWD CONTROLS; 
   GNWD CRO; GNWD CURRENT; GNWD DATATAG; GNWD DEFAULT; 
   GNWD DELIM; GNWD DELIMLEN; GNWD DESCSET; GNWD DOCTYPE; 
   GNWD DOCUMENT; GNWD DSC; GNWD DSO; GNWD DTAGLEN; 
   GNWD DTD; GNWD DTEMPLEN; GNWD DTGC; GNWD DTGO; 
   GNWD ELEMCAP; GNWD ELEMENT; GNWD ELEMENTS; GNWD EMPTY; 
   GNWD ENDTAG; GNWD ENTCAP; GNWD ENTCHCAP; GNWD ENTITIES; 
   GNWD ENTITY; GNWD ENTLVL; GNWD ERO; GNWD ETAGO; 
   GNWD EXCLUDE; GNWD EXGRPCAP; GNWD EXNMCAP; GNWD EXPLICIT; 
   GNWD FEATURES; GNWD FIXED; GNWD FORMAL; GNWD FUNCHAR; 
   GNWD FUNCTION; GNWD GENERAL; GNWD GRPC; GNWD GRPCAP; 
   GNWD GRPCNT; GNWD GRPGTCNT; GNWD GRPLVL; GNWD GRPO; 
   GNWD ID; GNWD IDCAP; GNWD IDLINK; GNWD IDREF; 
   GNWD IDREFCAP; GNWD IDREFS; GNWD IGNORE; GNWD IMPLICIT; 
   GNWD IMPLIED; GNWD INCLUDE; GNWD INITIAL; GNWD INSTANCE; 
   GNWD LCNMCHAR; GNWD LCNMSTRT; GNWD LINK; GNWD LINKTYPE; 
   GNWD LIT; GNWD LITA; GNWD LITLEN; GNWD LKNMCAP; 
   GNWD LKSETCAP; GNWD LPD; GNWD MAPCAP; GNWD MD; 
   GNWD MDC; GNWD MDO; GNWD MINIMIZE; GNWD MINUS; 
   GNWD MODEL; GNWD MS; GNWD MSC; GNWD MSICHAR; 
   GNWD MSOCHAR; GNWD MSSCHAR; GNWD NAME; GNWD NAMECASE; 
   GNWD NAMELEN; GNWD NAMES; GNWD NAMING; GNWD NDATA; 
   GNWD NET; GNWD NMTOKEN; GNWD NMTOKENS; GNWD NO; 
   GNWD NONE; GNWD NONSGML; GNWD NORMSEP; GNWD NOTATION; 
   GNWD NOTCAP; GNWD NOTCHCAP; GNWD NUMBER; GNWD NUMBERS; 
   GNWD NUTOKEN; GNWD NUTOKENS; GNWD O; GNWD OMITTAG; 
   GNWD OPT; GNWD OR; GNWD OTHER; GNWD PACK; 
   GNWD PCDATA; GNWD PERO; GNWD PI; GNWD PIC; 
   GNWD PILEN; GNWD PIO; GNWD PLUS; GNWD POSTLINK; 
   GNWD PUBLIC; GNWD QUANTITY; GNWD RANK; GNWD RCDATA; 
   GNWD RE; GNWD REFC; GNWD REP; GNWD REQUIRED; 
   GNWD RESTORE; GNWD RNI; GNWD RS; GNWD SCOPE; 
   GNWD SDATA; GNWD SDIF; GNWD SEPCHAR; GNWD SEQ; 
   GNWD SEQUENCE; GNWD SGML; GNWD SGMLREF; GNWD SHORTREF; 
   GNWD SHORTTAG; GNWD SHUNCHAR; GNWD SIMPLE; GNWD SPACE; 
   GNWD SRCNT; GNWD SRLEN; GNWD STAGO; GNWD STARTTAG; 
   GNWD SUBDOC; GNWD SWITCHES; GNWD SYNTAX; GNWD SYSTEM; 
   GNWD TAB; GNWD TAGC; GNWD TAGLEN; GNWD TAGLVL; 
   GNWD TEMP; GNWD TEXT; GNWD TOTALCAP; GNWD UCNMCHAR; 
   GNWD UCNMSTRT; GNWD UNPACK; GNWD UNUSED; GNWD USELINK; 
   GNWD USEMAP; GNWD VALIDATE; GNWD VI; GNWD YES; 
}ALWDTAB;
#if (defined (WATC))
#undef OPT               /* WATC Compiler Bug? */
#endif

typedef struct {
   GNWD ANY; GNWD ATTLIST; GNWD CAPACITY; GNWD CDATA; 
   GNWD CHARSET; GNWD CONREF; GNWD CURRENT; GNWD DEFAULT; 
   GNWD DOCTYPE; GNWD DOCUMENT; GNWD DTD; GNWD ELEMENT; 
   GNWD ELEMENTS; GNWD EMPTY; GNWD ENDTAG; GNWD ENTITIES; 
   GNWD ENTITY; GNWD FIXED; GNWD ID; GNWD IDLINK; 
   GNWD IDREF; GNWD IDREFS; GNWD IGNORE; GNWD IMPLIED; 
   GNWD INCLUDE; GNWD INITIAL; GNWD LINK; GNWD LINKTYPE; 
   GNWD LPD; GNWD MD; GNWD MS; GNWD NAME; 
   GNWD NAMES; GNWD NDATA; GNWD NMTOKEN; GNWD NMTOKENS; 
   GNWD NONSGML; GNWD NOTATION; GNWD NUMBER; GNWD NUMBERS; 
   GNWD NUTOKEN; GNWD NUTOKENS; GNWD O; GNWD PCDATA; 
   GNWD PI; GNWD POSTLINK; GNWD PUBLIC; GNWD RCDATA; 
   GNWD RE; GNWD REQUIRED; GNWD RESTORE; GNWD RS; 
   GNWD SDATA; GNWD SHORTREF; GNWD SIMPLE; GNWD SPACE; 
   GNWD STARTTAG; GNWD SUBDOC; GNWD SYNTAX; GNWD SYSTEM; 
   GNWD TEMP; GNWD TEXT; GNWD USELINK; GNWD USEMAP; 
}GNWDTAB;

#define DLVL_CHARID     'a'
#define CAPA_CHARID     'c'
#define DLIM_CHARID     'd'
#define FCLS_CHARID     'f'
#define GEN_CHARID      'g'
#define QNTY_CHARID     'q'
#define SGML_CHARID     's'
#define SYST_CHARID     'y'

/*-----------------------------------------------------------------------------+
| Recognition Modes                                                            |
|                                                                              |
| Some modes have been added vs. ISO 8869:                                     |
| LITC:  for literal with replaceable character data                           |
| LITP:  for literal with replaceable parameter data                           |
| ASL:   for attribute specification list strated with DSO                     |
| RCD:   for replaceable character data in context (RCDATA)                    |
| FCD:   for fixed character data in context (CDATA)                           |
| RCDMS: for replaceable character data in MS (RCDATA)                         |
| FCDMS: for fixed character data in MS (CDATA)                                |
| IGNMS: for an IGNOREd MS (marked section)                                    |
| INI:   when the parse of the document starts                                 |
+-----------------------------------------------------------------------------*/
#define CON_MODE      0
#define DS_MODE       1
#define GRP_MODE      2
#define LITC_MODE     3
#define MD_MODE       4
#define TAG_MODE      5
#define ASL_MODE      6
#define LITP_MODE     7
#define RCD_MODE      8
#define FCD_MODE      9
#define RCDMS_MODE   10
#define FCDMS_MODE   11
#define IGNMS_MODE   12
#define INI_MODE     13
#define NBR_OF_MODES 14

#define CON_MO        1
#define DS_MO         2
#define GRP_MO        4
#define LITC_MO       8
#define MD_MO        16
#define TAG_MO       32
#define ASL_MO       64
#define LITP_MO     128
#define RCD_MO      256
#define FCD_MO      512
#define RCDMS_MO   1024
#define FCDMS_MO   2048
#define IGNMS_MO   4096
#define INI_MO     8192

#define NBR_OF_DLMV  32
#define NBR_OF_DDLMV 12
typedef unsigned int ALLMO;

/*-----------------------------------------------------------------------------+
| Quantities                                                                   |
|                                                                              |
| These values are either static, or dynamic (customizable)                    |
+-----------------------------------------------------------------------------*/
typedef struct {
   uint value;          /* assigned value */
}QNTY;

typedef QNTY QNTYTAB[15];

#define ATTCNT               GA(qntytab)[ATTCNT_ix].value
#define ATTSPLEN             GA(qntytab)[ATTSPLEN_ix].value
#define BSEQLEN               960
#define DTAGLEN                16
#define DTEMPLEN               16
#define ENTLVL               GA(qntytab)[ENTLVL_ix].value
#define GRPCNT               GA(qntytab)[GRPCNT_ix].value
#define GRPGTCNT             GA(qntytab)[GRPGTCNT_ix].value
#define GRPLVL                 16
#define LITLEN               GA(qntytab)[LITLEN_ix].value
#define LITLEN_RCS            240
#define NAMELEN              GA(qntytab)[NAMELEN_ix].value
#define NAMELEN_RCS             8
#define NORMSEP              GA(qntytab)[NORMSEP_ix].value
#define PILEN                GA(qntytab)[PILEN_ix].value
#define TAGLEN               GA(qntytab)[TAGLEN_ix].value
#define TAGLVL               GA(qntytab)[TAGLVL_ix].value

#if (defined(DOS_SYS) || defined(OS2V1_SYS)) /* for 16-bits systems */
#define ATTCNT_MAX             180
#define ATTSPLEN_MAX         16000
#define ENTLVL_MAX              40
#define GRPCNT_MAX             100
#define GRPGTCNT_MAX           300
#define LITLEN_MAX            2400
#define NAMELEN_MAX             32
#define NORMSEP_MAX          16000
#define PILEN_MAX             2400
#define TAGLEN_MAX           16000
#define TAGLVL_MAX              40

#else /* for 32-bits systems */
#define ATTCNT_MAX             180
#define ATTSPLEN_MAX         16000
#define ENTLVL_MAX              40
#define GRPCNT_MAX             500
#define GRPGTCNT_MAX          1000
#define LITLEN_MAX            2400
#define NAMELEN_MAX             32
#define NORMSEP_MAX          16000
#define PILEN_MAX             2400
#define TAGLEN_MAX           16000
#define TAGLVL_MAX              40
#endif

/*@ End of production (gnname.exe) ------------------------------------------ */
