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