File: | Converters.c |
Location: | line 838, column 6 |
Description: | Assigned value is garbage or undefined |
1 | /*********************************************************** | ||
2 | Copyright (c) 1993, Oracle and/or its affiliates. All rights reserved. | ||
3 | |||
4 | Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | copy of this software and associated documentation files (the "Software"), | ||
6 | to deal in the Software without restriction, including without limitation | ||
7 | the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | and/or sell copies of the Software, and to permit persons to whom the | ||
9 | Software is furnished to do so, subject to the following conditions: | ||
10 | |||
11 | The above copyright notice and this permission notice (including the next | ||
12 | paragraph) shall be included in all copies or substantial portions of the | ||
13 | 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 | ||
18 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
20 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
21 | DEALINGS IN THE SOFTWARE. | ||
22 | |||
23 | Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. | ||
24 | |||
25 | All Rights Reserved | ||
26 | |||
27 | Permission to use, copy, modify, and distribute this software and its | ||
28 | documentation for any purpose and without fee is hereby granted, | ||
29 | provided that the above copyright notice appear in all copies and that | ||
30 | both that copyright notice and this permission notice appear in | ||
31 | supporting documentation, and that the name of Digital not be | ||
32 | used in advertising or publicity pertaining to distribution of the | ||
33 | software without specific, written prior permission. | ||
34 | |||
35 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | ||
36 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | ||
37 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | ||
38 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | ||
39 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | ||
40 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
41 | SOFTWARE. | ||
42 | |||
43 | ******************************************************************/ | ||
44 | |||
45 | /* | ||
46 | |||
47 | Copyright 1987, 1988, 1994, 1998 The Open Group | ||
48 | |||
49 | Permission to use, copy, modify, distribute, and sell this software and its | ||
50 | documentation for any purpose is hereby granted without fee, provided that | ||
51 | the above copyright notice appear in all copies and that both that | ||
52 | copyright notice and this permission notice appear in supporting | ||
53 | documentation. | ||
54 | |||
55 | The above copyright notice and this permission notice shall be included in | ||
56 | all copies or substantial portions of the Software. | ||
57 | |||
58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
61 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||
62 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
63 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
64 | |||
65 | Except as contained in this notice, the name of The Open Group shall not be | ||
66 | used in advertising or otherwise to promote the sale, use or other dealings | ||
67 | in this Software without prior written authorization from The Open Group. | ||
68 | |||
69 | */ | ||
70 | |||
71 | /*LINTLIBRARY*/ | ||
72 | /* Conversion.c - implementations of resource type conversion procs */ | ||
73 | |||
74 | #ifdef HAVE_CONFIG_H1 | ||
75 | #include <config.h> | ||
76 | #endif | ||
77 | #include "IntrinsicI.h" | ||
78 | #include "StringDefs.h" | ||
79 | #include "Shell.h" | ||
80 | #include <stdio.h> | ||
81 | #include <X11/cursorfont.h> | ||
82 | #include <X11/keysym.h> | ||
83 | #include <X11/Xlocale.h> | ||
84 | #include <errno(*__errno_location ()).h> /* for StringToDirectoryString */ | ||
85 | |||
86 | #ifdef __UNIXOS2__ | ||
87 | #define IsNewline(str)((str) == '\n') ((str) == '\n' || (str) == '\r') | ||
88 | #define IsWhitespace(str)((str)== ' ' || (str) == '\t') ((str)== ' ' || (str) == '\t' || (str) == '\r') | ||
89 | #else | ||
90 | #define IsNewline(str)((str) == '\n') ((str) == '\n') | ||
91 | #define IsWhitespace(str)((str)== ' ' || (str) == '\t') ((str)== ' ' || (str) == '\t') | ||
92 | #endif | ||
93 | |||
94 | static const String XtNwrongParameters = "wrongParameters"; | ||
95 | static const String XtNconversionError = "conversionError"; | ||
96 | static const String XtNmissingCharsetList = "missingCharsetList"; | ||
97 | |||
98 | /* Representation types */ | ||
99 | |||
100 | #define XtQAtomXrmPermStringToQuark(((char*)&XtStrings[1544])) XrmPermStringToQuark(XtRAtom((char*)&XtStrings[1544])) | ||
101 | #define XtQCommandArgArrayXrmPermStringToQuark(((char*)&XtStrings[2128])) XrmPermStringToQuark(XtRCommandArgArray((char*)&XtStrings[2128])) | ||
102 | #define XtQCursorXrmPermStringToQuark(((char*)&XtStrings[1611])) XrmPermStringToQuark(XtRCursor((char*)&XtStrings[1611])) | ||
103 | #define XtQDirectoryStringXrmPermStringToQuark(((char*)&XtStrings[2144])) XrmPermStringToQuark(XtRDirectoryString((char*)&XtStrings[2144])) | ||
104 | #define XtQDisplayXrmPermStringToQuark(((char*)&XtStrings[1628])) XrmPermStringToQuark(XtRDisplay((char*)&XtStrings[1628])) | ||
105 | #define XtQFileXrmPermStringToQuark(((char*)&XtStrings[1650])) XrmPermStringToQuark(XtRFile((char*)&XtStrings[1650])) | ||
106 | #define XtQFloatXrmPermStringToQuark(((char*)&XtStrings[1655])) XrmPermStringToQuark(XtRFloat((char*)&XtStrings[1655])) | ||
107 | #define XtQInitialStateXrmPermStringToQuark(((char*)&XtStrings[1705])) XrmPermStringToQuark(XtRInitialState((char*)&XtStrings[1705])) | ||
108 | #define XtQPixmapXrmPermStringToQuark(((char*)&XtStrings[1760])) XrmPermStringToQuark(XtRPixmap((char*)&XtStrings[1760])) | ||
109 | #define XtQRestartStyleXrmPermStringToQuark(((char*)&XtStrings[2177])) XrmPermStringToQuark(XtRRestartStyle((char*)&XtStrings[2177])) | ||
110 | #define XtQShortXrmPermStringToQuark(((char*)&XtStrings[1791])) XrmPermStringToQuark(XtRShort((char*)&XtStrings[1791])) | ||
111 | #define XtQUnsignedCharXrmPermStringToQuark(((char*)&XtStrings[1828])) XrmPermStringToQuark(XtRUnsignedChar((char*)&XtStrings[1828])) | ||
112 | #define XtQVisualXrmPermStringToQuark(((char*)&XtStrings[1858])) XrmPermStringToQuark(XtRVisual((char*)&XtStrings[1858])) | ||
113 | |||
114 | static XrmQuark XtQBool; | ||
115 | static XrmQuark XtQBoolean; | ||
116 | static XrmQuark XtQColor; | ||
117 | static XrmQuark XtQDimension; | ||
118 | static XrmQuark XtQFont; | ||
119 | static XrmQuark XtQFontSet; | ||
120 | static XrmQuark XtQFontStruct; | ||
121 | static XrmQuark XtQGravity; | ||
122 | static XrmQuark XtQInt; | ||
123 | static XrmQuark XtQPixel; | ||
124 | static XrmQuark XtQPosition; | ||
125 | #ifdef __UNIXOS2__ | ||
126 | XrmQuark _XtQString = 0; | ||
127 | #else | ||
128 | XrmQuark _XtQString; | ||
129 | #endif | ||
130 | |||
131 | void _XtConvertInitialize(void) | ||
132 | { | ||
133 | XtQBool = XrmPermStringToQuark(XtRBool((char*)&XtStrings[1556])); | ||
134 | XtQBoolean = XrmPermStringToQuark(XtRBoolean((char*)&XtStrings[1561])); | ||
135 | XtQColor = XrmPermStringToQuark(XtRColor((char*)&XtStrings[1596])); | ||
136 | XtQDimension = XrmPermStringToQuark(XtRDimension((char*)&XtStrings[1618])); | ||
137 | XtQFont = XrmPermStringToQuark(XtRFont((char*)&XtStrings[1661])); | ||
138 | XtQFontSet = XrmPermStringToQuark(XtRFontSet((char*)&XtStrings[2026])); | ||
139 | XtQFontStruct = XrmPermStringToQuark(XtRFontStruct((char*)&XtStrings[1666])); | ||
140 | XtQGravity = XrmPermStringToQuark(XtRGravity((char*)&XtStrings[2042])); | ||
141 | XtQInt = XrmPermStringToQuark(XtRInt((char*)&XtStrings[1718])); | ||
142 | XtQPixel = XrmPermStringToQuark(XtRPixel((char*)&XtStrings[1754])); | ||
143 | XtQPosition = XrmPermStringToQuark(XtRPosition((char*)&XtStrings[1775])); | ||
144 | _XtQString = XrmPermStringToQuark(XtRString((char*)&XtStrings[1797])); | ||
145 | } | ||
146 | |||
147 | #define donestr(type, value, tstr){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(type)) { toVal->size = sizeof(type); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, tstr); return 0; } *(type*)(toVal ->addr) = (value); } else { static type static_val; static_val = (value); toVal->addr = (XPointer)&static_val; } toVal ->size = sizeof(type); return 1; } \ | ||
148 | { \ | ||
149 | if (toVal->addr != NULL((void*)0)) { \ | ||
150 | if (toVal->size < sizeof(type)) { \ | ||
151 | toVal->size = sizeof(type); \ | ||
152 | XtDisplayStringConversionWarning(dpy, \ | ||
153 | (char*) fromVal->addr, tstr); \ | ||
154 | return False0; \ | ||
155 | } \ | ||
156 | *(type*)(toVal->addr) = (value); \ | ||
157 | } \ | ||
158 | else { \ | ||
159 | static type static_val; \ | ||
160 | static_val = (value); \ | ||
161 | toVal->addr = (XPointer)&static_val; \ | ||
162 | } \ | ||
163 | toVal->size = sizeof(type); \ | ||
164 | return True1; \ | ||
165 | } | ||
166 | |||
167 | #define done(type, value){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(type)) { toVal->size = sizeof(type); return 0; } * (type*)(toVal->addr) = (value); } else { static type static_val ; static_val = (value); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(type); return 1; } \ | ||
168 | { \ | ||
169 | if (toVal->addr != NULL((void*)0)) { \ | ||
170 | if (toVal->size < sizeof(type)) { \ | ||
171 | toVal->size = sizeof(type); \ | ||
172 | return False0; \ | ||
173 | } \ | ||
174 | *(type*)(toVal->addr) = (value); \ | ||
175 | } \ | ||
176 | else { \ | ||
177 | static type static_val; \ | ||
178 | static_val = (value); \ | ||
179 | toVal->addr = (XPointer)&static_val; \ | ||
180 | } \ | ||
181 | toVal->size = sizeof(type); \ | ||
182 | return True1; \ | ||
183 | } | ||
184 | |||
185 | void XtDisplayStringConversionWarning( | ||
186 | Display* dpy, | ||
187 | _Xconstconst char* from, | ||
188 | _Xconstconst char* toType | ||
189 | ) | ||
190 | { | ||
191 | #ifndef NO_MIT_HACKS | ||
192 | /* Allow suppression of conversion warnings. %%% Not specified. */ | ||
193 | |||
194 | static enum {Check, Report, Ignore} report_it = Check; | ||
195 | XtAppContext app = XtDisplayToApplicationContext(dpy); | ||
196 | |||
197 | LOCK_APP(app)if(app && app->lock)(*app->lock)(app); | ||
198 | LOCK_PROCESSif(_XtProcessLock)(*_XtProcessLock)(); | ||
199 | if (report_it == Check) { | ||
200 | XrmDatabase rdb = XtDatabase(dpy); | ||
201 | XrmName xrm_name[2]; | ||
202 | XrmClass xrm_class[2]; | ||
203 | XrmRepresentation rep_type; | ||
204 | XrmValue value; | ||
205 | xrm_name[0] = XrmPermStringToQuark( "stringConversionWarnings" ); | ||
206 | xrm_name[1] = 0; | ||
207 | xrm_class[0] = XrmPermStringToQuark( "StringConversionWarnings" ); | ||
208 | xrm_class[1] = 0; | ||
209 | if (XrmQGetResource( rdb, xrm_name, xrm_class, | ||
210 | &rep_type, &value )) | ||
211 | { | ||
212 | if (rep_type == XtQBoolean) | ||
213 | report_it = *(Boolean*)value.addr ? Report : Ignore; | ||
214 | else if (rep_type == _XtQString) { | ||
215 | XrmValue toVal; | ||
216 | Boolean report; | ||
217 | toVal.addr = (XPointer)&report; | ||
218 | toVal.size = sizeof(Boolean); | ||
219 | if (XtCallConverter(dpy, XtCvtStringToBoolean, (XrmValuePtr)NULL((void*)0), | ||
220 | (Cardinal)0, &value, &toVal, | ||
221 | (XtCacheRef*)NULL((void*)0))) | ||
222 | report_it = report ? Report : Ignore; | ||
223 | } | ||
224 | else report_it = Report; | ||
225 | } | ||
226 | else report_it = Report; | ||
227 | } | ||
228 | |||
229 | if (report_it == Report) { | ||
230 | #endif /* ifndef NO_MIT_HACKS */ | ||
231 | String params[2]; | ||
232 | Cardinal num_params = 2; | ||
233 | params[0] = (String)from; | ||
234 | params[1] = (String)toType; | ||
235 | XtAppWarningMsg(app, | ||
236 | XtNconversionError,"string",XtCXtToolkitError, | ||
237 | "Cannot convert string \"%s\" to type %s", | ||
238 | params,&num_params); | ||
239 | #ifndef NO_MIT_HACKS | ||
240 | } | ||
241 | #endif /* ifndef NO_MIT_HACKS */ | ||
242 | UNLOCK_PROCESSif(_XtProcessUnlock)(*_XtProcessUnlock)(); | ||
243 | UNLOCK_APP(app)if(app && app->unlock)(*app->unlock)(app); | ||
244 | } | ||
245 | |||
246 | void XtStringConversionWarning( | ||
247 | _Xconstconst char* from, | ||
248 | _Xconstconst char* toType | ||
249 | ) | ||
250 | { | ||
251 | String params[2]; | ||
252 | Cardinal num_params = 2; | ||
253 | params[0] = (String)from; | ||
254 | params[1] = (String)toType; | ||
255 | XtWarningMsg(XtNconversionError,"string",XtCXtToolkitError, | ||
256 | "Cannot convert string \"%s\" to type %s", | ||
257 | params,&num_params); | ||
258 | } | ||
259 | |||
260 | static int CompareISOLatin1(const char *, const char *); | ||
261 | |||
262 | |||
263 | static Boolean IsInteger( | ||
264 | String string, | ||
265 | int *value) | ||
266 | { | ||
267 | Boolean foundDigit = False0; | ||
268 | Boolean isNegative = False0; | ||
269 | Boolean isPositive = False0; | ||
270 | int val = 0; | ||
271 | char ch; | ||
272 | /* skip leading whitespace */ | ||
273 | #ifndef __UNIXOS2__ | ||
274 | while ((ch = *string) == ' ' || ch == '\t') string++; | ||
275 | #else | ||
276 | while ((ch = *string) == ' ' || ch == '\t' || ch == '\r') string++; | ||
277 | #endif | ||
278 | while ((ch = *string++)) { | ||
279 | if (ch >= '0' && ch <= '9') { | ||
280 | val *= 10; | ||
281 | val += ch - '0'; | ||
282 | foundDigit = True1; | ||
283 | continue; | ||
284 | } | ||
285 | if (IsWhitespace(ch)((ch)== ' ' || (ch) == '\t')) { | ||
286 | if (!foundDigit) return False0; | ||
287 | /* make sure only trailing whitespace */ | ||
288 | while ((ch = *string++)) { | ||
289 | if (!IsWhitespace(ch)((ch)== ' ' || (ch) == '\t')) | ||
290 | return False0; | ||
291 | } | ||
292 | break; | ||
293 | } | ||
294 | if (ch == '-' && !foundDigit && !isNegative && !isPositive) { | ||
295 | isNegative = True1; | ||
296 | continue; | ||
297 | } | ||
298 | if (ch == '+' && !foundDigit && !isNegative && !isPositive) { | ||
299 | isPositive = True1; | ||
300 | continue; | ||
301 | } | ||
302 | return False0; | ||
303 | } | ||
304 | if (ch == '\0') { | ||
305 | if (isNegative) | ||
306 | *value = -val; | ||
307 | else | ||
308 | *value = val; | ||
309 | return True1; | ||
310 | } | ||
311 | return False0; | ||
312 | } | ||
313 | |||
314 | |||
315 | /*ARGSUSED*/ | ||
316 | Boolean XtCvtIntToBoolean( | ||
317 | Display* dpy, | ||
318 | XrmValuePtr args, | ||
319 | Cardinal *num_args, | ||
320 | XrmValuePtr fromVal, | ||
321 | XrmValuePtr toVal, | ||
322 | XtPointer *closure_ret) | ||
323 | { | ||
324 | if (*num_args != 0) | ||
325 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
326 | XtNwrongParameters,"cvtIntToBoolean",XtCXtToolkitError, | ||
327 | "Integer to Boolean conversion needs no extra arguments", | ||
328 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
329 | done(Boolean, (*(int *)fromVal->addr != 0)){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Boolean)) { toVal->size = sizeof(Boolean); return 0 ; } *(Boolean*)(toVal->addr) = ((*(int *)fromVal->addr != 0)); } else { static Boolean static_val; static_val = ((*(int *)fromVal->addr != 0)); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(Boolean); return 1; }; | ||
330 | } | ||
331 | |||
332 | |||
333 | /*ARGSUSED*/ | ||
334 | Boolean XtCvtIntToShort( | ||
335 | Display* dpy, | ||
336 | XrmValuePtr args, | ||
337 | Cardinal *num_args, | ||
338 | XrmValuePtr fromVal, | ||
339 | XrmValuePtr toVal, | ||
340 | XtPointer *closure_ret) | ||
341 | { | ||
342 | if (*num_args != 0) | ||
343 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
344 | XtNwrongParameters,"cvtIntToShort",XtCXtToolkitError, | ||
345 | "Integer to Short conversion needs no extra arguments", | ||
346 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
347 | done(short, (*(int *)fromVal->addr)){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(short)) { toVal->size = sizeof(short); return 0; } *(short*)(toVal->addr) = ((*(int *)fromVal->addr)); } else { static short static_val; static_val = ((*(int *)fromVal-> addr)); toVal->addr = (XPointer)&static_val; } toVal-> size = sizeof(short); return 1; }; | ||
348 | } | ||
349 | |||
350 | |||
351 | /*ARGSUSED*/ | ||
352 | Boolean XtCvtStringToBoolean( | ||
353 | Display* dpy, | ||
354 | XrmValuePtr args, | ||
355 | Cardinal *num_args, | ||
356 | XrmValuePtr fromVal, | ||
357 | XrmValuePtr toVal, | ||
358 | XtPointer *closure_ret) | ||
359 | { | ||
360 | String str = (String)fromVal->addr; | ||
361 | if (*num_args != 0) | ||
362 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
363 | XtNwrongParameters,"cvtStringToBoolean",XtCXtToolkitError, | ||
364 | "String to Boolean conversion needs no extra arguments", | ||
365 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
366 | |||
367 | if ( (CompareISOLatin1(str, "true") == 0) | ||
368 | || (CompareISOLatin1(str, "yes") == 0) | ||
369 | || (CompareISOLatin1(str, "on") == 0) | ||
370 | || (CompareISOLatin1(str, "1") == 0)) donestr( Boolean, True, XtRBoolean ){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Boolean)) { toVal->size = sizeof(Boolean); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1561]) ); return 0; } *(Boolean*)(toVal->addr) = (1); } else { static Boolean static_val; static_val = (1); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(Boolean); return 1 ; }; | ||
371 | |||
372 | if ( (CompareISOLatin1(str, "false") == 0) | ||
373 | || (CompareISOLatin1(str, "no") == 0) | ||
374 | || (CompareISOLatin1(str, "off") == 0) | ||
375 | || (CompareISOLatin1(str, "0") == 0)) donestr( Boolean, False, XtRBoolean ){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Boolean)) { toVal->size = sizeof(Boolean); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1561]) ); return 0; } *(Boolean*)(toVal->addr) = (0); } else { static Boolean static_val; static_val = (0); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(Boolean); return 1 ; }; | ||
376 | |||
377 | XtDisplayStringConversionWarning(dpy, str, XtRBoolean((char*)&XtStrings[1561])); | ||
378 | return False0; | ||
379 | } | ||
380 | |||
381 | |||
382 | /*ARGSUSED*/ | ||
383 | Boolean XtCvtIntToBool( | ||
384 | Display* dpy, | ||
385 | XrmValuePtr args, | ||
386 | Cardinal *num_args, | ||
387 | XrmValuePtr fromVal, | ||
388 | XrmValuePtr toVal, | ||
389 | XtPointer *closure_ret) | ||
390 | { | ||
391 | if (*num_args != 0) | ||
392 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
393 | XtNwrongParameters,"cvtIntToBool",XtCXtToolkitError, | ||
394 | "Integer to Bool conversion needs no extra arguments", | ||
395 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
396 | done(Bool, (*(int *)fromVal->addr != 0)){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(int)) { toVal->size = sizeof(int); return 0; } *(int *)(toVal->addr) = ((*(int *)fromVal->addr != 0)); } else { static int static_val; static_val = ((*(int *)fromVal-> addr != 0)); toVal->addr = (XPointer)&static_val; } toVal ->size = sizeof(int); return 1; }; | ||
397 | } | ||
398 | |||
399 | |||
400 | /*ARGSUSED*/ | ||
401 | Boolean XtCvtStringToBool( | ||
402 | Display* dpy, | ||
403 | XrmValuePtr args, | ||
404 | Cardinal *num_args, | ||
405 | XrmValuePtr fromVal, | ||
406 | XrmValuePtr toVal, | ||
407 | XtPointer *closure_ret) | ||
408 | { | ||
409 | String str = (String)fromVal->addr; | ||
410 | if (*num_args != 0) | ||
411 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
412 | XtNwrongParameters,"cvtStringToBool", | ||
413 | XtCXtToolkitError, | ||
414 | "String to Bool conversion needs no extra arguments", | ||
415 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
416 | |||
417 | if ( (CompareISOLatin1(str, "true") == 0) | ||
418 | || (CompareISOLatin1(str, "yes") == 0) | ||
419 | || (CompareISOLatin1(str, "on") == 0) | ||
420 | || (CompareISOLatin1(str, "1") == 0)) donestr( Bool, True, XtRBool ){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(int)) { toVal->size = sizeof(int); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1556]) ); return 0; } *(int*)(toVal->addr) = (1); } else { static int static_val; static_val = (1); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(int); return 1; }; | ||
421 | |||
422 | if ( (CompareISOLatin1(str, "false") == 0) | ||
423 | || (CompareISOLatin1(str, "no") == 0) | ||
424 | || (CompareISOLatin1(str, "off") == 0) | ||
425 | || (CompareISOLatin1(str, "0") == 0)) donestr( Bool, False, XtRBool ){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(int)) { toVal->size = sizeof(int); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1556]) ); return 0; } *(int*)(toVal->addr) = (0); } else { static int static_val; static_val = (0); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(int); return 1; }; | ||
426 | |||
427 | XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRBool((char*)&XtStrings[1556])); | ||
428 | return False0; | ||
429 | } | ||
430 | |||
431 | XtConvertArgRec const colorConvertArgs[] = { | ||
432 | {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen)__builtin_offsetof(WidgetRec, core.screen), | ||
433 | sizeof(Screen *)}, | ||
434 | {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap)__builtin_offsetof(WidgetRec, core.colormap), | ||
435 | sizeof(Colormap)} | ||
436 | }; | ||
437 | |||
438 | |||
439 | /* ARGSUSED */ | ||
440 | Boolean XtCvtIntToColor( | ||
441 | Display* dpy, | ||
442 | XrmValuePtr args, | ||
443 | Cardinal *num_args, | ||
444 | XrmValuePtr fromVal, | ||
445 | XrmValuePtr toVal, | ||
446 | XtPointer *closure_ret) | ||
447 | { | ||
448 | XColor c; | ||
449 | Screen *screen; | ||
450 | Colormap colormap; | ||
451 | |||
452 | if (*num_args != 2) { | ||
453 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
454 | XtNwrongParameters,"cvtIntOrPixelToXColor",XtCXtToolkitError, | ||
455 | "Pixel to color conversion needs screen and colormap arguments", | ||
456 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
457 | return False0; | ||
458 | } | ||
459 | screen = *((Screen **) args[0].addr); | ||
460 | colormap = *((Colormap *) args[1].addr); | ||
461 | c.pixel = *(int *)fromVal->addr; | ||
462 | |||
463 | XQueryColor(DisplayOfScreen(screen)((screen)->display), colormap, &c); | ||
464 | done(XColor, c){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(XColor)) { toVal->size = sizeof(XColor); return 0; } *(XColor*)(toVal->addr) = (c); } else { static XColor static_val ; static_val = (c); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(XColor); return 1; }; | ||
465 | } | ||
466 | |||
467 | |||
468 | Boolean XtCvtStringToPixel( | ||
469 | Display* dpy, | ||
470 | XrmValuePtr args, | ||
471 | Cardinal *num_args, | ||
472 | XrmValuePtr fromVal, | ||
473 | XrmValuePtr toVal, | ||
474 | XtPointer *closure_ret) | ||
475 | { | ||
476 | String str = (String)fromVal->addr; | ||
477 | XColor screenColor; | ||
478 | XColor exactColor; | ||
479 | Screen *screen; | ||
480 | XtPerDisplay pd = _XtGetPerDisplay(dpy); | ||
481 | Colormap colormap; | ||
482 | Statusint status; | ||
483 | String params[1]; | ||
484 | Cardinal num_params=1; | ||
485 | |||
486 | if (*num_args != 2) { | ||
487 | XtAppWarningMsg(pd->appContext, XtNwrongParameters, "cvtStringToPixel", | ||
488 | XtCXtToolkitError, | ||
489 | "String to pixel conversion needs screen and colormap arguments", | ||
490 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
491 | return False0; | ||
492 | } | ||
493 | |||
494 | screen = *((Screen **) args[0].addr); | ||
495 | colormap = *((Colormap *) args[1].addr); | ||
496 | |||
497 | if (CompareISOLatin1(str, XtDefaultBackground"XtDefaultBackground") == 0) { | ||
498 | *closure_ret = NULL((void*)0); | ||
499 | if (pd->rv) donestr(Pixel, BlackPixelOfScreen(screen), XtRPixel){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Pixel)) { toVal->size = sizeof(Pixel); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1754]) ); return 0; } *(Pixel*)(toVal->addr) = (((screen)->black_pixel )); } else { static Pixel static_val; static_val = (((screen) ->black_pixel)); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(Pixel); return 1; } | ||
500 | else donestr(Pixel, WhitePixelOfScreen(screen), XtRPixel){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Pixel)) { toVal->size = sizeof(Pixel); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1754]) ); return 0; } *(Pixel*)(toVal->addr) = (((screen)->white_pixel )); } else { static Pixel static_val; static_val = (((screen) ->white_pixel)); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(Pixel); return 1; }; | ||
501 | } | ||
502 | if (CompareISOLatin1(str, XtDefaultForeground"XtDefaultForeground") == 0) { | ||
503 | *closure_ret = NULL((void*)0); | ||
504 | if (pd->rv) donestr(Pixel, WhitePixelOfScreen(screen), XtRPixel){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Pixel)) { toVal->size = sizeof(Pixel); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1754]) ); return 0; } *(Pixel*)(toVal->addr) = (((screen)->white_pixel )); } else { static Pixel static_val; static_val = (((screen) ->white_pixel)); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(Pixel); return 1; } | ||
505 | else donestr(Pixel, BlackPixelOfScreen(screen), XtRPixel){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Pixel)) { toVal->size = sizeof(Pixel); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1754]) ); return 0; } *(Pixel*)(toVal->addr) = (((screen)->black_pixel )); } else { static Pixel static_val; static_val = (((screen) ->black_pixel)); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(Pixel); return 1; }; | ||
506 | } | ||
507 | |||
508 | status = XAllocNamedColor(DisplayOfScreen(screen)((screen)->display), colormap, | ||
509 | (char*)str, &screenColor, &exactColor); | ||
510 | if (status == 0) { | ||
511 | String msg, type; | ||
512 | params[0] = str; | ||
513 | /* Server returns a specific error code but Xlib discards it. Ugh */ | ||
514 | if (XLookupColor(DisplayOfScreen(screen)((screen)->display), colormap, (char*)str, | ||
515 | &exactColor, &screenColor)) { | ||
516 | type = "noColormap"; | ||
517 | msg = "Cannot allocate colormap entry for \"%s\""; | ||
518 | } | ||
519 | else { | ||
520 | type = "badValue"; | ||
521 | msg = "Color name \"%s\" is not defined"; | ||
522 | } | ||
523 | |||
524 | XtAppWarningMsg(pd->appContext, type, "cvtStringToPixel", | ||
525 | XtCXtToolkitError, msg, params, &num_params); | ||
526 | *closure_ret = NULL((void*)0); | ||
527 | return False0; | ||
528 | } else { | ||
529 | *closure_ret = (char*)True1; | ||
530 | donestr(Pixel, screenColor.pixel, XtRPixel){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Pixel)) { toVal->size = sizeof(Pixel); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1754]) ); return 0; } *(Pixel*)(toVal->addr) = (screenColor.pixel ); } else { static Pixel static_val; static_val = (screenColor .pixel); toVal->addr = (XPointer)&static_val; } toVal-> size = sizeof(Pixel); return 1; }; | ||
531 | } | ||
532 | } | ||
533 | |||
534 | /* ARGSUSED */ | ||
535 | static void FreePixel( | ||
536 | XtAppContext app, | ||
537 | XrmValuePtr toVal, | ||
538 | XtPointer closure, | ||
539 | XrmValuePtr args, | ||
540 | Cardinal *num_args) | ||
541 | { | ||
542 | Screen *screen; | ||
543 | Colormap colormap; | ||
544 | |||
545 | if (*num_args != 2) { | ||
546 | XtAppWarningMsg(app, XtNwrongParameters,"freePixel",XtCXtToolkitError, | ||
547 | "Freeing a pixel requires screen and colormap arguments", | ||
548 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
549 | return; | ||
550 | } | ||
551 | |||
552 | screen = *((Screen **) args[0].addr); | ||
553 | colormap = *((Colormap *) args[1].addr); | ||
554 | |||
555 | if (closure) { | ||
556 | XFreeColors( DisplayOfScreen(screen)((screen)->display), colormap, | ||
557 | (unsigned long*)toVal->addr, 1, (unsigned long)0 | ||
558 | ); | ||
559 | } | ||
560 | } | ||
561 | |||
562 | |||
563 | /* no longer used by Xt, but it's in the spec */ | ||
564 | XtConvertArgRec const screenConvertArg[] = { | ||
565 | {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen)__builtin_offsetof(WidgetRec, core.screen), | ||
566 | sizeof(Screen *)} | ||
567 | }; | ||
568 | |||
569 | /*ARGSUSED*/ | ||
570 | static void FetchDisplayArg( | ||
571 | Widget widget, | ||
572 | Cardinal *size, | ||
573 | XrmValue* value) | ||
574 | { | ||
575 | if (widget == NULL((void*)0)) | ||
576 | XtErrorMsg("missingWidget", "fetchDisplayArg", XtCXtToolkitError, | ||
577 | "FetchDisplayArg called without a widget to reference", | ||
578 | (String*)NULL((void*)0), (Cardinal*)NULL((void*)0)); | ||
579 | /* can't return any useful Display and caller will de-ref NULL, | ||
580 | so aborting is the only useful option */ | ||
581 | |||
582 | value->size = sizeof(Display*); | ||
583 | value->addr = (XPointer)&DisplayOfScreen(XtScreenOfObject(widget))((((((Object)(widget))->object.widget_class->core_class .class_inited & 0x04) ? (widget)->core.screen : _XtIsHookObject (widget) ? ((HookObject)(widget))->hooks.screen : _XtWindowedAncestor (widget)->core.screen))->display); | ||
584 | } | ||
585 | |||
586 | static XtConvertArgRec const displayConvertArg[] = { | ||
587 | {XtProcedureArg, (XtPointer)FetchDisplayArg, 0}, | ||
588 | }; | ||
589 | |||
590 | /*ARGSUSED*/ | ||
591 | Boolean XtCvtStringToCursor( | ||
592 | Display* dpy, | ||
593 | XrmValuePtr args, | ||
594 | Cardinal *num_args, | ||
595 | XrmValuePtr fromVal, | ||
596 | XrmValuePtr toVal, | ||
597 | XtPointer *closure_ret) | ||
598 | { | ||
599 | static const struct _CursorName { | ||
600 | const char *name; | ||
601 | unsigned int shape; | ||
602 | } cursor_names[] = { | ||
603 | {"X_cursor", XC_X_cursor0}, | ||
604 | {"arrow", XC_arrow2}, | ||
605 | {"based_arrow_down", XC_based_arrow_down4}, | ||
606 | {"based_arrow_up", XC_based_arrow_up6}, | ||
607 | {"boat", XC_boat8}, | ||
608 | {"bogosity", XC_bogosity10}, | ||
609 | {"bottom_left_corner", XC_bottom_left_corner12}, | ||
610 | {"bottom_right_corner", XC_bottom_right_corner14}, | ||
611 | {"bottom_side", XC_bottom_side16}, | ||
612 | {"bottom_tee", XC_bottom_tee18}, | ||
613 | {"box_spiral", XC_box_spiral20}, | ||
614 | {"center_ptr", XC_center_ptr22}, | ||
615 | {"circle", XC_circle24}, | ||
616 | {"clock", XC_clock26}, | ||
617 | {"coffee_mug", XC_coffee_mug28}, | ||
618 | {"cross", XC_cross30}, | ||
619 | {"cross_reverse", XC_cross_reverse32}, | ||
620 | {"crosshair", XC_crosshair34}, | ||
621 | {"diamond_cross", XC_diamond_cross36}, | ||
622 | {"dot", XC_dot38}, | ||
623 | {"dotbox", XC_dotbox40}, | ||
624 | {"double_arrow", XC_double_arrow42}, | ||
625 | {"draft_large", XC_draft_large44}, | ||
626 | {"draft_small", XC_draft_small46}, | ||
627 | {"draped_box", XC_draped_box48}, | ||
628 | {"exchange", XC_exchange50}, | ||
629 | {"fleur", XC_fleur52}, | ||
630 | {"gobbler", XC_gobbler54}, | ||
631 | {"gumby", XC_gumby56}, | ||
632 | {"hand1", XC_hand158}, | ||
633 | {"hand2", XC_hand260}, | ||
634 | {"heart", XC_heart62}, | ||
635 | {"icon", XC_icon64}, | ||
636 | {"iron_cross", XC_iron_cross66}, | ||
637 | {"left_ptr", XC_left_ptr68}, | ||
638 | {"left_side", XC_left_side70}, | ||
639 | {"left_tee", XC_left_tee72}, | ||
640 | {"leftbutton", XC_leftbutton74}, | ||
641 | {"ll_angle", XC_ll_angle76}, | ||
642 | {"lr_angle", XC_lr_angle78}, | ||
643 | {"man", XC_man80}, | ||
644 | {"middlebutton", XC_middlebutton82}, | ||
645 | {"mouse", XC_mouse84}, | ||
646 | {"pencil", XC_pencil86}, | ||
647 | {"pirate", XC_pirate88}, | ||
648 | {"plus", XC_plus90}, | ||
649 | {"question_arrow", XC_question_arrow92}, | ||
650 | {"right_ptr", XC_right_ptr94}, | ||
651 | {"right_side", XC_right_side96}, | ||
652 | {"right_tee", XC_right_tee98}, | ||
653 | {"rightbutton", XC_rightbutton100}, | ||
654 | {"rtl_logo", XC_rtl_logo102}, | ||
655 | {"sailboat", XC_sailboat104}, | ||
656 | {"sb_down_arrow", XC_sb_down_arrow106}, | ||
657 | {"sb_h_double_arrow", XC_sb_h_double_arrow108}, | ||
658 | {"sb_left_arrow", XC_sb_left_arrow110}, | ||
659 | {"sb_right_arrow", XC_sb_right_arrow112}, | ||
660 | {"sb_up_arrow", XC_sb_up_arrow114}, | ||
661 | {"sb_v_double_arrow", XC_sb_v_double_arrow116}, | ||
662 | {"shuttle", XC_shuttle118}, | ||
663 | {"sizing", XC_sizing120}, | ||
664 | {"spider", XC_spider122}, | ||
665 | {"spraycan", XC_spraycan124}, | ||
666 | {"star", XC_star126}, | ||
667 | {"target", XC_target128}, | ||
668 | {"tcross", XC_tcross130}, | ||
669 | {"top_left_arrow", XC_top_left_arrow132}, | ||
670 | {"top_left_corner", XC_top_left_corner134}, | ||
671 | {"top_right_corner", XC_top_right_corner136}, | ||
672 | {"top_side", XC_top_side138}, | ||
673 | {"top_tee", XC_top_tee140}, | ||
674 | {"trek", XC_trek142}, | ||
675 | {"ul_angle", XC_ul_angle144}, | ||
676 | {"umbrella", XC_umbrella146}, | ||
677 | {"ur_angle", XC_ur_angle148}, | ||
678 | {"watch", XC_watch150}, | ||
679 | {"xterm", XC_xterm152}, | ||
680 | }; | ||
681 | const struct _CursorName *nP; | ||
682 | char *name = (char *)fromVal->addr; | ||
683 | register Cardinal i; | ||
684 | |||
685 | if (*num_args != 1) { | ||
686 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
687 | XtNwrongParameters,"cvtStringToCursor",XtCXtToolkitError, | ||
688 | "String to cursor conversion needs display argument", | ||
689 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
690 | return False0; | ||
691 | } | ||
692 | |||
693 | for (i=0, nP=cursor_names; i < XtNumber(cursor_names)((Cardinal) (sizeof(cursor_names) / sizeof(cursor_names[0]))); i++, nP++ ) { | ||
694 | if (strcmp(name, nP->name) == 0) { | ||
695 | Display *display = *(Display**)args[0].addr; | ||
696 | Cursor cursor = XCreateFontCursor(display, nP->shape ); | ||
697 | donestr(Cursor, cursor, XtRCursor){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Cursor)) { toVal->size = sizeof(Cursor); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1611]) ); return 0; } *(Cursor*)(toVal->addr) = (cursor); } else { static Cursor static_val; static_val = (cursor); toVal->addr = (XPointer)&static_val; } toVal->size = sizeof(Cursor ); return 1; }; | ||
698 | } | ||
699 | } | ||
700 | XtDisplayStringConversionWarning(dpy, name, XtRCursor((char*)&XtStrings[1611])); | ||
701 | return False0; | ||
702 | } | ||
703 | |||
704 | /* ARGSUSED */ | ||
705 | static void FreeCursor( | ||
706 | XtAppContext app, | ||
707 | XrmValuePtr toVal, | ||
708 | XtPointer closure, /* unused */ | ||
709 | XrmValuePtr args, | ||
710 | Cardinal *num_args) | ||
711 | { | ||
712 | Display* display; | ||
713 | |||
714 | if (*num_args != 1) { | ||
715 | XtAppWarningMsg(app, | ||
716 | XtNwrongParameters,"freeCursor",XtCXtToolkitError, | ||
717 | "Free Cursor requires display argument", | ||
718 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
719 | return; | ||
720 | } | ||
721 | |||
722 | display = *(Display**)args[0].addr; | ||
723 | XFreeCursor( display, *(Cursor*)toVal->addr ); | ||
724 | } | ||
725 | |||
726 | /*ARGSUSED*/ | ||
727 | Boolean XtCvtStringToDisplay( | ||
728 | Display* dpy, | ||
729 | XrmValuePtr args, | ||
730 | Cardinal *num_args, | ||
731 | XrmValuePtr fromVal, | ||
732 | XrmValuePtr toVal, | ||
733 | XtPointer *closure_ret) | ||
734 | { | ||
735 | Display *d; | ||
736 | |||
737 | if (*num_args != 0) | ||
738 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
739 | XtNwrongParameters,"cvtStringToDisplay",XtCXtToolkitError, | ||
740 | "String to Display conversion needs no extra arguments", | ||
741 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
742 | |||
743 | d = XOpenDisplay((char *)fromVal->addr); | ||
744 | if (d != NULL((void*)0)) | ||
745 | donestr(Display*, d, XtRDisplay){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Display*)) { toVal->size = sizeof(Display*); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1628]) ); return 0; } *(Display**)(toVal->addr) = (d); } else { static Display* static_val; static_val = (d); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(Display*); return 1; }; | ||
746 | |||
747 | XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRDisplay((char*)&XtStrings[1628])); | ||
748 | return False0; | ||
749 | } | ||
750 | |||
751 | |||
752 | /*ARGSUSED*/ | ||
753 | Boolean XtCvtStringToFile( | ||
754 | Display* dpy, | ||
755 | XrmValuePtr args, | ||
756 | Cardinal *num_args, | ||
757 | XrmValuePtr fromVal, | ||
758 | XrmValuePtr toVal, | ||
759 | XtPointer *closure_ret) | ||
760 | { | ||
761 | FILE *f; | ||
762 | |||
763 | if (*num_args != 0) | ||
764 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
765 | XtNwrongParameters,"cvtStringToFile",XtCXtToolkitError, | ||
766 | "String to File conversion needs no extra arguments", | ||
767 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
768 | |||
769 | f = fopen((char *)fromVal->addr, "r"); | ||
770 | if (f != NULL((void*)0)) | ||
771 | donestr(FILE*, f, XtRFile){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(FILE*)) { toVal->size = sizeof(FILE*); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1650]) ); return 0; } *(FILE**)(toVal->addr) = (f); } else { static FILE* static_val; static_val = (f); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(FILE*); return 1; }; | ||
772 | |||
773 | XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRFile((char*)&XtStrings[1650])); | ||
774 | return False0; | ||
775 | } | ||
776 | |||
777 | /* ARGSUSED */ | ||
778 | static void FreeFile( | ||
779 | XtAppContext app, | ||
780 | XrmValuePtr toVal, | ||
781 | XtPointer closure, /* unused */ | ||
782 | XrmValuePtr args, /* unused */ | ||
783 | Cardinal *num_args) | ||
784 | { | ||
785 | if (*num_args != 0) | ||
786 | XtAppWarningMsg(app, | ||
787 | XtNwrongParameters,"freeFile",XtCXtToolkitError, | ||
788 | "Free File requires no extra arguments", | ||
789 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
790 | |||
791 | fclose( *(FILE**)toVal->addr ); | ||
792 | } | ||
793 | |||
794 | /*ARGSUSED*/ | ||
795 | Boolean XtCvtIntToFloat( | ||
796 | Display* dpy, | ||
797 | XrmValuePtr args, | ||
798 | Cardinal *num_args, | ||
799 | XrmValuePtr fromVal, | ||
800 | XrmValuePtr toVal, | ||
801 | XtPointer *closure_ret) | ||
802 | { | ||
803 | if (*num_args != 0) | ||
804 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
805 | XtNwrongParameters,"cvtIntToFloat",XtCXtToolkitError, | ||
806 | "Integer to Float conversion needs no extra arguments", | ||
807 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
808 | done(float, (*(int *)fromVal->addr)){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(float)) { toVal->size = sizeof(float); return 0; } *(float*)(toVal->addr) = ((*(int *)fromVal->addr)); } else { static float static_val; static_val = ((*(int *)fromVal-> addr)); toVal->addr = (XPointer)&static_val; } toVal-> size = sizeof(float); return 1; }; | ||
809 | } | ||
810 | |||
811 | /*ARGSUSED*/ | ||
812 | Boolean XtCvtStringToFloat( | ||
813 | Display* dpy, | ||
814 | XrmValuePtr args, | ||
815 | Cardinal *num_args, | ||
816 | XrmValuePtr fromVal, | ||
817 | XrmValuePtr toVal, | ||
818 | XtPointer *closure_ret) | ||
819 | { | ||
820 | int ret; | ||
821 | float f, nan; | ||
822 | |||
823 | #ifndef ISC /* On ISC this generates a core dump :-( at least with gs */ | ||
824 | /* depending on the system this may or may not do anything useful */ | ||
825 | (void) sscanf ("NaNS", "%g", | ||
826 | toVal->addr != NULL((void*)0) ? (float*) toVal->addr : &nan); | ||
| |||
827 | #endif | ||
828 | |||
829 | if (*num_args != 0) | ||
| |||
830 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
831 | XtNwrongParameters,"cvtStringToFloat",XtCXtToolkitError, | ||
832 | "String to Float conversion needs no extra arguments", | ||
833 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
834 | |||
835 | ret = sscanf (fromVal->addr, "%g", &f); | ||
836 | if (ret == 0) { | ||
| |||
| |||
837 | if (toVal->addr != NULL((void*)0) && toVal->size == sizeof nan) | ||
| |||
838 | *(float*)toVal->addr = nan; | ||
| |||
839 | XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, XtRFloat((char*)&XtStrings[1655])); | ||
840 | return False0; | ||
841 | } | ||
842 | donestr(float, f, XtRFloat){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(float)) { toVal->size = sizeof(float); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1655]) ); return 0; } *(float*)(toVal->addr) = (f); } else { static float static_val; static_val = (f); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(float); return 1; }; | ||
843 | } | ||
844 | |||
845 | /*ARGSUSED*/ | ||
846 | Boolean XtCvtStringToFont( | ||
847 | Display* dpy, | ||
848 | XrmValuePtr args, | ||
849 | Cardinal *num_args, | ||
850 | XrmValuePtr fromVal, | ||
851 | XrmValuePtr toVal, | ||
852 | XtPointer *closure_ret) | ||
853 | { | ||
854 | Font f; | ||
855 | Display* display; | ||
856 | |||
857 | if (*num_args != 1) { | ||
858 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
859 | XtNwrongParameters,"cvtStringToFont",XtCXtToolkitError, | ||
860 | "String to font conversion needs display argument", | ||
861 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
862 | return False0; | ||
863 | } | ||
864 | |||
865 | display = *(Display**)args[0].addr; | ||
866 | |||
867 | if (CompareISOLatin1((String)fromVal->addr, XtDefaultFont"XtDefaultFont") != 0) { | ||
868 | f = XLoadFont(display, (char *)fromVal->addr); | ||
869 | if (f != 0) { | ||
870 | Done: donestr( Font, f, XtRFont ){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Font)) { toVal->size = sizeof(Font); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1661]) ); return 0; } *(Font*)(toVal->addr) = (f); } else { static Font static_val; static_val = (f); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(Font); return 1; }; | ||
871 | } | ||
872 | XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRFont((char*)&XtStrings[1661])); | ||
873 | } | ||
874 | /* try and get the default font */ | ||
875 | |||
876 | { | ||
877 | XrmName xrm_name[2]; | ||
878 | XrmClass xrm_class[2]; | ||
879 | XrmRepresentation rep_type; | ||
880 | XrmValue value; | ||
881 | |||
882 | xrm_name[0] = XrmPermStringToQuark ("xtDefaultFont"); | ||
883 | xrm_name[1] = 0; | ||
884 | xrm_class[0] = XrmPermStringToQuark ("XtDefaultFont"); | ||
885 | xrm_class[1] = 0; | ||
886 | if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class, | ||
887 | &rep_type, &value)) { | ||
888 | if (rep_type == _XtQString) { | ||
889 | f = XLoadFont(display, (char *)value.addr); | ||
890 | if (f != 0) | ||
891 | goto Done; | ||
892 | else | ||
893 | XtDisplayStringConversionWarning(dpy, (char *)value.addr, | ||
894 | XtRFont((char*)&XtStrings[1661])); | ||
895 | } else if (rep_type == XtQFont) { | ||
896 | f = *(Font*)value.addr; | ||
897 | goto Done; | ||
898 | } else if (rep_type == XtQFontStruct) { | ||
899 | f = ((XFontStruct*)value.addr)->fid; | ||
900 | goto Done; | ||
901 | } | ||
902 | } | ||
903 | } | ||
904 | /* Should really do XListFonts, but most servers support this */ | ||
905 | f = XLoadFont(display, "-*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-*"); | ||
906 | if (f != 0) | ||
907 | goto Done; | ||
908 | |||
909 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
910 | "noFont","cvtStringToFont",XtCXtToolkitError, | ||
911 | "Unable to load any usable ISO8859 font", | ||
912 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
913 | |||
914 | return False0; | ||
915 | } | ||
916 | |||
917 | /* ARGSUSED */ | ||
918 | static void FreeFont( | ||
919 | XtAppContext app, | ||
920 | XrmValuePtr toVal, | ||
921 | XtPointer closure, /* unused */ | ||
922 | XrmValuePtr args, | ||
923 | Cardinal *num_args) | ||
924 | { | ||
925 | Display *display; | ||
926 | if (*num_args != 1) { | ||
927 | XtAppWarningMsg(app, | ||
928 | XtNwrongParameters,"freeFont",XtCXtToolkitError, | ||
929 | "Free Font needs display argument", | ||
930 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
931 | return; | ||
932 | } | ||
933 | |||
934 | display = *(Display**)args[0].addr; | ||
935 | XUnloadFont( display, *(Font*)toVal->addr ); | ||
936 | } | ||
937 | |||
938 | /*ARGSUSED*/ | ||
939 | Boolean XtCvtIntToFont( | ||
940 | Display* dpy, | ||
941 | XrmValuePtr args, | ||
942 | Cardinal *num_args, | ||
943 | XrmValuePtr fromVal, | ||
944 | XrmValuePtr toVal, | ||
945 | XtPointer *closure_ret) | ||
946 | { | ||
947 | if (*num_args != 0) | ||
948 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
949 | XtNwrongParameters,"cvtIntToFont",XtCXtToolkitError, | ||
950 | "Integer to Font conversion needs no extra arguments", | ||
951 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
952 | done(Font, *(int*)fromVal->addr){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Font)) { toVal->size = sizeof(Font); return 0; } * (Font*)(toVal->addr) = (*(int*)fromVal->addr); } else { static Font static_val; static_val = (*(int*)fromVal->addr ); toVal->addr = (XPointer)&static_val; } toVal->size = sizeof(Font); return 1; }; | ||
953 | } | ||
954 | |||
955 | /*ARGSUSED*/ | ||
956 | Boolean XtCvtStringToFontSet( | ||
957 | Display* dpy, | ||
958 | XrmValuePtr args, | ||
959 | Cardinal *num_args, | ||
960 | XrmValuePtr fromVal, | ||
961 | XrmValuePtr toVal, | ||
962 | XtPointer *closure_ret) | ||
963 | { | ||
964 | XFontSet f; | ||
965 | Display* display; | ||
966 | char** missing_charset_list; | ||
967 | int missing_charset_count; | ||
968 | char* def_string; | ||
969 | |||
970 | if (*num_args != 2) { | ||
971 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
972 | XtNwrongParameters,"cvtStringToFontSet",XtCXtToolkitError, | ||
973 | "String to FontSet conversion needs display and locale arguments", | ||
974 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
975 | return False0; | ||
976 | } | ||
977 | |||
978 | display = *(Display**)args[0].addr; | ||
979 | |||
980 | if (CompareISOLatin1((String)fromVal->addr, XtDefaultFontSet"XtDefaultFontSet") != 0) { | ||
981 | f = XCreateFontSet(display, (char *)fromVal->addr, | ||
982 | &missing_charset_list, &missing_charset_count, &def_string); | ||
983 | /* Free any returned missing charset list */ | ||
984 | if (missing_charset_count) { | ||
985 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
986 | XtNmissingCharsetList,"cvtStringToFontSet",XtCXtToolkitError, | ||
987 | "Missing charsets in String to FontSet conversion", | ||
988 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
989 | XFreeStringList(missing_charset_list); | ||
990 | } | ||
991 | if (f != NULL((void*)0)) { | ||
992 | Done: donestr( XFontSet, f, XtRFontSet ){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(XFontSet)) { toVal->size = sizeof(XFontSet); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[2026]) ); return 0; } *(XFontSet*)(toVal->addr) = (f); } else { static XFontSet static_val; static_val = (f); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(XFontSet); return 1; }; | ||
993 | } | ||
994 | XtDisplayStringConversionWarning(dpy, (char *)fromVal->addr, XtRFontSet((char*)&XtStrings[2026])); | ||
995 | } | ||
996 | /* try and get the default fontset */ | ||
997 | |||
998 | { | ||
999 | XrmName xrm_name[2]; | ||
1000 | XrmClass xrm_class[2]; | ||
1001 | XrmRepresentation rep_type; | ||
1002 | XrmValue value; | ||
1003 | |||
1004 | xrm_name[0] = XrmPermStringToQuark ("xtDefaultFontSet"); | ||
1005 | xrm_name[1] = 0; | ||
1006 | xrm_class[0] = XrmPermStringToQuark ("XtDefaultFontSet"); | ||
1007 | xrm_class[1] = 0; | ||
1008 | if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class, | ||
1009 | &rep_type, &value)) { | ||
1010 | if (rep_type == _XtQString) { | ||
1011 | |||
1012 | f = XCreateFontSet(display, (char *)value.addr, | ||
1013 | &missing_charset_list, &missing_charset_count, | ||
1014 | &def_string); | ||
1015 | /* Free any returned missing charset list */ | ||
1016 | if (missing_charset_count) { | ||
1017 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1018 | XtNmissingCharsetList,"cvtStringToFontSet", | ||
1019 | XtCXtToolkitError, | ||
1020 | "Missing charsets in String to FontSet conversion", | ||
1021 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1022 | XFreeStringList(missing_charset_list); | ||
1023 | } | ||
1024 | if (f != NULL((void*)0)) | ||
1025 | goto Done; | ||
1026 | else | ||
1027 | XtDisplayStringConversionWarning(dpy, (char *)value.addr, | ||
1028 | XtRFontSet((char*)&XtStrings[2026])); | ||
1029 | } else if (rep_type == XtQFontSet) { | ||
1030 | f = *(XFontSet*)value.addr; | ||
1031 | goto Done; | ||
1032 | } | ||
1033 | } | ||
1034 | } | ||
1035 | |||
1036 | /* Should really do XListFonts, but most servers support this */ | ||
1037 | f = XCreateFontSet(display, "-*-*-*-R-*-*-*-120-*-*-*-*,*", | ||
1038 | &missing_charset_list, &missing_charset_count, &def_string); | ||
1039 | |||
1040 | /* Free any returned missing charset list */ | ||
1041 | if (missing_charset_count) { | ||
1042 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1043 | XtNmissingCharsetList,"cvtStringToFontSet",XtCXtToolkitError, | ||
1044 | "Missing charsets in String to FontSet conversion", | ||
1045 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1046 | XFreeStringList(missing_charset_list); | ||
1047 | } | ||
1048 | if (f != NULL((void*)0)) | ||
1049 | goto Done; | ||
1050 | |||
1051 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1052 | "noFont","cvtStringToFontSet",XtCXtToolkitError, | ||
1053 | "Unable to load any usable fontset", | ||
1054 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1055 | |||
1056 | return False0; | ||
1057 | } | ||
1058 | |||
1059 | /*ARGSUSED*/ | ||
1060 | static void FreeFontSet( | ||
1061 | XtAppContext app, | ||
1062 | XrmValuePtr toVal, | ||
1063 | XtPointer closure, /* unused */ | ||
1064 | XrmValuePtr args, | ||
1065 | Cardinal *num_args) | ||
1066 | { | ||
1067 | Display *display; | ||
1068 | if (*num_args != 2) { | ||
1069 | XtAppWarningMsg(app, | ||
1070 | XtNwrongParameters,"freeFontSet",XtCXtToolkitError, | ||
1071 | "FreeFontSet needs display and locale arguments", | ||
1072 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1073 | return; | ||
1074 | } | ||
1075 | |||
1076 | display = *(Display**)args[0].addr; | ||
1077 | XFreeFontSet( display, *(XFontSet*)toVal->addr ); | ||
1078 | } | ||
1079 | |||
1080 | /*ARGSUSED*/ | ||
1081 | static void FetchLocaleArg( | ||
1082 | Widget widget, /* unused */ | ||
1083 | Cardinal *size, /* unused */ | ||
1084 | XrmValue *value) | ||
1085 | { | ||
1086 | static XrmString locale; | ||
1087 | |||
1088 | locale = XrmQuarkToString(XrmStringToQuark | ||
1089 | (setlocale(LC_CTYPE__LC_CTYPE, (char*)NULL((void*)0)))); | ||
1090 | value->size = sizeof(XrmString); | ||
1091 | value->addr = (XPointer)&locale; | ||
1092 | } | ||
1093 | |||
1094 | static XtConvertArgRec const localeDisplayConvertArgs[] = { | ||
1095 | {XtProcedureArg, (XtPointer)FetchDisplayArg, 0}, | ||
1096 | {XtProcedureArg, (XtPointer)FetchLocaleArg, 0}, | ||
1097 | }; | ||
1098 | |||
1099 | |||
1100 | /*ARGSUSED*/ | ||
1101 | Boolean | ||
1102 | XtCvtStringToFontStruct( | ||
1103 | Display* dpy, | ||
1104 | XrmValuePtr args, | ||
1105 | Cardinal *num_args, | ||
1106 | XrmValuePtr fromVal, | ||
1107 | XrmValuePtr toVal, | ||
1108 | XtPointer *closure_ret) | ||
1109 | { | ||
1110 | XFontStruct *f; | ||
1111 | Display* display; | ||
1112 | |||
1113 | if (*num_args != 1) { | ||
1114 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1115 | XtNwrongParameters,"cvtStringToFontStruct",XtCXtToolkitError, | ||
1116 | "String to font conversion needs display argument", | ||
1117 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1118 | return False0; | ||
1119 | } | ||
1120 | |||
1121 | display = *(Display**)args[0].addr; | ||
1122 | |||
1123 | if (CompareISOLatin1((String)fromVal->addr, XtDefaultFont"XtDefaultFont") != 0) { | ||
1124 | f = XLoadQueryFont(display, (char *)fromVal->addr); | ||
1125 | if (f != NULL((void*)0)) { | ||
1126 | Done: donestr( XFontStruct*, f, XtRFontStruct){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(XFontStruct*)) { toVal->size = sizeof(XFontStruct* ); XtDisplayStringConversionWarning(dpy, (char*) fromVal-> addr, ((char*)&XtStrings[1666])); return 0; } *(XFontStruct **)(toVal->addr) = (f); } else { static XFontStruct* static_val ; static_val = (f); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(XFontStruct*); return 1; }; | ||
1127 | } | ||
1128 | |||
1129 | XtDisplayStringConversionWarning(dpy, (char*)fromVal->addr, | ||
1130 | XtRFontStruct((char*)&XtStrings[1666])); | ||
1131 | } | ||
1132 | |||
1133 | /* try and get the default font */ | ||
1134 | |||
1135 | { | ||
1136 | XrmName xrm_name[2]; | ||
1137 | XrmClass xrm_class[2]; | ||
1138 | XrmRepresentation rep_type; | ||
1139 | XrmValue value; | ||
1140 | |||
1141 | xrm_name[0] = XrmPermStringToQuark ("xtDefaultFont"); | ||
1142 | xrm_name[1] = 0; | ||
1143 | xrm_class[0] = XrmPermStringToQuark ("XtDefaultFont"); | ||
1144 | xrm_class[1] = 0; | ||
1145 | if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class, | ||
1146 | &rep_type, &value)) { | ||
1147 | if (rep_type == _XtQString) { | ||
1148 | f = XLoadQueryFont(display, (char*)value.addr); | ||
1149 | if (f != NULL((void*)0)) | ||
1150 | goto Done; | ||
1151 | else | ||
1152 | XtDisplayStringConversionWarning(dpy, (char*)value.addr, | ||
1153 | XtRFontStruct((char*)&XtStrings[1666])); | ||
1154 | } else if (rep_type == XtQFont) { | ||
1155 | f = XQueryFont(display, *(Font*)value.addr ); | ||
1156 | if (f != NULL((void*)0)) goto Done; | ||
1157 | } else if (rep_type == XtQFontStruct) { | ||
1158 | f = (XFontStruct*)value.addr; | ||
1159 | goto Done; | ||
1160 | } | ||
1161 | } | ||
1162 | } | ||
1163 | /* Should really do XListFonts, but most servers support this */ | ||
1164 | f = XLoadQueryFont(display, "-*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-*"); | ||
1165 | if (f != NULL((void*)0)) | ||
1166 | goto Done; | ||
1167 | |||
1168 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1169 | "noFont","cvtStringToFontStruct",XtCXtToolkitError, | ||
1170 | "Unable to load any usable ISO8859 font", | ||
1171 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1172 | |||
1173 | return False0; | ||
1174 | } | ||
1175 | |||
1176 | /* ARGSUSED */ | ||
1177 | static void FreeFontStruct( | ||
1178 | XtAppContext app, | ||
1179 | XrmValuePtr toVal, | ||
1180 | XtPointer closure, /* unused */ | ||
1181 | XrmValuePtr args, | ||
1182 | Cardinal *num_args) | ||
1183 | { | ||
1184 | Display *display; | ||
1185 | if (*num_args != 1) { | ||
1186 | XtAppWarningMsg(app, | ||
1187 | XtNwrongParameters,"freeFontStruct",XtCXtToolkitError, | ||
1188 | "Free FontStruct requires display argument", | ||
1189 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1190 | return; | ||
1191 | } | ||
1192 | |||
1193 | display = *(Display**)args[0].addr; | ||
1194 | XFreeFont( display, *(XFontStruct**)toVal->addr ); | ||
1195 | } | ||
1196 | |||
1197 | /*ARGSUSED*/ | ||
1198 | Boolean XtCvtStringToInt( | ||
1199 | Display* dpy, | ||
1200 | XrmValuePtr args, | ||
1201 | Cardinal *num_args, | ||
1202 | XrmValuePtr fromVal, | ||
1203 | XrmValuePtr toVal, | ||
1204 | XtPointer *closure_ret) | ||
1205 | { | ||
1206 | int i; | ||
1207 | |||
1208 | if (*num_args != 0) | ||
1209 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1210 | XtNwrongParameters,"cvtStringToInt",XtCXtToolkitError, | ||
1211 | "String to Integer conversion needs no extra arguments", | ||
1212 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1213 | if (IsInteger((String)fromVal->addr, &i)) | ||
1214 | donestr(int, i, XtRInt){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(int)) { toVal->size = sizeof(int); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1718]) ); return 0; } *(int*)(toVal->addr) = (i); } else { static int static_val; static_val = (i); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(int); return 1; }; | ||
1215 | |||
1216 | XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRInt((char*)&XtStrings[1718])); | ||
1217 | return False0; | ||
1218 | } | ||
1219 | |||
1220 | /*ARGSUSED*/ | ||
1221 | Boolean XtCvtStringToShort( | ||
1222 | Display* dpy, | ||
1223 | XrmValuePtr args, | ||
1224 | Cardinal *num_args, | ||
1225 | XrmValuePtr fromVal, | ||
1226 | XrmValuePtr toVal, | ||
1227 | XtPointer *closure_ret) | ||
1228 | { | ||
1229 | int i; | ||
1230 | |||
1231 | if (*num_args != 0) | ||
1232 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1233 | XtNwrongParameters,"cvtStringToShort",XtCXtToolkitError, | ||
1234 | "String to Integer conversion needs no extra arguments", | ||
1235 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1236 | if (IsInteger((String)fromVal->addr, &i)) | ||
1237 | donestr(short, (short)i, XtRShort){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(short)) { toVal->size = sizeof(short); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1791]) ); return 0; } *(short*)(toVal->addr) = ((short)i); } else { static short static_val; static_val = ((short)i); toVal-> addr = (XPointer)&static_val; } toVal->size = sizeof(short ); return 1; }; | ||
1238 | |||
1239 | XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRShort((char*)&XtStrings[1791])); | ||
1240 | return False0; | ||
1241 | } | ||
1242 | |||
1243 | /*ARGSUSED*/ | ||
1244 | Boolean XtCvtStringToDimension( | ||
1245 | Display* dpy, | ||
1246 | XrmValuePtr args, | ||
1247 | Cardinal *num_args, | ||
1248 | XrmValuePtr fromVal, | ||
1249 | XrmValuePtr toVal, | ||
1250 | XtPointer *closure_ret) | ||
1251 | { | ||
1252 | int i; | ||
1253 | |||
1254 | if (*num_args != 0) | ||
1255 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1256 | XtNwrongParameters,"cvtStringToDimension",XtCXtToolkitError, | ||
1257 | "String to Dimension conversion needs no extra arguments", | ||
1258 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1259 | if (IsInteger((String)fromVal->addr, &i)) { | ||
1260 | if ( i < 0 ) | ||
1261 | XtDisplayStringConversionWarning(dpy, (char*)fromVal->addr, | ||
1262 | XtRDimension((char*)&XtStrings[1618])); | ||
1263 | donestr(Dimension, (Dimension)i, XtRDimension){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Dimension)) { toVal->size = sizeof(Dimension); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1618]) ); return 0; } *(Dimension*)(toVal->addr) = ((Dimension)i) ; } else { static Dimension static_val; static_val = ((Dimension )i); toVal->addr = (XPointer)&static_val; } toVal-> size = sizeof(Dimension); return 1; }; | ||
1264 | } | ||
1265 | XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRDimension((char*)&XtStrings[1618])); | ||
1266 | return False0; | ||
1267 | } | ||
1268 | |||
1269 | /*ARGSUSED*/ | ||
1270 | Boolean XtCvtIntToUnsignedChar( | ||
1271 | Display* dpy, | ||
1272 | XrmValuePtr args, | ||
1273 | Cardinal *num_args, | ||
1274 | XrmValuePtr fromVal, | ||
1275 | XrmValuePtr toVal, | ||
1276 | XtPointer *closure_ret) | ||
1277 | { | ||
1278 | if (*num_args != 0) | ||
1279 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1280 | XtNwrongParameters,"cvtIntToUnsignedChar",XtCXtToolkitError, | ||
1281 | "Integer to UnsignedChar conversion needs no extra arguments", | ||
1282 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1283 | done(unsigned char, (*(int *)fromVal->addr)){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(unsigned char)) { toVal->size = sizeof(unsigned char ); return 0; } *(unsigned char*)(toVal->addr) = ((*(int *) fromVal->addr)); } else { static unsigned char static_val; static_val = ((*(int *)fromVal->addr)); toVal->addr = ( XPointer)&static_val; } toVal->size = sizeof(unsigned char ); return 1; }; | ||
1284 | } | ||
1285 | |||
1286 | |||
1287 | /*ARGSUSED*/ | ||
1288 | Boolean XtCvtStringToUnsignedChar( | ||
1289 | Display* dpy, | ||
1290 | XrmValuePtr args, | ||
1291 | Cardinal *num_args, | ||
1292 | XrmValuePtr fromVal, | ||
1293 | XrmValuePtr toVal, | ||
1294 | XtPointer *closure_ret) | ||
1295 | { | ||
1296 | int i; | ||
1297 | |||
1298 | if (*num_args != 0) | ||
1299 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1300 | XtNwrongParameters,"cvtStringToUnsignedChar",XtCXtToolkitError, | ||
1301 | "String to Integer conversion needs no extra arguments", | ||
1302 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1303 | if (IsInteger((String)fromVal->addr, &i)) { | ||
1304 | if ( i < 0 || i > 255 ) | ||
1305 | XtDisplayStringConversionWarning(dpy, (char*)fromVal->addr, | ||
1306 | XtRUnsignedChar((char*)&XtStrings[1828])); | ||
1307 | donestr(unsigned char, i, XtRUnsignedChar){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(unsigned char)) { toVal->size = sizeof(unsigned char ); XtDisplayStringConversionWarning(dpy, (char*) fromVal-> addr, ((char*)&XtStrings[1828])); return 0; } *(unsigned char *)(toVal->addr) = (i); } else { static unsigned char static_val ; static_val = (i); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(unsigned char); return 1; }; | ||
1308 | } | ||
1309 | XtDisplayStringConversionWarning(dpy, (char*)fromVal->addr, | ||
1310 | XtRUnsignedChar((char*)&XtStrings[1828])); | ||
1311 | return False0; | ||
1312 | } | ||
1313 | |||
1314 | |||
1315 | /*ARGSUSED*/ | ||
1316 | Boolean XtCvtColorToPixel( | ||
1317 | Display* dpy, | ||
1318 | XrmValuePtr args, | ||
1319 | Cardinal *num_args, | ||
1320 | XrmValuePtr fromVal, | ||
1321 | XrmValuePtr toVal, | ||
1322 | XtPointer *closure_ret) | ||
1323 | { | ||
1324 | if (*num_args != 0) | ||
1325 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1326 | XtNwrongParameters,"cvtXColorToPixel",XtCXtToolkitError, | ||
1327 | "Color to Pixel conversion needs no extra arguments", | ||
1328 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1329 | done(Pixel, ((XColor *)fromVal->addr)->pixel){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Pixel)) { toVal->size = sizeof(Pixel); return 0; } *(Pixel*)(toVal->addr) = (((XColor *)fromVal->addr)-> pixel); } else { static Pixel static_val; static_val = (((XColor *)fromVal->addr)->pixel); toVal->addr = (XPointer)& static_val; } toVal->size = sizeof(Pixel); return 1; }; | ||
1330 | } | ||
1331 | |||
1332 | /*ARGSUSED*/ | ||
1333 | Boolean XtCvtIntToPixel( | ||
1334 | Display* dpy, | ||
1335 | XrmValuePtr args, | ||
1336 | Cardinal *num_args, | ||
1337 | XrmValuePtr fromVal, | ||
1338 | XrmValuePtr toVal, | ||
1339 | XtPointer *closure_ret) | ||
1340 | { | ||
1341 | if (*num_args != 0) | ||
1342 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1343 | XtNwrongParameters,"cvtIntToPixel",XtCXtToolkitError, | ||
1344 | "Integer to Pixel conversion needs no extra arguments", | ||
1345 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1346 | done(Pixel, *(int*)fromVal->addr){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Pixel)) { toVal->size = sizeof(Pixel); return 0; } *(Pixel*)(toVal->addr) = (*(int*)fromVal->addr); } else { static Pixel static_val; static_val = (*(int*)fromVal-> addr); toVal->addr = (XPointer)&static_val; } toVal-> size = sizeof(Pixel); return 1; }; | ||
1347 | } | ||
1348 | |||
1349 | /*ARGSUSED*/ | ||
1350 | Boolean XtCvtIntToPixmap( | ||
1351 | Display* dpy, | ||
1352 | XrmValuePtr args, | ||
1353 | Cardinal *num_args, | ||
1354 | XrmValuePtr fromVal, | ||
1355 | XrmValuePtr toVal, | ||
1356 | XtPointer *closure_ret) | ||
1357 | { | ||
1358 | if (*num_args != 0) | ||
1359 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1360 | XtNwrongParameters,"cvtIntToPixmap",XtCXtToolkitError, | ||
1361 | "Integer to Pixmap conversion needs no extra arguments", | ||
1362 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1363 | done(Pixmap, *(int*)fromVal->addr){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Pixmap)) { toVal->size = sizeof(Pixmap); return 0; } *(Pixmap*)(toVal->addr) = (*(int*)fromVal->addr); } else { static Pixmap static_val; static_val = (*(int*)fromVal-> addr); toVal->addr = (XPointer)&static_val; } toVal-> size = sizeof(Pixmap); return 1; }; | ||
1364 | } | ||
1365 | |||
1366 | #ifdef MOTIFBC | ||
1367 | void LowerCase(register char *source, register *dest) | ||
1368 | { | ||
1369 | register char ch; | ||
1370 | int i; | ||
1371 | |||
1372 | for (i = 0; (ch = *source) != 0 && i < 999; source++, dest++, i++) { | ||
1373 | if ('A' <= ch && ch <= 'Z') | ||
1374 | *dest = ch - 'A' + 'a'; | ||
1375 | else | ||
1376 | *dest = ch; | ||
1377 | } | ||
1378 | *dest = 0; | ||
1379 | } | ||
1380 | #endif | ||
1381 | |||
1382 | static int CompareISOLatin1 (const char *first, const char *second) | ||
1383 | { | ||
1384 | register const unsigned char *ap, *bp; | ||
1385 | |||
1386 | for (ap = (const unsigned char *) first, | ||
1387 | bp = (const unsigned char *) second; | ||
1388 | *ap && *bp; ap++, bp++) { | ||
1389 | register unsigned char a, b; | ||
1390 | |||
1391 | if ((a = *ap) != (b = *bp)) { | ||
1392 | /* try lowercasing and try again */ | ||
1393 | |||
1394 | if ((a >= XK_A0x0041) && (a <= XK_Z0x005a)) | ||
1395 | a += (XK_a0x0061 - XK_A0x0041); | ||
1396 | else if ((a >= XK_Agrave0x00c0) && (a <= XK_Odiaeresis0x00d6)) | ||
1397 | a += (XK_agrave0x00e0 - XK_Agrave0x00c0); | ||
1398 | else if ((a >= XK_Ooblique0x00d8) && (a <= XK_Thorn0x00de)) | ||
1399 | a += (XK_oslash0x00f8 - XK_Ooblique0x00d8); | ||
1400 | |||
1401 | if ((b >= XK_A0x0041) && (b <= XK_Z0x005a)) | ||
1402 | b += (XK_a0x0061 - XK_A0x0041); | ||
1403 | else if ((b >= XK_Agrave0x00c0) && (b <= XK_Odiaeresis0x00d6)) | ||
1404 | b += (XK_agrave0x00e0 - XK_Agrave0x00c0); | ||
1405 | else if ((b >= XK_Ooblique0x00d8) && (b <= XK_Thorn0x00de)) | ||
1406 | b += (XK_oslash0x00f8 - XK_Ooblique0x00d8); | ||
1407 | |||
1408 | if (a != b) break; | ||
1409 | } | ||
1410 | } | ||
1411 | return (((int) *bp) - ((int) *ap)); | ||
1412 | } | ||
1413 | |||
1414 | static void CopyISOLatin1Lowered(char *dst, const char *src) | ||
1415 | { | ||
1416 | unsigned char *dest = (unsigned char *) dst; | ||
1417 | const unsigned char *source = (const unsigned char *) src; | ||
1418 | |||
1419 | for ( ; *source; source++, dest++) { | ||
1420 | if (*source >= XK_A0x0041 && *source <= XK_Z0x005a) | ||
1421 | *dest = *source + (XK_a0x0061 - XK_A0x0041); | ||
1422 | else if (*source >= XK_Agrave0x00c0 && *source <= XK_Odiaeresis0x00d6) | ||
1423 | *dest = *source + (XK_agrave0x00e0 - XK_Agrave0x00c0); | ||
1424 | else if (*source >= XK_Ooblique0x00d8 && *source <= XK_Thorn0x00de) | ||
1425 | *dest = *source + (XK_oslash0x00f8 - XK_Ooblique0x00d8); | ||
1426 | else | ||
1427 | *dest = *source; | ||
1428 | } | ||
1429 | *dest = '\0'; | ||
1430 | } | ||
1431 | |||
1432 | /*ARGSUSED*/ | ||
1433 | Boolean | ||
1434 | XtCvtStringToInitialState( | ||
1435 | Display* dpy, | ||
1436 | XrmValuePtr args, | ||
1437 | Cardinal *num_args, | ||
1438 | XrmValuePtr fromVal, | ||
1439 | XrmValuePtr toVal, | ||
1440 | XtPointer *closure_ret) | ||
1441 | { | ||
1442 | String str = (String)fromVal->addr; | ||
1443 | if (*num_args != 0) | ||
1444 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1445 | XtNwrongParameters,"cvtStringToInitialState",XtCXtToolkitError, | ||
1446 | "String to InitialState conversion needs no extra arguments", | ||
1447 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1448 | |||
1449 | if (CompareISOLatin1(str, "NormalState") == 0) donestr(int, NormalState, XtRInitialState){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(int)) { toVal->size = sizeof(int); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1705]) ); return 0; } *(int*)(toVal->addr) = (1); } else { static int static_val; static_val = (1); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(int); return 1; }; | ||
1450 | if (CompareISOLatin1(str, "IconicState") == 0) donestr(int, IconicState, XtRInitialState){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(int)) { toVal->size = sizeof(int); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1705]) ); return 0; } *(int*)(toVal->addr) = (3); } else { static int static_val; static_val = (3); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(int); return 1; }; | ||
1451 | { | ||
1452 | int val; | ||
1453 | if (IsInteger(str, &val)) donestr( int, val, XtRInitialState ){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(int)) { toVal->size = sizeof(int); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1705]) ); return 0; } *(int*)(toVal->addr) = (val); } else { static int static_val; static_val = (val); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(int); return 1; }; | ||
1454 | } | ||
1455 | XtDisplayStringConversionWarning(dpy, str, XtRInitialState((char*)&XtStrings[1705])); | ||
1456 | return False0; | ||
1457 | } | ||
1458 | |||
1459 | static XtConvertArgRec const visualConvertArgs[] = { | ||
1460 | {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen)__builtin_offsetof(WidgetRec, core.screen), | ||
1461 | sizeof(Screen *)}, | ||
1462 | {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.depth)__builtin_offsetof(WidgetRec, core.depth), | ||
1463 | sizeof(Cardinal)} | ||
1464 | }; | ||
1465 | |||
1466 | /*ARGSUSED*/ | ||
1467 | Boolean XtCvtStringToVisual( | ||
1468 | Display* dpy, | ||
1469 | XrmValuePtr args, /* Screen, depth */ | ||
1470 | Cardinal *num_args, /* 2 */ | ||
1471 | XrmValuePtr fromVal, | ||
1472 | XrmValuePtr toVal, | ||
1473 | XtPointer *closure_ret) /* unused */ | ||
1474 | { | ||
1475 | String str = (String)fromVal->addr; | ||
1476 | int vc; | ||
1477 | XVisualInfo vinfo; | ||
1478 | if (*num_args != 2) { | ||
1479 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1480 | XtNwrongParameters,"cvtStringToVisual",XtCXtToolkitError, | ||
1481 | "String to Visual conversion needs screen and depth arguments", | ||
1482 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1483 | return False0; | ||
1484 | } | ||
1485 | |||
1486 | if (CompareISOLatin1(str, "StaticGray") == 0) vc = StaticGray0; | ||
1487 | else if (CompareISOLatin1(str, "StaticColor") == 0) vc = StaticColor2; | ||
1488 | else if (CompareISOLatin1(str, "TrueColor") == 0) vc = TrueColor4; | ||
1489 | else if (CompareISOLatin1(str, "GrayScale") == 0) vc = GrayScale1; | ||
1490 | else if (CompareISOLatin1(str, "PseudoColor") == 0) vc = PseudoColor3; | ||
1491 | else if (CompareISOLatin1(str, "DirectColor") == 0) vc = DirectColor5; | ||
1492 | else if (!IsInteger(str, &vc)) { | ||
1493 | XtDisplayStringConversionWarning(dpy, str, "Visual class name"); | ||
1494 | return False0; | ||
1495 | } | ||
1496 | |||
1497 | if (XMatchVisualInfo( XDisplayOfScreen((Screen*)*(Screen**)args[0].addr), | ||
1498 | XScreenNumberOfScreen((Screen*)*(Screen**)args[0].addr), | ||
1499 | (int)*(int*)args[1].addr, | ||
1500 | vc, | ||
1501 | &vinfo) ) { | ||
1502 | donestr( Visual*, vinfo.visual, XtRVisual ){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Visual*)) { toVal->size = sizeof(Visual*); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1858]) ); return 0; } *(Visual**)(toVal->addr) = (vinfo.visual); } else { static Visual* static_val; static_val = (vinfo.visual ); toVal->addr = (XPointer)&static_val; } toVal->size = sizeof(Visual*); return 1; }; | ||
1503 | } | ||
1504 | else { | ||
1505 | String params[2]; | ||
1506 | Cardinal num_params = 2; | ||
1507 | params[0] = str; | ||
1508 | params[1] = | ||
1509 | DisplayString(XDisplayOfScreen((Screen*)*(Screen**)args[0].addr))(((_XPrivDisplay)XDisplayOfScreen((Screen*)*(Screen**)args[0] .addr))->display_name); | ||
1510 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1511 | XtNconversionError, "stringToVisual", XtCXtToolkitError, | ||
1512 | "Cannot find Visual of class %s for display %s", | ||
1513 | params, &num_params ); | ||
1514 | return False0; | ||
1515 | } | ||
1516 | } | ||
1517 | |||
1518 | |||
1519 | /*ARGSUSED*/ | ||
1520 | Boolean XtCvtStringToAtom( | ||
1521 | Display* dpy, | ||
1522 | XrmValuePtr args, | ||
1523 | Cardinal *num_args, | ||
1524 | XrmValuePtr fromVal, | ||
1525 | XrmValuePtr toVal, | ||
1526 | XtPointer *closure_ret) | ||
1527 | { | ||
1528 | Atom atom; | ||
1529 | if (*num_args != 1) { | ||
1530 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1531 | XtNwrongParameters,"cvtStringToAtom",XtCXtToolkitError, | ||
1532 | "String to Atom conversion needs Display argument", | ||
1533 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1534 | return False0; | ||
1535 | } | ||
1536 | |||
1537 | atom = XInternAtom( *(Display**)args->addr, (char*)fromVal->addr, False0 ); | ||
1538 | donestr(Atom, atom, XtRAtom){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(Atom)) { toVal->size = sizeof(Atom); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[1544]) ); return 0; } *(Atom*)(toVal->addr) = (atom); } else { static Atom static_val; static_val = (atom); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(Atom); return 1; }; | ||
1539 | } | ||
1540 | |||
1541 | /*ARGSUSED*/ | ||
1542 | Boolean XtCvtStringToDirectoryString( | ||
1543 | Display *dpy, | ||
1544 | XrmValuePtr args, | ||
1545 | Cardinal *num_args, | ||
1546 | XrmValuePtr fromVal, | ||
1547 | XrmValuePtr toVal, | ||
1548 | XtPointer *closure_ret) | ||
1549 | { | ||
1550 | String str; | ||
1551 | char directory[PATH_MAX4096+1]; | ||
1552 | |||
1553 | if (*num_args != 0) | ||
1554 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1555 | XtNwrongParameters,"cvtStringToDirectoryString",XtCXtToolkitError, | ||
1556 | "String to DirectoryString conversion needs no extra arguments", | ||
1557 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1558 | |||
1559 | str = (String)fromVal->addr; | ||
1560 | if (CompareISOLatin1(str, "XtCurrentDirectory") == 0) { | ||
1561 | /* uglier, but does not depend on compiler knowing return type */ | ||
1562 | #if !defined(X_NOT_POSIX) || defined(SYSV) || defined(WIN32) | ||
1563 | if (getcwd(directory, PATH_MAX4096 + 1)) | ||
1564 | str = directory; | ||
1565 | #else | ||
1566 | if (getwd(directory)) | ||
1567 | str = directory; | ||
1568 | #endif | ||
1569 | if (!str) { | ||
1570 | if (errno(*__errno_location ()) == EACCES13) | ||
1571 | errno(*__errno_location ()) = 0; /* reset errno */ | ||
1572 | XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, | ||
1573 | XtRDirectoryString((char*)&XtStrings[2144])); | ||
1574 | return False0; | ||
1575 | } | ||
1576 | } | ||
1577 | |||
1578 | /* Since memory from the resource database or from static buffers of | ||
1579 | * system libraries may be freed or overwritten, allocate memory. | ||
1580 | * The memory is freed when all cache references are released. | ||
1581 | */ | ||
1582 | str = XtNewString(str)((str) != ((void*)0) ? (strcpy(XtMalloc((unsigned)strlen(str) + 1), str)) : ((void*)0)); | ||
1583 | donestr(String, str, XtRDirectoryString){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(String)) { toVal->size = sizeof(String); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[2144]) ); return 0; } *(String*)(toVal->addr) = (str); } else { static String static_val; static_val = (str); toVal->addr = (XPointer )&static_val; } toVal->size = sizeof(String); return 1 ; }; | ||
1584 | } | ||
1585 | |||
1586 | /*ARGSUSED*/ | ||
1587 | static void FreeDirectoryString( | ||
1588 | XtAppContext app, | ||
1589 | XrmValuePtr toVal, | ||
1590 | XtPointer closure, /* unused */ | ||
1591 | XrmValuePtr args, | ||
1592 | Cardinal *num_args) | ||
1593 | { | ||
1594 | if (*num_args != 0) | ||
1595 | XtAppWarningMsg(app, | ||
1596 | XtNwrongParameters,"freeDirectoryString",XtCXtToolkitError, | ||
1597 | "Free Directory String requires no extra arguments", | ||
1598 | (String *) NULL((void*)0), (Cardinal *) NULL((void*)0)); | ||
1599 | |||
1600 | XtFree((char *) toVal->addr); | ||
1601 | } | ||
1602 | |||
1603 | /*ARGSUSED*/ | ||
1604 | Boolean XtCvtStringToRestartStyle( | ||
1605 | Display *dpy, | ||
1606 | XrmValuePtr args, | ||
1607 | Cardinal *num_args, | ||
1608 | XrmValuePtr fromVal, | ||
1609 | XrmValuePtr toVal, | ||
1610 | XtPointer *closure_ret) | ||
1611 | { | ||
1612 | String str = (String)fromVal->addr; | ||
1613 | if (*num_args != 0) | ||
1614 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1615 | XtNwrongParameters,"cvtStringToRestartStyle",XtCXtToolkitError, | ||
1616 | "String to RestartStyle conversion needs no extra arguments", | ||
1617 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1618 | |||
1619 | if (CompareISOLatin1(str, "RestartIfRunning") == 0) | ||
1620 | donestr(unsigned char, SmRestartIfRunning, XtRRestartStyle){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(unsigned char)) { toVal->size = sizeof(unsigned char ); XtDisplayStringConversionWarning(dpy, (char*) fromVal-> addr, ((char*)&XtStrings[2177])); return 0; } *(unsigned char *)(toVal->addr) = (0); } else { static unsigned char static_val ; static_val = (0); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(unsigned char); return 1; }; | ||
1621 | if (CompareISOLatin1(str, "RestartAnyway") == 0) | ||
1622 | donestr(unsigned char, SmRestartAnyway, XtRRestartStyle){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(unsigned char)) { toVal->size = sizeof(unsigned char ); XtDisplayStringConversionWarning(dpy, (char*) fromVal-> addr, ((char*)&XtStrings[2177])); return 0; } *(unsigned char *)(toVal->addr) = (1); } else { static unsigned char static_val ; static_val = (1); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(unsigned char); return 1; }; | ||
1623 | if (CompareISOLatin1(str, "RestartImmediately") == 0) | ||
1624 | donestr(unsigned char, SmRestartImmediately, XtRRestartStyle){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(unsigned char)) { toVal->size = sizeof(unsigned char ); XtDisplayStringConversionWarning(dpy, (char*) fromVal-> addr, ((char*)&XtStrings[2177])); return 0; } *(unsigned char *)(toVal->addr) = (2); } else { static unsigned char static_val ; static_val = (2); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(unsigned char); return 1; }; | ||
1625 | if (CompareISOLatin1(str, "RestartNever") == 0) | ||
1626 | donestr(unsigned char, SmRestartNever, XtRRestartStyle){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(unsigned char)) { toVal->size = sizeof(unsigned char ); XtDisplayStringConversionWarning(dpy, (char*) fromVal-> addr, ((char*)&XtStrings[2177])); return 0; } *(unsigned char *)(toVal->addr) = (3); } else { static unsigned char static_val ; static_val = (3); toVal->addr = (XPointer)&static_val ; } toVal->size = sizeof(unsigned char); return 1; }; | ||
1627 | XtDisplayStringConversionWarning(dpy, str, XtRRestartStyle((char*)&XtStrings[2177])); | ||
1628 | return False0; | ||
1629 | } | ||
1630 | |||
1631 | /*ARGSUSED*/ | ||
1632 | Boolean XtCvtStringToCommandArgArray( | ||
1633 | Display *dpy, | ||
1634 | XrmValuePtr args, | ||
1635 | Cardinal *num_args, | ||
1636 | XrmValuePtr fromVal, | ||
1637 | XrmValuePtr toVal, | ||
1638 | XtPointer *closure_ret) | ||
1639 | { | ||
1640 | String *strarray, *ptr; | ||
1641 | char *src; | ||
1642 | char *dst, *dst_str; | ||
1643 | char *start; | ||
1644 | int tokens, len; | ||
1645 | |||
1646 | if (*num_args != 0) | ||
1647 | XtAppWarningMsg(XtDisplayToApplicationContext(dpy), | ||
1648 | XtNwrongParameters,"cvtStringToCommandArgArray",XtCXtToolkitError, | ||
1649 | "String to CommandArgArray conversion needs no extra arguments", | ||
1650 | (String *)NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1651 | |||
1652 | src = fromVal->addr; | ||
1653 | dst = dst_str = __XtMalloc((unsigned) strlen(src) + 1); | ||
1654 | tokens = 0; | ||
1655 | |||
1656 | while (*src != '\0') { | ||
1657 | /* skip whitespace */ | ||
1658 | while (IsWhitespace(*src)((*src)== ' ' || (*src) == '\t') || IsNewline(*src)((*src) == '\n')) | ||
1659 | src++; | ||
1660 | /* test for end of string */ | ||
1661 | if (*src == '\0') | ||
1662 | break; | ||
1663 | |||
1664 | /* start new token */ | ||
1665 | tokens++; | ||
1666 | start = src; | ||
1667 | while (*src != '\0' && !IsWhitespace(*src)((*src)== ' ' || (*src) == '\t') && !IsNewline(*src)((*src) == '\n')) { | ||
1668 | if (*src == '\\' && | ||
1669 | (IsWhitespace(*(src+1))((*(src+1))== ' ' || (*(src+1)) == '\t') || IsNewline(*(src+1))((*(src+1)) == '\n'))) { | ||
1670 | len = src - start; | ||
1671 | if (len) { | ||
1672 | /* copy preceeding part of token */ | ||
1673 | memcpy(dst, start, len); | ||
1674 | dst += len; | ||
1675 | } | ||
1676 | /* skip backslash */ | ||
1677 | src++; | ||
1678 | /* next part of token starts at whitespace */ | ||
1679 | start = src; | ||
1680 | } | ||
1681 | src++; | ||
1682 | } | ||
1683 | len = src - start; | ||
1684 | if (len) { | ||
1685 | /* copy last part of token */ | ||
1686 | memcpy(dst, start, len); | ||
1687 | dst += len; | ||
1688 | } | ||
1689 | *dst = '\0'; | ||
1690 | if (*src != '\0') | ||
1691 | dst++; | ||
1692 | } | ||
1693 | |||
1694 | ptr = strarray = (String*) __XtMalloc((Cardinal)(tokens+1) * sizeof(String)); | ||
1695 | src = dst_str; | ||
1696 | while (--tokens >= 0) { | ||
1697 | *ptr = src; | ||
1698 | ptr++; | ||
1699 | if (tokens) { | ||
1700 | len = strlen(src); | ||
1701 | src = src + len + 1; | ||
1702 | } | ||
1703 | } | ||
1704 | *ptr = NULL((void*)0); | ||
1705 | |||
1706 | *closure_ret = (XtPointer) strarray; | ||
1707 | donestr(char**, strarray, XtRCommandArgArray){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(char**)) { toVal->size = sizeof(char**); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[2128]) ); return 0; } *(char***)(toVal->addr) = (strarray); } else { static char** static_val; static_val = (strarray); toVal-> addr = (XPointer)&static_val; } toVal->size = sizeof(char **); return 1; } | ||
1708 | } | ||
1709 | |||
1710 | /*ARGSUSED*/ | ||
1711 | static void ArgArrayDestructor( | ||
1712 | XtAppContext app, | ||
1713 | XrmValuePtr toVal, | ||
1714 | XtPointer closure, | ||
1715 | XrmValuePtr args, | ||
1716 | Cardinal *num_args) | ||
1717 | { | ||
1718 | String *strarray; | ||
1719 | |||
1720 | if (closure) { | ||
1721 | strarray = (String*) closure; | ||
1722 | XtFree(*strarray); | ||
1723 | XtFree((char *) strarray); | ||
1724 | } | ||
1725 | } | ||
1726 | |||
1727 | /*ARGSUSED*/ | ||
1728 | Boolean XtCvtStringToGravity ( | ||
1729 | Display* dpy, | ||
1730 | XrmValuePtr args, | ||
1731 | Cardinal *num_args, | ||
1732 | XrmValuePtr fromVal, | ||
1733 | XrmValuePtr toVal, | ||
1734 | XtPointer *closure_ret) | ||
1735 | { | ||
1736 | static struct _namepair { | ||
1737 | XrmQuark quark; | ||
1738 | const char *name; | ||
1739 | int gravity; | ||
1740 | } names[] = { | ||
1741 | { NULLQUARK((XrmQuark) 0), "forget", ForgetGravity0 }, | ||
1742 | { NULLQUARK((XrmQuark) 0), "northwest", NorthWestGravity1 }, | ||
1743 | { NULLQUARK((XrmQuark) 0), "north", NorthGravity2 }, | ||
1744 | { NULLQUARK((XrmQuark) 0), "northeast", NorthEastGravity3 }, | ||
1745 | { NULLQUARK((XrmQuark) 0), "west", WestGravity4 }, | ||
1746 | { NULLQUARK((XrmQuark) 0), "center", CenterGravity5 }, | ||
1747 | { NULLQUARK((XrmQuark) 0), "east", EastGravity6 }, | ||
1748 | { NULLQUARK((XrmQuark) 0), "southwest", SouthWestGravity7 }, | ||
1749 | { NULLQUARK((XrmQuark) 0), "south", SouthGravity8 }, | ||
1750 | { NULLQUARK((XrmQuark) 0), "southeast", SouthEastGravity9 }, | ||
1751 | { NULLQUARK((XrmQuark) 0), "static", StaticGravity10 }, | ||
1752 | { NULLQUARK((XrmQuark) 0), "unmap", UnmapGravity0 }, | ||
1753 | { NULLQUARK((XrmQuark) 0), "0", ForgetGravity0 }, | ||
1754 | { NULLQUARK((XrmQuark) 0), "1", NorthWestGravity1 }, | ||
1755 | { NULLQUARK((XrmQuark) 0), "2", NorthGravity2 }, | ||
1756 | { NULLQUARK((XrmQuark) 0), "3", NorthEastGravity3 }, | ||
1757 | { NULLQUARK((XrmQuark) 0), "4", WestGravity4 }, | ||
1758 | { NULLQUARK((XrmQuark) 0), "5", CenterGravity5 }, | ||
1759 | { NULLQUARK((XrmQuark) 0), "6", EastGravity6 }, | ||
1760 | { NULLQUARK((XrmQuark) 0), "7", SouthWestGravity7 }, | ||
1761 | { NULLQUARK((XrmQuark) 0), "8", SouthGravity8 }, | ||
1762 | { NULLQUARK((XrmQuark) 0), "9", SouthEastGravity9 }, | ||
1763 | { NULLQUARK((XrmQuark) 0), "10", StaticGravity10 }, | ||
1764 | { NULLQUARK((XrmQuark) 0), NULL((void*)0), ForgetGravity0 } | ||
1765 | }; | ||
1766 | static Boolean haveQuarks = FALSE0; | ||
1767 | char lowerName[40]; | ||
1768 | XrmQuark q; | ||
1769 | char *s; | ||
1770 | struct _namepair *np; | ||
1771 | |||
1772 | if (*num_args != 0) { | ||
1773 | XtAppWarningMsg(XtDisplayToApplicationContext (dpy), | ||
1774 | "wrongParameters","cvtStringToGravity","XtToolkitError", | ||
1775 | "String to Gravity conversion needs no extra arguments", | ||
1776 | (String *) NULL((void*)0), (Cardinal *)NULL((void*)0)); | ||
1777 | return False0; | ||
1778 | } | ||
1779 | if (!haveQuarks) { | ||
1780 | for (np = names; np->name; np++) { | ||
1781 | np->quark = XrmPermStringToQuark (np->name); | ||
1782 | } | ||
1783 | haveQuarks = TRUE1; | ||
1784 | } | ||
1785 | s = (char *) fromVal->addr; | ||
1786 | if (strlen(s) < sizeof lowerName) { | ||
1787 | CopyISOLatin1Lowered (lowerName, s); | ||
1788 | q = XrmStringToQuark (lowerName); | ||
1789 | for (np = names; np->name; np++) | ||
1790 | if (np->quark == q) donestr(int, np->gravity, XtRGravity){ if (toVal->addr != ((void*)0)) { if (toVal->size < sizeof(int)) { toVal->size = sizeof(int); XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, ((char*)&XtStrings[2042]) ); return 0; } *(int*)(toVal->addr) = (np->gravity); } else { static int static_val; static_val = (np->gravity); toVal ->addr = (XPointer)&static_val; } toVal->size = sizeof (int); return 1; }; | ||
1791 | } | ||
1792 | XtDisplayStringConversionWarning(dpy, (char *)fromVal->addr, XtRGravity((char*)&XtStrings[2042])); | ||
1793 | return False0; | ||
1794 | } | ||
1795 | |||
1796 | void _XtAddDefaultConverters( | ||
1797 | ConverterTable table) | ||
1798 | { | ||
1799 | #define Add(from, to, proc, convert_args, num_args, cache)_XtTableAddConverter(table, from, to, proc, (XtConvertArgList ) convert_args, (Cardinal)num_args, 1, cache, (XtDestructor)( (void*)0), 1) \ | ||
1800 | _XtTableAddConverter(table, from, to, proc, \ | ||
1801 | (XtConvertArgList) convert_args, (Cardinal)num_args, \ | ||
1802 | True1, cache, (XtDestructor)NULL((void*)0), True1) | ||
1803 | |||
1804 | #define Add2(from, to, proc, convert_args, num_args, cache, destructor)_XtTableAddConverter(table, from, to, proc, (XtConvertArgList ) convert_args, (Cardinal)num_args, 1, cache, destructor, 1) \ | ||
1805 | _XtTableAddConverter(table, from, to, proc, \ | ||
1806 | (XtConvertArgList) convert_args, (Cardinal)num_args, \ | ||
1807 | True1, cache, destructor, True1) | ||
1808 | |||
1809 | Add(XtQColor, XtQPixel, XtCvtColorToPixel, NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQColor, XtQPixel, XtCvtColorToPixel , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1810 | |||
1811 | Add(XtQInt, XtQBool, XtCvtIntToBool, NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQInt, XtQBool, XtCvtIntToBool, ( XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1812 | Add(XtQInt, XtQBoolean, XtCvtIntToBoolean, NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQInt, XtQBoolean, XtCvtIntToBoolean , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1813 | Add(XtQInt, XtQColor, XtCvtIntToColor,_XtTableAddConverter(table, XtQInt, XtQColor, XtCvtIntToColor , (XtConvertArgList) colorConvertArgs, (Cardinal)((Cardinal) ( sizeof(colorConvertArgs) / sizeof(colorConvertArgs[0]))), 1, 0x003 , (XtDestructor)((void*)0), 1) | ||
1814 | colorConvertArgs, XtNumber(colorConvertArgs), XtCacheByDisplay)_XtTableAddConverter(table, XtQInt, XtQColor, XtCvtIntToColor , (XtConvertArgList) colorConvertArgs, (Cardinal)((Cardinal) ( sizeof(colorConvertArgs) / sizeof(colorConvertArgs[0]))), 1, 0x003 , (XtDestructor)((void*)0), 1); | ||
1815 | Add(XtQInt, XtQDimension, XtCvtIntToShort, NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQInt, XtQDimension, XtCvtIntToShort , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1816 | Add(XtQInt, XtQFloat, XtCvtIntToFloat, NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQInt, XrmPermStringToQuark(((char *)&XtStrings[1655])), XtCvtIntToFloat, (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor)((void*)0), 1); | ||
1817 | Add(XtQInt, XtQFont, XtCvtIntToFont, NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQInt, XtQFont, XtCvtIntToFont, ( XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1818 | Add(XtQInt, XtQPixel, XtCvtIntToPixel, NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQInt, XtQPixel, XtCvtIntToPixel , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1819 | Add(XtQInt, XtQPixmap, XtCvtIntToPixmap, NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQInt, XrmPermStringToQuark(((char *)&XtStrings[1760])), XtCvtIntToPixmap, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor)((void*)0) , 1); | ||
1820 | Add(XtQInt, XtQPosition, XtCvtIntToShort, NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQInt, XtQPosition, XtCvtIntToShort , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1821 | Add(XtQInt, XtQShort, XtCvtIntToShort, NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQInt, XrmPermStringToQuark(((char *)&XtStrings[1791])), XtCvtIntToShort, (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor)((void*)0), 1); | ||
1822 | Add(XtQInt, XtQUnsignedChar,XtCvtIntToUnsignedChar,NULL, 0, XtCacheNone)_XtTableAddConverter(table, XtQInt, XrmPermStringToQuark(((char *)&XtStrings[1828])), XtCvtIntToUnsignedChar, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor)((void*)0) , 1); | ||
1823 | |||
1824 | Add(XtQPixel, XtQColor, XtCvtIntToColor,_XtTableAddConverter(table, XtQPixel, XtQColor, XtCvtIntToColor , (XtConvertArgList) colorConvertArgs, (Cardinal)((Cardinal) ( sizeof(colorConvertArgs) / sizeof(colorConvertArgs[0]))), 1, 0x003 , (XtDestructor)((void*)0), 1) | ||
1825 | colorConvertArgs, XtNumber(colorConvertArgs), XtCacheByDisplay)_XtTableAddConverter(table, XtQPixel, XtQColor, XtCvtIntToColor , (XtConvertArgList) colorConvertArgs, (Cardinal)((Cardinal) ( sizeof(colorConvertArgs) / sizeof(colorConvertArgs[0]))), 1, 0x003 , (XtDestructor)((void*)0), 1); | ||
1826 | |||
1827 | Add(_XtQString, XtQAtom, XtCvtStringToAtom,_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1544])), XtCvtStringToAtom, (XtConvertArgList ) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg ) / sizeof(displayConvertArg[0]))), 1, 0x001, (XtDestructor)( (void*)0), 1) | ||
1828 | displayConvertArg, XtNumber(displayConvertArg), XtCacheNone)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1544])), XtCvtStringToAtom, (XtConvertArgList ) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg ) / sizeof(displayConvertArg[0]))), 1, 0x001, (XtDestructor)( (void*)0), 1); | ||
1829 | Add(_XtQString, XtQBool, XtCvtStringToBool, NULL, 0, XtCacheNone)_XtTableAddConverter(table, _XtQString, XtQBool, XtCvtStringToBool , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1830 | Add(_XtQString, XtQBoolean, XtCvtStringToBoolean, NULL, 0, XtCacheNone)_XtTableAddConverter(table, _XtQString, XtQBoolean, XtCvtStringToBoolean , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1831 | Add2(_XtQString, XtQCommandArgArray, XtCvtStringToCommandArgArray,_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[2128])), XtCvtStringToCommandArgArray, (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001 | 0x100 , ArgArrayDestructor, 1) | ||
1832 | NULL, 0, XtCacheNone | XtCacheRefCount, ArgArrayDestructor)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[2128])), XtCvtStringToCommandArgArray, (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001 | 0x100 , ArgArrayDestructor, 1); | ||
1833 | Add2(_XtQString, XtQCursor, XtCvtStringToCursor,_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1611])), XtCvtStringToCursor, (XtConvertArgList ) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg ) / sizeof(displayConvertArg[0]))), 1, 0x003, FreeCursor, 1) | ||
1834 | displayConvertArg, XtNumber(displayConvertArg),_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1611])), XtCvtStringToCursor, (XtConvertArgList ) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg ) / sizeof(displayConvertArg[0]))), 1, 0x003, FreeCursor, 1) | ||
1835 | XtCacheByDisplay, FreeCursor)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1611])), XtCvtStringToCursor, (XtConvertArgList ) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg ) / sizeof(displayConvertArg[0]))), 1, 0x003, FreeCursor, 1); | ||
1836 | Add(_XtQString, XtQDimension, XtCvtStringToDimension,NULL, 0, XtCacheNone)_XtTableAddConverter(table, _XtQString, XtQDimension, XtCvtStringToDimension , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1837 | Add2(_XtQString, XtQDirectoryString, XtCvtStringToDirectoryString, NULL, 0,_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[2144])), XtCvtStringToDirectoryString, (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001 | 0x100 , FreeDirectoryString, 1) | ||
1838 | XtCacheNone | XtCacheRefCount, FreeDirectoryString)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[2144])), XtCvtStringToDirectoryString, (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001 | 0x100 , FreeDirectoryString, 1); | ||
1839 | Add(_XtQString, XtQDisplay, XtCvtStringToDisplay, NULL, 0, XtCacheAll)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1628])), XtCvtStringToDisplay, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x002, (XtDestructor)((void*)0) , 1); | ||
1840 | Add2(_XtQString, XtQFile, XtCvtStringToFile, NULL, 0,_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1650])), XtCvtStringToFile, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x002 | 0x100, FreeFile, 1) | ||
1841 | XtCacheAll | XtCacheRefCount, FreeFile)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1650])), XtCvtStringToFile, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x002 | 0x100, FreeFile, 1); | ||
1842 | Add(_XtQString, XtQFloat, XtCvtStringToFloat, NULL, 0, XtCacheNone)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1655])), XtCvtStringToFloat, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor)((void*)0) , 1); | ||
1843 | |||
1844 | Add2(_XtQString, XtQFont, XtCvtStringToFont,_XtTableAddConverter(table, _XtQString, XtQFont, XtCvtStringToFont , (XtConvertArgList) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg) / sizeof(displayConvertArg[0]))), 1, 0x003, FreeFont, 1) | ||
1845 | displayConvertArg, XtNumber(displayConvertArg),_XtTableAddConverter(table, _XtQString, XtQFont, XtCvtStringToFont , (XtConvertArgList) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg) / sizeof(displayConvertArg[0]))), 1, 0x003, FreeFont, 1) | ||
1846 | XtCacheByDisplay, FreeFont)_XtTableAddConverter(table, _XtQString, XtQFont, XtCvtStringToFont , (XtConvertArgList) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg) / sizeof(displayConvertArg[0]))), 1, 0x003, FreeFont, 1); | ||
1847 | Add2(_XtQString, XtQFontSet, XtCvtStringToFontSet,_XtTableAddConverter(table, _XtQString, XtQFontSet, XtCvtStringToFontSet , (XtConvertArgList) localeDisplayConvertArgs, (Cardinal)((Cardinal ) (sizeof(localeDisplayConvertArgs) / sizeof(localeDisplayConvertArgs [0]))), 1, 0x003, FreeFontSet, 1) | ||
1848 | localeDisplayConvertArgs, XtNumber(localeDisplayConvertArgs),_XtTableAddConverter(table, _XtQString, XtQFontSet, XtCvtStringToFontSet , (XtConvertArgList) localeDisplayConvertArgs, (Cardinal)((Cardinal ) (sizeof(localeDisplayConvertArgs) / sizeof(localeDisplayConvertArgs [0]))), 1, 0x003, FreeFontSet, 1) | ||
1849 | XtCacheByDisplay, FreeFontSet)_XtTableAddConverter(table, _XtQString, XtQFontSet, XtCvtStringToFontSet , (XtConvertArgList) localeDisplayConvertArgs, (Cardinal)((Cardinal ) (sizeof(localeDisplayConvertArgs) / sizeof(localeDisplayConvertArgs [0]))), 1, 0x003, FreeFontSet, 1); | ||
1850 | Add2(_XtQString, XtQFontStruct,XtCvtStringToFontStruct,_XtTableAddConverter(table, _XtQString, XtQFontStruct, XtCvtStringToFontStruct , (XtConvertArgList) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg) / sizeof(displayConvertArg[0]))), 1, 0x003, FreeFontStruct, 1) | ||
1851 | displayConvertArg, XtNumber(displayConvertArg),_XtTableAddConverter(table, _XtQString, XtQFontStruct, XtCvtStringToFontStruct , (XtConvertArgList) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg) / sizeof(displayConvertArg[0]))), 1, 0x003, FreeFontStruct, 1) | ||
1852 | XtCacheByDisplay, FreeFontStruct)_XtTableAddConverter(table, _XtQString, XtQFontStruct, XtCvtStringToFontStruct , (XtConvertArgList) displayConvertArg, (Cardinal)((Cardinal) (sizeof(displayConvertArg) / sizeof(displayConvertArg[0]))), 1, 0x003, FreeFontStruct, 1); | ||
1853 | |||
1854 | Add(_XtQString, XtQGravity, XtCvtStringToGravity, NULL, 0, XtCacheNone)_XtTableAddConverter(table, _XtQString, XtQGravity, XtCvtStringToGravity , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor )((void*)0), 1); | ||
1855 | Add(_XtQString, XtQInitialState, XtCvtStringToInitialState, NULL, 0,_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1705])), XtCvtStringToInitialState, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor)((void*)0) , 1) | ||
1856 | XtCacheNone)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1705])), XtCvtStringToInitialState, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor)((void*)0) , 1); | ||
1857 | Add(_XtQString, XtQInt, XtCvtStringToInt, NULL, 0, XtCacheAll)_XtTableAddConverter(table, _XtQString, XtQInt, XtCvtStringToInt , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x002, (XtDestructor )((void*)0), 1); | ||
1858 | Add2(_XtQString, XtQPixel, XtCvtStringToPixel,_XtTableAddConverter(table, _XtQString, XtQPixel, XtCvtStringToPixel , (XtConvertArgList) colorConvertArgs, (Cardinal)((Cardinal) ( sizeof(colorConvertArgs) / sizeof(colorConvertArgs[0]))), 1, 0x003 , FreePixel, 1) | ||
1859 | colorConvertArgs, XtNumber(colorConvertArgs),_XtTableAddConverter(table, _XtQString, XtQPixel, XtCvtStringToPixel , (XtConvertArgList) colorConvertArgs, (Cardinal)((Cardinal) ( sizeof(colorConvertArgs) / sizeof(colorConvertArgs[0]))), 1, 0x003 , FreePixel, 1) | ||
1860 | XtCacheByDisplay, FreePixel)_XtTableAddConverter(table, _XtQString, XtQPixel, XtCvtStringToPixel , (XtConvertArgList) colorConvertArgs, (Cardinal)((Cardinal) ( sizeof(colorConvertArgs) / sizeof(colorConvertArgs[0]))), 1, 0x003 , FreePixel, 1); | ||
1861 | Add(_XtQString, XtQPosition, XtCvtStringToShort, NULL, 0, XtCacheAll)_XtTableAddConverter(table, _XtQString, XtQPosition, XtCvtStringToShort , (XtConvertArgList) ((void*)0), (Cardinal)0, 1, 0x002, (XtDestructor )((void*)0), 1); | ||
1862 | Add(_XtQString, XtQRestartStyle, XtCvtStringToRestartStyle, NULL, 0,_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[2177])), XtCvtStringToRestartStyle, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor)((void*)0) , 1) | ||
1863 | XtCacheNone)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[2177])), XtCvtStringToRestartStyle, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x001, (XtDestructor)((void*)0) , 1); | ||
1864 | Add(_XtQString, XtQShort, XtCvtStringToShort, NULL, 0, XtCacheAll)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1791])), XtCvtStringToShort, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x002, (XtDestructor)((void*)0) , 1); | ||
1865 | Add(_XtQString, XtQUnsignedChar, XtCvtStringToUnsignedChar,_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1828])), XtCvtStringToUnsignedChar, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x002, (XtDestructor)((void*)0) , 1) | ||
1866 | NULL, 0, XtCacheAll)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1828])), XtCvtStringToUnsignedChar, (XtConvertArgList ) ((void*)0), (Cardinal)0, 1, 0x002, (XtDestructor)((void*)0) , 1); | ||
1867 | Add2(_XtQString, XtQVisual, XtCvtStringToVisual,_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1858])), XtCvtStringToVisual, (XtConvertArgList ) visualConvertArgs, (Cardinal)((Cardinal) (sizeof(visualConvertArgs ) / sizeof(visualConvertArgs[0]))), 1, 0x003, ((void*)0), 1) | ||
1868 | visualConvertArgs, XtNumber(visualConvertArgs),_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1858])), XtCvtStringToVisual, (XtConvertArgList ) visualConvertArgs, (Cardinal)((Cardinal) (sizeof(visualConvertArgs ) / sizeof(visualConvertArgs[0]))), 1, 0x003, ((void*)0), 1) | ||
1869 | XtCacheByDisplay, NULL)_XtTableAddConverter(table, _XtQString, XrmPermStringToQuark( ((char*)&XtStrings[1858])), XtCvtStringToVisual, (XtConvertArgList ) visualConvertArgs, (Cardinal)((Cardinal) (sizeof(visualConvertArgs ) / sizeof(visualConvertArgs[0]))), 1, 0x003, ((void*)0), 1); | ||
1870 | |||
1871 | _XtAddTMConverters(table); | ||
1872 | } |