Other PSL Functions

Unlike the functions in PSL International Functions, the functions described in this section existed before internationalized versions of PATROL were available. These functions have little to do with internationalized PSL development, but each function has a feature or two that supports internationalization. The following section briefly describes these features.

Command Execution Functions

The following table lists the command execution functions that have internationalization features.

Function

Description

execute()

You should set the CODECVT locale category to match the locale of the command output. If CODECVT differs from CTYPE, this function converts the locale and returns text in CTYPE.

fopen()

You should set the CODECVT locale category to match the locale of the text data in the file. This function opens a channel that has a registered locale equal to CODECVT. During subsequent read and write operations, PATROL automatically converts the locale when necessary.

popen()

You should set the CODECVT locale category to match the locale of the text data in the channel. This function opens a channel that has a registered locale equal to CODECVT. During subsequent read and write operations, PATROL automatically converts the locale when necessary.

system()

You should set the CODECVT locale category to match the locale of the command output. If CODECVT differs from CTYPE, this function converts the locale and returns text in CTYPE.


Input and Output Functions

The following table lists the input and output functions that have internationalization features. 

Function

Description


printf() 
sprintf()

The printf() and sprintf() functions support specification of the converted argument position.

read()

If the registered locale for the channel differs from CTYPE, read() converts the locale and returns text in the CTYPE locale. The popen() and fopen() functions register the locale for a channel. The size parameter specifies the number of bytes that the function reads from the channel. Note: This description differs from the PATROL 3.2.09i version of read().

readln()

If the registered locale for the channel differs from CTYPE, readln() converts the locale and returns text in the CTYPE locale. The popen() and fopen() functions register the locale for a channel.

write()

If the registered locale for the channel differs from CTYPE, write() converts the locale and writes text data to the channel in the locale for the channel. The popen() and fopen() functions register the locale for a channel.

File Handling Functions

The following table lists the file-handling functions that have internationalization features. 

Function

Description

cat()

You should set the CODECVT locale category to match the locale of the text data in the file. If CODECVT differs from CTYPE, this function converts the locale and returns text in CTYPE.

fseek()

The offset parameter of the fseek() function specifies the number of bytes. Note: In PATROL 3.2.09i, offset specifies the number of characters (including multiple-byte characters).

ftell()

The ftell() function returns the file position as the number of bytes from the beginning of the file. Note: In PATROL 3.2.09i, this function returns the number of characters (including multiple-byte characters).

String Functions

The following table lists the string functions that have internationalization features. 

Function

Description

grep()

The grep() function supports multiple-byte characters in the regular-expression and text parameters. It also supports ranges expression using code point ordering.

index() 
rindex()

The index() and rindex() functions support multiple-byte characters in the text and string parameters. These functions return position counts in characters.

length()

The length() function returns the number of characters (including multiple-byte characters).

lines() 
nthline() 
nthlinef()
tail()

These functions support multiple-byte characters in the text and separator parameters.

ntharg() 
nthargf()

The ntharg() and nthargf() functions support multiple-byte characters in the textdelimiters and separator parameters.

substr()

The substr() function supports multiple-byte characters in the text parameter. The start and length parameters specify the number of characters.

tolower() 
toupper()

The tolower() and toupper() functions use the locale of the CTYPE locale category to change the case of text.

trim()

The trim() function supports multiple-byte characters in the str and chars parameters.


Set Functions

The following table lists the set functions that have internationalization features. 

Function

Description

sort()

The sort() function supports multiple-byte characters in list element strings using code point ordering. The position parameter specifies the position in terms of the number of characters from the beginning of the list.

difference() 
intersection()
subset() 
union() 
unique()

These functions support multiple-byte characters in the element strings.


Date and Time

The following table lists the date and time functions that have internationalization features. 

Function

Description


asctime()
date()

The asctime() and date() functions use a default date and time format that is determined by the locale of the TIME locale category.


Where to go from here

Internationalized PSL Scripts

Was this page helpful? Yes No Submitting... Thank you

Comments