Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
XmtRegisterEnumConverter(3)Library Functions ManualXmtRegisterEnumConverter(3)

       XmtRegisterEnumConverter(),  XmtConvertStringToEnum() - a resource con-
       verter for enumerated types.

       #include	<Xmt/Converters.h>

       Boolean XmtConvertStringToEnum(Display *dpy, XrmValue *args, Cardinal
		      *num_args, XrmValue *from, XrmValue *to, XtPointer

       void XmtRegisterEnumConverter(String type, String *names, int *values,
		      int num, String *prefixes)


	    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	perma-
		   nently allocated.

		   The number of elements in the names and values arrays.

		   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

       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	speci-
       fied as integers, but the converter will	work correctly even when  con-
       version	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	perma-
       nent-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				  Motif	Tools	   XmtRegisterEnumConverter(3)


Want to link to this manual page? Use this URL:

home | help