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

  1. /******************************************************************************/
  2. /* Changed ipbbuf from UNIV to char * for consistency with read() arg.        */
  3. /******************************************************************************/
  4. /* Deleted idcan, entref, and entdef services (prohibited by standard).       */
  5. /* Add control blocks for getting and freeing memory.                         */
  6. /******************************************************************************/
  7. /* SGMLCB.H: Symbols for SGML interface control blocks that are used
  8.              for parameters when calling SGML services (IPB), or as return
  9.              control blocks after completing the services (RCB).
  10. */
  11. /******************************************************************************/
  12. /* Housekeeping.
  13. */
  14. #define NAMEBUF   10                 /* Buffer size for names. */
  15. /******************************************************************************/
  16. /* Interface parameter block types (IPBTYPE) for calls to SGML:
  17. */
  18. /* NULL pointer    0      SGML: parse current entity (returns RCB ptr). */
  19. #define SGMLSET    1   /* SGML: set up first pass (RCB pts to delims). */
  20. #define SGMLRSET   2   /* SGML: reset for subsequent pass (no RCB). */
  21. #define SGMLEND    3   /* SGML: clean up after last pass (RCB pts to stat). */
  22. #define ENTPRIME   6   /* Entity: declare & ref primary entity (RC: <0=error).*/
  23. #define GISET      7   /* GI: store start- and end- ptrs with GI(RC: 1=no GI).*/
  24. #define GIGET      8   /* GI: get start- and end- ptrs for GI (RC: 1=no GI). */
  25. #define ENTGET    10   /* Entity: get entity text if data entity. */
  26. /******************************************************************************/
  27. /* NOTE: Names in IPBT are unsigned character arrays whose length
  28.          (including the length byte itself and a zero terminator) is in the
  29.          first character position; e.g., the name "JACK" is actually: \6JACK\0
  30.          This convention is also followed for strings and arrays that (like
  31.          names) cannot exceed a known maximum length (except that arrays have
  32.          no zero terminator, and their length is stored as indicated
  33.          by the #define statements in SGMLMAIN.H.
  34.          For other strings and arrays, the length is in itl1 or itl2 and the
  35.          array pointer in itp1 or itp2; there is no zero terminator.
  36. */
  37. struct ipbt {                 /* IPB for calls to SGML. */
  38.      UNS ipbtype;             /* Type of interface parameter block. */
  39.      UNIV itnm;               /* Entity, GI, or ID name. */
  40.      UNS itl1;                /* Length of string pointed to by p1 (if any). */
  41.      UNIV itp1;               /* Start-GI proc; ID data. */
  42.                               /* ENTPRIME: Permanent DOS fileid. */
  43.                               /* SGMLSET: Address of return code from SGML. */
  44.                               /* SGMLRESET: Address of sw switches array. */
  45.                               /* ENTGET: Pointer to data entity text. */
  46.      UNS itl2;                /* Length of string pointed to by p2 (if any). */
  47.      UNIV itp2;               /* GI end-tag proc. */
  48.                               /* SGMLSET: Address of SGML RCB pointer. */
  49.                               /* From SGMLSET: Address of delimiter array. */
  50. };
  51. /******************************************************************************/
  52. /* Return control block types (RCBTYPE) from calls to parser (SGML):
  53.    Names and strings follow the convention for the IPBs.
  54. */
  55. #define SGMLDAF    1   /* Data found. */
  56. #define SGMLEOD    2   /* End of document. */
  57. #define SGMLETG    3   /* End-tag found. */
  58. #define SGMLPIS    4   /* Processing instruction (string). */
  59. #define SGMLREF    5   /* Record end found. */
  60. #define SGMLSTG    6   /* Start-tag found. */
  61. #define SGMLSDTD   7   /* Document type definition started (data is type). */
  62. #define SGMLEDTD   8   /* Document type definition ended (data is type). */
  63. #define SGMLMV     9   /* Information for markup validator only (ignore). */
  64. /******************************************************************************/
  65. /* Default format classes (returned with SGMLSTG and SGMLETG RCBs).
  66. */
  67. #define FORMATP    1   /* Phrase: change font (e.g., quote, citation). */
  68. #define FORMATB    2   /* Block: vertical space (e.g., paragraph, list item). */
  69. #define FORMATS    3   /* Structure: indent margins (e.g., list, long quote). */
  70. #define FORMATN    4   /* Non-SGML data: print file ID and notation. */
  71. /******************************************************************************/
  72. /* NOTE: Pointers to data within SGML are offsets only; DS is returned
  73.          by the call to SGMLSET.
  74. */
  75. struct rcbdata {              /* Return control block: DAF EOD REF PIS DTD. */
  76.      UNS rcbtype;             /* Type of return control block. */
  77.      PSCB sgmlscbs;           /* Source control block stack. */
  78.      int sgmles;              /* Index into sgmlscbs. */
  79.      UNS contersw;            /* 1=context error; 2,4,8=data type; 0=not. */
  80.      UNS datalen;             /* Length of data or PI (0=single nonchar). */
  81.      UNCH *data;              /* Data, PI, single nonSGML, or NDATA ecb ptr. */
  82. };
  83. struct rcbtag {               /* Return control block for STG and ETG. */
  84.      UNS rcbtype;             /* Type of return control block. */
  85.      PSCB sgmlscbs;           /* Source control block stack. */
  86.      int sgmles;              /* Index into sgmlscbs. */
  87.      UNS contersw;            /* 1=context error; 2=NET enabled; 0/0=not. */
  88.      UNS tagmin;              /* Minim: NONE NULL NET DATA; implied by S/ETAG */
  89.      UNCH curgi[NAMEBUF];     /* Start-tag (or end-tag) GI. */
  90.      UNIV gidata;             /* User data associated with start (or end) GI. */
  91.      union {
  92.           struct ad *al;      /* Start-tag: attribute list. */
  93.           UNCH *oldgi;        /* End-tag: resumed GI. */
  94.      } ru;
  95.      long idrefl;             /* IDREF hits (in order of IDREF tokens in al). */
  96.      struct ad *lal;          /* Start-tag: link attribute list (UNUSED). */
  97.      UNS format;              /* Format class for default processing. */
  98.      struct etd *tagreal;     /* Dummy etd or ptr to GI that implied this tag.*/
  99.      int etictr;              /* Number of elements on stack with NET enabled.*/
  100.      UNCH *srmnm;             /* Current SHORTREF map name (NULL=#EMPTY). */
  101.      struct entity **aentl;   /* AENTITY ECBs (order of AENTITY tokens in al).*/
  102. };
  103. /******************************************************************************/
  104. /* Interface parameter block types (IPBTYPE) for calls to I/O services
  105.    performed for SGML by the text processor (SGMLIO).
  106.    NOTE: Strings in these blocks are zero-terminated; no length byte
  107.          (except that DOS fileid returned by FILENAME has length byte).
  108. */
  109. #define FILENM     1   /* File: generate IO filename from fpi control block. */
  110. #define FILEOPEN   2   /* File: open file. */
  111. #define FILEREAD   3   /* File: read next block. */
  112. #define FILEPEND   4   /* File: close file temporarily and save location. */
  113. #define FILECONT   5   /* File: reopen file; position at saved location. */
  114. #define FILECLOS   6   /* File: close file permanently. */
  115. /******************************************************************************/
  116. struct ipbfile {              /* IPB for FILEOPEN FILEREAD FILECLOS FILENM. */
  117.      UNS ipbtype;             /* Type of interface parameter block. */
  118.      PSCB sgmlscbs;           /* Source control block stack. */
  119.      int sgmles;              /* This file's SCB level (NAME=current file's). */
  120.      int ipbrc;               /* From OPEN FRST READ: -1=error; >=0 if o.k. */
  121.      UNIV ipbn;               /* To NAME: fpi ptr; from NAME: SGMLIO name ptr.*/
  122.                               /* To OPEN: name ptr; from OPEN: SGMLIO fcb ptr.*/
  123.                               /* To FRST READ CLOSE PEND CONT: SGMLIO fcb ptr.*/
  124.      char *ipbbuf;            /* To FRST READ: SGML read buffer. */
  125.                               /* From FRST READ: actual read buffer. */
  126.      UNS ipboff;              /* To PEND: characters parsed in current block. */
  127. };
  128. /******************************************************************************/
  129. /* Error types (ERRTYPE) for calls to error-handling services
  130.    performed for SGML by the text processor (SGMLIO).
  131.    NOTE: Strings in these blocks have no lengths, but cannot exceed
  132.    NAMELEN (plus 1 more byte for the zero terminator).
  133. */
  134. #define FILERR    7           /* Error: file access. */
  135. #define DOCERR    8           /* Error: in document markup. */
  136. #define MDERR     9           /* Error: in markup declaration with subdcl. */
  137. #define MDERR2   10           /* Error: in markup declaration with no subdcl. */
  138. #define EXITERR  11           /* Error: terminal error in document markup. */
  139. /******************************************************************************/
  140. /* Quantities affecting error messages and their arguments.
  141. */
  142. #define MAXARGS    2          /* Maximum number of arguments in a msg. */
  143. #define MAXMSGS  255          /* Number of error messages in msgfile. */
  144. #define MAXHDRS    7          /* Number of header messages in msgfile. */
  145. #define MAXPCBS   25          /* Number of parse mode parameters in msgfile. */
  146. #define MAXDCLS   11          /* Number of declaration name parms in msgfile. */
  147. /******************************************************************************/
  148. /* NOTE: Error handler must return, or next call to SGML must be RSET or END,
  149.          except for errors with severity code 'C', which must not return.
  150. */
  151. struct ipberr {               /* IPB for error messages. */
  152.      UNS errtype;             /* Type of error: DOC, MD, MD2, FIL. */
  153.      PSCB sgmlscbs;           /* Source control block stack. */
  154.      int sgmles;              /* Index into sgmlscbs. */
  155.      UNS errnum;              /* Error number. */
  156.      UNS errsp;               /* Special parameter index in message file. */
  157.      int parmno;              /* MDERROR: declaration parameter number. */
  158.      UNCH subdcl[NAMEBUF];    /* MDERROR: subject of declaration. */
  159.      UNIV eparm[MAXARGS];     /* Ptrs to arguments (no length, but EOS). */
  160. };
  161. /******************************************************************************/
  162. /* Memory service request types (MEMTYPE) for calls to memory services
  163.    performed for SGML by the support environment (SGMLMEM).
  164. */
  165. #define MEMGET    1           /* Memory: get area of specified size. */
  166. #define MEMFREE   2           /* Memory: free previously gotten area. */
  167. /******************************************************************************/
  168. struct ipbmem {               /* IPB for memory services. */
  169.      UNS memtype;             /* Type of request: GET, FREE. */
  170.      UNIV memarea;            /* From GET: area gotten; to FREE: gotten area. */
  171.      UNS memsize;             /* To GET: size of area to get (in chars). */
  172.      UNS mempool;             /* Subpool number (TEMP: unused - always 0). */
  173. };
  174. /******************************************************************************/
  175.