denis@vlsisj.VLSI.COM (Denis Bohm) (05/08/90)
I have some code that gets some options using XrmGetResource.
After I get the type and value I want to convert it using the
standard converters (so I can get the standard error messages).
I see that there is a procedure XtDirectConvert that takes a
pointer to a converter, but how do I get a pointer to a converter?
I am not installing a converter because I am not using XtInitialize(),
I'm using xtToolkitInitialize and XtOpenDisplay, and I could not figure
out how to specify that the converter be invoked.
I looked at lib/Xt/Convert.c add didn't see any externally available
way to get a converter from the source and destination type.
Does anyone know who to get this option converted to an int?
This is the source with the problem:
#include <stdio.h>
#include <X11/Intrinsic.h>
main(argc, argv)
int argc;
char *argv[];
{
static XrmOptionDescRec options[] = {
{"-frame_delay", "*frame_delay", XrmoptionSepArg, NULL}
};
XtAppContext app_context;
Display *dpy;
char *type;
XrmValue value;
Bool result;
app_context = XtCreateApplicationContext();
XtToolkitInitialize();
dpy = XtOpenDisplay(app_context, "", "test", "Test", options,
XtNumber(options), &argc, argv);
if (dpy == NULL) {
fprintf(stderr, "can't open display...\n");
exit(1);
}
result = XrmGetResource(XtDatabase(dpy), "test.frame_delay",
"Test.Frame_delay", &type, &value);
if (result) {
/*
### how do I get a converter given the source and destination types? ###
XtDirectConvert(converter, NULL, 0, &value, &int_value);
if (int_value.address == NULL) {
fprintf(stderr, "can't convert resource value to int...\n");
exit(2);
}
printf("frame_delay: %d\n", (int) int_value.addr);
*/
printf("frame_delay: %s\n", value.addr);
}
exit(0);
}
--
Denis Bohm (usenet: decwrl!vlsisj!denis)
(internet: vlsisj!denis@decwrl.dec.com)