code wiki / (root) / nx_varcensus_lib.nx

nx_varcensus_lib.nx

buildroot/runtime/nx_varcensus_lib.nx

24713 B594 linesdepth 2pulls 2 transitivereach 4 importersview sourcekind librarytopic varcensus
docsdependenciesstructsconstsfunctions

about

nx_varcensus_lib.nx -- the VaM corpus census's DATA-DRIVEN pieces, importable by the CLI (nx_varcensus) and its gate. (1) a growable byte ARENA -- tables store OFFSETS into it, so growth (a bigger mapping plus a copy) never leaves a dangling pointer; an i64 vector rides the same arena in 8-byte cells. (2) a growable string COUNTER -- FNV-1a, open addressing, the slot table doubled at half load; entries are kept in FIRST-SEEN ORDER so a report reads in the order the corpus was walked (and the walk itself is sorted). (3) the RULES conf (the classifier is DATA, never code). Rows, TAB separated, '#' comments: role|format <TAB> <class> <TAB> <kind> <TAB> <pattern> [<TAB> <kind> <TAB> <pattern>] both conditions must hold screen <TAB> <reason letter A-Z> <TAB> class <TAB> <role class> a member of that class sets the reason screen <TAB> <reason letter A-Z> <TAB> namecontains <TAB> <token> the package id contains the token deptag <TAB> <tag> <TAB> prefix <TAB> <dependency id prefix> a direct dependency with that prefix kinds: dirent (name ends with a slash) | exact | prefix | suffix | contains. Matching is on LOWERCASED names and lowercased patterns. Within one axis the FIRST matching rule wins, and a member no rule matches lands in the implicit class `other` of that axis -- so each axis is a PARTITION of the members by construction, and the census asserts the sum. A row this parser does not understand is an ERROR counted with its line number: a malformed rules file cannot produce a census (the CLI refuses), because a silently skipped rule moves members into `other` with no trace. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_varcensus_lib.nx nx_varcensus.nx nx_varcensus_candidate_t139.nx nx_varcensus_gate.nx

imports: nx_syscalls.nx

imported by: nx_varcensus.nxnx_varcensus_candidate_t139.nxnx_varcensus_gate.nx

structs

none

consts

20const VCL_PAD: i64 = 16
21const VCL_ARENA_INIT: i64 = 65536
22const VCL_CELL: i64 = 8
23const VCL_A_PTR: i64 = 0
24const VCL_A_USED: i64 = 1
25const VCL_A_CAP: i64 = 2
26const VCL_A_N: i64 = 3
28const VCL_TAB: i64 = 9
29const VCL_LF: i64 = 10
30const VCL_CR: i64 = 13
31const VCL_SPACE: i64 = 32
32const VCL_HASHMARK: i64 = 35
33const VCL_SLASH: i64 = 47
34const VCL_DOT: i64 = 46
35const VCL_UPPER_A: i64 = 65
36const VCL_UPPER_Z: i64 = 90
37const VCL_CASE_OFF: i64 = 32
38const VCL_ASCII_0: i64 = 48
39const VCL_DEC: i64 = 10
42const VCL_FNV_BASIS: i64 = 2166136261
43const VCL_FNV_PRIME: i64 = 16777619
44const VCL_U32_MASK: i64 = 0xffffffff
45const VCL_SLOTS_INIT: i64 = 256
46const VCL_E_W: i64 = 4
47const VCL_E_HASH: i64 = 0
48const VCL_E_KOFF: i64 = 1
49const VCL_E_KLEN: i64 = 2
50const VCL_E_COUNT: i64 = 3
51const VCL_C_SLOTS: i64 = 0
52const VCL_C_CAP: i64 = 1
53const VCL_C_NENT: i64 = 2
54const VCL_C_ENTS: i64 = 3
55const VCL_C_KEYS: i64 = 4
56const VCL_C_N: i64 = 5
59const VCL_K_NONE: i64 = 0
60const VCL_K_DIRENT: i64 = 1
61const VCL_K_EXACT: i64 = 2
62const VCL_K_PREFIX: i64 = 3
63const VCL_K_SUFFIX: i64 = 4
64const VCL_K_CONTAINS: i64 = 5
65const VCL_AX_ROLE: i64 = 0
66const VCL_AX_FORMAT: i64 = 1
67const VCL_AX_N: i64 = 2
68const VCL_R_W: i64 = 8
69const VCL_R_AXIS: i64 = 0
70const VCL_R_CLASS: i64 = 1
71const VCL_R_K1: i64 = 2
72const VCL_R_P1: i64 = 3
73const VCL_R_L1: i64 = 4
74const VCL_R_K2: i64 = 5
75const VCL_R_P2: i64 = 6
76const VCL_R_L2: i64 = 7
77const VCL_S_W: i64 = 4
78const VCL_S_BIT: i64 = 0
79const VCL_S_KIND: i64 = 1
80const VCL_S_ARG: i64 = 2
81const VCL_S_LEN: i64 = 3
82const VCL_SK_CLASS: i64 = 1
83const VCL_SK_NAME: i64 = 2
84const VCL_T_W: i64 = 3
85const VCL_T_TAG: i64 = 0
86const VCL_T_P: i64 = 1
87const VCL_T_L: i64 = 2
88const VCL_REASONS: i64 = 26
89const VCL_MAX_FIELDS: i64 = 8
91const VCL_RS_RULES: i64 = 0
92const VCL_RS_NRULES: i64 = 1
93const VCL_RS_STR: i64 = 2
94const VCL_RS_CLASS_ROLE: i64 = 3
95const VCL_RS_CLASS_FORMAT: i64 = 4
96const VCL_RS_OTHER_ROLE: i64 = 5
97const VCL_RS_OTHER_FORMAT: i64 = 6
98const VCL_RS_SCREEN: i64 = 7
99const VCL_RS_NSCREEN: i64 = 8
100const VCL_RS_DEPTAG: i64 = 9
101const VCL_RS_NDEPTAG: i64 = 10
102const VCL_RS_TAGS: i64 = 11
103const VCL_RS_ERRORS: i64 = 12
104const VCL_RS_FIRST_ERR_LINE: i64 = 13
105const VCL_RS_N: i64 = 16
106const VCL_OTHER: *u8 = "other"

