WSTRING64 & WinAPI V14 compiler V16 WinAPI
V13: WSTRING64 runtime library created (20+ helper functions). V14: Compiler now lowers WSTRING expressions through the full pipeline: lexer -> parser -> semantic -> codegen -> PE.
WSTRING Variable Declarations
Syntax:
LOCAL w AS WSTRING | STATIC w AS WSTRING | GLOBAL w AS WSTRINGV14 allocates WSTRING descriptors in the stack frame or static storage. The descriptor contains: data pointer, length (UTF-16 code units), capacity, and flags.
STRING / WSTRING Cross-Assignment
Syntax:
w$ = s$ (STRING to WSTRING) | s$ = w$ (WSTRING to STRING)LOCAL s AS STRING, w AS WSTRING s = "Hello" w = s ' MultiByteToWideChar (CP_ACP -> UTF-16) s = w ' WideCharToMultiByte (UTF-16 -> CP_ACP)
Generated Assembly (STRING -> WSTRING)
; Get source STRING pointer -> RCX ; WideCharToMultiByte or MultiByteToWideChar mov rcx, 65001 ; CP_UTF8 / CP_ACP xor rdx, rdx ; dwFlags = 0 mov r8, [rbp - src_ptr] ; source mov r9, -1 ; null-terminated call [__imp_MultiByteToWideChar] ; returns required buffer size
PRINT WSTRING
Syntax:
PRINT w$Lowered through a temporary narrow conversion buffer (WideCharToMultiByte), then output via the existing WriteFile console path.
LEN(WSTRING) / STRPTR(WSTRING)
Syntax:
LEN(w$) | STRPTR(w$)LEN returns UTF-16 code-unit count from the descriptor. STRPTR returns the raw WCHAR* data pointer.
LOCAL w AS WSTRING w = "Hello" PRINT LEN(w) ' 5 (code units) PRINT STRPTR(w) ' address of wchar_t data
WSTRING Comparison
Syntax:
w1$ = w2$ | w1$ <> w2$ | w1$ < w2$Mixed STRING/WSTRING expressions auto-promote to WSTRING. Comparison uses memcmp on UTF-16 byte spans.
WSTRING Concatenation
Syntax:
w$ = w1$ + w2$ | w$ = s$ + w$ (mixed)Uses pb_wstr64_concat runtime. Mixed STRING/WSTRING operands are promoted to WSTRING before concatenation.
FUNCTION AS WSTRING
Syntax:
FUNCTION name(BYVAL w AS WSTRING) AS WSTRINGFull scalar return path. Parameters can be BYVAL or default BYREF WSTRING.
FUNCTION Greet(BYVAL name AS WSTRING) AS WSTRING
LOCAL w AS WSTRING
w = "Hello, " + name
FUNCTION = w
END FUNCTION
Still Pending
- Dynamic STRING/WSTRING fields inside UDTs (recursive init/copy/free)
- UDT arrays and REDIM PRESERVE with dynamic string fields
- Full Unicode console/file I/O (WriteConsoleW, UTF-16 file modes)
- WSTRING arrays