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

  1. /* SGMLMAIN: Main interface to SGML services.
  2.  
  3. Preprocessor variable names are the only supported interface
  4. to data maintained by SGML.  They are defined in this file or in adl.h.
  5. */
  6. /* Return control block types (RCBTYPE) from calls to parser (SGML):
  7.    Names and strings follow the convention for the IPBs.
  8. */
  9. enum sgmlevent {
  10.      SGMLEOD,            /* End of document. */
  11.      SGMLDAF,            /* Data found. */
  12.      SGMLSTG,            /* Start-tag found. */
  13.      SGMLETG,            /* End-tag found. */
  14.      SGMLREF,            /* Record end found. */
  15.      SGMLPIS,            /* Processing instruction (string). */
  16.      SGMLAPP            /* APPINFO (string) */
  17. };
  18.  
  19. struct rcbdata {              /* Return control block: DAF EOD REF PIS APP. */
  20.      UNS contersw;            /* 1=context error; 2,4,8=data type; 0=not. */
  21.      UNS datalen;             /* Length of data or PI (0=single nonchar). */
  22.      UNCH *data;              /* Data, PI, single nonSGML, or NDATA ecb ptr. */
  23. };
  24.  
  25. struct rcbtag {               /* Return control block for STG and ETG. */
  26.      UNS contersw;            /* 1=context error; 2=NET enabled; 0/0=not. */
  27.      UNS tagmin;              /* Minim: NONE NULL NET DATA; implied by S/ETAG */
  28.      UNCH *curgi;          /* Start-tag (or end-tag) GI. */
  29.      union {
  30.           struct ad *al;      /* Start-tag: attribute list. */
  31.           UNCH *oldgi;        /* End-tag: resumed GI. */
  32.      } ru;
  33.      struct ad *lal;          /* Start-tag: link attribute list (UNUSED). */
  34.      UNS format;              /* Format class for default processing. */
  35.      struct etd *tagreal;     /* Dummy etd or ptr to GI that implied this tag.*/
  36.      int etictr;              /* Number of elements on stack with NET enabled.*/
  37.      UNCH *srmnm;             /* Current SHORTREF map name (NULL=#EMPTY). */
  38. };
  39.  
  40. /* Accessors for rcbdata and rcbtag. */
  41. /* Datatype abbreviations: C=unsigned char  S=string  U=unsigned int L=4 bytes
  42.                            A=array  P=ptr to structure N=name (see sgmlcb.h)
  43. */
  44. /* Data control block fields: processing instructions (SGMLPIS).
  45. */
  46. #define PDATA(d) ((d).data)            /*S  PI string. */
  47. #define PDATALEN(d) ((d).datalen)      /*U  Length of PI string. */
  48. #define PIESW(d) (((d).contersw & 4))  /*U  1=PIDATA entity returned. */
  49. /* Data control block fields: other data types.
  50. */
  51. #define CDATA(d) ((d).data)            /*S  CDATA content string. */
  52. #define CDATALEN(d) ((d).datalen)      /*U  Length of CDATA content string. */
  53. #define CONTERSW(d) (((d).contersw &1))/*U  1=CDATA or TAG out of context. */
  54. #define CDESW(d) (((d).contersw & 2))  /*U  1=CDATA entity returned. */
  55. #define SDESW(d) (((d).contersw & 4))  /*U  1=SDATA entity returned. */
  56. #define NDESW(d) (((d).contersw & 8))  /*U  1=NDATA entity returned. */
  57. #define NEPTR(d) ((PNE)(d).data)       /*P  Ptr to NDATA control block. */
  58. #define MARKUP(d) ((d).data)           /*A  Markup delimiter strings. */
  59. #define DTYPELEN(d) ((d).datalen)      /*U  Length of doc type name +len+EOS. */
  60. #define DOCTYPE(d) ((d).data)          /*S  Document type name (with len+EOS). */
  61. #define ADATA(d) ((d).data)           /*S  APPINFO */
  62. #define ADATALEN(d) ((d).datalen)      /*U  Length of APPINFO string.  */
  63. /* Tag control block fields.
  64. */
  65. #define ALPTR(t) ((t).ru.al)           /*P  Ptr to SGML attribute list. */
  66. #define CURGI(t) ((t).curgi+1)         /*N  GI of started or ended element. */
  67. #define OLDGI(t) ((t).ru.oldgi)        /*S  GI of resumed element. */
  68. #define TAGMIN(t) (t).tagmin          /*U  Minimization for current tag. */
  69. #define TAGREAL(t) ((t).tagreal)      /*P  Dummy etd that implied this tag. */
  70. #define TAGRLNM(t) ((UNCH *)(t).tagreal)  /*P GI of tag that implied this tag.*/
  71. #define ETISW(t) (((t).contersw & 2))  /*U  1=NET delimiter enabled by ETI. */
  72. #define PEXSW(t) (((t).contersw & 4))  /*U  1=Element was plus exception. */
  73. #define MTYSW(t) (((t).contersw & 8))  /*U  1=Element is empty. */
  74. #define ETICTR(t) ((t).etictr)         /*U  Number of active NET delimiters. */
  75. #define SRMNM(t) ((t).srmnm)           /*S  Name of current SHORTREF map. */
  76. #define SRMCNT(t) ((t).contersw)       /*U  Number of SHORTREF maps defined. */
  77. #define FORMAT(t) ((t).format)         /*U  Format class.*/
  78.  
  79. /* These function names are chosen so as to be distinct in the first 6
  80. letters. */
  81.  
  82. /* Initialize. */
  83. struct markup *sgmlset P((struct switches *));
  84. /* Cleanup and return capacity usage statistics. */
  85. VOID sgmlend P((struct sgmlcap *));
  86. /* Set document entity. */
  87. int sgmlsdoc P((UNIV));
  88. /* Get entity. */
  89. int sgmlgent P((UNCH *, PNE *, UNCH **));
  90. /* Mark an entity.  Return is non-zero if already marked.*/
  91. int sgmlment P((UNCH *));
  92. /* Get the next sgml event. */
  93. enum sgmlevent sgmlnext P((struct rcbdata *, struct rcbtag *));
  94. /* Get the error count. */
  95. int sgmlgcnterr P((void));
  96. /* Get the current location. */
  97. int sgmlloc P((unsigned long *, char **));
  98. /* Write out the SGML declaration. */
  99. VOID sgmlwrsd P((FILE *));
  100. /* Note subdocument capacity usage. */
  101. VOID sgmlsubcap P((long *));
  102.