]> git.sesse.net Git - rdpsrv/blob - Xserver/lib/X11/Xresource.h
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / lib / X11 / Xresource.h
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 $ */
3
4 /***********************************************************
5
6 Copyright (c) 1987, 1988  X Consortium
7
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:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
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.
24
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.
28
29
30 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
31
32                         All Rights Reserved
33
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.  
41
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
48 SOFTWARE.
49
50 ******************************************************************/
51
52 #ifndef _XRESOURCE_H_
53 #define _XRESOURCE_H_
54
55 /* You must include <X11/Xlib.h> before including this file */
56
57 /****************************************************************
58  ****************************************************************
59  ***                                                          ***
60  ***                                                          ***
61  ***          X Resource Manager Intrinsics                   ***
62  ***                                                          ***
63  ***                                                          ***
64  ****************************************************************
65  ****************************************************************/
66
67 _XFUNCPROTOBEGIN
68
69 /****************************************************************
70  *
71  * Memory Management
72  *
73  ****************************************************************/
74
75 extern char *Xpermalloc(
76 #if NeedFunctionPrototypes
77     unsigned int        /* size */
78 #endif
79 );
80
81 /****************************************************************
82  *
83  * Quark Management
84  *
85  ****************************************************************/
86
87 typedef int     XrmQuark, *XrmQuarkList;
88 #define NULLQUARK ((XrmQuark) 0)
89
90 typedef char *XrmString;
91 #define NULLSTRING ((XrmString) 0)
92
93 /* find quark for string, create new quark if none already exists */
94 extern XrmQuark XrmStringToQuark(
95 #if NeedFunctionPrototypes
96     _Xconst char*       /* string */
97 #endif
98 );
99
100 extern XrmQuark XrmPermStringToQuark(
101 #if NeedFunctionPrototypes
102     _Xconst char*       /* string */
103 #endif
104 );
105
106 /* find string for quark */
107 extern XrmString XrmQuarkToString(
108 #if NeedFunctionPrototypes
109     XrmQuark            /* quark */
110 #endif
111 );
112
113 extern XrmQuark XrmUniqueQuark(
114 #if NeedFunctionPrototypes
115     void
116 #endif
117 );
118
119 #define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0)
120
121
122 /****************************************************************
123  *
124  * Conversion of Strings to Lists
125  *
126  ****************************************************************/
127
128 typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList;
129
130 extern void XrmStringToQuarkList(
131 #if NeedFunctionPrototypes
132     _Xconst char*       /* string */,
133     XrmQuarkList        /* quarks_return */
134 #endif
135 );
136
137 extern void XrmStringToBindingQuarkList(
138 #if NeedFunctionPrototypes
139     _Xconst char*       /* string */,
140     XrmBindingList      /* bindings_return */,
141     XrmQuarkList        /* quarks_return */
142 #endif
143 );
144
145 /****************************************************************
146  *
147  * Name and Class lists.
148  *
149  ****************************************************************/
150
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)
156
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)
162
163
164
165 /****************************************************************
166  *
167  * Resource Representation Types and Values
168  *
169  ****************************************************************/
170
171 typedef XrmQuark     XrmRepresentation;
172 #define XrmStringToRepresentation(string)   XrmStringToQuark(string)
173 #define XrmRepresentationToString(type)   XrmQuarkToString(type)
174
175 typedef struct {
176     unsigned int    size;
177     XPointer        addr;
178 } XrmValue, *XrmValuePtr;
179
180
181 /****************************************************************
182  *
183  * Resource Manager Functions
184  *
185  ****************************************************************/
186
187 typedef struct _XrmHashBucketRec *XrmHashBucket;
188 typedef XrmHashBucket *XrmHashTable;
189 typedef XrmHashTable XrmSearchList[];
190 typedef struct _XrmHashBucketRec *XrmDatabase;
191
192
193 extern void XrmDestroyDatabase(
194 #if NeedFunctionPrototypes
195     XrmDatabase         /* database */    
196 #endif
197 );
198
199 extern void XrmQPutResource(
200 #if NeedFunctionPrototypes
201     XrmDatabase*        /* database */,
202     XrmBindingList      /* bindings */,
203     XrmQuarkList        /* quarks */,
204     XrmRepresentation   /* type */,
205     XrmValue*           /* value */
206 #endif
207 );
208
209 extern void XrmPutResource(
210 #if NeedFunctionPrototypes
211     XrmDatabase*        /* database */,
212     _Xconst char*       /* specifier */,
213     _Xconst char*       /* type */,
214     XrmValue*           /* value */
215 #endif
216 );
217
218 extern void XrmQPutStringResource(
219 #if NeedFunctionPrototypes
220     XrmDatabase*        /* database */,
221     XrmBindingList      /* bindings */,
222     XrmQuarkList        /* quarks */,
223     _Xconst char*       /* value */
224 #endif
225 );
226
227 extern void XrmPutStringResource(
228 #if NeedFunctionPrototypes
229     XrmDatabase*        /* database */,
230     _Xconst char*       /* specifier */,
231     _Xconst char*       /* value */
232 #endif
233 );
234
235 extern void XrmPutLineResource(
236 #if NeedFunctionPrototypes
237     XrmDatabase*        /* database */,
238     _Xconst char*       /* line */
239 #endif
240 );
241
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 */
249 #endif
250 );
251
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 */
259 #endif
260 );
261
262 extern Bool XrmQGetSearchList(
263 #if NeedFunctionPrototypes
264     XrmDatabase         /* database */,
265     XrmNameList         /* names */,
266     XrmClassList        /* classes */,
267     XrmSearchList       /* list_return */,
268     int                 /* list_length */
269 #endif
270 );
271
272 extern Bool XrmQGetSearchResource(
273 #if NeedFunctionPrototypes
274     XrmSearchList       /* list */,
275     XrmName             /* name */,
276     XrmClass            /* class */,
277     XrmRepresentation*  /* type_return */,
278     XrmValue*           /* value_return */
279 #endif
280 );
281
282 /****************************************************************
283  *
284  * Resource Database Management
285  *
286  ****************************************************************/
287
288 extern void XrmSetDatabase(
289 #if NeedFunctionPrototypes
290     Display*            /* display */,
291     XrmDatabase         /* database */
292 #endif
293 );
294
295 extern XrmDatabase XrmGetDatabase(
296 #if NeedFunctionPrototypes
297     Display*            /* display */
298 #endif
299 );
300
301 extern XrmDatabase XrmGetFileDatabase(
302 #if NeedFunctionPrototypes
303     _Xconst char*       /* filename */
304 #endif
305 );
306
307 extern Status XrmCombineFileDatabase(
308 #if NeedFunctionPrototypes
309     _Xconst char*       /* filename */,
310     XrmDatabase*        /* target */,
311     Bool                /* override */
312 #endif
313 );
314
315 extern XrmDatabase XrmGetStringDatabase(
316 #if NeedFunctionPrototypes
317     _Xconst char*       /* data */  /*  null terminated string */
318 #endif
319 );
320
321 extern void XrmPutFileDatabase(
322 #if NeedFunctionPrototypes
323     XrmDatabase         /* database */,
324     _Xconst char*       /* filename */
325 #endif
326 );
327
328 extern void XrmMergeDatabases(
329 #if NeedFunctionPrototypes
330     XrmDatabase         /* source_db */,
331     XrmDatabase*        /* target_db */
332 #endif
333 );
334
335 extern void XrmCombineDatabase(
336 #if NeedFunctionPrototypes
337     XrmDatabase         /* source_db */,
338     XrmDatabase*        /* target_db */,
339     Bool                /* override */
340 #endif
341 );
342
343 #define XrmEnumAllLevels 0
344 #define XrmEnumOneLevel  1
345
346 extern Bool XrmEnumerateDatabase(
347 #if NeedFunctionPrototypes
348     XrmDatabase         /* db */,
349     XrmNameList         /* name_prefix */,
350     XrmClassList        /* class_prefix */,
351     int                 /* mode */,
352     Bool (*)(
353 #if NeedNestedPrototypes
354              XrmDatabase*       /* db */,
355              XrmBindingList     /* bindings */,
356              XrmQuarkList       /* quarks */,
357              XrmRepresentation* /* type */,
358              XrmValue*          /* value */,
359              XPointer           /* closure */
360 #endif
361              )          /* proc */,
362     XPointer            /* closure */
363 #endif
364 );
365
366 extern char *XrmLocaleOfDatabase(
367 #if NeedFunctionPrototypes
368     XrmDatabase         /* database */
369 #endif
370 );
371
372
373 /****************************************************************
374  *
375  * Command line option mapping to resource entries
376  *
377  ****************************************************************/
378
379 typedef enum {
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 */
389 } XrmOptionKind;
390
391 typedef struct {
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;
397
398
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 */                    
407 #endif
408 );
409
410 _XFUNCPROTOEND
411
412 #endif /* _XRESOURCE_H_ */
413 /* DON'T ADD STUFF AFTER THIS #endif */