1 | |
2 | /*********************************************************** |
3 | |
4 | Copyright 1987, 1988, 1998 The Open Group |
5 | |
6 | Permission to use, copy, modify, distribute, and sell this software and its |
7 | documentation for any purpose is hereby granted without fee, provided that |
8 | the above copyright notice appear in all copies and that both that |
9 | copyright notice and this permission notice appear in supporting |
10 | documentation. |
11 | |
12 | The above copyright notice and this permission notice shall be included in |
13 | all copies or substantial portions of the Software. |
14 | |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
18 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
19 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
21 | |
22 | Except as contained in this notice, the name of The Open Group shall not be |
23 | used in advertising or otherwise to promote the sale, use or other dealings |
24 | in this Software without prior written authorization from The Open Group. |
25 | |
26 | |
27 | Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. |
28 | |
29 | All Rights Reserved |
30 | |
31 | Permission to use, copy, modify, and distribute this software and its |
32 | documentation for any purpose and without fee is hereby granted, |
33 | provided that the above copyright notice appear in all copies and that |
34 | both that copyright notice and this permission notice appear in |
35 | supporting documentation, and that the name of Digital not be |
36 | used in advertising or publicity pertaining to distribution of the |
37 | software without specific, written prior permission. |
38 | |
39 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING |
40 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL |
41 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR |
42 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
43 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
44 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
45 | SOFTWARE. |
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 | |
74 | extern char *Xpermalloc( |
75 | unsigned int /* size */ |
76 | ); |
77 | |
78 | /**************************************************************** |
79 | * |
80 | * Quark Management |
81 | * |
82 | ****************************************************************/ |
83 | |
84 | typedef int XrmQuark, *XrmQuarkList; |
85 | #define NULLQUARK ((XrmQuark) 0) |
86 | |
87 | typedef char *XrmString; |
88 | #define NULLSTRING ((XrmString) 0) |
89 | |
90 | /* find quark for string, create new quark if none already exists */ |
91 | extern XrmQuark XrmStringToQuark( |
92 | _Xconst char* /* string */ |
93 | ); |
94 | |
95 | extern XrmQuark XrmPermStringToQuark( |
96 | _Xconst char* /* string */ |
97 | ); |
98 | |
99 | /* find string for quark */ |
100 | extern XrmString XrmQuarkToString( |
101 | XrmQuark /* quark */ |
102 | ); |
103 | |
104 | extern 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 | |
117 | typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList; |
118 | |
119 | extern void XrmStringToQuarkList( |
120 | _Xconst char* /* string */, |
121 | XrmQuarkList /* quarks_return */ |
122 | ); |
123 | |
124 | extern 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 | |
136 | typedef XrmQuark XrmName; |
137 | typedef XrmQuarkList XrmNameList; |
138 | #define XrmNameToString(name) XrmQuarkToString(name) |
139 | #define XrmStringToName(string) XrmStringToQuark(string) |
140 | #define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name) |
141 | |
142 | typedef XrmQuark XrmClass; |
143 | typedef 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 | |
156 | typedef XrmQuark XrmRepresentation; |
157 | #define XrmStringToRepresentation(string) XrmStringToQuark(string) |
158 | #define XrmRepresentationToString(type) XrmQuarkToString(type) |
159 | |
160 | typedef struct { |
161 | unsigned int size; |
162 | XPointer addr; |
163 | } XrmValue, *XrmValuePtr; |
164 | |
165 | |
166 | /**************************************************************** |
167 | * |
168 | * Resource Manager Functions |
169 | * |
170 | ****************************************************************/ |
171 | |
172 | typedef struct _XrmHashBucketRec *XrmHashBucket; |
173 | typedef XrmHashBucket *XrmHashTable; |
174 | typedef XrmHashTable XrmSearchList[]; |
175 | typedef struct _XrmHashBucketRec *XrmDatabase; |
176 | |
177 | |
178 | extern void XrmDestroyDatabase( |
179 | XrmDatabase /* database */ |
180 | ); |
181 | |
182 | extern void XrmQPutResource( |
183 | XrmDatabase* /* database */, |
184 | XrmBindingList /* bindings */, |
185 | XrmQuarkList /* quarks */, |
186 | XrmRepresentation /* type */, |
187 | XrmValue* /* value */ |
188 | ); |
189 | |
190 | extern void XrmPutResource( |
191 | XrmDatabase* /* database */, |
192 | _Xconst char* /* specifier */, |
193 | _Xconst char* /* type */, |
194 | XrmValue* /* value */ |
195 | ); |
196 | |
197 | extern void XrmQPutStringResource( |
198 | XrmDatabase* /* database */, |
199 | XrmBindingList /* bindings */, |
200 | XrmQuarkList /* quarks */, |
201 | _Xconst char* /* value */ |
202 | ); |
203 | |
204 | extern void XrmPutStringResource( |
205 | XrmDatabase* /* database */, |
206 | _Xconst char* /* specifier */, |
207 | _Xconst char* /* value */ |
208 | ); |
209 | |
210 | extern void XrmPutLineResource( |
211 | XrmDatabase* /* database */, |
212 | _Xconst char* /* line */ |
213 | ); |
214 | |
215 | extern Bool XrmQGetResource( |
216 | XrmDatabase /* database */, |
217 | XrmNameList /* quark_name */, |
218 | XrmClassList /* quark_class */, |
219 | XrmRepresentation* /* quark_type_return */, |
220 | XrmValue* /* value_return */ |
221 | ); |
222 | |
223 | extern 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 | |
231 | extern Bool XrmQGetSearchList( |
232 | XrmDatabase /* database */, |
233 | XrmNameList /* names */, |
234 | XrmClassList /* classes */, |
235 | XrmSearchList /* list_return */, |
236 | int /* list_length */ |
237 | ); |
238 | |
239 | extern 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 | |
255 | extern void XrmSetDatabase( |
256 | Display* /* display */, |
257 | XrmDatabase /* database */ |
258 | ); |
259 | |
260 | extern XrmDatabase XrmGetDatabase( |
261 | Display* /* display */ |
262 | ); |
263 | |
264 | #endif /* !_XP_PRINT_SERVER_ */ |
265 | |
266 | extern XrmDatabase XrmGetFileDatabase( |
267 | _Xconst char* /* filename */ |
268 | ); |
269 | |
270 | extern Status XrmCombineFileDatabase( |
271 | _Xconst char* /* filename */, |
272 | XrmDatabase* /* target */, |
273 | Bool /* override */ |
274 | ); |
275 | |
276 | extern XrmDatabase XrmGetStringDatabase( |
277 | _Xconst char* /* data */ /* null terminated string */ |
278 | ); |
279 | |
280 | extern void XrmPutFileDatabase( |
281 | XrmDatabase /* database */, |
282 | _Xconst char* /* filename */ |
283 | ); |
284 | |
285 | extern void XrmMergeDatabases( |
286 | XrmDatabase /* source_db */, |
287 | XrmDatabase* /* target_db */ |
288 | ); |
289 | |
290 | extern void XrmCombineDatabase( |
291 | XrmDatabase /* source_db */, |
292 | XrmDatabase* /* target_db */, |
293 | Bool /* override */ |
294 | ); |
295 | |
296 | #define 0 |
297 | #define 1 |
298 | |
299 | extern Bool ( |
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 | |
315 | extern const char *XrmLocaleOfDatabase( |
316 | XrmDatabase /* database */ |
317 | ); |
318 | |
319 | |
320 | /**************************************************************** |
321 | * |
322 | * Command line option mapping to resource entries |
323 | * |
324 | ****************************************************************/ |
325 | |
326 | typedef 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 | |
338 | typedef 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 | |
346 | extern 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 | |