Guardian Procedure Calls Reference Manual

MBCS_TRIMFRAGMENT_ Procedure
Summary
Syntax for C Programmers
Syntax for TAL Programmers
Parameters
Related Programming Manual
Summary
The MBCS_TRIMFRAGMENT_ procedure detects and trims trailing multibyte character fragments
from text strings.
In conversational mode operations, a string read from a terminal might contain a partial multibyte
character at the end of the string; the result perhaps of a read operation of an odd length. If the
terminal operator attempts to enter a string of greater length than the requested read count, the
read operation will complete upon reaching the requested read count. If the characters entered
by the terminal operator were all two-byte characters, then the input byte which satisfies the read
count becomes the first byte of a two-byte character. The second byte of the character is lost. Since
multibyte characters and one-byte characters may be freely mixed in text strings, with a multibyte
character beginning at any byte location, a trailing fragment can occur at the end of any
conversational mode read operation. The multibyte character fragment is an undesirable effect of
the use of one-byte I/O operations to handle multibyte characters.
Syntax for C Programmers
#include <cextdecs(MBCS_TRIMFRAGMENT_)>
void MBCS_TRIMFRAGMENT_ ( char *bytestring
,short *bytecount
,[ short charset ]
,[ short *charinfo ] );
Syntax for TAL Programmers
CALL MBCS_TRIMFRAGMENT_ ( bytestring ! i
,bytecount ! i,o
,[ charset ] ! i
,[ charinfo ] ); ! o
Parameters
bytestring
input
STRING .EXT:ref:*
is a pointer to a buffer containing a text string which may contain any mixture of one-byte and
MBCS characters. The content of the bytestring pointer is not altered by the trim operation.
bytecount
input, output
INT .EXT:ref:1
on input, is an integer variable containing the length in bytes of the text string bytestring.
On output, is an integer variable containing the length in bytes of the text string bytestring.
The output value will be less than the input value when a multibyte character fragment has
been found and trimmed from the text string.
826 Guardian Procedure Calls (M)