code wiki / (root) / nx_licdetect_lib.nx

nx_licdetect_lib.nx

buildroot/runtime/nx_licdetect_lib.nx

9446 B228 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_licdetect_lib.nx -- WHICH LICENCE IS THIS TEXT? Read from the bytes, never from a declaration. THE MEASUREMENT THAT JUSTIFIES A TEXT DETECTOR AT ALL. Across 124,278 licence chains surveyed in the field, 96.5% of datasets and 95.8% of models LACK the required licence text, and only 2.3% / 3.2% satisfy both the licence-text and copyright requirements. The survey's conclusion is this lib's design rule: LICENCE FILES AND NOTICES, NOT METADATA, ARE THE SOURCE OF LEGAL TRUTH. It is also what the librarian measured directly: of 26 NAVER releases, 2 carried any licence string on the listing, and the one we then FETCHED turned out to be 483 bytes off the canonical Apache text because it adds a copyright preamble and drops the appendix. A declaration is a claim; bytes are not. THREE OUTCOMES, AND ONLY ONE OF THEM IS AN ANSWER: DETECTED exactly one licence's REQUIRE markers all matched and none of its EXCLUDE markers did UNKNOWN nothing matched -- fail-closed, the artifact does NOT advance to evidence=READ AMBIGUOUS two or more matched -- ALSO fail-closed. A text matching two licences is not a decision, and taking the first would be a coin flip wearing a verdict. MARKERS ARE DATA (knowledge/license_markers.conf), so a new licence costs a row and never a rebuild, and every marker set is auditable by a human reading the conf rather than the binary. NO GUESSED CAPS: every array here is sized from the CONF'S OWN LINE COUNT, counted before allocation. A marker table cannot overflow a bound derived from the file that defines it. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_licdetect_lib.nx nx_licdetect.nx nx_licdetect_gate.nx

imports: nx_syscalls.nx

imported by: nx_licdetect.nxnx_licdetect_gate.nx

structs

none

consts

25const LD_DETECTED: i64 = 0
26const LD_UNKNOWN: i64 = 1
27const LD_AMBIGUOUS: i64 = 2
29const LD_TAB: i64 = 9
30const LD_NL: i64 = 10
31const LD_HASH: i64 = 35
32const LD_M: i64 = 77 // 'M' marker row
33const LD_V: i64 = 86 // 'V' verified-against row
34const LD_WORD: i64 = 8
35const LD_ROW_STRIDE: i64 = 5 // lic_off, lic_len, kind, mk_off, mk_len
36const LD_KIND_REQUIRE: i64 = 1
37const LD_KIND_EXCLUDE: i64 = 2
38const LD_CTX_SLOTS: i64 = 8 // buf, n, rows, nrows, vrows, nv

functions

40func ld_streq_n(a: *u8, ao: i64, an: i64, b: *u8, bo: i64, bn: i64) -> i64
48func ld_contains(text: *u8, n: i64, buf: *u8, mo: i64, mn: i64) -> i64
called by 1: ld_detect
66func ld_field(buf: *u8, s: i64, e: i64, idx: i64, box: *i64) -> i64
called by 1: ld_ctx
82func ld_ctx() -> *i64
160func ld_marker_set_verified(ctx: *i64, lo: i64, ll: i64) -> i64
called by 2: mainmain calls 1: ld_streq_n
174func ld_detect(ctx: *i64, text: *u8, n: i64, out: *i64) -> i64
224func ld_result_name(r: i64) -> *u8
called by 1: main