|type||The representation type for which the converter is to be registered. This string must be permanently allocated.|
|names||A sorted array of names for each enumerated value. These names and this array must be permanently allocated.|
|values||An array of enumerated values that correspond to each of the strings in the names array. This array must be permanently allocated.|
|num_values||The number of elements in the names and values arrays.|
|prefixes||A NULL-terminated array of strings which may optionally appear as prefixes of the strings in the names array. These strings and this array must be permanently allocated.|
XmtConvertStringToEnum() is a new-style resource converter of type XtTypeConverter. It is a generalized resource converter appropriate for converting any enumerated type. It is intended to be registered with the Xt resource conversion mechanism rather than being invoked directly, so its arguments are not documented here.
XmtRegisterEnumConverter() registers XmtConvertStringToEnum() for the representation type type. The converter is registered so that type, names, values, num_values, and prefixes are passed to it in its args argument.
names is an array of strings that will be recognized by the converter. It must be in alphabetical order so that it can be searched with a binary search algorithm.
values is an array of integers that specifies the enumerated value that corresponds to each string in the names array. These values are specified as integers, but the converter will work correctly even when conversion is requested to a one-byte or a two-byte value. To save space in widget instance records, enumerated values are often stored in one byte unsigned char fields.
prefixes is a NULL-terminated array of strings that specify optional prefixes that the converter will recognize in front of any string it converts. Each of these prefixes is optional, but if they do occur, they must appear in the order specified in this array.
All of the strings and arrays passed to this function must be permanent-their values must not change, and if they are in allocated memory, that memory must not be freed for the life time of the application. This is generally ensured by using statically initialized arrays.
Chapter 8, Utility Functions.
|Xmt||XMTREGISTERENUMCONVERTER (3)||Motif Tools|