HPlogo MPE/iX Intrinsics Reference Manual > Chapter 9 Command Definitions (MAIL-PUTJCW)

NLMATCHINIT

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701 ♥
Edition 7 E0300
Edition 6 E0195

Compiles a pattern into a form for use with the NLMATCH intrinsic.

Syntax



  I                      BA       I            IV
  result := NLMATCHINIT (pattern, pattern_len, langid,
                         BA            I
                         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 Meaning
001NLS is not installed
002The specified language is not configured
101Missing "]" or "}" operators
102Expecting alpha symbols
104Incomplete pattern specified
105Bad range operation specified
203Pattern too big
900Internal 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:

CharSelected
aUppercase, lowercase, or 16-bit Asian character
uUppercase alphabetic character
lLowercase alphabetic character
bBlank (space)
dDigits, as defined in the NLS character attribute table
?Any character

Other metacharacter indicate choice, grouping, and ranges:

CharSelected
!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
:Rangex:y
+ / *Repetition (1 / 0 or more)x+ or x*
Concatenationxy
,Choicex,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
Manuals Native Language Programmer's Guide




NLMATCH


NLNUMSPEC