1 | /* $Xorg: Oid.h,v 1.3 2000/08/17 19:48:06 cpqbld Exp $ */
|
---|
2 | /*
|
---|
3 | (c) Copyright 1996 Hewlett-Packard Company
|
---|
4 | (c) Copyright 1996 International Business Machines Corp.
|
---|
5 | (c) Copyright 1996 Sun Microsystems, Inc.
|
---|
6 | (c) Copyright 1996 Novell, Inc.
|
---|
7 | (c) Copyright 1996 Digital Equipment Corp.
|
---|
8 | (c) Copyright 1996 Fujitsu Limited
|
---|
9 | (c) Copyright 1996 Hitachi, Ltd.
|
---|
10 |
|
---|
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
12 | of this software and associated documentation files (the "Software"), to deal
|
---|
13 | in the Software without restriction, including without limitation the rights
|
---|
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
15 | copies of the Software, and to permit persons to whom the Software is
|
---|
16 | furnished to do so, subject to the following conditions:
|
---|
17 |
|
---|
18 | The above copyright notice and this permission notice shall be included in
|
---|
19 | all copies or substantial portions of the Software.
|
---|
20 |
|
---|
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
24 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
---|
25 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
26 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
27 |
|
---|
28 | Except as contained in this notice, the names of the copyright holders shall
|
---|
29 | not be used in advertising or otherwise to promote the sale, use or other
|
---|
30 | dealings in this Software without prior written authorization from said
|
---|
31 | copyright holders.
|
---|
32 | */
|
---|
33 |
|
---|
34 | #ifdef HAVE_DIX_CONFIG_H
|
---|
35 | #include <dix-config.h>
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #ifndef _Xp_Oid_h
|
---|
39 | #define _Xp_Oid_h
|
---|
40 |
|
---|
41 | #include <X11/Xproto.h>
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * include the auto-generated XpOid enum definition
|
---|
45 | */
|
---|
46 | #include "OidDefs.h"
|
---|
47 |
|
---|
48 | /*
|
---|
49 | * messages
|
---|
50 | */
|
---|
51 | #define XPMSG_WARN_MSS "Syntax error parsing medium-source-sizes"
|
---|
52 | #define XPMSG_WARN_ITM "Syntax error parsing input-trays-medium"
|
---|
53 | #define XPMSG_WARN_DOC_FMT "Syntax error parsing document format"
|
---|
54 | #define XPMSG_WARN_DOCFMT_LIST "Syntax error parsing document format list"
|
---|
55 | #define XPMSG_WARN_CARD_LIST "Syntax error parsing cardinal list"
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * macros for memory allocation
|
---|
59 | */
|
---|
60 | #define XpOidMalloc(size) ((char*)Xalloc((unsigned long)(size)))
|
---|
61 | #define XpOidCalloc(count, size) \
|
---|
62 | ((char*)Xcalloc((unsigned long)((count)*(size))))
|
---|
63 | #define XpOidFree(mem) (Xfree((unsigned long*)(mem)))
|
---|
64 |
|
---|
65 | /*
|
---|
66 | * list of object identifiers
|
---|
67 | */
|
---|
68 | typedef struct _XpOidList
|
---|
69 | {
|
---|
70 | XpOid* list;
|
---|
71 | int count;
|
---|
72 | } XpOidList;
|
---|
73 |
|
---|
74 | /*
|
---|
75 | * linked list of object identifiers
|
---|
76 | */
|
---|
77 | typedef struct XpOidNodeStruct
|
---|
78 | {
|
---|
79 | XpOid oid;
|
---|
80 | struct XpOidNodeStruct* next;
|
---|
81 | } *XpOidNode;
|
---|
82 |
|
---|
83 | typedef struct _XpOidLinkedList
|
---|
84 | {
|
---|
85 | XpOidNode head;
|
---|
86 | XpOidNode tail;
|
---|
87 | XpOidNode current;
|
---|
88 | int count;
|
---|
89 | } XpOidLinkedList;
|
---|
90 |
|
---|
91 | /*
|
---|
92 | * XpOidMediumSourceSize and related definitions
|
---|
93 | */
|
---|
94 | typedef struct
|
---|
95 | {
|
---|
96 | float minimum_x;
|
---|
97 | float maximum_x;
|
---|
98 | float minimum_y;
|
---|
99 | float maximum_y;
|
---|
100 | } XpOidArea;
|
---|
101 |
|
---|
102 | typedef struct
|
---|
103 | {
|
---|
104 | float lower_bound;
|
---|
105 | float upper_bound;
|
---|
106 | } XpOidRealRange;
|
---|
107 |
|
---|
108 | typedef struct
|
---|
109 | {
|
---|
110 | XpOidRealRange range_across_feed;
|
---|
111 | float increment_across_feed;
|
---|
112 | XpOidRealRange range_in_feed;
|
---|
113 | float increment_in_feed;
|
---|
114 | BOOL long_edge_feeds;
|
---|
115 | XpOidArea assured_reproduction_area;
|
---|
116 | } XpOidMediumContinuousSize;
|
---|
117 |
|
---|
118 | typedef struct
|
---|
119 | {
|
---|
120 | XpOid page_size;
|
---|
121 | BOOL long_edge_feeds;
|
---|
122 | XpOidArea assured_reproduction_area;
|
---|
123 | } XpOidMediumDiscreteSize;
|
---|
124 |
|
---|
125 | typedef struct
|
---|
126 | {
|
---|
127 | XpOidMediumDiscreteSize* list;
|
---|
128 | int count;
|
---|
129 | } XpOidMediumDiscreteSizeList;
|
---|
130 |
|
---|
131 | typedef struct
|
---|
132 | {
|
---|
133 | XpOid input_tray; /* may be set to xpoid_none or xpoid_unspecified */
|
---|
134 | enum { XpOidMediumSS_DISCRETE, XpOidMediumSS_CONTINUOUS } mstag;
|
---|
135 | union
|
---|
136 | {
|
---|
137 | XpOidMediumDiscreteSizeList* discrete;
|
---|
138 | XpOidMediumContinuousSize* continuous_size;
|
---|
139 | } ms; /* "ms" is short for medium-size */
|
---|
140 |
|
---|
141 | } XpOidMediumSourceSize;
|
---|
142 |
|
---|
143 | typedef struct
|
---|
144 | {
|
---|
145 | XpOidMediumSourceSize* mss;
|
---|
146 | int count;
|
---|
147 | } XpOidMediumSS;
|
---|
148 |
|
---|
149 |
|
---|
150 | typedef struct
|
---|
151 | {
|
---|
152 | XpOid input_tray; /* may be set to xpoid_none */
|
---|
153 | XpOid medium;
|
---|
154 | } XpOidTrayMedium;
|
---|
155 |
|
---|
156 | typedef struct
|
---|
157 | {
|
---|
158 | XpOidTrayMedium* list;
|
---|
159 | int count;
|
---|
160 | } XpOidTrayMediumList;
|
---|
161 |
|
---|
162 | typedef enum {
|
---|
163 | XPOID_NOTIFY_UNSUPPORTED,
|
---|
164 | XPOID_NOTIFY_NONE,
|
---|
165 | XPOID_NOTIFY_EMAIL
|
---|
166 | } XpOidNotify;
|
---|
167 |
|
---|
168 | typedef struct
|
---|
169 | {
|
---|
170 | unsigned long *list;
|
---|
171 | int count;
|
---|
172 | } XpOidCardList;
|
---|
173 |
|
---|
174 | typedef struct
|
---|
175 | {
|
---|
176 | char* format;
|
---|
177 | char* variant;
|
---|
178 | char* version;
|
---|
179 | } XpOidDocFmt;
|
---|
180 |
|
---|
181 | typedef struct
|
---|
182 | {
|
---|
183 | XpOidDocFmt* list;
|
---|
184 | int count;
|
---|
185 | } XpOidDocFmtList;
|
---|
186 |
|
---|
187 |
|
---|
188 | /*
|
---|
189 | * XpOid public methods
|
---|
190 | */
|
---|
191 | const char* XpOidString(XpOid);
|
---|
192 | int XpOidStringLength(XpOid);
|
---|
193 | XpOid XpOidFromString(const char* value);
|
---|
194 | BOOL XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray);
|
---|
195 |
|
---|
196 | /*
|
---|
197 | * XpOidList public methods
|
---|
198 | */
|
---|
199 | XpOidList* XpOidListNew(const char* value_string,
|
---|
200 | const XpOidList* valid_oids);
|
---|
201 | #define XpOidListInit(l, a, c) { (l)->list = (a); (l)->count = (c); }
|
---|
202 | void XpOidListDelete(XpOidList*);
|
---|
203 | #define XpOidListCount(l) ((l) ? (l)->count : 0)
|
---|
204 | #define XpOidListGetOid(l, i) ((l) ? (l)->list[(i)] : xpoid_none)
|
---|
205 | int XpOidListGetIndex(const XpOidList* list, XpOid oid);
|
---|
206 | BOOL XpOidListHasOid(const XpOidList* list, XpOid oid);
|
---|
207 | char* XpOidListString(const XpOidList*);
|
---|
208 |
|
---|
209 |
|
---|
210 | /*
|
---|
211 | * XpOidLinkedList public methods
|
---|
212 | */
|
---|
213 | XpOidLinkedList* XpOidLinkedListNew(void);
|
---|
214 | void XpOidLinkedListDelete(XpOidLinkedList*);
|
---|
215 | #define XpOidLinkedListCount(l) ((l) ? (l)->count : 0)
|
---|
216 | XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i);
|
---|
217 | void XpOidLinkedListAddOid(XpOidLinkedList* list, XpOid oid);
|
---|
218 | int XpOidLinkedListGetIndex(XpOidLinkedList* list, XpOid oid);
|
---|
219 | BOOL XpOidLinkedListHasOid(XpOidLinkedList* list,
|
---|
220 | XpOid oid);
|
---|
221 | XpOid XpOidLinkedListFirstOid(XpOidLinkedList* list);
|
---|
222 | XpOid XpOidLinkedListNextOid(XpOidLinkedList* list);
|
---|
223 |
|
---|
224 | /*
|
---|
225 | * XpOidMediumSourceSize public methods
|
---|
226 | */
|
---|
227 | XpOidMediumSS* XpOidMediumSSNew(const char* value_string,
|
---|
228 | const XpOidList* valid_trays,
|
---|
229 | const XpOidList* valid_medium_sizes);
|
---|
230 | void XpOidMediumSSDelete(XpOidMediumSS*);
|
---|
231 | #define XpOidMediumSSCount(me) ((me) ? (me)->count : 0)
|
---|
232 | BOOL XpOidMediumSSHasSize(XpOidMediumSS*, XpOid medium_size);
|
---|
233 | char* XpOidMediumSSString(const XpOidMediumSS*);
|
---|
234 |
|
---|
235 | /*
|
---|
236 | * XpOidTrayMediumList public methods
|
---|
237 | */
|
---|
238 | XpOidTrayMediumList* XpOidTrayMediumListNew(const char* value_string,
|
---|
239 | const XpOidList* valid_trays,
|
---|
240 | const XpOidMediumSS* msss);
|
---|
241 | void XpOidTrayMediumListDelete(XpOidTrayMediumList* me);
|
---|
242 | #define XpOidTrayMediumListCount(me) ((me) ? (me)->count : 0)
|
---|
243 | #define XpOidTrayMediumListTray(me, i) \
|
---|
244 | ((me) ? (me)->list[(i)].input_tray : xpoid_none)
|
---|
245 | #define XpOidTrayMediumListMedium(me, i) \
|
---|
246 | ((me) ? (me)->list[(i)].medium : xpoid_none)
|
---|
247 | char* XpOidTrayMediumListString(const XpOidTrayMediumList*);
|
---|
248 |
|
---|
249 | /*
|
---|
250 | * XpOidNotify public methods
|
---|
251 | */
|
---|
252 | XpOidNotify XpOidNotifyParse(const char* value_string);
|
---|
253 | const char* XpOidNotifyString(XpOidNotify notify);
|
---|
254 |
|
---|
255 | /*
|
---|
256 | * XpOidDocFmt public methods
|
---|
257 | */
|
---|
258 | XpOidDocFmt* XpOidDocFmtNew(const char* value_string);
|
---|
259 | void XpOidDocFmtDelete(XpOidDocFmt*);
|
---|
260 | char* XpOidDocFmtString(XpOidDocFmt*);
|
---|
261 |
|
---|
262 | /*
|
---|
263 | * XpOidDocFmtList public methods
|
---|
264 | */
|
---|
265 | XpOidDocFmtList* XpOidDocFmtListNew(const char* value_string,
|
---|
266 | const XpOidDocFmtList* valid_fmts);
|
---|
267 | void XpOidDocFmtListDelete(XpOidDocFmtList*);
|
---|
268 | char* XpOidDocFmtListString(const XpOidDocFmtList*);
|
---|
269 | #define XpOidDocFmtListCount(me) ((me) ? (me)->count : 0)
|
---|
270 | #define XpOidDocFmtListGetDocFmt(me, i) \
|
---|
271 | ((me) ? &(me)->list[(i)] : (XpDocFmt*)NULL)
|
---|
272 | BOOL XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
|
---|
273 | const XpOidDocFmt* fmt);
|
---|
274 | /*
|
---|
275 | * XpOidCardList public methods
|
---|
276 | */
|
---|
277 | XpOidCardList* XpOidCardListNew(const char* value_string,
|
---|
278 | const XpOidCardList* valid_cards);
|
---|
279 | #define XpOidCardListInit(l, a, c) { (l)->list = (a); (l)->count = (c); }
|
---|
280 | void XpOidCardListDelete(XpOidCardList*);
|
---|
281 | char* XpOidCardListString(const XpOidCardList*);
|
---|
282 | #define XpOidCardListCount(me) ((me) ? (me)->count : 0)
|
---|
283 | #define XpOidCardListGetCard(me, i) ((me) ? (me)->list[(i)] : 0)
|
---|
284 | BOOL XpOidCardListHasCard(const XpOidCardList*, unsigned long);
|
---|
285 |
|
---|
286 | /*
|
---|
287 | * misc parsing functions
|
---|
288 | */
|
---|
289 | BOOL XpOidParseUnsignedValue(const char* value_string,
|
---|
290 | const char** ptr_return,
|
---|
291 | unsigned long* unsigned_return);
|
---|
292 |
|
---|
293 |
|
---|
294 | #endif /* _Xp_Oid_h - don't add anything after this line */
|
---|