NLMATCHINIT
Compiles a pattern into a form for use with the NLMATCH intrinsic.
Syntax
_________________________________________________
| |
| I BA I |
| result := NLMATCHINIT(pattern,pattern_len,|
| IV BA I |
| langid,comp_pattern,comp_buf_size); |
_________________________________________________
Functional Return
Zero is returned if the compilation of pattern is successful. Otherwise
the result contains the error code.
result Integer Error Meaning
001 NLS is not installed
002 The specified language is not configured
101 Missing "]" or "}" operators
102 Expecting alpha symbols
104 Incomplete pattern specified
105 Bad range operation specified
203 Pattern too big
900 Internal state machine error
Parameters
pattern Byte array (required)
A byte array containing the pattern to be compiled.
Leading and training spaces are ignored.
A pattern consists of a series of special
characters that indicate the type of data to be
selected. These characters are:
-------------------------------------------------------------------------------------------
| |
| Char Selected |
| |
| a Uppercase, lowercase, or 16-bit Asian character |
| |
| u Uppercase alphabetic character |
| |
| l Lowercase alphabetic character |
| |
| b Blank (space) |
| |
| d Digits, as defined in the NLS character attribute table |
| |
| ? Any character |
| |
-------------------------------------------------------------------------------------------
Other metacharacter indicate choice, grouping, and
ranges:
-------------------------------------------------------------------------------------------
| |
| Char Operation |
| |
| ! Transparency |
| |
| , Choice |
| |
| : Range |
| |
| { } Grouping |
| |
| [ ] Optional |
| |
| + Repetition (one or more) |
| |
| * Repetition (zero or more) |
| |
-------------------------------------------------------------------------------------------
Pattern operators are evaluated in the following
order, where x and y are any character for the
language:
------------------------------------------------------------------------------------------------
| | | |
| Char | Operation | Example |
| | | |
------------------------------------------------------------------------------------------------
| | | |
| ! | Transparency | !x |
| | | |
| : | Range | x:y |
| | | |
| +/* | Repetition (1/0 or more) | x+ or x* |
| | | |
| | Concatenation | xy |
| | | |
| , | Choice | x,y |
| | | |
------------------------------------------------------------------------------------------------
The repetition, concatenation, and choice operators
can be used with patterns. For instance: x,y are
any pattern in this case.
pattern_len Integer (required)
Length, in bytes, of the pattern to be compiled.
langid Integer by value (required)
The language ID number of the language to be used
in compiling the pattern.
comp_pattern Byte array (required)
A byte array specifying where the compiled pattern
is to be constructed.
comp_buf _size Integer (required)
The length of the comp_pattern, in bytes, available
for constructing the compiled pattern.
Operation Notes
NLMATCHINIT converts the regular expression in pattern to a reduced,
finite state machine and places it in comp_pattern, where pattern_len is
the expression's length in bytes, and comp_buf_size is the maximum size
of the comp_pattern in bytes.
If comp_buf_size is 0 (zero), only a syntax check of pattern is performed
and no comp_pattern will be generated.
If NLMATCHINIT returns 0 (zero), the compilation of pattern succeeded.
If comp_buf_size > 0 (zero), the comp_pattern contains the compiled
pattern and comp_buf_size contains its actual size in bytes.
If NLMATCHINIT is not zero, an error occurred and NLMATCHINIT returns the
error code in return. In such cases, pattern_len contains the
zero-origin index into pattern and tells you how far the scan has
progressed (the scan may have completed). The pattern description and
grammar are the ones used in VPLUS.
Related Information
Intrinsics NLMATCH
Commands
Manuals Data Entry and Forms Management System VPLUS
Reference Manual (32209-90001) and Native Language
Programmer's Guide (32650-90022),