code wiki / _hdl_build / nx_ownlib.nx

nx_ownlib.nx

buildroot/runtime/_hdl_build/nx_ownlib.nx

91512 B1721 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_store_seed_lib.nx nx_seg_store.nx nx_syscalls.nx nx_ownlib.nx

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

main ol_puts ol_w sys_write ol_slen sys_exit ol_streq ol_selftest sys_mmap nxa_die sys_write ↻ sys_exit ↻ nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ ol_puts ↻ ol_nrm_is sys_mmap ↻ ol_norm sys_mmap ↻ ol_utf8_next ol_fold ol_is_letter_cp ol_drop_tok ol_tokeq ol_roman_val ol_tokeq ↻ ol_catn sys_mmap ↻ ol_catb ol_slen ↻ ol_bufeq

structs

none

consts

31const OL_CAP: i64 = 8388608
32const OL_TAB: i64 = 9
33const OL_NL: i64 = 10
34const OL_SP: i64 = 32
35const OL_ROWCAP: i64 = 8192
36const OL_TITLECAP: i64 = 2048
37const OL_SMALL: i64 = 64
141const 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
142const 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
566const OL_ADV_UNKNOWN: i64 = 0
567const OL_ADV_DONTBUY: i64 = 1
568const OL_ADV_BUY: i64 = 2
569const OL_ADV_WAIT: i64 = 3

functions

39func ol_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
40func ol_w(s: *u8, n: i64) -> i64 { sys_write(1, s, n); return 0 }
41func ol_puts(s: *u8) -> i64 { ol_w(s, ol_slen(s)); return 0 }
42func ol_num(v: i64) -> i64 {
55func ol_prefix() -> *u8 { return "knowledge/store/ownlib-" as *u8 }
called by 2: ol_loadol_add
56func 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 }
57func 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 }
58func ol_catn(d: *u8, o: i64, v: i64) -> i64 {
68func ol_streq(a: *u8, b: *u8) -> i64 {
75func ol_tokeq(t: *u8, n: i64, lit: *u8) -> i64 {
81func ol_bufeq(a: *u8, an: i64, b: *u8, bn: i64) -> i64 {
91func ol_drop_tok(t: *u8, n: i64) -> i64 {
called by 1: ol_norm calls 1: ol_tokeq
110func ol_roman_val(t: *u8, n: i64) -> i64 {
called by 1: ol_norm calls 1: ol_tokeq
154func ol_is_letter_cp(cp: i64) -> i64 {
called by 2: ol_normol_selftest
169func ol_utf8_next(src: *u8, sn: i64, i: i64, cpout: *i64) -> i64 {
called by 1: ol_norm
196func ol_fold(cp: i64, out: *u8) -> i64 {
called by 2: ol_normol_selftest
210func ol_norm(src: *u8, sn: i64, dst: *u8, dcap: i64) -> i64 {
294func ol_has_tok(hay: *u8, hn: i64, t: *u8, tl: i64) -> i64 {
315func ol_subset(a: *u8, an: i64, b: *u8, bn: i64) -> i64 {
called by 2: ol_checkol_selftest calls 1: ol_has_tok
334func ol_field(row: *u8, rn: i64, idx: i64, lenout: *i64) -> *u8 {
351func ol_kind_ok(k: *u8) -> i64 {
359func ol_state_ok(s: *u8) -> i64 {
called by 3: ol_addol_ingestol_selftest calls 1: ol_streq
367func ol_clean(s: *u8) -> i64 {
377func ol_load(buf: *u8, flags: *i64) -> i64 {
382func ol_load_guard(flags: *i64) -> i64 {
391func ol_add(kind: *u8, store: *u8, state: *u8, title: *u8, ext: *u8, note: *u8) -> i64 {
431func ol_check(q: *u8, qn: i64) -> i64 {
515func ol_offer_prefix() -> *u8 { return "knowledge/store/ownoffer-" as *u8 }
called by 2: ol_offerol_advise
516func ol_atoi(s: *u8) -> i64 {
called by 2: ol_offerol_advise
528func ol_money(cents: i64) -> i64 {
called by 2: ol_offerol_advise calls 2: ol_numol_puts
536func ol_offer(store: *u8, title: *u8, pricearg: *u8, cur: *u8) -> i64 {
582func ol_advice_code(lvl: i64, seen: i64, cheaper: i64) -> i64 {
589func ol_advise(pricearg: *u8, q: *u8, qn: i64) -> i64 {
654func ol_list(filter: *u8) -> i64 {
688func ol_stats() -> i64 {
735func ol_handler_prefix() -> *u8 { return "knowledge/store/ownhandler-" as *u8 }
called by 1: ol_handler_add
737func ol_url_host(url: *u8, un: i64, out: *u8, cap: i64) -> i64 {
765func ol_host_claims(host: *u8, hn: i64, pat: *u8, pn: i64) -> i64 {
calls 1: ol_bufeq
772func ol_contains_b(hay: *u8, hn: i64, ndl: *u8, nn: i64) -> i64 {
called by 1: ol_selftest
785func ol_handler_add(id: *u8, host: *u8, pathpat: *u8, kind: *u8, store: *u8, hint: *u8) -> i64 {
815func ol_handler_scan(url: *u8, un: i64, listall: i64) -> i64 {
883func ol_lit_at(buf: *u8, n: i64, i: i64, lit: *u8) -> i64 {
894func ol_lookup(nq: *u8, nqn: i64, buf: *u8, n: i64, nearout: *i64) -> i64 {
944func ol_hexval(c: i64) -> i64 {
955func ol_hex4(page: *u8, pn: i64, j: i64) -> i64 {
971func ol_utf8(cp: i64, dst: *u8, tnp: *i64, cap: i64) {
1008func ol_json_esc(page: *u8, pn: i64, j: i64, dst: *u8, tnp: *i64, cap: i64) -> i64 {
1064func ol_scan(path: *u8, skipfirst: i64) -> i64 {
1235func ol_t(name: *u8, got: i64, want: i64, pass: *i64, tot: *i64) -> i64 {
1243func ol_nrm_is(src: *u8, want: *u8, pass: *i64, tot: *i64, label: *u8) -> i64 {
1261func ol_ingest_verdict(found: i64, refused: i64) -> i64 {
1277func ol_ingest(kind: *u8, store: *u8, state: *u8, path: *u8, key: *u8) -> i64 {
1409func ol_skipflag(argc: i64, arg3: *u8) -> i64 {
1418func ol_same_key(a: *u8, b: *u8) -> i64 {
1428func ol_dectest(src: *u8, dst: *u8, cap: i64) -> i64 {
1445func ol_selftest() -> i64 {
1597func main(argc: i64, argv: *i64) -> i64 {