1 /* ADL.H: Definitions for attribute descriptor list processing. 2 */ 3 /* N/C/SDATA external entity types for nxetype member of ne structure. */ 4 #define ESNCDATA 1 /* External character data entity. */ 5 #define ESNNDATA 2 /* Non-SGML data entity. */ 6 #define ESNSDATA 3 /* External specific character data entity. */ 7 #define ESNSUB 4 /* SGML subdocument entity. */ 8 9 /* N/C/SDATA control block for AENTITY attributes and NDATA returns.*/ 10 struct ne { /* N/C/SDATA entity control block. */ 11 UNIV neid; /* Files for NDATA entity. */ 12 UNCH *nepubid; /* Public identifier if specified. */ 13 UNCH *nesysid; /* System identifier if specified. */ 14 PDCB nedcn; /* Data content notation control block. */ 15 struct ad *neal; /* Data attribute list (NULL if none). */ 16 UNCH *neename; /* Ptr to entity name (length and EOS). */ 17 UNCH nextype; /* Entity type: NDATA SDATA CDATA SUBDOC. */ 18 }; 19 #define NESZ (sizeof(struct ne)) 20 typedef struct ne *PNE; 21 /* NDATA entity control block fields. */ 22 #define NEID(p) (((PNE)p)->neid) /* File ID of NDATA entity. */ 23 #define NESYSID(p) (((PNE)p)->nesysid) /* System ID of NDATA entity. */ 24 #define NEPUBID(p) (((PNE)p)->nepubid) /* Public ID of NDATA entity. */ 25 #define NEDCN(p) (((PNE)p)->nedcn->ename) /* Data content notation name. */ 26 #define NEDCNSYSID(p) (((PNE)p)->nedcn->sysid) /* Notation system ID.*/ 27 #define NEDCNPUBID(p) (((PNE)p)->nedcn->pubid) /* Notation public ID.*/ 28 #define NEDCNDEFINED(p) (((PNE)p)->nedcn->defined) /* Notation defined? */ 29 #define NEDCNADL(p) (((PNE)p)->nedcn->adl) /* Data content notation attlist.*/ 30 #define NEENAME(p) (((PNE)p)->neename) /* Entity name pointer. */ 31 #define NEXTYPE(p) (((PNE)p)->nextype) /* External entity type. */ 32 #define NEAL(p) (((PNE)p)->neal) /* Data attributes (if any). */ 33 #define NEDCNMARK(p) DCNMARK(((PNE)p)->nedcn) 34 35 /* Attribute descriptor list entry. */ 36 struct ad { 37 UNCH *adname; /* Attribute name with length and EOS. */ 38 UNCH adflags; /* Attribute flags. */ 39 UNCH adtype; /* Value type. */ 40 UNS adnum; /* Group size or member pos in grp. */ 41 UNS adlen; /* Length of default or value (for capacity). */ 42 UNCH *addef; /* Default value (NULL if REQUIRED or IMPLIED). */ 43 union { 44 PNE n; /* AENTITY: NDATA control block. */ 45 PDCB x; /* ANOTEGRP: DCN control block. */ 46 } addata; /* Special data associated with some attributes.*/ 47 }; 48 #define ADSZ (sizeof(struct ad)) /* Size of an ad structure. */ 49 50 /* Attribute flags for entire list adflags: ADLF. */ 51 #define ADLREQ 0x80 /* Attribute list: 1=REQUIRED att defined. */ 52 #define ADLNOTE 0x40 /* Attribute list: 1=NOTATION att defined. */ 53 #define ADLCONR 0x20 /* Attribute list: 1=CONREF att defined. */ 54 55 /* Attribute flags for list member adflags: ADFLAGS(n). */ 56 #define AREQ 0x80 /* Attribute: 0=null; 1=required. */ 57 #define ACURRENT 0x40 /* Attribute: 0=normal; 1=current. */ 58 #define AFIXED 0x20 /* Attribute: 0=normal; 1=must equal default. */ 59 #define AGROUP 0x10 /* Attribute: 0=single; 1=group of ad's. */ 60 #define ACONREF 0x08 /* Attribute: 0=normal; 1=att is CONREF. */ 61 #define AINVALID 0x04 /* Attribute: 1=value is invalid; 0=o.k. */ 62 #define AERROR 0x02 /* Attribute: 1=error was specified; 0=o.k. */ 63 #define ASPEC 0x01 /* Attribute: 1=value was specified; 0=default. */ 64 65 /* Attribute types for adtype. */ 66 #define ANMTGRP 0x00 /* Attribute: Name token group or member. */ 67 #define ANOTEGRP 0x01 /* Attribute: Notation (name group). */ 68 #define ACHARS 0x02 /* Attribute: Character string. */ 69 #define AENTITY 0x03 /* Attribute: Data entity (name). */ 70 #define AID 0x04 /* Attribute: ID value (name). */ 71 #define AIDREF 0x05 /* Attribute: ID reference value (name). */ 72 #define ANAME 0x06 /* Attribute: Name. */ 73 #define ANMTOKE 0x07 /* Attribute: Name token. */ 74 #define ANUMBER 0x08 /* Attribute: Number. */ 75 #define ANUTOKE 0x09 /* Attribute: Number token. */ 76 #define ATKNLIST 0x0A /* Attribute: >= means value is a token list. */ 77 #define AENTITYS 0x0A /* Attribute: Data entities (name list). */ 78 #define AIDREFS 0x0B /* Attribute: ID reference value (name list). */ 79 #define ANAMES 0x0C /* Attribute: Name list. */ 80 #define ANMTOKES 0x0D /* Attribute: Name token list. */ 81 #define ANUMBERS 0x0E /* Attribute: Number list. */ 82 #define ANUTOKES 0x0F /* Attribute: Number token list. */ 83 84 /* Field definitions for entries in an attribute list. 85 The first argument to all of these is the list address. 86 */ 87 /* Attribute list: flags. */ 88 #define ADLF(a) ((a)[0].adflags) 89 /* Attribute list: number of list members. */ 90 #define ADN(a) ((a)[0].adtype) 91 /* Attribute list: number of attributes. */ 92 #define AN(a) ((a)[0].adnum) 93 /* Nth attribute in list: name. */ 94 #define ADNAME(a, n) (((a)[n].adname+1)) 95 /* Nth att in list: number of val)ues. */ 96 #define ADNUM(a, n) ((a)[n].adnum) 97 /* Nth attribute in list: flags. */ 98 #define ADFLAGS(a, n) ((a)[n].adflags) 99 /* Nth attribute in list: type. */ 100 #define ADTYPE(a, n) ((a)[n].adtype) 101 /* Nth attribute in list: len of def or val.*/ 102 #define ADLEN(a, n) ((a)[n].adlen) 103 /* Nth attribute in list: def or value. */ 104 #define ADVAL(a, n) ((a)[n].addef) 105 /* Nth attribute in list: special data. */ 106 #define ADDATA(a, n) ((a)[n].addata) 107 /* Nth att: token at Pth pos in value. */ 108 #define ADTOKEN(a, n, p)(((a)[n].addef+(p))) 109 110 #define IDHASH 101 /* Size of ID hash table. Must be prime. */ 111 struct id { /* ID attribute control block. */ 112 struct id *idnext; /* Next ID in chain. */ 113 UNCH *idname; /* ID name with length prefix and EOS. */ 114 UNCH iddefed; /* Non-zero if it has been defined. */ 115 struct fwdref *idrl; /* Chain of forward references to this ID. */ 116 }; 117 #define IDSZ sizeof(struct id) 118 typedef struct id *PID; /* Ptr to ID attribute control block. */ 119