functions

108func vcl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
109func vcl_lc(c: i64) -> i64 { if c >= VCL_UPPER_A { if c <= VCL_UPPER_Z { return c + VCL_CASE_OFF } } return c }
110func vcl_lower(src: *u8, n: i64, out: *u8) -> i64
116func vcl_eq(a: *u8, ao: i64, b: *u8, bo: i64, n: i64) -> i64
123func vcl_arena_new(init: i64) -> *i64
132func vcl_arena_reserve(a: *i64, extra: i64) -> i64
148func vcl_at(a: *i64, off: i64) -> *u8 { return (a[VCL_A_PTR] + off) as *u8 }
149func vcl_used(a: *i64) -> i64 { return a[VCL_A_USED] }
151func vcl_put(a: *i64, src: *u8, so: i64, n: i64) -> i64
162func vcl_app(a: *i64, src: *u8, so: i64, n: i64) -> i64
called by 1: vcl_apps calls 1: vcl_arena_reserve
171func vcl_apps(a: *i64, s: *u8) -> i64 { return vcl_app(a, s, 0, vcl_slen(s)) }
172func vcl_appc(a: *i64, c: i64) -> i64
179func vcl_appn(a: *i64, v: i64) -> i64
195func vcl_appclean(a: *i64, src: *u8, so: i64, n: i64) -> i64
208func vcl_push(a: *i64, v: i64) -> i64
215func vcl_vec_n(a: *i64) -> i64 { return a[VCL_A_USED] / VCL_CELL }
216func vcl_vec_at(a: *i64, i: i64) -> i64 { let cell: *i64 = (a[VCL_A_PTR] + i * VCL_CELL) as *i64; return cell[0] }
219func vcl_hash(s: *u8, so: i64, n: i64) -> i64
229func vcl_counter_new() -> *i64
238func vcl_ent(c: *i64, idx: i64) -> *i64
242func vcl_counter_n(c: *i64) -> i64 { return c[VCL_C_NENT] }
243func vcl_counter_count(c: *i64, idx: i64) -> i64 { let e: *i64 = vcl_ent(c, idx); return e[VCL_E_COUNT] }
244func vcl_counter_key(c: *i64, idx: i64) -> *u8 { let e: *i64 = vcl_ent(c, idx); return vcl_at(c[VCL_C_KEYS] as *i64, e[VCL_E_KOFF]) }
245func vcl_counter_klen(c: *i64, idx: i64) -> i64 { let e: *i64 = vcl_ent(c, idx); return e[VCL_E_KLEN] }
246func vcl_counter_rehash(c: *i64, ncap: i64) -> i64
264func vcl_counter_add(c: *i64, src: *u8, so: i64, n: i64, inc: i64) -> i64
296func vcl_counter_find(c: *i64, src: *u8, so: i64, n: i64) -> i64
315func vcl_kind(src: *u8, so: i64, n: i64) -> i64
325func vcl_field_is(src: *u8, so: i64, n: i64, lit: *u8) -> i64
called by 1: vcl_rules_parse calls 2: vcl_slenvcl_eq
330func vcl_put_lower(str: *i64, src: *u8, so: i64, n: i64) -> i64
335func vcl_rules_err(rs: *i64, line: i64) -> i64
called by 1: vcl_rules_parse
342func vcl_rules_parse(text: *u8, n: i64) -> *i64
495func vcl_nclasses(rs: *i64, axis: i64) -> i64
499func vcl_class_name(rs: *i64, axis: i64, idx: i64) -> *u8
505func vcl_match(kind: i64, name: *u8, nl: i64, pat: *u8, pl: i64) -> i64
520func vcl_classify(rs: *i64, axis: i64, name: *u8, nl: i64) -> i64
545func vcl_screen(rs: *i64, role_counts: *i64, id_lc: *u8, idl: i64) -> i64
569func vcl_deptag(rs: *i64, dep_lc: *u8, dl: i64) -> i64
584func vcl_app_reasons(a: *i64, mask: i64) -> i64
called by 2: vc_censusvc_census calls 1: vcl_appc