code wiki / (root) / nx_artlicense.nx

nx_artlicense.nx

buildroot/runtime/nx_artlicense.nx

16340 B337 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_artlicense.nx -- THE LICENSE CHAIN AND THE ROYALTY LEDGER AS DATA (2026-08-24, /compare/phototwin PT4). license_tier: ORIGINAL No hw writes (Rule 26). nx_artlicense check <sku> [now_epoch] [territory] [conf] -> 0 SHIP-OK | 3 REVIEW | 4 REFUSE | 2 usage nx_artlicense royalty <ledger.tsv> <sku> <sale_id> <sale_cents> [conf] -> appends ONE row (idempotent on sale_id) nx_artlicense total <ledger.tsv> <sku> -> royalty cents owed for the sku THE DEFECT IT PREVENTS. A garment print is a REPRODUCTION of the photograph, the gamut-mapped twin is a DERIVATIVE work, and selling it is DISTRIBUTION -- three of the exclusive rights the copyright owner holds by default (knowledge/fetched/cmp_phototwin_copyright.html). A SKU carries those rights only through a chain row that grants all three, inside its term, inside its territory, with the artist's approval of the soft proof on record. FAIL-CLOSED like nx_licgate: no chain, an expired or not-yet-started term, a missing right, or an unknown territory against a restricted chain -> REFUSE (4). A chain without proof approval -> REVIEW (3): the artist, not a machine, settles that. Silence is never permission. The exit vocabulary is nx_licgate's (0/3/4) so one caller can compose both verdicts with one rule. CHAIN ROWS (knowledge/artlicense.conf), pipe-separated, one per SKU: chain|<sku>|<owner>|<rights letters from r d s>|<term_start_epoch>|<term_end_epoch>|<territories csv or *>|<royalty_permil>|<proof_approved yes or no> ROYALTY LEDGER (tab-separated, APPEND-ONLY -- history is sacred, rule 13): epoch sku sale_id sale_cents royalty_cents owner royalty = sale_cents * permil / 1000 in INTEGER CENTS (floor), never float.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_artlicense.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main al_usage al_w sys_write al_streq 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 ↻ al_total sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close al_field al_span_eq al_span_num al_w ↻ al_wn al_w ↻ sys_mmap ↻ sys_write ↻ al_atoi sys_read_file ↻ al_reason_text

structs

none

consts

23const AL_EXIT_OK: i64 = 0
24const AL_EXIT_USAGE: i64 = 2
25const AL_EXIT_REVIEW: i64 = 3
26const AL_EXIT_REFUSE: i64 = 4
27const AL_CONF_DEFAULT: *u8 = "knowledge/artlicense.conf"
28const AL_PIPE: i64 = 124
29const AL_NL: i64 = 10
30const AL_HASH: i64 = 35
31const AL_TAB: i64 = 9
32const AL_COMMA: i64 = 44
33const AL_STAR: i64 = 42
34const AL_ASCII_ZERO: i64 = 48
35const AL_ASCII_NINE: i64 = 57
36const AL_DECIMAL: i64 = 10
37const AL_F_SKU: i64 = 1
38const AL_F_OWNER: i64 = 2
39const AL_F_RIGHTS: i64 = 3
40const AL_F_START: i64 = 4
41const AL_F_END: i64 = 5
42const AL_F_TERR: i64 = 6
43const AL_F_PERMIL: i64 = 7
44const AL_F_APPROVED: i64 = 8
45const AL_FIELDS: i64 = 9
46const AL_RIGHT_REPRODUCE: i64 = 114 // r
47const AL_RIGHT_DERIVE: i64 = 100 // d
48const AL_RIGHT_DISTRIBUTE: i64 = 115 // s
49const AL_PERMIL: i64 = 1000
50const AL_LINE_CAP: i64 = 1024
51const AL_MODE_0644: i64 = 420
52const AL_NOW_UNSET: i64 = 0 - 1
53const AL_LEDGER_F_SKU: i64 = 1
54const AL_LEDGER_F_SALE: i64 = 2
55const AL_LEDGER_F_ROYALTY: i64 = 4
56const AL_DUP: i64 = 0 - 1
58const AL_R_OK: i64 = 0
59const AL_R_NO_CHAIN: i64 = 1
60const AL_R_NOT_STARTED: i64 = 2
61const AL_R_EXPIRED: i64 = 3
62const AL_R_RIGHT_MISSING: i64 = 4
63const AL_R_TERRITORY: i64 = 5
64const AL_R_NOT_APPROVED: i64 = 6
65const AL_R_MALFORMED: i64 = 7
66const AL_R_NO_CONF: i64 = 8
67const AL_OUT_REASON: i64 = 0
68const AL_OUT_PERMIL: i64 = 1
69const AL_OUT_OWNER_OFF: i64 = 2
70const AL_OUT_OWNER_LEN: i64 = 3
71const AL_OUT_SLOTS: i64 = 8
72const AL_SLOT: i64 = 8

functions

74func al_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 3: al_wnal_usagemain calls 1: sys_write
75func al_wn(v: i64) -> i64
called by 1: main calls 3: al_wsys_mmapsys_write
88func al_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 }
called by 1: main
89func al_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
90func al_atoi(s: *u8) -> i64
called by 1: main
99func al_span_num(buf: *u8, off: i64, len: i64) -> i64
105func al_span_eq(buf: *u8, off: i64, len: i64, s: *u8) -> i64
112func al_field(buf: *u8, s: i64, e: i64, idx: i64, sep: i64, box: *i64) -> i64
128func al_span_has_char(buf: *u8, off: i64, len: i64, c: i64) -> i64
called by 1: al_license_chain
134func al_territory_ok(buf: *u8, off: i64, len: i64, terr: *u8) -> i64
called by 1: al_license_chain calls 1: al_span_eq
149func al_license_chain(buf: *u8, n: i64, sku: *u8, now: i64, terr: *u8, out: *i64) -> i64
195func al_reason_text(r: i64) -> *u8
called by 1: main
209func al_royalty_ledger(ledger: *u8, sku: *u8, sale_id: *u8, sale_cents: i64, permil: i64, owner_buf: *u8, owner_off: i64, owner_len: i64, now: i64) -> i64
246func al_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } return p }
called by 1: al_royalty_ledger
247func al_catn(d: *u8, o: i64, v: i64) -> i64
called by 1: al_royalty_ledger calls 1: sys_mmap
259func al_total(ledger: *u8, sku: *u8, rows_out: *i64) -> i64
284func al_usage() -> i64
called by 1: main calls 1: al_w
289func main(argc: i64, argv: *i64) -> i64