1 /* This file controls the interface between the parser core and the auxiliary 2 functions in entgen.c, sgmlio.c, and sgmlmsg.c */ 3 4 #include "std.h" 5 #include "entity.h" 6 #include "sgmldecl.h" 7 8 /* Error types (ERRTYPE) for calls to error-handling services 9 performed for SGML by the text processor (SGMLIO). 10 NOTE: Strings in these blocks have no lengths, but cannot exceed 11 NAMELEN (plus 1 more byte for the zero terminator). 12 */ 13 #define FILERR 0 /* Error: file access. */ 14 #define DOCERR 1 /* Error: in document markup. */ 15 #define MDERR 2 /* Error: in markup declaration with subdcl. */ 16 #define MDERR2 3 /* Error: in markup declaration with no subdcl. */ 17 #define EXITERR 4 /* Error: terminal error in document markup. */ 18 /* Quantities affecting error messages and their arguments. 19 */ 20 #define MAXARGS 2 /* Maximum number of arguments in a msg. */ 21 22 /* NOTE: Error handler must return, or next call to SGML must be RSET or END, 23 except for EXITERR errors which must not return. 24 */ 25 struct error { /* IPB for error messages. */ 26 UNS errtype; /* Type of error: DOC, MD, MD2, FIL. */ 27 UNS errnum; /* Error number. */ 28 UNS errsp; /* Special parameter index in message file. */ 29 int sverrno; /* Saved value of errno. */ 30 int parmno; /* MDERROR: declaration parameter number. */ 31 UNCH *subdcl; /* MDERROR: subject of declaration. */ 32 UNIV eparm[MAXARGS]; /* Ptrs to arguments (no length, but EOS). */ 33 }; 34 35 struct location { 36 int filesw; 37 unsigned long rcnt; 38 int ccnt; 39 UNCH curchar; 40 UNCH nextchar; 41 UNCH *ename; 42 UNIV fcb; 43 }; 44 45 int ioopen P((UNIV, UNIV*)); 46 VOID ioclose P((UNIV)); 47 int ioread P((UNIV, UNCH *, int *)); 48 VOID iopend P((UNIV, int, UNCH *)); 49 int iocont P((UNIV)); 50 VOID ioinit P((struct switches *)); 51 char *ioflid P((UNIV)); 52 53 UNIV entgen P((struct fpi *)); 54 VOID entginit P((struct switches *)); 55 56 VOID msgprint P((struct error *)); 57 VOID msginit P((struct switches *)); 58 UNIV msgsave P((struct error *)); 59 VOID msgsprint P((UNIV)); 60 VOID msgsfree P((UNIV)); 61 int msgcnterr P((void)); 62 63 64 int inprolog P((void)); 65 UNCH *getgi P((int)); 66 67 int getlocation P((int, struct location *)); 68 UNIV rmalloc P((unsigned int)); 69 UNIV rrealloc P((UNIV, UNS)); 70 VOID frem P((UNIV)); 71 VOID exiterr P((unsigned int,struct parse *)); 72 char *getsubst P((void)); 73