1 /* $XConsortium: Xresource.h /main/38 1996/10/22 14:24:34 kaleb $ */
2 /* $XFree86: xc/lib/X11/Xresource.h,v 3.1 1996/12/23 05:59:51 dawes Exp $ */
4 /***********************************************************
6 Copyright (c) 1987, 1988 X Consortium
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 Except as contained in this notice, the name of the X Consortium shall not be
26 used in advertising or otherwise to promote the sale, use or other dealings
27 in this Software without prior written authorization from the X Consortium.
30 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
34 Permission to use, copy, modify, and distribute this software and its
35 documentation for any purpose and without fee is hereby granted,
36 provided that the above copyright notice appear in all copies and that
37 both that copyright notice and this permission notice appear in
38 supporting documentation, and that the name of Digital not be
39 used in advertising or publicity pertaining to distribution of the
40 software without specific, written prior permission.
42 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
43 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
44 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
45 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
46 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
47 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
50 ******************************************************************/
55 /* You must include <X11/Xlib.h> before including this file */
57 /****************************************************************
58 ****************************************************************
61 *** X Resource Manager Intrinsics ***
64 ****************************************************************
65 ****************************************************************/
69 /****************************************************************
73 ****************************************************************/
75 extern char *Xpermalloc(
76 #if NeedFunctionPrototypes
77 unsigned int /* size */
81 /****************************************************************
85 ****************************************************************/
87 typedef int XrmQuark, *XrmQuarkList;
88 #define NULLQUARK ((XrmQuark) 0)
90 typedef char *XrmString;
91 #define NULLSTRING ((XrmString) 0)
93 /* find quark for string, create new quark if none already exists */
94 extern XrmQuark XrmStringToQuark(
95 #if NeedFunctionPrototypes
96 _Xconst char* /* string */
100 extern XrmQuark XrmPermStringToQuark(
101 #if NeedFunctionPrototypes
102 _Xconst char* /* string */
106 /* find string for quark */
107 extern XrmString XrmQuarkToString(
108 #if NeedFunctionPrototypes
113 extern XrmQuark XrmUniqueQuark(
114 #if NeedFunctionPrototypes
119 #define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0)
122 /****************************************************************
124 * Conversion of Strings to Lists
126 ****************************************************************/
128 typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList;
130 extern void XrmStringToQuarkList(
131 #if NeedFunctionPrototypes
132 _Xconst char* /* string */,
133 XrmQuarkList /* quarks_return */
137 extern void XrmStringToBindingQuarkList(
138 #if NeedFunctionPrototypes
139 _Xconst char* /* string */,
140 XrmBindingList /* bindings_return */,
141 XrmQuarkList /* quarks_return */
145 /****************************************************************
147 * Name and Class lists.
149 ****************************************************************/
151 typedef XrmQuark XrmName;
152 typedef XrmQuarkList XrmNameList;
153 #define XrmNameToString(name) XrmQuarkToString(name)
154 #define XrmStringToName(string) XrmStringToQuark(string)
155 #define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name)
157 typedef XrmQuark XrmClass;
158 typedef XrmQuarkList XrmClassList;
159 #define XrmClassToString(c_class) XrmQuarkToString(c_class)
160 #define XrmStringToClass(c_class) XrmStringToQuark(c_class)
161 #define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class)
165 /****************************************************************
167 * Resource Representation Types and Values
169 ****************************************************************/
171 typedef XrmQuark XrmRepresentation;
172 #define XrmStringToRepresentation(string) XrmStringToQuark(string)
173 #define XrmRepresentationToString(type) XrmQuarkToString(type)
178 } XrmValue, *XrmValuePtr;
181 /****************************************************************
183 * Resource Manager Functions
185 ****************************************************************/
187 typedef struct _XrmHashBucketRec *XrmHashBucket;
188 typedef XrmHashBucket *XrmHashTable;
189 typedef XrmHashTable XrmSearchList[];
190 typedef struct _XrmHashBucketRec *XrmDatabase;
193 extern void XrmDestroyDatabase(
194 #if NeedFunctionPrototypes
195 XrmDatabase /* database */
199 extern void XrmQPutResource(
200 #if NeedFunctionPrototypes
201 XrmDatabase* /* database */,
202 XrmBindingList /* bindings */,
203 XrmQuarkList /* quarks */,
204 XrmRepresentation /* type */,
205 XrmValue* /* value */
209 extern void XrmPutResource(
210 #if NeedFunctionPrototypes
211 XrmDatabase* /* database */,
212 _Xconst char* /* specifier */,
213 _Xconst char* /* type */,
214 XrmValue* /* value */
218 extern void XrmQPutStringResource(
219 #if NeedFunctionPrototypes
220 XrmDatabase* /* database */,
221 XrmBindingList /* bindings */,
222 XrmQuarkList /* quarks */,
223 _Xconst char* /* value */
227 extern void XrmPutStringResource(
228 #if NeedFunctionPrototypes
229 XrmDatabase* /* database */,
230 _Xconst char* /* specifier */,
231 _Xconst char* /* value */
235 extern void XrmPutLineResource(
236 #if NeedFunctionPrototypes
237 XrmDatabase* /* database */,
238 _Xconst char* /* line */
242 extern Bool XrmQGetResource(
243 #if NeedFunctionPrototypes
244 XrmDatabase /* database */,
245 XrmNameList /* quark_name */,
246 XrmClassList /* quark_class */,
247 XrmRepresentation* /* quark_type_return */,
248 XrmValue* /* value_return */
252 extern Bool XrmGetResource(
253 #if NeedFunctionPrototypes
254 XrmDatabase /* database */,
255 _Xconst char* /* str_name */,
256 _Xconst char* /* str_class */,
257 char** /* str_type_return */,
258 XrmValue* /* value_return */
262 extern Bool XrmQGetSearchList(
263 #if NeedFunctionPrototypes
264 XrmDatabase /* database */,
265 XrmNameList /* names */,
266 XrmClassList /* classes */,
267 XrmSearchList /* list_return */,
268 int /* list_length */
272 extern Bool XrmQGetSearchResource(
273 #if NeedFunctionPrototypes
274 XrmSearchList /* list */,
276 XrmClass /* class */,
277 XrmRepresentation* /* type_return */,
278 XrmValue* /* value_return */
282 /****************************************************************
284 * Resource Database Management
286 ****************************************************************/
288 extern void XrmSetDatabase(
289 #if NeedFunctionPrototypes
290 Display* /* display */,
291 XrmDatabase /* database */
295 extern XrmDatabase XrmGetDatabase(
296 #if NeedFunctionPrototypes
297 Display* /* display */
301 extern XrmDatabase XrmGetFileDatabase(
302 #if NeedFunctionPrototypes
303 _Xconst char* /* filename */
307 extern Status XrmCombineFileDatabase(
308 #if NeedFunctionPrototypes
309 _Xconst char* /* filename */,
310 XrmDatabase* /* target */,
315 extern XrmDatabase XrmGetStringDatabase(
316 #if NeedFunctionPrototypes
317 _Xconst char* /* data */ /* null terminated string */
321 extern void XrmPutFileDatabase(
322 #if NeedFunctionPrototypes
323 XrmDatabase /* database */,
324 _Xconst char* /* filename */
328 extern void XrmMergeDatabases(
329 #if NeedFunctionPrototypes
330 XrmDatabase /* source_db */,
331 XrmDatabase* /* target_db */
335 extern void XrmCombineDatabase(
336 #if NeedFunctionPrototypes
337 XrmDatabase /* source_db */,
338 XrmDatabase* /* target_db */,
343 #define XrmEnumAllLevels 0
344 #define XrmEnumOneLevel 1
346 extern Bool XrmEnumerateDatabase(
347 #if NeedFunctionPrototypes
348 XrmDatabase /* db */,
349 XrmNameList /* name_prefix */,
350 XrmClassList /* class_prefix */,
353 #if NeedNestedPrototypes
354 XrmDatabase* /* db */,
355 XrmBindingList /* bindings */,
356 XrmQuarkList /* quarks */,
357 XrmRepresentation* /* type */,
358 XrmValue* /* value */,
359 XPointer /* closure */
362 XPointer /* closure */
366 extern char *XrmLocaleOfDatabase(
367 #if NeedFunctionPrototypes
368 XrmDatabase /* database */
373 /****************************************************************
375 * Command line option mapping to resource entries
377 ****************************************************************/
380 XrmoptionNoArg, /* Value is specified in OptionDescRec.value */
381 XrmoptionIsArg, /* Value is the option string itself */
382 XrmoptionStickyArg, /* Value is characters immediately following option */
383 XrmoptionSepArg, /* Value is next argument in argv */
384 XrmoptionResArg, /* Resource and value in next argument in argv */
385 XrmoptionSkipArg, /* Ignore this option and the next argument in argv */
386 XrmoptionSkipLine, /* Ignore this option and the rest of argv */
387 XrmoptionSkipNArgs /* Ignore this option and the next
388 OptionDescRes.value arguments in argv */
392 char *option; /* Option abbreviation in argv */
393 char *specifier; /* Resource specifier */
394 XrmOptionKind argKind; /* Which style of option it is */
395 XPointer value; /* Value to provide if XrmoptionNoArg */
396 } XrmOptionDescRec, *XrmOptionDescList;
399 extern void XrmParseCommand(
400 #if NeedFunctionPrototypes
401 XrmDatabase* /* database */,
402 XrmOptionDescList /* table */,
403 int /* table_count */,
404 _Xconst char* /* name */,
405 int* /* argc_in_out */,
406 char** /* argv_in_out */
412 #endif /* _XRESOURCE_H_ */
413 /* DON'T ADD STUFF AFTER THIS #endif */