1
2/***********************************************************
3
4Copyright 1987, 1988, 1998 The Open Group
5
6Permission to use, copy, modify, distribute, and sell this software and its
7documentation for any purpose is hereby granted without fee, provided that
8the above copyright notice appear in all copies and that both that
9copyright notice and this permission notice appear in supporting
10documentation.
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall not be
23used in advertising or otherwise to promote the sale, use or other dealings
24in this Software without prior written authorization from The Open Group.
25
26
27Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
28
29 All Rights Reserved
30
31Permission to use, copy, modify, and distribute this software and its
32documentation for any purpose and without fee is hereby granted,
33provided that the above copyright notice appear in all copies and that
34both that copyright notice and this permission notice appear in
35supporting documentation, and that the name of Digital not be
36used in advertising or publicity pertaining to distribution of the
37software without specific, written prior permission.
38
39DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45SOFTWARE.
46
47******************************************************************/
48
49#ifndef _X11_XRESOURCE_H_
50#define _X11_XRESOURCE_H_
51
52#ifndef _XP_PRINT_SERVER_
53#include <X11/Xlib.h>
54#endif
55
56/****************************************************************
57 ****************************************************************
58 *** ***
59 *** ***
60 *** X Resource Manager Intrinsics ***
61 *** ***
62 *** ***
63 ****************************************************************
64 ****************************************************************/
65
66_XFUNCPROTOBEGIN
67
68/****************************************************************
69 *
70 * Memory Management
71 *
72 ****************************************************************/
73
74extern char *Xpermalloc(
75 unsigned int /* size */
76);
77
78/****************************************************************
79 *
80 * Quark Management
81 *
82 ****************************************************************/
83
84typedef int XrmQuark, *XrmQuarkList;
85#define NULLQUARK ((XrmQuark) 0)
86
87typedef char *XrmString;
88#define NULLSTRING ((XrmString) 0)
89
90/* find quark for string, create new quark if none already exists */
91extern XrmQuark XrmStringToQuark(
92 _Xconst char* /* string */
93);
94
95extern XrmQuark XrmPermStringToQuark(
96 _Xconst char* /* string */
97);
98
99/* find string for quark */
100extern XrmString XrmQuarkToString(
101 XrmQuark /* quark */
102);
103
104extern XrmQuark XrmUniqueQuark(
105 void
106);
107
108#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0)
109
110
111/****************************************************************
112 *
113 * Conversion of Strings to Lists
114 *
115 ****************************************************************/
116
117typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList;
118
119extern void XrmStringToQuarkList(
120 _Xconst char* /* string */,
121 XrmQuarkList /* quarks_return */
122);
123
124extern void XrmStringToBindingQuarkList(
125 _Xconst char* /* string */,
126 XrmBindingList /* bindings_return */,
127 XrmQuarkList /* quarks_return */
128);
129
130/****************************************************************
131 *
132 * Name and Class lists.
133 *
134 ****************************************************************/
135
136typedef XrmQuark XrmName;
137typedef XrmQuarkList XrmNameList;
138#define XrmNameToString(name) XrmQuarkToString(name)
139#define XrmStringToName(string) XrmStringToQuark(string)
140#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name)
141
142typedef XrmQuark XrmClass;
143typedef XrmQuarkList XrmClassList;
144#define XrmClassToString(c_class) XrmQuarkToString(c_class)
145#define XrmStringToClass(c_class) XrmStringToQuark(c_class)
146#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class)
147
148
149
150/****************************************************************
151 *
152 * Resource Representation Types and Values
153 *
154 ****************************************************************/
155
156typedef XrmQuark XrmRepresentation;
157#define XrmStringToRepresentation(string) XrmStringToQuark(string)
158#define XrmRepresentationToString(type) XrmQuarkToString(type)
159
160typedef struct {
161 unsigned int size;
162 XPointer addr;
163} XrmValue, *XrmValuePtr;
164
165
166/****************************************************************
167 *
168 * Resource Manager Functions
169 *
170 ****************************************************************/
171
172typedef struct _XrmHashBucketRec *XrmHashBucket;
173typedef XrmHashBucket *XrmHashTable;
174typedef XrmHashTable XrmSearchList[];
175typedef struct _XrmHashBucketRec *XrmDatabase;
176
177
178extern void XrmDestroyDatabase(
179 XrmDatabase /* database */
180);
181
182extern void XrmQPutResource(
183 XrmDatabase* /* database */,
184 XrmBindingList /* bindings */,
185 XrmQuarkList /* quarks */,
186 XrmRepresentation /* type */,
187 XrmValue* /* value */
188);
189
190extern void XrmPutResource(
191 XrmDatabase* /* database */,
192 _Xconst char* /* specifier */,
193 _Xconst char* /* type */,
194 XrmValue* /* value */
195);
196
197extern void XrmQPutStringResource(
198 XrmDatabase* /* database */,
199 XrmBindingList /* bindings */,
200 XrmQuarkList /* quarks */,
201 _Xconst char* /* value */
202);
203
204extern void XrmPutStringResource(
205 XrmDatabase* /* database */,
206 _Xconst char* /* specifier */,
207 _Xconst char* /* value */
208);
209
210extern void XrmPutLineResource(
211 XrmDatabase* /* database */,
212 _Xconst char* /* line */
213);
214
215extern Bool XrmQGetResource(
216 XrmDatabase /* database */,
217 XrmNameList /* quark_name */,
218 XrmClassList /* quark_class */,
219 XrmRepresentation* /* quark_type_return */,
220 XrmValue* /* value_return */
221);
222
223extern Bool XrmGetResource(
224 XrmDatabase /* database */,
225 _Xconst char* /* str_name */,
226 _Xconst char* /* str_class */,
227 char** /* str_type_return */,
228 XrmValue* /* value_return */
229);
230
231extern Bool XrmQGetSearchList(
232 XrmDatabase /* database */,
233 XrmNameList /* names */,
234 XrmClassList /* classes */,
235 XrmSearchList /* list_return */,
236 int /* list_length */
237);
238
239extern Bool XrmQGetSearchResource(
240 XrmSearchList /* list */,
241 XrmName /* name */,
242 XrmClass /* class */,
243 XrmRepresentation* /* type_return */,
244 XrmValue* /* value_return */
245);
246
247/****************************************************************
248 *
249 * Resource Database Management
250 *
251 ****************************************************************/
252
253#ifndef _XP_PRINT_SERVER_
254
255extern void XrmSetDatabase(
256 Display* /* display */,
257 XrmDatabase /* database */
258);
259
260extern XrmDatabase XrmGetDatabase(
261 Display* /* display */
262);
263
264#endif /* !_XP_PRINT_SERVER_ */
265
266extern XrmDatabase XrmGetFileDatabase(
267 _Xconst char* /* filename */
268);
269
270extern Status XrmCombineFileDatabase(
271 _Xconst char* /* filename */,
272 XrmDatabase* /* target */,
273 Bool /* override */
274);
275
276extern XrmDatabase XrmGetStringDatabase(
277 _Xconst char* /* data */ /* null terminated string */
278);
279
280extern void XrmPutFileDatabase(
281 XrmDatabase /* database */,
282 _Xconst char* /* filename */
283);
284
285extern void XrmMergeDatabases(
286 XrmDatabase /* source_db */,
287 XrmDatabase* /* target_db */
288);
289
290extern void XrmCombineDatabase(
291 XrmDatabase /* source_db */,
292 XrmDatabase* /* target_db */,
293 Bool /* override */
294);
295
296#define XrmEnumAllLevels 0
297#define XrmEnumOneLevel 1
298
299extern Bool XrmEnumerateDatabase(
300 XrmDatabase /* db */,
301 XrmNameList /* name_prefix */,
302 XrmClassList /* class_prefix */,
303 int /* mode */,
304 Bool (*)(
305 XrmDatabase* /* db */,
306 XrmBindingList /* bindings */,
307 XrmQuarkList /* quarks */,
308 XrmRepresentation* /* type */,
309 XrmValue* /* value */,
310 XPointer /* closure */
311 ) /* proc */,
312 XPointer /* closure */
313);
314
315extern const char *XrmLocaleOfDatabase(
316 XrmDatabase /* database */
317);
318
319
320/****************************************************************
321 *
322 * Command line option mapping to resource entries
323 *
324 ****************************************************************/
325
326typedef enum {
327 XrmoptionNoArg, /* Value is specified in OptionDescRec.value */
328 XrmoptionIsArg, /* Value is the option string itself */
329 XrmoptionStickyArg, /* Value is characters immediately following option */
330 XrmoptionSepArg, /* Value is next argument in argv */
331 XrmoptionResArg, /* Resource and value in next argument in argv */
332 XrmoptionSkipArg, /* Ignore this option and the next argument in argv */
333 XrmoptionSkipLine, /* Ignore this option and the rest of argv */
334 XrmoptionSkipNArgs /* Ignore this option and the next
335 OptionDescRes.value arguments in argv */
336} XrmOptionKind;
337
338typedef struct {
339 char *option; /* Option abbreviation in argv */
340 char *specifier; /* Resource specifier */
341 XrmOptionKind argKind; /* Which style of option it is */
342 XPointer value; /* Value to provide if XrmoptionNoArg */
343} XrmOptionDescRec, *XrmOptionDescList;
344
345
346extern void XrmParseCommand(
347 XrmDatabase* /* database */,
348 XrmOptionDescList /* table */,
349 int /* table_count */,
350 _Xconst char* /* name */,
351 int* /* argc_in_out */,
352 char** /* argv_in_out */
353);
354
355_XFUNCPROTOEND
356
357#endif /* _X11_XRESOURCE_H_ */
358/* DON'T ADD STUFF AFTER THIS #endif */
359