aboutsummaryrefslogtreecommitdiffstats
path: root/prototypes
Commit message (Collapse)AuthorAgeFilesLines
* Add text states and cursors to Pure moduleseunhhu2026-09-258-249/+1155
| | | | | | | | | | | | | | | | | | | | | | Module format v3 adds text states, cursors, UTF-8 constants, text inputs and text views. A text state is a runtime-owned draft without a store, so a large text edits as an extent tree. Cursors are byte positions the runtime keeps on character boundaries: insertion pushes cursors at or after the point, removal gathers cursors inside the range, and a failed event returns every text draft and cursor to where it was. The verifier types a cursor by the text it belongs to and rejects editing one text with another's cursor. Operations cover constants, concatenation, shortest round-trip number text, character, line and byte counts, character and column-keeping line moves, insert, remove, line views, whole-text replacement and UTF-8 checked conversion from bytes. Replies of edited documents or texts are copied before they are finished. pure-run gains text input and text output. test-module covers typing Korean and emoji, moves that stop at the ends, line moves, views, rollback, invalid UTF-8 and replacement, text-specific verifier rules, and 20,000 damaged text modules whose cursors always stay on character boundaries under ASan/UBSan.
* Allow drafts without a stored baseeunhhu2026-09-253-2/+49
| | | | | | | | | | Runtime-owned values such as an app's text need the same extent tree as stored documents without a store file. pure_draft_new creates such a draft; it edits, lends versions and reclaims like any draft but refuses to commit. pure_draft_restore returns a held draft to an earlier version, so a failed event can abandon its edits. A test runs 4,000 random edits with a fifth abandoned against a flat oracle under ASan/UBSan.
* Add typed messages and keyed documents to Pure moduleseunhhu2026-09-258-161/+1044
| | | | | | | | | | | | | | | | | | | | Module format v2 adds byte values, message inputs with u32 and bytes-tail fields, one keyed byte collection, replies and require. The verifier checks every operand's type and the context each operation may run in, and allows branches and joins only at an empty stack, so typed values never merge. A message event opens its key's working version through a PureData host, conflicts early on a stale base revision, runs its handlers, and commits only if they succeed; a failed event leaves documents and states unchanged. Replies lend payload or document extents, and a document reply is copied before commit. pure_tree_data implements the host on tree store drafts, and pure-edit-module offers the document CLI contract of pure-edit from a module. test-module adds document semantics on an in-memory host (not found, create, conflict before bounds, limits, short payloads, busy commits, stable replies, require, state rollback), typed verifier rules, and 20,000 damaged message modules run safely under ASan/UBSan.
* Keep draft versions readable within a transactioneunhhu2026-09-253-7/+60
| | | | | | | | | A module event may read a document and then edit it; the value it read must not change. pure_draft_version captures an immutable version and pure_draft_read_version lends its extents; pure_draft_hold suspends arena reclamation while a transaction still reads earlier versions. A test reads the original 200 KB after 400 held edits and checks reclamation on release.
* Define Pure module format v1 with a static verifiereunhhu2026-09-255-1/+748
| | | | | | | | | | | | | | | Pure now owns the format its toolchains target, as the JVM owns class files. A v1 module carries f64 states, key inputs, atomic event handlers and pure views. pure_module_load checks sizes, names, keys, operands, forward-only branches, reachability and stack heights at every join before anything runs, so execution needs no stack checks and each event is bounded by its handler length. PureApp runs events on a pending copy and replaces modules keeping states by name, without allocation. Semantics match the workbench engine, including IEEE minimum/maximum on signed zeros. test-module covers behaviour, atomic faults, 26 rejection checks and 20,000 damaged modules under ASan/UBSan; pure-run is a JSON test host.
* Let the runtime own working versions as draftseunhhu2026-09-255-9/+437
| | | | | | | | | | | | | | | | | | state.h gives any app a runtime-owned working version of a stored value on the tree store. A draft shares unchanged extents with the stored version, edits in memory by path copying, lends ordered extents without copying, and commits only its new nodes when the key is still at its base revision. A failed commit changes neither the draft nor the store; a draft whose file was replaced by compaction copies its stored extents on commit. Unreachable arena nodes are reclaimed once they outweigh max(reachable, 32 KiB). Typing into the middle of a 1 MiB document and saving each character peaked at about 1,660 KiB RSS with a draft against about 4,480 KiB for an app copy compared with storage on save; saves were only 1-2 ms faster. This corrects 073, which had attributed the TUI's remaining 8 ms to that comparison. Drafts are not yet charged to the runtime budget or visible to .pure definitions.
* Add selected single-file persistent tree storeeunhhu2026-09-256-6/+1399
| | | | | | | | | | | | | | | | store-tree.c keeps every document in one append-only file as a persistent B-tree of byte extents, with the key catalog in the same structure. A splice writes only the changed leaf and path; unchanged extents are shared between versions, readers take no lock, and two alternating head slots publish a commit after its nodes are durable. Compaction rewrites reachable nodes. On the recorded ext4 host a durable 1-byte middle insert into a 1 MiB document took 8.58 ms against 78.51 ms for the default store, and the real TUI's Ctrl+S after typing took 16.60 ms against 84.59 ms. check-tree runs the store's crash/oracle tests and the unchanged runtime, splice, async and real-PTY editor checks on it. It stays opt-in: linked code is 12.7 KB larger and contiguous multi-leaf reads copy.
* Move document key listing behind the store APIeunhhu2026-09-256-40/+90
| | | | | | | | | | The terminal editor listed documents by reading the flat store's obj- file names, so a UI host depended on one storage layout. pure_store_keys now lists keys through the selected store; per-object file stores share store-keys.c, linked only by hosts that browse documents, so the default CLI and HTTP hosts are unchanged. The source TUI ceiling reviews the measured 368-byte cost.
* Verify paged document app under 4 KiB AArch64 kerneleunhhu2026-09-248-3/+70
|
* Admit aligned OS pages in selected paged storeeunhhu2026-09-248-5/+47
|
* Establish native micro runtime checkpointeunhhu2026-09-241095-0/+125691