#include <string.h>#include <X11/Intrinsic.h>#include "Converters.h"#include "CharSet.h"Include dependency graph for StrToShap.c:

Go to the source code of this file.
Defines | |
| #define | done(type, value) |
Functions | |
| Boolean | XmuCvtStringToShapeStyle (Display *dpy, XrmValue *args, Cardinal *num_args, XrmValue *from, XrmValue *toVal, XtPointer *data) |
| Boolean | XmuCvtShapeStyleToString (Display *dpy, XrmValue *args, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, XtPointer *data) |
Value:
{ \
if (toVal->addr != NULL) { \
if (toVal->size < sizeof(type)) { \
toVal->size = sizeof(type); \
return False; \
} \
*(type*)(toVal->addr) = (value); \
} \
else { \
static type static_val; \
static_val = (value); \
toVal->addr = (XtPointer)&static_val; \
} \
toVal->size = sizeof(type); \
return True; \
}
Definition at line 36 of file StrToShap.c.
| Boolean XmuCvtShapeStyleToString | ( | Display * | dpy, | |
| XrmValue * | args, | |||
| Cardinal * | num_args, | |||
| XrmValue * | fromVal, | |||
| XrmValue * | toVal, | |||
| XtPointer * | data | |||
| ) |
Definition at line 78 of file StrToShap.c.
References buffer, NULL, size, XmuShapeEllipse, XmuShapeOval, XmuShapeRectangle, XmuShapeRoundedRectangle, XtEEllipse, XtEOval, XtERectangle, and XtERoundedRectangle.
00080 { 00081 static char *buffer; 00082 Cardinal size; 00083 00084 switch (*(int *)fromVal->addr) 00085 { 00086 case XmuShapeRectangle: 00087 buffer = XtERectangle; 00088 break; 00089 case XmuShapeOval: 00090 buffer = XtEOval; 00091 break; 00092 case XmuShapeEllipse: 00093 buffer = XtEEllipse; 00094 break; 00095 case XmuShapeRoundedRectangle: 00096 buffer = XtERoundedRectangle; 00097 break; 00098 default: 00099 XtAppWarning(XtDisplayToApplicationContext(dpy), 00100 "Cannot convert ShapeStyle to String"); 00101 toVal->addr = NULL; 00102 toVal->size = 0; 00103 00104 return (False); 00105 } 00106 00107 size = strlen(buffer) + 1; 00108 if (toVal->addr != NULL) 00109 { 00110 if (toVal->size <= size) 00111 { 00112 toVal->size = size; 00113 return (False); 00114 } 00115 strcpy((char *)toVal->addr, buffer); 00116 } 00117 else 00118 toVal->addr = (XPointer)buffer; 00119 toVal->size = size; 00120 00121 return (True); 00122 }
| Boolean XmuCvtStringToShapeStyle | ( | Display * | dpy, | |
| XrmValue * | args, | |||
| Cardinal * | num_args, | |||
| XrmValue * | from, | |||
| XrmValue * | toVal, | |||
| XtPointer * | data | |||
| ) |
Definition at line 57 of file StrToShap.c.
References done, name, XmuCompareISOLatin1(), XmuShapeEllipse, XmuShapeOval, XmuShapeRectangle, XmuShapeRoundedRectangle, XtEEllipse, XtEOval, XtERectangle, XtERoundedRectangle, and XtRShapeStyle.
00059 { 00060 String name = (String)from->addr; 00061 00062 if (XmuCompareISOLatin1(name, XtERectangle) == 0) 00063 done(int, XmuShapeRectangle); 00064 if (XmuCompareISOLatin1(name, XtEOval) == 0) 00065 done(int, XmuShapeOval); 00066 if (XmuCompareISOLatin1(name, XtEEllipse) == 0) 00067 done(int, XmuShapeEllipse); 00068 if (XmuCompareISOLatin1(name, XtERoundedRectangle) == 0) 00069 done(int, XmuShapeRoundedRectangle); 00070 00071 XtDisplayStringConversionWarning(dpy, name, XtRShapeStyle); 00072 00073 return (False); 00074 }
Here is the call graph for this function:

1.5.1