StrToOrnt.c File Reference

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include "Converters.h"
#include "CharSet.h"

Include dependency graph for StrToOrnt.c:

Go to the source code of this file.

Functions

static void InitializeQuarks (void)
void XmuCvtStringToOrientation (XrmValuePtr args, Cardinal *num_args, XrmValuePtr fromVal, XrmValuePtr toVal)
Boolean XmuCvtOrientationToString (Display *dpy, XrmValuePtr args, Cardinal *num_args, XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data)

Variables

static XrmQuark Qhorizontal
static XrmQuark Qvertical
static Boolean haveQuarks


Function Documentation

static void InitializeQuarks ( void   )  [static]

Definition at line 51 of file StrToOrnt.c.

References haveQuarks, Qhorizontal, and Qvertical.

00052 {
00053   if (!haveQuarks)
00054     {
00055       Qhorizontal = XrmPermStringToQuark(XtEhorizontal);
00056       Qvertical = XrmPermStringToQuark(XtEvertical);
00057       haveQuarks = True;
00058     }
00059 }

Boolean XmuCvtOrientationToString ( Display *  dpy,
XrmValuePtr  args,
Cardinal *  num_args,
XrmValuePtr  fromVal,
XrmValuePtr  toVal,
XtPointer *  data 
)

Definition at line 90 of file StrToOrnt.c.

References buffer, NULL, size, XtorientHorizontal, and XtorientVertical.

00093 {
00094   static String buffer;
00095   Cardinal size;
00096 
00097   switch (*(XtOrientation *)fromVal->addr)
00098     {
00099     case XtorientVertical:
00100       buffer = XtEvertical;
00101       break;
00102     case XtorientHorizontal:
00103       buffer = XtEhorizontal;
00104       break;
00105     default:
00106       XtWarning("Cannot convert Orientation to String");
00107       toVal->addr = NULL;
00108       toVal->size = 0;
00109       return (False);
00110     }
00111 
00112   size = strlen(buffer) + 1;
00113   if (toVal->addr != NULL)
00114     {
00115       if (toVal->size < size)
00116         {
00117           toVal->size = size;
00118           return (False);
00119         }
00120       strcpy((char *)toVal->addr, buffer);
00121     }
00122   else
00123     toVal->addr = (XPointer)buffer;
00124   toVal->size = sizeof(String);
00125 
00126   return (True);
00127 }

void XmuCvtStringToOrientation ( XrmValuePtr  args,
Cardinal *  num_args,
XrmValuePtr  fromVal,
XrmValuePtr  toVal 
)

Definition at line 63 of file StrToOrnt.c.

References InitializeQuarks(), name, NULL, Qhorizontal, Qvertical, XmuNCopyISOLatin1Lowered(), XtorientHorizontal, and XtorientVertical.

00065 {
00066     static XtOrientation orient;
00067     XrmQuark    q;
00068   char name[11];
00069 
00070   InitializeQuarks();
00071   XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
00072   q = XrmStringToQuark(name);
00073 
00074   toVal->size = sizeof(XtJustify);
00075   toVal->addr = (XPointer)&orient;
00076 
00077   if (q == Qhorizontal)
00078         orient = XtorientHorizontal;
00079   else if (q == Qvertical)
00080         orient = XtorientVertical;
00081   else
00082     {
00083       toVal->addr = NULL;
00084       XtStringConversionWarning((char *)fromVal->addr, XtROrientation);
00085     }
00086 }

Here is the call graph for this function:


Variable Documentation

Boolean haveQuarks [static]

Definition at line 45 of file StrToOrnt.c.

XrmQuark Qhorizontal [static]

Definition at line 44 of file StrToOrnt.c.

Referenced by InitializeQuarks(), and XmuCvtStringToOrientation().

XrmQuark Qvertical [static]

Definition at line 44 of file StrToOrnt.c.

Referenced by InitializeQuarks(), and XmuCvtStringToOrientation().


Generated on Sun Mar 4 16:04:25 2007 for Scilab [trunk] by  doxygen 1.5.1