Repository navigation
Conversation
Zig ports of the Roc Screen and RocCap libraries, completing the four-helper parity the issue asks for (screen, json, grid, cap): - src/screen.zig: cell-grid Screen with putText/putRow/putGrid/ fill/rule/boxed and renderPlain/renderJson/renderAnsi plus renderRowsJson and boxEdge. The JSON screen document is byte-for-byte the Roc one (run-length style spans, default runs omitted, rows padded to width); tests mirror the Screen.roc expect cases. - src/cap.zig: RocCap Session (issue/attach/requests/counter/ fromPending/answered/done/isEmpty) and the eight request document builders, on top of the SDK json values; documents encode byte-for-byte like Roc. Drawing and session updates mutate in place (the grid port's precedent); renders and documents allocate from a caller-provided allocator. Verified with pinned Zig 0.16.0: zig fmt --check clean, zig build test green (22 new tests), wasm32-freestanding build OK via zig-sdk-test.sh. Stacked on xaltha/12596-zig-sdk (PR #12793, slice 1) — retarget to main once that merges. Refs #12596.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
dezren39
added a commit
that referenced
this pull request
Nov 23, 2026
Slice 3 of #12596: examples/zig-counter/, the third twin of roc-counter/rust-counter — the same counter scenario on the Plaza ABI v1 surface, built on the Zig guest SDK (screen for the boxed view/layout, json for the records document). - src/main.zig: the pure program (init/update/view/layout/records/ wants/snapshot/restore) plus the plaza_* glue mirroring the Rust SDK's plaza_guest! plumbing (leaked model pointer, one shared output slot, alloc/free over the guest allocator); host tests mirror the rust-counter suite. - build.zig builds an import-free wasm32-freestanding module with exactly the 14 documented exports + memory; build.sh runs the tests and refreshes the checked-in counter.wasm so the F12.7 conformance suite can load it without a Zig toolchain. - zig-sdk-test.sh now also covers the example (fmt, host tests, guest build); root .gitignore gains the zig-counter build-output lines, mirroring the zig-sdk ones. Verified with pinned Zig 0.16.0: zig-sdk-test.sh green (SDK suites 53 tests + counter 3/3 host tests, both wasm builds OK); the checked-in counter.wasm driven at the raw ABI level (init, inc x2 with a trimmed event, view byte-identical to the twins' boxed screen document, records {"count":2}, wants {}, snapshot/restore round-trip, restore total on junk) — all checks pass, zero imports. Refs #12596. Stacked on xaltha/12596-zig-sdk-screen-cap (PR #12827); retargets to main as the stack merges.
This branch has not been deployed
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.
Slice 2 of #12596 (Refs #12596). Stacked on PR #12793 (
xaltha/12596-zig-sdk, slice 1) — this PR targets that branch; retarget tomainonce #12793 merges.Adds the remaining two helpers of the four-helper Roc parity set:
src/screen.zig— Zig port ofScreen:Screen.init/putText/putRow/putGrid/fill/rule/boxed,renderPlain,renderJson,renderAnsi, plusrenderRowsJsonandboxEdge. The JSON screen document is byte-for-byte the Roc one (run-length style spans, default runs omitted, rows padded to width, one column per Unicode scalar value). Tests mirror theScreen.rocexpect cases, including the titledboxed, bothrender_jsonspan cases, all threerender_rows_jsoncases, andbox_edge.src/cap.zig— Zig port ofRocCap: aSessionwithissue/attach/requests/counter/fromPending/answered/done/isEmptyand the eight request-document builders (chatRequest,nowRequest,playersRequest,worldRequest,historyRequest,recordsRequest,scheduleAtRequest,scheduleCancelRequest), built on the slice-1jsonvalues and encoding byte-for-byte like Roc (field order andr<counter>ids included).Idioms follow slice 1: drawing/session updates mutate in place (the
Grid.setprecedent), renders/documents allocate from a caller-provided allocator, and ownership is documented at the use site (aSessionowns its pending entries; a cell'schis a borrowed slice).Verification (local, pinned Zig 0.16.0 via
zig-sdk-test.sh):zig fmt --checkclean,zig build testgreen — 22 new tests (15 screen + 7 cap) on top of slice 1's suites,wasm32-freestandingbuild OK. No Roc/Rust/laptop needed.Remaining on #12596 after this: the playable example world and the F12.7 conformance run (plus the
roc-testwiring once the nix Zig version is confirmed).Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.