Bug Summary

File:src/Converters.c
Location:line 570, column 30
Description:Dereference of null pointer

Annotated Source Code

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