home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / sgml / unix / sgmlh / entity.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-03  |  11.5 KB  |  206 lines

  1. /******************************************************************************/
  2. /* Struct dcncb: attribute list added to support data attributes.             */
  3. /******************************************************************************/
  4. #ifndef ENTITY_H              /* Don't include this file more than once. */
  5. #define ENTITY_H
  6. /******************************************************************************/
  7. /* ENTITY.H: Definitions and control block templates for entity management.
  8. */
  9. #include "tools.h"            /* Definitions for type declarations, etc. */
  10. /* SGML Character Use
  11. */
  12. #define EOFCHAR   '\032'      /* FUNCTION: EE (entity end: files). */
  13. #define EOS         '\0'      /* NONCHAR: EE (entity end: strings). */
  14. #define EOBCHAR   '\034'      /* NONCHAR: EOB (file entity: end of buffer. */
  15. #define RSCHAR    '\012'      /* FUNCTION: RS (record start). */
  16. #define RECHAR    '\015'      /* FUNCTION: RE (record end). */
  17. #define TABCHAR   '\011'      /* FUNCTION: TAB (horizontal tab). */
  18. #define SPCCHAR   '\040'      /* FUNCTION: SPACE (horizontal space). */
  19.  
  20. /* SGML Naming Rules
  21. */
  22. #define ENTCASE       0       /* 1=case translation of entity names; 0=no. */
  23. #define NAMECASE      1       /* 1=case translation of non-entity names; 0=no.*/
  24. #define AVALCASE      2       /* 2=untranslated string of name characters. */
  25.  
  26. /* SGML Reference Quantity Set
  27. */
  28. #define ATTCNT       40       /* Att names & name tokens in an att def. */
  29. #define ATTSPLEN    960       /* Length: attribute specification.*/
  30. #define BSEQLEN     960       /* Length: blank/space sequence.*/
  31. #define CAPACITY  35000L      /* Capacity points allowed in document. */
  32. #define DTAGLEN      16       /* Length: data tag in document. */
  33. #define DTEMPLEN     16       /* Length: data tag/pat template (less delims). */
  34. #define ENTLVL       16       /* Level: nested entities (less primary). */
  35. #define GRPCNT       32       /* Tokens in a group or model. */
  36. #define GRPGTCNT     96       /* Grand total: tokens at all lvls of model grp.*/
  37. #define GRPLVL       16       /* Nested level of model grps (including 1st). */
  38. #define LITLEN      240       /* Length: literal, del att value (less delims).*/
  39. #define NAMELEN       8       /* Length of name, name token, number, etc.. */
  40. #define NORMSEP       2       /* Length: separator for normalized lengths. */
  41. #define PILEN       240       /* Length: processing instruction (less delims).*/
  42. #define TAGLEN      960       /* Length: start-tag as entered (with delims). */
  43. #define TAGLVL       24       /* Level: nesting of open elements (tag stack).*/
  44.  
  45. /* Minimization status of returned tags.
  46. */
  47. #define MINNONE 0             /* Minimization: tag not minimized. */
  48. #define MINNULL 1             /* Minimization: tag was null. */
  49. #define MINNET  2             /* Minimization: end-tag was NET delimiter. */
  50. #define MINDATA 3             /* Minimization: end-tag was data tag. */
  51. #define MINSTAG 4             /* Minimization: tag implied by start-tag. */
  52. #define MINETAG 5             /* Minimization: end-tag implied by end-tag. */
  53.  
  54. /* Formal public identifier public text classes.
  55. */
  56. #define FPICAP         1
  57. #define FPICHARS       2
  58. #define FPINOT         3
  59. #define FPISYN         4
  60. #define FPICMINV       5      /* Minimum fpic value for versionable text. */
  61. #define FPIDOC         5
  62. #define FPIDTD         6
  63. #define FPIELEM        7
  64. #define FPIENT         8
  65. #define FPILPD         9
  66. #define FPINON        10
  67. #define FPISHORT      11
  68. #define FPISUB        12
  69. #define FPITEXT       13
  70. struct fpi {                  /* Formal public identifier. */
  71.      UNCH fpiot;              /* Owner type: + or - or ! (for ISO). */
  72.      UNCH fpiol;              /* Length of owner identifier. */
  73.      int fpio;                /* Offset in pubis of owner identifier (no EOS).*/
  74.      int fpic;                /* Public text class. */
  75.      UNCH fpitt;              /* Text type: - or + (for available). */
  76.      UNCH fpitl;              /* Length of text identifier. */
  77.      int fpit;                /* Offset in pubis of text identifier (no EOS). */
  78.      UNCH fpil[2];            /* Public text language. */
  79.      UNCH fpivl;              /* Length of display version . */
  80.      int fpiv;                /* Offset in pubis of display version (no EOS). */
  81.      int fpiversw;            /* 1=use best ver; 0=use stated ver; -1=error. */
  82.      UNCH fpinml;             /* Length of entity name. */
  83.      UNCH fpinm[NAMELEN+2];   /* Entity/DCN name (length & EOS). */
  84.      UNCH fpistore;           /* 1=NDATA 2=general 3=parm 4=DTD 5=LPD 6=DCN. */
  85.      UNCH fpipubl;            /* Length of public ID string. */
  86.      UNCH fpipubis[LITLEN+2]; /* Public ID string (length & EOS). */
  87.      UNCH fpisysl;            /* Length of system ID string. */
  88.      UNCH fpisysis[LITLEN+2]; /* System ID string (length & EOS). */
  89. };
  90. #define FPISZ sizeof(struct fpi)
  91. typedef struct fpi *PFPI;     /* Ptr to FPI control block. */
  92.  
  93. /* General control blocks.
  94. */
  95. #define NONONCH 1             /* Character references to non-chars invalid. */
  96. #define OKNONCH 0             /* Character references to non-chars allowed. */
  97. struct parse {                /* Parse control block. */
  98.      UNCH   *pname;           /* Parse name; content, tag, etc. */
  99.      UNCH   *plex;            /* Lexical analysis table. */
  100.      UNCH   **ptab;           /* State and action table. */
  101.      UNS    state;            /* State. */
  102.      UNS    input;            /* Input. */
  103.      UNS    action;           /* Action. */
  104.      UNS    newstate;         /* Next state. */
  105. };
  106. struct restate {
  107.      UNS   sstate;            /* State. */
  108.      UNS   sinput;            /* Input. */
  109.      UNS   saction;           /* Action. */
  110.      UNS   snext;             /* Next state. */
  111. };
  112. struct map {
  113.      UNCH   *mapnm;           /* Name followed by EOS. */
  114.      int    mapdata;          /* Data associated with that name. */
  115. };
  116. struct hash {                 /* Dummy structure for function arguments. */
  117.      struct hash *enext;      /* Next entry in chain. */
  118.      UNCH ename [NAMELEN+2];  /* Entry name with size and EOS. */
  119. };
  120. typedef struct hash *PHASH;   /* Ptr to hash table entry. */
  121. typedef struct hash **THASH;  /* Ptr to hash table. */
  122.  
  123. struct loc {                  /* Location where ID or IDREF was found. */
  124.      struct loc *lnext;       /* Pt to next location in chain. */
  125.      UNCH *letdgi;            /* Element type (GI). */
  126.      UNCH *lename;            /* Entity name. */
  127.      UNS lrcnt;               /* Source record number. */
  128.      UNS lccnt;               /* Source record chars since last RS. */
  129.      UNIV lfile;              /* DOS fileid if external, else NULL. */
  130. };
  131. #define LOCSZ sizeof(struct loc)
  132.  
  133. struct dcncb {                /* Data content notation control block. */
  134.      /*l nt -e18                 Suppress duplicate definition msg. */
  135.      struct dcncb *enext;     /* Next DCN in chain. */
  136.      UNCH ename[NAMELEN+2];   /* Notation name followed by EOS. */
  137.      /*l nt +e18                 Restore duplicate definition msg. */
  138.      UNIV dcnid;              /* DOS ID of full notation identifier. */
  139.      struct ad *adl;          /* Data attribute list (NULL if none). */
  140. };
  141. #define DCBSZ sizeof(struct dcncb)
  142. typedef struct dcncb *PDCB;   /* Ptr to DCN control block. */
  143.  
  144. struct stat {                 /* Document statistics. */
  145.      long capused;            /* Total: NAMELEN*cnt + 1*chars (not counterr). */
  146.      long capacity;           /* Capacity points allowed in document. */
  147.      UNS counterr;            /* ** MOVED TO TP ** Number of errors reported. */
  148.      UNS dcncnt;              /* Number of data content notations defined. */
  149.      UNS pmexgcnt;            /* Number of plus or minus exception groups. */
  150.      UNS etdcnt;              /* Number of element types declared. */
  151.      UNS etdercnt;            /* Number of element types defined by default. */
  152.      UNS pmexcnt;             /* Number of plus/minus exception grp members. */
  153.      UNS modcnt;              /* Number of content model tokens defined. */
  154.      UNS attcnt;              /* Number of attributes defined. */
  155.      UNS attdef;              /* Characters of attribute defaults defined. */
  156.      UNS attgcnt;             /* Number of att value grp members (incl dcn). */
  157.      UNS idcnt;               /* Number of ID attributes specified. */
  158.      UNS idrcnt;              /* Number of ID references specified. */
  159.      UNS ecbcnt;              /* Number of entities declared. */
  160.      UNS ecbtext;             /* Characters of entity text defined. */
  161.      UNS srcnt;               /* Number of short reference tables defined. */
  162.      UNS dcntext;             /* Characters of notation identifiers defined. */
  163. };
  164. struct switches {             /* Parser control switches (1=non-standard). */
  165.      int swetdtag;            /* 1=return only for tags with user data; 0=all.*/
  166.      int swdupent;            /* 1=msg if duplicate ENTITY def attempted;0=no.*/
  167.      int swcommnt;            /* 1=return comment declarations as data; 0=no. */
  168.      int swrefmsg;            /* 1=msg if undeclared ref is defaulted; 0=no. */
  169.      UNS swbufsz;             /* Size of source file buffer for READ(). */
  170.      UNCH deleob;             /* Delimiter: end of block (IGNORED: 28 used). */
  171.      UNCH deleof;             /* Delimiter: end of file (IGNORED: 26 used). */
  172.      UNCH delcdata;           /* Delimiters: CDATA entity in att value. */
  173.      UNCH delsdata;           /* Delimiters: SDATA entity in att value. */
  174.      UNCH delnonch;           /* Prefix: non-SGML character. */
  175.      UNCH addnonch;           /* Addend: added to non-SGML char (mod 256). */
  176.      int *src;                /* Return code from call to SGML services. */
  177.      UNIV *srcbp;             /* Ptr to SGML's RCB/IPB. */
  178.      int swenttr;             /* 1=trace entity stack in error messages; 0=no.*/
  179.      UNCH swproc[NAMELEN+2];  /* Link process name (IGNORED). */
  180. };
  181. struct markup {               /* Delimiter strings for text processor. */
  182.      char *cro;               /* LEXCON markup string: CRO        */
  183.      char *dso;               /* LEXCON markup string: DSO        */
  184.      char *ero;               /* LEXCON markup string: ERO        */
  185.      char *etag;              /* LEXMARK markup string: end-tag   */
  186.      char *lit;               /* LEXMARK markup string: LIT       */
  187.      char *lita;              /* LEXMARK markup string: LITA      */
  188.      char *mdc;               /* LEXCON markup string: MDC       */
  189.      char *mdo;               /* LEXCON markup string: MDO       */
  190.      char *mse;               /* LEXCON markup string: mse        */
  191.      char *mss;               /* LEXCON markup string: mss        */
  192.      char *mssc;              /* LEXCON markup string: mss CDATA  */
  193.      char *mssr;              /* LEXCON markup string: mss RCDATA */
  194.      char *pic;               /* LEXCON markup string: PIC        */
  195.      char *pio;               /* LEXCON markup string: PIO        */
  196.      char *refc;              /* LEXGRP markup string: REFC       */
  197.      char *stag;              /* LEXMARK markup string: start-tag */
  198.      char *tagc;              /* LEXMARK markup string: TAGC      */
  199.      char *vi;                /* LEXMARK markup string: VI        */
  200.      int lennet;              /* LEXMARK markup string length: null end-tag. */
  201.      int lennst;              /* LEXMARK markup string length: null start-tag.*/
  202. };
  203. /******************************************************************************/
  204. #endif /* ndef ENTITY_H */
  205. /******************************************************************************/
  206.