Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtdocbook / sgmls / adl.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: adl.h /main/3 1996/06/19 17:14:09 drk $ */
24 /* ADL.H: Definitions for attribute descriptor list processing.
25 */
26 /* N/C/SDATA external entity types for nxetype member of ne structure. */
27 #define ESNCDATA    1         /* External character data entity. */
28 #define ESNNDATA    2         /* Non-SGML data entity. */
29 #define ESNSDATA    3         /* External specific character data entity. */
30 #define ESNSUB      4         /* SGML subdocument entity. */
31
32 /* N/C/SDATA control block for AENTITY attributes and NDATA returns.*/
33 struct ne {                   /* N/C/SDATA entity control block. */
34      UNIV neid;               /* Files for NDATA entity. */
35      UNCH *nepubid;           /* Public identifier if specified. */
36      UNCH *nesysid;           /* System identifier if specified. */
37      PDCB nedcn;              /* Data content notation control block. */
38      struct ad *neal;         /* Data attribute list (NULL if none). */
39      UNCH *neename;           /* Ptr to entity name (length and EOS). */
40      UNCH nextype;            /* Entity type: NDATA SDATA CDATA SUBDOC. */
41 };
42 #define NESZ (sizeof(struct ne))
43 typedef struct ne *PNE;
44 /* NDATA entity control block fields. */
45 #define NEID(p) (((PNE)p)->neid)            /* File ID of NDATA entity. */
46 #define NESYSID(p) (((PNE)p)->nesysid)      /* System ID of NDATA entity. */
47 #define NEPUBID(p) (((PNE)p)->nepubid)      /* Public ID of NDATA entity. */
48 #define NEDCN(p) (((PNE)p)->nedcn->ename)   /* Data content notation name. */
49 #define NEDCNSYSID(p) (((PNE)p)->nedcn->sysid) /* Notation system ID.*/
50 #define NEDCNPUBID(p) (((PNE)p)->nedcn->pubid) /* Notation public ID.*/
51 #define NEDCNDEFINED(p) (((PNE)p)->nedcn->defined) /* Notation defined? */
52 #define NEDCNADL(p) (((PNE)p)->nedcn->adl)  /* Data content notation attlist.*/
53 #define NEENAME(p) (((PNE)p)->neename)      /* Entity name pointer. */
54 #define NEXTYPE(p) (((PNE)p)->nextype)      /* External entity type. */
55 #define NEAL(p) (((PNE)p)->neal)            /* Data attributes (if any). */
56 #define NEDCNMARK(p) DCNMARK(((PNE)p)->nedcn)
57
58 /* Attribute descriptor list entry. */
59 struct ad {
60      UNCH *adname;            /* Attribute name with length and EOS. */
61      UNCH adflags;            /* Attribute flags. */
62      UNCH adtype;             /* Value type. */
63      UNS adnum;               /* Group size or member pos in grp. */
64      UNS adlen;               /* Length of default or value (for capacity). */
65      UNCH *addef;             /* Default value (NULL if REQUIRED or IMPLIED). */
66      union {
67           PNE n;              /* AENTITY: NDATA control block. */
68           PDCB x;             /* ANOTEGRP: DCN control block. */
69      } addata;                /* Special data associated with some attributes.*/
70 };
71 #define ADSZ (sizeof(struct ad))   /* Size of an ad structure. */
72
73 /* Attribute flags for entire list adflags: ADLF. */
74 #define ADLREQ    0x80        /* Attribute list: 1=REQUIRED att defined. */
75 #define ADLNOTE   0x40        /* Attribute list: 1=NOTATION att defined. */
76 #define ADLCONR   0x20        /* Attribute list: 1=CONREF att defined. */
77
78 /* Attribute flags for list member adflags: ADFLAGS(n). */
79 #define AREQ      0x80        /* Attribute: 0=null; 1=required. */
80 #define ACURRENT  0x40        /* Attribute: 0=normal; 1=current. */
81 #define AFIXED    0x20        /* Attribute: 0=normal; 1=must equal default. */
82 #define AGROUP    0x10        /* Attribute: 0=single; 1=group of ad's. */
83 #define ACONREF   0x08        /* Attribute: 0=normal; 1=att is CONREF. */
84 #define AINVALID  0x04        /* Attribute: 1=value is invalid; 0=o.k. */
85 #define AERROR    0x02        /* Attribute: 1=error was specified; 0=o.k. */
86 #define ASPEC     0x01        /* Attribute: 1=value was specified; 0=default. */
87
88 /* Attribute types for adtype. */
89 #define ANMTGRP   0x00        /* Attribute: Name token group or member. */
90 #define ANOTEGRP  0x01        /* Attribute: Notation (name group). */
91 #define ACHARS    0x02        /* Attribute: Character string. */
92 #define AENTITY   0x03        /* Attribute: Data entity (name). */
93 #define AID       0x04        /* Attribute: ID value (name). */
94 #define AIDREF    0x05        /* Attribute: ID reference value (name). */
95 #define ANAME     0x06        /* Attribute: Name. */
96 #define ANMTOKE   0x07        /* Attribute: Name token. */
97 #define ANUMBER   0x08        /* Attribute: Number. */
98 #define ANUTOKE   0x09        /* Attribute: Number token. */
99 #define ATKNLIST  0x0A        /* Attribute: >= means value is a token list. */
100 #define AENTITYS  0x0A        /* Attribute: Data entities (name list). */
101 #define AIDREFS   0x0B        /* Attribute: ID reference value (name list). */
102 #define ANAMES    0x0C        /* Attribute: Name list. */
103 #define ANMTOKES  0x0D        /* Attribute: Name token list. */
104 #define ANUMBERS  0x0E        /* Attribute: Number list. */
105 #define ANUTOKES  0x0F        /* Attribute: Number token list. */
106
107 /* Field definitions for entries in an attribute list.
108    The first argument to all of these is the list address.
109 */
110 /* Attribute list: flags. */
111 #define ADLF(a) ((a)[0].adflags)
112 /* Attribute list: number of list members. */
113 #define ADN(a) ((a)[0].adtype)
114 /* Attribute list: number of attributes. */
115 #define AN(a) ((a)[0].adnum)
116 /* Nth attribute in list: name. */
117 #define ADNAME(a, n) (((a)[n].adname+1))
118 /* Nth att in list: number of val)ues. */
119 #define ADNUM(a, n) ((a)[n].adnum)
120 /* Nth attribute in list: flags. */
121 #define ADFLAGS(a, n) ((a)[n].adflags)
122 /* Nth attribute in list: type. */
123 #define ADTYPE(a, n) ((a)[n].adtype)
124 /* Nth attribute in list: len of def or val.*/
125 #define ADLEN(a, n) ((a)[n].adlen)
126 /* Nth attribute in list: def or value. */
127 #define ADVAL(a, n) ((a)[n].addef)
128 /* Nth attribute in list: special data. */
129 #define ADDATA(a, n) ((a)[n].addata)
130 /* Nth att: token at Pth pos in value. */
131 #define ADTOKEN(a, n, p)(((a)[n].addef+(p)))
132
133 #define IDHASH 101            /* Size of ID hash table.  Must be prime. */
134 struct id {                   /* ID attribute control block. */
135      struct id *idnext;       /* Next ID in chain. */
136      UNCH *idname;            /* ID name with length prefix and EOS. */
137      UNCH iddefed;            /* Non-zero if it has been defined. */
138      struct fwdref *idrl;     /* Chain of forward references to this ID. */
139 };
140 #define IDSZ sizeof(struct id)
141 typedef struct id *PID;       /* Ptr to ID attribute control block. */