code wiki / _hdl_build / nx_ownlib.nx
nx_ownlib.nx
buildroot/runtime/_hdl_build/nx_ownlib.nx
about
nx_ownlib.nx -- SOVEREIGN PRIVATE OWNERSHIP LEDGER: "do I already own this?"
Answers the one question a storefront CANNOT answer for you. Steam refuses to sell you a game you
already have -- but a bundle (Humble/Fanatical) hands you a KEY, and until that key is redeemed no
storefront knows you own it. That is the actual mechanism behind almost every accidental rebuy.
So ENTITLEMENT (you hold the right) and REDEMPTION (it is in a library) are SEPARATE columns here,
never one boolean -- an unredeemed key is the single most valuable thing this ledger can tell you.
Plane: knowledge/store/ownlib- Row (TSV, 8 cols):
<epoch_id>\t<kind>\t<store>\t<state>\t<norm_title>\t<title>\t<ext_id>\t<note>
kind = game|movie|tv|book|audiobook
state = redeemed|unredeemed|refunded|wishlist
norm_title = ol_norm(title) -- the MATCH KEY, edition/article/roman-numeral insensitive.
MATCH POLICY (deliberate, and the reason this tool can be trusted): EXACT normalized-key equality
asserts OWNED. Anything looser is reported as a NEAR match for human review and NEVER claims
ownership -- naive token-subset matching would announce you own "Hollow Knight Silksong" because
you own "Hollow Knight". A ledger that lies once is a ledger nobody consults again.
nx_ownlib add <kind> <store> <state> <title> [ext_id] [note]
nx_ownlib check <title words...>
nx_ownlib list [kind]
nx_ownlib stats
nx_ownlib selftest
Fail-closed: unknown kind/state commits NOTHING; a SHORT plane load refuses to answer at all
(answering "not owned" from a partial ledger is exactly how you buy a thing twice).
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 31 | const OL_CAP: i64 = 8388608 |
| 32 | const OL_TAB: i64 = 9 |
| 33 | const OL_NL: i64 = 10 |
| 34 | const OL_SP: i64 = 32 |
| 35 | const OL_ROWCAP: i64 = 8192 |
| 36 | const OL_TITLECAP: i64 = 2048 |
| 37 | const OL_SMALL: i64 = 64 |
| 141 | const OL_FOLD_L1: *u8 = "a a a a a a aec e e e e i i i i d n o o o o o o u u u u y thssa a a a a a aec e e e e i i i i d n o o o o o o u u u u y thy " as *u8 |
| 142 | const OL_FOLD_LA: *u8 = "a a a a a a c c c c c c c c d d d d e e e e e e e e e e g g g g g g g g h h h h i i i i i i i i i i ijijj j k k k l l l l l l l l l l n n n n n n n n n o o o o o o oeoer r r r r r s s s s s s s s t t t t t t u u u u u u u u u u u u w w y y y z z z z z z s " as *u8 |
| 566 | const OL_ADV_UNKNOWN: i64 = 0 |
| 567 | const OL_ADV_DONTBUY: i64 = 1 |
| 568 | const OL_ADV_BUY: i64 = 2 |
| 569 | const OL_ADV_WAIT: i64 = 3 |
functions
| 39 | func ol_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 40 | func ol_w(s: *u8, n: i64) -> i64 { sys_write(1, s, n); return 0 } |
| 41 | func ol_puts(s: *u8) -> i64 { ol_w(s, ol_slen(s)); return 0 } |
| 42 | func ol_num(v: i64) -> i64 { |
| 55 | func ol_prefix() -> *u8 { return "knowledge/store/ownlib-" as *u8 } |
| 56 | func ol_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o+i] = s[i]; i = i + 1 } return o + i } |
| 57 | func ol_catb(d: *u8, o: i64, s: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { d[o+i] = s[i]; i = i + 1 } return o + n } |
| 58 | func ol_catn(d: *u8, o: i64, v: i64) -> i64 { |
| 68 | func ol_streq(a: *u8, b: *u8) -> i64 { |
| 75 | func ol_tokeq(t: *u8, n: i64, lit: *u8) -> i64 { |
| 81 | func ol_bufeq(a: *u8, an: i64, b: *u8, bn: i64) -> i64 { |
| 91 | func ol_drop_tok(t: *u8, n: i64) -> i64 { |
| 110 | func ol_roman_val(t: *u8, n: i64) -> i64 { |
| 154 | func ol_is_letter_cp(cp: i64) -> i64 { |
| 169 | func ol_utf8_next(src: *u8, sn: i64, i: i64, cpout: *i64) -> i64 {
called by 1: ol_norm |
| 196 | func ol_fold(cp: i64, out: *u8) -> i64 { |
| 210 | func ol_norm(src: *u8, sn: i64, dst: *u8, dcap: i64) -> i64 { |
| 294 | func ol_has_tok(hay: *u8, hn: i64, t: *u8, tl: i64) -> i64 { |
| 315 | func ol_subset(a: *u8, an: i64, b: *u8, bn: i64) -> i64 { |
| 334 | func ol_field(row: *u8, rn: i64, idx: i64, lenout: *i64) -> *u8 { |
| 351 | func ol_kind_ok(k: *u8) -> i64 { |
| 359 | func ol_state_ok(s: *u8) -> i64 { |
| 367 | func ol_clean(s: *u8) -> i64 { |
| 377 | func ol_load(buf: *u8, flags: *i64) -> i64 { |
| 382 | func ol_load_guard(flags: *i64) -> i64 { |
| 391 | func ol_add(kind: *u8, store: *u8, state: *u8, title: *u8, ext: *u8, note: *u8) -> i64 { |
| 431 | func ol_check(q: *u8, qn: i64) -> i64 { |
| 515 | func ol_offer_prefix() -> *u8 { return "knowledge/store/ownoffer-" as *u8 } |
| 516 | func ol_atoi(s: *u8) -> i64 { |
| 528 | func ol_money(cents: i64) -> i64 { |
| 536 | func ol_offer(store: *u8, title: *u8, pricearg: *u8, cur: *u8) -> i64 { |
| 582 | func ol_advice_code(lvl: i64, seen: i64, cheaper: i64) -> i64 { |
| 589 | func ol_advise(pricearg: *u8, q: *u8, qn: i64) -> i64 { |
| 654 | func ol_list(filter: *u8) -> i64 { |
| 688 | func ol_stats() -> i64 { |
| 735 | func ol_handler_prefix() -> *u8 { return "knowledge/store/ownhandler-" as *u8 }
called by 1: ol_handler_add |
| 737 | func ol_url_host(url: *u8, un: i64, out: *u8, cap: i64) -> i64 { |
| 765 | func ol_host_claims(host: *u8, hn: i64, pat: *u8, pn: i64) -> i64 {
calls 1: ol_bufeq |
| 772 | func ol_contains_b(hay: *u8, hn: i64, ndl: *u8, nn: i64) -> i64 {
called by 1: ol_selftest |
| 785 | func ol_handler_add(id: *u8, host: *u8, pathpat: *u8, kind: *u8, store: *u8, hint: *u8) -> i64 { |
| 815 | func ol_handler_scan(url: *u8, un: i64, listall: i64) -> i64 { |
| 883 | func ol_lit_at(buf: *u8, n: i64, i: i64, lit: *u8) -> i64 { |
| 894 | func ol_lookup(nq: *u8, nqn: i64, buf: *u8, n: i64, nearout: *i64) -> i64 { |
| 944 | func ol_hexval(c: i64) -> i64 { |
| 955 | func ol_hex4(page: *u8, pn: i64, j: i64) -> i64 { |
| 971 | func ol_utf8(cp: i64, dst: *u8, tnp: *i64, cap: i64) { |
| 1008 | func ol_json_esc(page: *u8, pn: i64, j: i64, dst: *u8, tnp: *i64, cap: i64) -> i64 { |
| 1064 | func ol_scan(path: *u8, skipfirst: i64) -> i64 { |
| 1235 | func ol_t(name: *u8, got: i64, want: i64, pass: *i64, tot: *i64) -> i64 { |
| 1243 | func ol_nrm_is(src: *u8, want: *u8, pass: *i64, tot: *i64, label: *u8) -> i64 { |
| 1261 | func ol_ingest_verdict(found: i64, refused: i64) -> i64 { |
| 1277 | func ol_ingest(kind: *u8, store: *u8, state: *u8, path: *u8, key: *u8) -> i64 { |
| 1409 | func ol_skipflag(argc: i64, arg3: *u8) -> i64 { |
| 1418 | func ol_same_key(a: *u8, b: *u8) -> i64 { |
| 1428 | func ol_dectest(src: *u8, dst: *u8, cap: i64) -> i64 { |
| 1445 | func ol_selftest() -> i64 { |
| 1597 | func main(argc: i64, argv: *i64) -> i64 { |