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

NLSUBSTR

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701
Edition 7 E0300 ♥
Edition 6 E0195

NM and CM callable.

Extracts movelength bytes from the instring to the outstring.

Syntax



            CA        I16V      CA         I16        I16V
  NLSUBSTR (instring, inlength, outstring, outlength, startposition,
  
    I16V        I16V     I16V   U16A   U16A
    movelength, langnum, flags, error, charset);

Parameters


instring

character array (required)

Contains the string from which the substring is extracted. The string can contain both 1 byte and 2 byte Asian characters.

inlength

16-bit signed integer by value (required)

Contains the length, in bytes, of instring.

outstring

character array (required)

Indicates where substring is placed.

outlength

16-bit signed integer by reference (required)

Passes the length, in bytes, of outstring. After a successful call, outlength returns the actual length of the substring moved to outstring.

startposition

16-bit signed integer by value (required)

Contains the offset into instring where the substring starts. A value of zero is the beginning point.

movelength

16-bit signed integer by value (required)

Passes the length, in bytes, of the substring.

langnum

16-bit signed integer by value (required)

Contains the language ID number.

flags

16-bit signed integer by value (required)

Contains the flag word, and is used primarily with Asian languages. It is meaningless with 1 byte languages. It is used when special treatment is required:

Bits

Value/Meaning

12:4

Used if the first character of a substring is the second byte of a 2 byte Asian character:

0000

Return an error condition

0001

Start from startposition +1

0010

Start from startposition -1

0011

Start from startposition, but replace character with a blank in outstring

0100

Start from startposition regardless

8:4

Used if the last character in a substring is the first byte of a 2 byte Asian character:

0000

Return an error condition

0001

Move until movelength +1

0010

Move until movelength -1

0011

Move until movelength, but replace character with a blank in outstring

0100

Move until movelength regardless

0:8

Reserved for the operating system

error

16-bit unsigned integer array (required)

Returns two elements: the first element is the error number; the second element is reserved and always returns 0. The possible error number values are:

Value

Meaning

0

Successful

1

*NLS not installed

2

*Specified language not configured

3

Not returned

4

Not returned

5

*NLS internal error

6

*NLS internal error

7

Invalid inlength

8

Invalid startposition

9

Invalid table element

10

Reserved portion of flags not zero

11

Invalid value for flags ( 8:4)

12

Invalid value for flags (12:4)

13

*Start position first byte of an Asian character, or an overflow condition occurred due to flags

14

*End position second byte of an Asian character, or an overflow condition occurred due to flags

* Do not apply to calls with langnum equal to 0 (NATIVE-3000).

charset

16-bit unsigned integer array (optional)

Contains the character set definition for the language to be used, as returned by itemnum= 12 of NLINFO. When specifying a character set, be sure that the language ID used matches the character set.

Operation Notes


Split-stack calls are not permitted.

Related Information


Intrinsics

NLCOLLATE, NLKEYCOMPARE, NLREPCHAR, NLSWITCHBUF, NLSTRANSLATE

Manual

Native Language Programmer's Guide




NLSCANMOVE


NLSWITCHBUF