1
/* $XConsortium: StrToBS.c,v 1.2 90/12/20 13:27:50 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"
22
#define done(address, type) \
23
{ (*toVal).size = sizeof(type); (*toVal).addr = (caddr_t) address; }
27
XmuCvtStringToBackingStore (args, num_args, fromVal, toVal)
28
XrmValue *args; /* unused */
29
Cardinal *num_args; /* unused */
33
char lowerString[1024];
35
static int backingStoreType;
36
static XrmQuark XtQEnotUseful, XtQEwhenMapped, XtQEalways, XtQEdefault;
37
static int haveQuarks = 0;
40
XtWarning("String to BackingStore conversion needs no extra arguments");
42
XmuCopyISOLatin1Lowered (lowerString, XtEnotUseful);
43
XtQEnotUseful = XrmStringToQuark(lowerString);
44
XmuCopyISOLatin1Lowered (lowerString, XtEwhenMapped);
45
XtQEwhenMapped = XrmStringToQuark(lowerString);
46
XmuCopyISOLatin1Lowered (lowerString, XtEalways);
47
XtQEalways = XrmStringToQuark(lowerString);
48
XmuCopyISOLatin1Lowered (lowerString, XtEdefault);
49
XtQEdefault = XrmStringToQuark(lowerString);
52
XmuCopyISOLatin1Lowered (lowerString, (char *) fromVal->addr);
53
q = XrmStringToQuark (lowerString);
54
if (q == XtQEnotUseful) {
55
backingStoreType = NotUseful;
56
done (&backingStoreType, int);
57
} else if (q == XtQEwhenMapped) {
58
backingStoreType = WhenMapped;
59
done (&backingStoreType, int);
60
} else if (q == XtQEalways) {
61
backingStoreType = Always;
62
done (&backingStoreType, int);
63
} else if (q == XtQEdefault) {
64
backingStoreType = Always + WhenMapped + NotUseful;
65
done (&backingStoreType, int);
67
XtStringConversionWarning((char *) fromVal->addr, "BackingStore");