Struct enhancements#81
Merged
Merged
Conversation
Extend the SIZE keyword from STRING-only to all base types in struct definitions. Array members push their address (like STRING) and reject scalar assignment. Includes spec, state file, and test. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add STRUCM.structdef pointer to link struct members to their type definition, enabling chained -> resolution for nested structs. Supports arbitrary nesting depth (a->b->c->field) by accumulating offsets at compile time. Updated push_struct (read), assign_to_struct (write), and address_of_object (@addr) to handle embedded structs. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Phase 3: Add structptrtype for typed pointer members (Inner *ptr). Enables -> chaining through pointer members in push_struct, assign_to_struct, and VARPTR. BSS emits ds.l 1 for pointer slot. Phase 4: Allow self-referential struct pointers (Node *nxt) by relaxing the self-reference check in define_structure(). Embedded self-references (infinite size) are still rejected. Full test suite passes (123 tests across all categories). Co-Authored-By: Claude Opus 4.6 <[email protected]>
Support Inner items SIZE n syntax for arrays of embedded structs inside struct definitions. Indexed access via c->items(i)->field with runtime index expressions, constant and variable indices. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Allow s->arr(i) syntax for BYTE/SHORTINT/LONGINT/SINGLE SIZE n members, matching the existing struct array indexing pattern. Previously these required manual PEEK/POKE with pointer arithmetic. Three helper functions extracted to reduce duplication: - gen_typed_array_addr(): index computation (misc.c, calls parser) - gen_push_value_a0(): push value at (a0) by type (codegen.c) - gen_store_value_a0(): pop and store value by type (codegen.c) Supported in all struct access contexts: direct, embedded struct chains, struct pointer chains, and inside struct array elements. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Document typed arrays (SIZE for all types), indexed access s->member(i), chained -> for embedded structs, typed struct pointers, self-referential structs, and struct arrays as members in ref.txt, ace.txt, quickref.txt, and CubicIDE quickinfo. Co-Authored-By: Claude Opus 4.6 <[email protected]>
#80) Use Phase 5 struct array members (HttpHeader SIZE 16/32) instead of STRING SIZE 5120/10240 with manual pointer arithmetic. Remove 7 helper functions (_HdrSetSlot, _HdrGetName, etc.) and rewrite 9 callers to use typed struct array indexing. Also change TcpConn _bufData from STRING to BYTE (Phase 1 feature). Binary layout unchanged. Co-Authored-By: Claude Opus 4.6 <[email protected]>
8ba5126 to
5b02abb
Compare
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.