| u0079 | Index Level | u0089 |
| Syntax | code = OCONV( size^item.id^item.body, "u007A" ) |
| Category | BASIC |
| Type | User Exit |
| Description |
updates a binary item from a FlashBASIC program.
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. "item.id" Item-id of the binary item. "item.body" Since a FlashBASIC program cannot handle segment marks (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) and '_' the underscore character. The following 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 (hex 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 includes the number of segment marks after decompression. In other words, it is the size as if 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, but this space is not contiguous in the Virtual space, which may 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. |
| Options | |
| See Also | |
| Example |
equ DLE to char(16)
x=char(01):DLE:"_" open "dict","object" to fd code=oconv(2:AM:'test':AM:x, "u007a") Write a binary item 'test' containing the TWO characters (in hex) x'01ff' in the dict of the file 'object'. 'code' returns 1 frame allocated. 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") Write 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 non existent) item is used to 'reference' the file. |
| Warnings | Because the file is referenced by a previous statement, avoid single stepping through the sequence of code. |
| Compatibility | AP 6.1 |
| u0079 | Index Level | u0089 |