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