V19 introduces genuine heap-managed dynamic string runtimes: pb_string64 (ANSI) and pb_wstring64 (UTF-16). Previous versions used fixed-length ASCIIZ stack buffers.
src/runtime/pb_string64.c, include/compiler/runtime/pb_string64.h| Function | Description |
|---|---|
pb_str64_init | Allocate and initialize STRING descriptor |
pb_str64_assign | Assign from C string |
pb_str64_concat | Concatenate multiple STRING operands |
pb_str64_compare | Relational comparison (<, =, >) |
pb_str64_instr | Find substring position |
pb_str64_left/right/mid | Substring extraction |
pb_str64_trim/ucase/lcase | Whitespace/case operations |
pb_str64_space/string | Generate filled strings |
pb_str64_remove/extract | Remove substring / extract field |
pb_str64_format_i64/_d | Numeric formatting |
| UTF-8 conversion | Convert from UTF-16LE to narrow UTF-8 |
src/runtime/pb_wstring64.c, include/compiler/runtime/pb_wstring64.hMirror API of STRING64 operating on uint16_t* (UTF-16 code units). Includes: init, assign, concat, compare, instr, left, right, mid, trim, ucase, lcase, space, string, remove, extract, parse, WCHR, ASCW, from_ascii, to_ascii, plus UTF-8/UTF-16LE conversion helpers.
OPEN "file" FOR RANDOM AS #n LEN = recLen | OPEN "file" FOR BINARY AS #nV19 adds full RANDOM and BINARY file modes. Both open handles for simultaneous read+write using the Win32 file pipeline.
' Open random-access file with 128-byte records OPEN "data.dat" FOR RANDOM AS #1 LEN = 128 ' Write record 5 PUT #1, 5, myRecord ' Read record 3 GET #1, 3, myRecord ' Query position PRINT LOC(1) ' record number (RANDOM mode) PRINT SEEK(1) ' 1-based byte position ' Seek to record SEEK #1, 10
OPEN "data.bin" FOR BINARY AS #2 GET #2, 100, value ' read at byte offset 100 PUT #2, 200, value ' write at byte offset 200 SEEK #2, 50 ' seek to byte 50 PRINT LOC(2) ' byte position (BINARY mode)
Numeric GET/PUT now uses the packed scalar byte size instead of always 8 bytes. UDTs with dynamic STRING/WSTRING fields are rejected with a diagnostic in BINARY/RANDOM mode.
LINE INPUT #n, s$ with encoding-aware filesV19 adds UTF-16LE-to-narrow conversion: LINE INPUT from UTF16LE/UTF16LE_BOM files now reads UTF-16 code units and converts to UTF-8-compatible heap strings for STRING targets.
OPEN "unicode.txt" FOR INPUT ENCODING UTF16LE_BOM AS #1 LINE INPUT #1, s$ ' reads UTF-16LE, converts to STRING CLOSE #1