home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 10 / Fresh_Fish_10_2352.bin / new / dev / lang / sgmls / src / entity.h < prev    next >
C/C++ Source or Header  |  1994-07-10  |  9KB  |  193 lines

  1. /* Struct dcncb: attribute list added to support data attributes.             */
  2. #ifndef ENTITY_H              /* Don't include this file more than once. */
  3. #define ENTITY_H
  4. /* ENTITY.H: Definitions and control block templates for entity management.
  5. */
  6. #include "tools.h"            /* Definitions for type declarations, etc. */
  7. #include "msgcat.h"
  8. #include "catalog.h"
  9.  
  10. #define STDINNAME "-"          /* File name that refers to standard input. */
  11.  
  12. #define EOS         '\0'      /* NONCHAR: EE (entity end: strings). */
  13.  
  14. #define AVALCASE      2       /* 2=untranslated string of name characters. */
  15.  
  16. #define REFNAMELEN 8          /* reference quantity set NAMELEN */
  17. #define REFLITLEN 240         /* reference quantity set LITLEN */
  18.  
  19. /* Minimization status of returned tags.
  20. */
  21. #define MINNONE 0             /* Minimization: tag not minimized. */
  22. #define MINNULL 1             /* Minimization: tag was null. */
  23. #define MINNET  2             /* Minimization: end-tag was NET delimiter. */
  24. #define MINDATA 3             /* Minimization: end-tag was data tag. */
  25. #define MINSTAG 4             /* Minimization: tag implied by start-tag. */
  26. #define MINETAG 5             /* Minimization: end-tag implied by end-tag. */
  27.  
  28. /* Formal public identifier public text classes.
  29. */
  30. #define FPICAP         1
  31. #define FPICHARS       2
  32. #define FPINOT         3
  33. #define FPISYN         4
  34. #define FPICMINV       5      /* Minimum fpic value for versionable text. */
  35. #define FPIDOC         5
  36. #define FPIDTD         6
  37. #define FPIELEM        7
  38. #define FPIENT         8
  39. #define FPILPD         9
  40. #define FPINON        10
  41. #define FPISHORT      11
  42. #define FPISUB        12
  43. #define FPITEXT       13
  44. struct fpi {                  /* Formal public identifier. */
  45.      UNCH fpiot;              /* Owner type: + or - or ! (for ISO). */
  46.      UNS fpiol;              /* Length of owner identifier. */
  47.      UNS fpio;                /* Offset in pubis of owner identifier (no EOS).*/
  48.      int fpic;                /* Public text class. */
  49.      UNCH fpitt;              /* Text type: - or + (for available). */
  50.      UNS fpitl;              /* Length of text identifier. */
  51.      UNS fpit;                /* Offset in pubis of text identifier (no EOS). */
  52.      UNS fpill;              /* Language/designating sequence length. */
  53.      UNS fpil;                /* Offset in pubis of language. */
  54.      UNS fpivl;              /* Length of display version . */
  55.      UNS fpiv;                /* Offset in pubis of display version (no EOS). */
  56.      int fpiversw;          /* 1=use best ver; 0=use stated ver; -1=error. */
  57.      UNCH *fpinm;          /* Entity/DCN name (EOS, no length). */
  58.      UNCH fpistore;           /* 1=NDATA 2=general 3=parm 4=DTD 5=LPD 6=DCN. */
  59.      /* Name of the entity's DCN.  Valid only when fpistore == 1.
  60.     NULL if it's a SUBDOC. */
  61.      UNCH *fpinedcn;
  62.      UNCH *fpipubis; /* Public ID string (EOS). */
  63.      UNCH *fpisysis; /* System ID string (EOS). */
  64. };
  65. #define FPISZ sizeof(struct fpi)
  66. typedef struct fpi *PFPI;     /* Ptr to FPI control block. */
  67.  
  68. /* General control blocks.
  69. */
  70. #define NONONCH 1             /* Character references to non-chars invalid. */
  71. #define OKNONCH 0             /* Character references to non-chars allowed. */
  72. struct parse {                /* Parse control block. */
  73.      char   *pname;           /* Parse name; content, tag, etc. */
  74.      UNCH   *plex;            /* Lexical analysis table. */
  75.      UNCH   **ptab;           /* State and action table. */
  76.      UNS    state;            /* State. */
  77.      UNS    input;            /* Input. */
  78.      UNS    action;           /* Action. */
  79.      UNS    newstate;         /* Next state. */
  80. };
  81. struct restate {
  82.      UNS   sstate;            /* State. */
  83.      UNS   sinput;            /* Input. */
  84.      UNS   saction;           /* Action. */
  85.      UNS   snext;             /* Next state. */
  86. };
  87. struct map {
  88.      UNCH   *mapnm;           /* Name followed by EOS. */
  89.      int    mapdata;          /* Data associated with that name. */
  90. };
  91. struct hash {                 /* Dummy structure for function arguments. */
  92.      struct hash *enext;      /* Next entry in chain. */
  93.      UNCH *ename;          /* Entry name with size and EOS. */
  94. };
  95. typedef struct hash *PHASH;   /* Ptr to hash table entry. */
  96. typedef struct hash **THASH;  /* Ptr to hash table. */
  97.  
  98. struct fwdref {               /* A forward id reference. */
  99.      struct fwdref *next;     /* Pt to next reference in chain. */
  100.      UNIV msg;              /* Ptr to saved error messsage. */
  101. };
  102. #define FWDREFSZ sizeof(struct fwdref)
  103.  
  104. struct dcncb {                /* Data content notation control block. */
  105.      struct dcncb *enext;     /* Next DCN in chain. */
  106.      UNCH *ename;          /* Notation name followed by EOS. */
  107.      UNCH mark;              /* For use by application. */
  108.      UNCH entsw;          /* Entity defined with this notation? */
  109.      UNCH defined;            /* Has this notation been defined. */
  110.      UNCH *sysid;             /* System identifier of notation. */
  111.      UNCH *pubid;             /* Public identifier of notation. */
  112.      struct ad *adl;          /* Data attribute list (NULL if none). */
  113. };
  114. #define DCBSZ sizeof(struct dcncb)
  115. #define DCNMARK(p) ((p)->mark ? 1 : ((p)->mark = 1, 0))
  116.  
  117. typedef struct dcncb *PDCB;   /* Ptr to DCN control block. */
  118.  
  119. /* Number of capacities in a capacity set. */
  120.  
  121. #define NCAPACITY 17
  122.  
  123. struct sgmlcap {
  124.      char **name;
  125.      UNCH *points;
  126.      long *number;
  127.      long *limit;
  128. };
  129.  
  130. struct sgmlstat {             /* Document statistics. */
  131.      UNS dcncnt;              /* Number of data content notations defined. */
  132.      UNS pmexgcnt;            /* Number of plus or minus exception groups. */
  133.      UNS etdcnt;              /* Number of element types declared. */
  134.      UNS etdercnt;            /* Number of element types defined by default. */
  135.      UNS pmexcnt;             /* Number of plus/minus exception grp members. */
  136.      UNS modcnt;              /* Number of content model tokens defined. */
  137.      UNS attcnt;              /* Number of attributes defined. */
  138.      UNS attdef;              /* Characters of attribute defaults defined. */
  139.      UNS attgcnt;             /* Number of att value grp members (incl dcn). */
  140.      UNS idcnt;               /* Number of ID attributes specified. */
  141.      UNS idrcnt;              /* Number of ID references specified. */
  142.      UNS ecbcnt;              /* Number of entities declared. */
  143.      UNS ecbtext;             /* Characters of entity text defined. */
  144.      UNS srcnt;               /* Number of short reference tables defined. */
  145.      UNS dcntext;             /* Characters of notation identifiers defined. */
  146. };
  147. struct switches {             /* Parser control switches (1=non-standard). */
  148.      int swdupent;            /* 1=msg if duplicate ENTITY def attempted;0=no.*/
  149.      int swcommnt;            /* 1=return comment declarations as data; 0=no. */
  150.      int swrefmsg;            /* 1=msg if undeclared ref is defaulted; 0=no. */
  151.      UNS swbufsz;             /* Size of source file buffer for READ(). */
  152.      int swenttr;             /* 1=trace entity stack in error messages; 0=no.*/
  153.      int sweltr;          /* 1=trace element stack in error messages; 0=no. */
  154.      int swambig;          /* 1=check content model ambiguity */
  155.      int swundef;          /* 1=warn about undefined elements. */
  156.      int swcap;              /* 1=report capcity errors */
  157.      char *prog;              /* Program name for error messages. */
  158. #ifdef TRACE
  159.      char *trace;          /* What to trace in the body. */
  160.      char *ptrace;          /* What to trace in the prolog. */
  161. #endif /* TRACE */
  162.      nl_catd catd;          /* Message catalog descriptor. */
  163.      long nopen;          /* Number of open document entities */
  164.      int onlypro;          /* Parse only the prolog. */
  165.      char **includes;          /* List of parameter entities to be defined
  166.                      as "INCLUDE"; NULL terminated.*/
  167.      VOID (*die) P((void));   /* Function to call on fatal error. */
  168.      CATALOG catalog;          /* Catalog for generating system identifiers. */
  169. };
  170. struct markup {               /* Delimiter strings for text processor. */
  171.      UNCH *cro;               /* LEXCON markup string: CRO        */
  172.      UNCH *dso;               /* LEXCON markup string: DSO        */
  173.      UNCH