NAME
XtDirectConvert − explicitly invoke an "old-style" resource converter and cache result.
Synopsis
void XtDirectConvert(converter, args, num_args, from, to_return)
XtConverter converter;
XrmValuePtr args;
Cardinal num_args;
XrmValuePtr from;
XrmValuePtr to_return;
Inputs
converterSpecifies the "old-style" conversion procedure to be called.
argsSpecifies the argument list that contains the additional arguments needed to perform the conversion (often NULL).
num_argsSpecifies the number of additional arguments (often zero).
fromSpecifies the value to be converted.
Outputs
to_returnReturns the converted value.
Description
XtDirectConvert() looks in the converter cache to see if the named conversion procedure has previously been called with the specified arguments. If so, it sets the cached resource address and size in to_return and returns. If no cached value is found, it sets to_return->addr to NULL and to_return->size to zero and calls converter with its remaining arguments. The results of the conversion are stored in the cache and returned in to_return. If the conversion is successful, to_return->addr will be non-NULL. The data at this address must be copied immediately by the caller, because it may be in static storage owned by the type converter procedure.
Usage
XtDirectConvert() invokes an "old-style" converter of type XtConverter. In Release 4, more flexible (and incompatible) "new-style" converters of type XtTypeConverter were added. Old-style converters are still in use, and if you have to invoke one explicitly, you must use XtDirectConvert(). If you are writing your own converter, you should use the new style. XtConvertAndStore() provides a higher level interface to resource conversion, and is easier to use in most cases. It works with both old-style and new-style converters. You do not often need, in applications or widgets, to convert between resource types directly. Generally you can rely on the Intrinsics resource management code to perform all necessary conversions for you. When writing a resource converter, however, you may find that you need to invoke another converter.
Structures
typedef struct {
unsigned int size;
XPointer addr;
} XrmValue, *XrmValuePtr;
See Also
XtAppAddConverter(1), XtCallConverter(1), XtConvertAndStore(1), XtSetTypeConverter(1),
XtConverter(2), XtTypeConverter(2).
Copyright O’Reilly & Assoc. — X Toolkit Intrinsics Reference Manual © O’Reilly & Associates