Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/text/README.md # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / text / README.md` 65 lines ยท 5087 bytes Raw Blame History Rendered 1 # seed/text: bytes, search, fields, integer text and UTF-8 code points in seeded Omega 2 3 The RM5 text unit of `docs/ROADMAP-1.0.md`: a composable `.om` file with no new compiler word, no 4 global, no `text`, no host word and no `om2` line of its own. A program puts `om2` first and 5 concatenates the unit before its own code: 6 7 ```sh 8 { printf 'om2\n'; cat seed/text/text.om app.om; } > app.full.om 9 seed/out/omc < app.full.om > app 10 ``` 11 12 | Function | Result | 13 |---|---| 14 | `tx_eq a b`, `tx_cmp a b` | byte equality; unsigned byte order, a proper prefix first (-1, 0, 1) | 15 | `tx_find h nd from` | first index >= from of nd in h, or `txnone`; empty nd is found at from | 16 | `tx_field s sep p` | end of the field starting at p (next sep, or `len s`); the split loop is in its note | 17 | `tx_pdec`, `tx_phex`, `tx_pdeci` (`s o n v`) | strict `[0-9]+`, `[0-9a-fA-F]+`, `-?[0-9]+` into `v[0]`: 0, `txeempty`, `txedigit`, `txerange` (never wrapped; a bad byte is reported before range) | 18 | `tx_fdec`, `tx_fdeci`, `tx_fhex` (`v [w] b o`) | decimal / lowercase hex (zero-padded to w <= 16) at `b[o ..]`: the end offset, or `txespace` with b unchanged | 19 | `tx_u8ok s o n` | `o + n` when well-formed UTF-8 (RFC 3629 section 4), else the first byte of the first ill-formed or truncated sequence | 20 | `tx_u8dec s o n` | the code point starting at `s[o]` as `(cp << 3) \| length`, or `txnone` when that sequence is ill-formed or truncated (same rules as `tx_u8ok`) | 21 | `tx_u8len cp` | UTF-8 length 1..4 of cp, or 0 for a surrogate D800..DFFF or a value above 10FFFF | 22 | `tx_u8enc cp b o` | cp as UTF-8 at `b[o ..]`: the end offset, `txerange` for a surrogate or out-of-range value, or `txespace` with b unchanged | 23 24 Arrays are OM-2 unsized views and edits owned by the caller; pass a slice with `part A o k`, and never 25 two slices of one array in one call (omc error 19). A slice outside its array traps 3. Long inputs are 26 walked in blocks of 65536, so lengths far above the `1000000`-pass loop guard work. The UTF-8 state 27 machine is the one in `seed/json/json.om` (`js_u8st`), copied as `tx_u8st`; `tx_find` is a plain 28 comparison loop (time up to `len h * len nd`). 29 30 ## Gate 31 32 `sh seed/text/tests/gate.sh` builds `tests/txdrv.om` with the unit, runs the cases from 33 `tests/gen.om` and requires every answer to equal that oracle's. `gen.om` is a separate seeded Omega 34 program that never calls `text.om`: byte loops for comparison, order, search and fields; strict-form 35 checks plus a digit-string comparison against the range limits for integer text; Unicode table 3-7 36 for UTF-8 validation, decoding and encoding. It replaced the Python oracle `tests/gen.py`: on omc 37 ``cfd96b48`` it wrote the same 18 files byte for byte as gen.py at ``b2433586`` (rows=`1840870`), and, built 38 without the 1-byte parse loop, the same files as gen.py at ``965c3996`` (rows=`1839334`), MT19937 seeded and 39 drawn as CPython 3.12's `random.Random(`20261108`)`. UTF-8 coverage: every 1- and 2-byte string, every 40 3-byte string with lead E0..EF, every 4-byte string with lead F0..F4 and second byte 80..BF over a 41 fixed sample of the last two bytes, and seeded random mixes; plus inputs that cross the 65536 block 42 edge. Integer text: fixed edges, every 1-byte string and every byte followed by `1` for D, H and I, 43 and seeded random digit strings. Decoding is checked on every 1- and 2-byte string, every 3-byte 44 string led by E0, E1, E8, ED, EF, sampled 4-byte strings and random mixes; encoding for every 7th code 45 point, the whole D700..E100 band, edges past 10FFFF and every room size 0..4. Twelve mutants (decimal 46 overflow boundary, surrogates, overlong E0 forms, needle at the end, prefix order, -2^63, truncated 47 sequence, 3-byte decode mask, U+D800 encoded, 3-byte lead byte, U+07FF length, backquote read as a 48 hex digit) must each give a wrong answer. Host run 2026-11-10 at omc ``cfd96b48``: `TEXTGATE PASS 49 rows=`1840870` mutants=12`. The gate is standalone and is not in `seed/host/check.sh`; its driver is 50 still sh with perl for the mutant edits (migration debt). Exit status: 0 PASS, 1 FAIL, 3 NOT_RUN (the 51 run was interrupted by HUP, INT or TERM). On a FAIL against the oracle the gate keeps its run folder 52 and names the cases file, the driver's exit status (100+N is trap N) and the got and want files. 53 54 The gate also runs `tests/boundary.cases` through the existing OM-2 conductor. It checks 55 empty end slices, wrapped offsets and counts, insufficient output space, unchanged caller 56 storage on clean refusal, invalid UTF-8 code points, and exact bounds traps. Two additional 57 mutants remove the offset and length guards; each must turn the expected trap into a clean 58 wrong return. These checks do not require allocating enormous arrays. 59 60 Function-mode `text` literals, including empty literals, are refused with error 9 under 61 OMEGESE section 9.12. The boundary cases enforce that named refusal, satisfying RM5's 62 literal support-or-refusal choice without claiming a foreign text ABI. The byte-array 63 functions remain composable; cross-language callers require separate RM7 qualification. 64 65 Not here yet: number text for floats (see `seed/json/jsonf.om`).