P.OPT - set/change options for the pattern compiler.
Usage:
B:
%b/manif/pmatch
ret = p.opt(class, action, chr);
C:
#include <pmatch.h>
ret = p_opt(pm_opt_class class, pm_action action,
int chr);
Examples:
p.set(PM_End, PM_On, '/'); /* / delimits a pattern */
Options:
- class
- defines the type of option being affected. It must be one
of the following values:
- PM_Special
- affects the special pattern characters.
"chr" must be one of
"d$([{*.^|+<>@".
- PM_Escape
- sets the pattern escape character to
"chr".
- PM_End
- says that this call to P.OPT adds or removes a
character from the list of characters that
terminate a pattern. In this case,
"chr" is the character to be added or
removed.
- action
- must be one of the following values:
- PM_Off (0)
- turns off the special meaning of a pattern
character, sets the escape character to none, or
deletes "chr" from the list of pattern
termination characters.
- PM_On (1)
- turns on the special meaning of a pattern
character, sets the escape character to
"chr", or adds "chr" to the
list of pattern termination characters.
- PM_Query (2)
- just tests the state of the character.
- chr
- is the character value being set/tested.
- ret
- is -1 if any of the arguments to P.OPT is invalid. For
PM_Special and PM_End, P.OPT returns PM_Off or PM_On,
depending whether the "chr" was set before you
called P.OPT. For PM_Escape, P.OPT returns the previous
escape character.
Description:
P.OPT sets or tests options for P.COMPILE.
Calls to P.OPT do not affect the behavior of patterns that have
already been compiled; therefore you should use P.OPT to set
options before you call P.COMPILE.
A call like
p.opt(PM_Escape, PM_Off, chr);
ignores the "chr" argument, and sets the escape
character to zero. This means there is no escape character.
p.opt(PM_Escape, PM_On, 0);
has the same effect.
Copyright © 1996, Thinkage Ltd.