XmParseMapping(3) | Library Functions Manual | XmParseMapping(3) |
XmParseMapping — Data type for a compound string parse mapping "XmParseMapping" "data types" "XmParseMapping"
#include <Xm/Xm.h>
XmParseMapping is an opaque data type for a parse mapping used by XmStringParseText to create a compound string. A parse mapping contains a pattern to be matched in text being parsed to create a compound string. It also contains a compound string, or a function to be invoked to provide a compound string, to be included in the compound string being created whenever the pattern is matched.
An application uses a resource-style interface to specify components for an XmParseMapping. XmParseMappingCreate creates a parse mapping, using a resource-style argument list. XmParseMappingGetValues and XmParseMappingSetValues retrieve and set the components of a parse mapping. XmParseMappingFree recovers memory used by a parse mapping. XmParseTable is an array of XmParseMapping objects.
The XmNinvokeParseProc resource is a function of type XmParseProc, which is defined as follows:
XmIncludeStatus (*XmParseProc) (text_in_out, text_end, type, tag, entry, pattern_length, str_include, call_data)
XtPointer *text_in_out;
XtPointer text_end;
XmTextType type;
XmStringTag tag;
XmParseMapping entry;
int pattern_length;
XmString *str_include;
XtPointer call_data;
A parse procedure provides an escape mechanism for arbitrarily complex parsing. This procedure is invoked when a pattern in the input text is matched with a pattern in a parse mapping whose XmNincludeStatus is XmINVOKE.
The input text is a pointer to the first byte of the pattern that was matched to trigger the call to the parse procedure. The parse procedure consumes as many bytes of the input string as it needs and sets the input text pointer to the following byte. It returns a compound string to be included in the compound string being constructed, and it also returns an XmIncludeStatus indicating how the returned compound string should be handled. If the parse procedure does not set the input text pointer ahead by at least one byte, the parsing routine continues trying to match the input text with the patterns in the remaining parse mappings in the parse table. Otherwise, the parsing routine begins with the new input text pointer and tries to match the input text with patterns in the parse mappings starting at the beginning of the parse table.
The parse procedure returns an XmIncludeStatus indicating how str_include is to be included in the compound string being constructed. Following are the possible values:
The following table defines a set of resources used by the programmer to specify data. The codes in the access column indicate if the given resource can be set at creation time (C), set by using XmParseMappingSetValues (S), retrieved by using XmParseMappingGetValues (G), or is not applicable (N/A).
XmParseMapping Resource Set | ||||
Name | Class | Type | Default | Access |
XmNclientData | XtPointer | NULL | CSG | |
XmNincludeStatus | XmIncludeStatus | XmINSERT | CSG | |
XmNinvokeParseProc | XmParseProc | NULL | CSG | |
XmNpattern | XtPointer | NULL | CSG | |
XmNpatternType | XmTextType | XmCHARSET_TEXT | CSG | |
XmNsubstitute | XmString | NULL | CSG | |
XmParseMappingCreate(3), XmParseMappingFree(3), XmParseMappingGetValues(3), XmParseMappingSetValues(3), XmParseTable(3), and XmString(3).