StrToBS.c File Reference

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

Include dependency graph for StrToBS.c:

Go to the source code of this file.

Functions

static void InitializeQuarks (void)
void XmuCvtStringToBackingStore (XrmValue *args, Cardinal *num_args, XrmValuePtr fromVal, XrmValuePtr toVal)
Boolean XmuCvtBackingStoreToString (Display *dpy, XrmValuePtr args, Cardinal *num_args, XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data)

Variables

static XrmQuark QnotUseful
static XrmQuark QwhenMapped
static XrmQuark Qalways
static XrmQuark Qdefault
static Boolean haveQuarks


Function Documentation

static void InitializeQuarks ( void   )  [static]

Definition at line 50 of file StrToBS.c.

References haveQuarks, name, Qalways, Qdefault, QnotUseful, QwhenMapped, XmuNCopyISOLatin1Lowered(), XtEalways, XtEdefault, XtEnotUseful, and XtEwhenMapped.

Referenced by XmuCvtStringToBackingStore(), XmuCvtStringToJustify(), and XmuCvtStringToOrientation().

00051 {
00052   if (!haveQuarks)
00053     {
00054       char name[11];
00055 
00056       XmuNCopyISOLatin1Lowered(name, XtEnotUseful, sizeof(name));
00057       QnotUseful = XrmStringToQuark(name);
00058       XmuNCopyISOLatin1Lowered(name, XtEwhenMapped, sizeof(name));
00059       QwhenMapped = XrmStringToQuark(name);
00060       XmuNCopyISOLatin1Lowered(name, XtEalways, sizeof(name));
00061       Qalways = XrmStringToQuark(name);
00062       XmuNCopyISOLatin1Lowered(name, XtEdefault, sizeof(name));
00063       Qdefault = XrmStringToQuark(name);
00064       haveQuarks = True;
00065     }
00066 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 103 of file StrToBS.c.

References buffer, NULL, size, XtEalways, XtEdefault, XtEnotUseful, and XtEwhenMapped.

00106 {
00107   static String buffer;
00108   Cardinal size;
00109 
00110   switch (*(int *)fromVal->addr)
00111     {
00112     case NotUseful:
00113       buffer = XtEnotUseful;
00114       break;
00115     case WhenMapped:
00116       buffer = XtEwhenMapped;
00117       break;
00118     case Always:
00119       buffer = XtEalways;
00120       break;
00121     case (Always + WhenMapped + NotUseful):
00122       buffer = XtEdefault;
00123       break;
00124     default:
00125       XtWarning("Cannot convert BackingStore to String");
00126       toVal->addr = NULL;
00127       toVal->size = 0;
00128       return (False);
00129     }
00130 
00131   size = strlen(buffer) + 1;
00132   if (toVal->addr != NULL)
00133     {
00134       if (toVal->size < size)
00135         {
00136           toVal->size = size;
00137           return (False);
00138         }
00139       strcpy((char *)toVal->addr, buffer);
00140     }
00141   else
00142     toVal->addr = (XPointer)buffer;
00143   toVal->size = sizeof(String);
00144 
00145   return (True);
00146 }

void XmuCvtStringToBackingStore ( XrmValue *  args,
Cardinal *  num_args,
XrmValuePtr  fromVal,
XrmValuePtr  toVal 
)

Definition at line 70 of file StrToBS.c.

References InitializeQuarks(), int, name, Qalways, Qdefault, QnotUseful, QwhenMapped, XmuNCopyISOLatin1Lowered(), and XtRBackingStore.

00072 {
00073     XrmQuark    q;
00074   char name[11];
00075     static int  backingStoreType;
00076 
00077     if (*num_args != 0)
00078         XtWarning("String to BackingStore conversion needs no extra arguments");
00079 
00080   InitializeQuarks();
00081   XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
00082 
00083   q = XrmStringToQuark (name);
00084   if (q == QnotUseful)
00085         backingStoreType = NotUseful;
00086   else if (q == QwhenMapped)
00087         backingStoreType = WhenMapped;
00088   else if (q == Qalways)
00089         backingStoreType = Always;
00090   else if (q == Qdefault)
00091         backingStoreType = Always + WhenMapped + NotUseful;
00092   else
00093     {
00094       XtStringConversionWarning((char *)fromVal->addr, XtRBackingStore);
00095       return;
00096     }
00097   toVal->size = sizeof(int);
00098   toVal->addr = (XPointer)&backingStoreType;
00099 }

Here is the call graph for this function:


Variable Documentation

Boolean haveQuarks [static]

Definition at line 44 of file StrToBS.c.

Referenced by InitializeQuarks(), and XmuCvtStringToGravity().

XrmQuark Qalways [static]

Definition at line 43 of file StrToBS.c.

Referenced by InitializeQuarks(), and XmuCvtStringToBackingStore().

XrmQuark Qdefault [static]

Definition at line 43 of file StrToBS.c.

Referenced by InitializeQuarks(), and XmuCvtStringToBackingStore().

XrmQuark QnotUseful [static]

Definition at line 43 of file StrToBS.c.

Referenced by InitializeQuarks(), and XmuCvtStringToBackingStore().

XrmQuark QwhenMapped [static]

Definition at line 43 of file StrToBS.c.

Referenced by InitializeQuarks(), and XmuCvtStringToBackingStore().


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