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

  1. /* sgmls.h
  2.    Interface to a library for reading output of sgmls. */
  3.  
  4. struct sgmls_data {
  5.   char *s;
  6.   unsigned len;
  7.   char is_sdata;
  8. };
  9.  
  10. struct sgmls_notation {
  11.   char *name;
  12.   char *sysid;
  13.   char *pubid;
  14. };
  15.  
  16. struct sgmls_internal_entity {
  17.   char *name;
  18.   struct sgmls_data data;
  19. };
  20.  
  21. enum sgmls_external_entity_type {
  22.   SGMLS_ENTITY_CDATA,
  23.   SGMLS_ENTITY_SDATA,
  24.   SGMLS_ENTITY_NDATA,
  25.   SGMLS_ENTITY_SUBDOC
  26.   };
  27.  
  28. struct sgmls_external_entity {
  29.   char *name;
  30.   enum sgmls_external_entity_type type;
  31.   char **filenames;
  32.   int nfilenames;
  33.   char *pubid;
  34.   char *sysid;
  35.   struct sgmls_attribute *attributes;
  36.   struct sgmls_notation *notation;
  37. };
  38.   
  39. struct sgmls_entity {
  40.   union {
  41.     struct sgmls_internal_entity internal;
  42.     struct sgmls_external_entity external;
  43.   } u;
  44.   char is_internal;
  45. };
  46.  
  47. enum sgmls_attribute_type {
  48.   SGMLS_ATTR_IMPLIED,
  49.   SGMLS_ATTR_CDATA,
  50.   SGMLS_ATTR_TOKEN,
  51.   SGMLS_ATTR_ENTITY,
  52.   SGMLS_ATTR_NOTATION
  53. };
  54.  
  55. struct sgmls_attribute {
  56.   struct sgmls_attribute *next;
  57.   char *name;
  58.   enum sgmls_attribute_type type;
  59.   union {
  60.     struct {
  61.       struct sgmls_data *v;
  62.       int n;
  63.     } data;
  64.     struct {
  65.       struct sgmls_entity **v;
  66.       int n;
  67.     } entity;
  68.     struct {
  69.       char **v;
  70.       int n;
  71.     } token;
  72.     struct sgmls_notation *notation;
  73.   } value;
  74. };
  75.  
  76. enum sgmls_event_type {
  77.   SGMLS_EVENT_DATA,        /* data */
  78.   SGMLS_EVENT_ENTITY,        /* external entity reference */
  79.   SGMLS_EVENT_PI,        /* processing instruction */
  80.   SGMLS_EVENT_START,        /* element start */
  81.   SGMLS_EVENT_END,        /* element end */
  82.   SGMLS_EVENT_SUBSTART,        /* subdocument start */
  83.   SGMLS_EVENT_SUBEND,        /* subdocument end */
  84.   SGMLS_EVENT_APPINFO,        /* appinfo */
  85.   SGMLS_EVENT_CONFORMING        /* the document was conforming */
  86.   };
  87.  
  88. struct sgmls_event {
  89.   enum sgmls_event_type type;
  90.   union {
  91.     struct {
  92.       struct sgmls_data *v;
  93.       int n;
  94.     } data;
  95.     struct sgmls_external_entity *entity;
  96.     struct {
  97.       char *s;
  98.       unsigned len;
  99.     } pi;
  100.     struct {
  101.       char *gi;
  102.       struct sgmls_attribute *attributes;
  103.     } start;
  104.     struct {
  105.       char *gi;
  106.     } end;
  107.     char *appinfo;
  108.   } u;
  109.   char *filename;        /* SGML filename */
  110.   unsigned long lineno;        /* SGML lineno */
  111. };
  112.  
  113. #ifdef __STDC__
  114. void sgmls_free_attributes(struct sgmls_attribute *);
  115. struct sgmls *sgmls_create(FILE *);
  116. int sgmls_next(struct sgmls *, struct sgmls_event *);
  117. void sgmls_free(struct sgmls *);
  118. typedef void sgmls_errhandler(int, char *, unsigned long);
  119. sgmls_errhandler *sgmls_set_errhandler(sgmls_errhandler *);
  120. #else /* not __STDC__ */
  121. void sgmls_free_attributes();
  122. struct sgmls *sgmls_create();
  123. int sgmls_next();
  124. void sgmls_free();
  125. typedef void sgmls_errhandler();
  126. sgmls_errhandler *sgmls_set_errhandler();
  127. #endif /* not __STDC__ */
  128.