u007a user exit

The u007A user exit updates a binary item from a FlashBASIC or BASIC program.

Syntax

code = oconv(size^ item-ID^ item.body, "u007a")

Parameter(s)

item-ID Item-ID of the binary item.
item.body Because a FlashBASIC or BASIC program cannot handle segment mark (decimal 255) characters, a special encoding scheme is used. A segment mark is replaced by the special two character sequence dle_ , where dle is a data link escape character (decimal 16). These special sequences are replaced at file time:
dle dle Replaced by one dle.
dle _ Replaced by one segment mark.
dle xx Replaced by one or more segment marks, where xx is the number of segment marks from 1 to 126, plus 128 (hexadecimal x 80). For example, dle x 81 is replaced by one segment mark, dle x A3 is replaced by x A3 -x 80 =x 23 =35 segment marks.
size Item body size, in decimal. The size does not include the special dle escape sequences, but it should include the number of segment marks after decompression. In other words, it is the size where the item body was not encoded with dle sequences. If the size is not large enough, additional overflow is allocated to hold the binary item. However, this space is not contiguous in the virtual space, which can have some impact on performance while accessing the binary item.
code Return code:
>0 Number of frames allocated to hold the binary item.
-1 Not enough overflow.
-2 Illegal dle sequence.
-3 Illegal file reference.

Description

The file in which the item is stored is referenced by the last open or last file access preceding the call. See the examples below.

Note: Because the file is referenced by a previous statement, avoid single stepping through the sequence of code.

Example(s)

The example below writes a binary item test containing the two characters (in hexadecimal) x’01ff’ in the dictionary of the file object. code returns 1 frame allocated.

equ dle to char(16)
x=char(01):dle:"_"
open "dict","object" to fd
code=oconv(2:am:’test’:am:x, "u007a")

The example below writes a binary item test containing 32 consecutive segment marks, followed by one DLE, in a file described by the file descriptor (fd). Note how the read of a dummy (possibly nonexistent) item is used to reference the file.

equ DLE to char(16)
x=DLE:char(128+32):DLE:DLE
read dummy from fd,’’ else dummy=’’
code=oconv(33:am:’test’:am:x, "u007a")