1
/* $XConsortium: StrToShap.c,v 1.3 90/12/20 13:36:01 converse Exp $ */
4
* Copyright 1988 by the Massachusetts Institute of Technology
6
* Permission to use, copy, modify, and distribute this software and its
7
* documentation for any purpose and without fee is hereby granted, provided
8
* that the above copyright notice appear in all copies and that both that
9
* copyright notice and this permission notice appear in supporting
10
* documentation, and that the name of M.I.T. not be used in advertising
11
* or publicity pertaining to distribution of the software without specific,
12
* written prior permission. M.I.T. makes no representations about the
13
* suitability of this software for any purpose. It is provided "as is"
14
* without express or implied warranty.
18
#include <X11/Intrinsic.h>
19
#include "Converters.h"
23
#define done(type, value) \
25
if (toVal->addr != NULL) { \
26
if (toVal->size < sizeof(type)) { \
27
toVal->size = sizeof(type); \
30
*(type*)(toVal->addr) = (value); \
33
static type static_val; \
34
static_val = (value); \
35
toVal->size = sizeof(type); \
36
toVal->addr = (XtPointer)&static_val; \
42
Boolean XmuCvtStringToShapeStyle(dpy, args, num_args, from, toVal, data)
44
XrmValue *args; /* unused */
45
Cardinal *num_args; /* unused */
48
XtPointer *data; /* unused */
50
if ( XmuCompareISOLatin1((char*)from->addr, XtERectangle) == 0
51
|| XmuCompareISOLatin1((char*)from->addr, "ShapeRectangle") == 0)
52
done( int, XmuShapeRectangle );
53
if ( XmuCompareISOLatin1((char*)from->addr, XtEOval) == 0
54
|| XmuCompareISOLatin1((char*)from->addr, "ShapeOval") == 0)
55
done( int, XmuShapeOval );
56
if ( XmuCompareISOLatin1((char*)from->addr, XtEEllipse) == 0
57
|| XmuCompareISOLatin1((char*)from->addr, "ShapeEllipse") == 0)
58
done( int, XmuShapeEllipse );
59
if ( XmuCompareISOLatin1((char*)from->addr, XtERoundedRectangle) == 0
60
|| XmuCompareISOLatin1((char*)from->addr, "ShapeRoundedRectangle") == 0)
61
done( int, XmuShapeRoundedRectangle );
64
char ch, *p = (char*)from->addr;
66
if (ch >= '0' && ch <= '9') {
72
if (ch == '\0' && style <= XmuShapeRoundedRectangle)
75
XtDisplayStringConversionWarning( dpy, (char*)from->addr, XtRShapeStyle );