Next: , Up: Control Sequence Matching   [Contents][Index]


3.1 Matcher Configuration

Matcher configuration consists of two parts: the number of matching patterns, and the pattern values. Invoke function ctlseqs_matcher_config to configure a matcher.

struct ctlseqs_matcher *matcher /* = ... */;
char const *patterns[] = {
    // ...
};
struct ctlseqs_matcher_options options = {
    .patterns  = patterns,
    .npatterns = sizeof(patterns) / sizeof(char const *),
};
int result = ctlseqs_matcher_config(matcher, &options);
// ...

Each invocation of ctlseqs_matcher_config on the same matcher overwrites the data generated from the last invocation. Upon success, the function returns CTLSEQS_OK. If the function fails to allocate enough memory, returns CTLSEQS_NOMEM.

Caution: If the patterns field in struct ctlseqs_matcher_options is invalid, function behaviour is undefined. See Patterns for details.