Taking the address of a direct struct instance in static initializer data
(pointer arrays and pointer-typed struct fields) worked on 6502 only. The
typed `&&` operator already provides the needed type, but the IR path broke
on targets without symbol prefixes:
- The virtual target skips symbol prefixing, so address-of symbols kept
their plain scoped names (`main.p1`) while the struct instance storage is
registered as `prog8_struct_instances.main_p1`. IRUnusedCodeRemover then
crashed with "no chunk with label 'main.p1'" (only when optimizing).
StConvert now resolves both the plain scoped form and the p8i_->p8v_
prefixed form used on 6502 and m68k targets.
- Both symbol prefixers rebuilt PtAddressOf nodes for static initializer
elements without their typed/msb flags; the flags are now preserved.
Allow `Point p` declarations with direct field access, initialization and
whole-struct copy on the 6502-based targets as well. Remove the checker
rejection and the corresponding doc/table restrictions.
Direct instances are emitted in a prog8_struct_instances block (or its
_bss variant when uninitialized or a union); references get a consistent
label via the new structInstanceLabel mapping, which rewrites the 'v'
declaration prefix to the 'i' reference prefix of the symbol prefixer.
Pointer-deref chains load the instance's storage address as the start
pointer, so field reads, writes and address-of work as expected.
Allow `Point p` declarations with direct field access, initialization and
whole-struct copy (`q = p` lowers to sys.memcopy) on 32-bit and virtual
targets. 6502 targets reject with a clear error and keep using pointers or
arrays of struct instances.
Direct variables are represented as StStructInstance nodes with static
storage; field access resolves via PtrDereference and address-of/field
addresses use the struct-instances symbol labels. Adds array-literal-to-
struct-initializer lowering and avoids false frame-address-escape warnings.
6502 targets use uword sizes with no alignment overhead; m68k/virtual use
long sizes with even-address alignment. Updated the six pointer examples that used to have their own arena implementation.
Parser: accept `Type[N] name` between type and identifier
(Prog8ANTLR.g4, Antlr2KotlinVisitor) via elementToArray()
for STRUCT_INSTANCE; CodeDesugarer: handle struct-instance
bases, addressOfStructInstance(), whole-struct memcopy
(points[a]=points[b]), and fix variable-index 16-bit scaling
in 6502 AssignmentAsmGen.computeStructArrayElementAddress();
IR: preserve STRUCTDEFS round-trip, VM loader support;
m68k/new6502/intermediate backends; docs + todo updated.
Limitations: not as struct fields (AstChecker/
AstIdentifiersChecker error) nor as sub params.
* Add an index and set some non-ASCII fonts to improve the resulting pdf.
* Fix coroutines index interfering with code block
* Add genindex which is needed to get a link to the html index.
it was still there for backward compatibility reasons with really old prog8 code. If you need a word array to be not split, just use @nosplit on the array.