code wiki / (root) / nx_twincard_lib.nx

nx_twincard_lib.nx

buildroot/runtime/nx_twincard_lib.nx

28843 B644 linesdepth 6pulls 7 transitivereach 23 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_twincard_lib.nx -- THE TWIN CARD: one declared person or synth, every value on a declared axis with its SIDE, unit, method and source (aesthetictwin AT23, symbol tc_card_check, 2026-09-16). Operator: "a system that is more comprehensive than the illusion cards", then "minute variation between left and right ... down to the smallest unit ... each freckle or smaller is reproducible". An Illusion character card is a PNG carrying about a hundred unitless sliders and no provenance; this card is DATA (knowledge/twincard/<slug>.card) whose axes are declared in knowledge/twincard.axes (identity, body, soft tissue, skin, hair, eyes, ears, lips, teeth, hands, feet, body hair, nails) and, for the face, ARE the canon ids of knowledge/facecanon.conf -- one ruler for the face, never two. A PAIRED axis is recorded per side (L and R are two values, never one), an unpaired axis is C. Individual surface features (freckle, mole, scar, vein, tattoo, birthmark) are one row each in a declared body-surface region with permil chart coordinates, a diameter in mm100 and a CIELAB colour, so a freckle field is reproducible feature by feature. Every axis may name its RULER (the sovereign organ and symbol that measures it); the CLI censuses which rulers exist today, so the measurement investment is a number rather than a wish. Every row carries a METHOD (measured, observed, declared, generated) and a SOURCE, so the card reports what it knows and how; coverage, the method partition and the completed left-right pairs are numbers a page can print. Card rows: card|<slug>|<display>|<class>|<sex>|<licence>|<schema> axis|<section>|<id>|<side L R C>|<value>|<method>|<source>|<when> feature|<kind>|<side>|<region>|<u permil>|<v permil>|<diam mm100>|<L10>|<a10>|<b10>|<method>|<source> ref|<key>|<mirror>|<sha>|<licence>|<note> shot|<refkey>|<date>|<age>|<pose>|<expression>|<light>|<backdrop>|<camera>|<accessories> Schema rows: axis|<section>|<id>|<unit>|<lo>|<hi>|<paired 0 1>|<note> class|<section>|<id>|<word> ruler|<section>|<id or *>|<organ path>|<symbol> region|<word>|<note> Refusals are named: an undeclared axis (a group label is not an axis), a value outside its band, a class word not declared, a method outside the four, a side that contradicts the pairing, a duplicate axis-and-side, a feature of unknown kind or region or out of its chart, a shot naming no ref, a malformed ref or header. A canon band is a hypothesis under test, so a face value is never range-checked against it. Composes nx_refintake_lib for the row helpers (the intake is the card's media leg). LIB, no main. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 3 importers

nx_syscalls.nx nx_refintake_lib.nx nx_symdecl_lib.nx nx_twincard_lib.nx nx_skinsample_lib.nx nx_twincard.nx nx_twincard_gate.nx

imports: nx_syscalls.nxnx_refintake_lib.nxnx_symdecl_lib.nx

imported by: nx_skinsample_lib.nxnx_twincard.nxnx_twincard_gate.nx

structs

none

consts

30const TC_AXES: *u8 = "knowledge/twincard.axes"
31const TC_BUILDROOT: *u8 = "buildroot/"
32const TC_C_ROWS: i64 = 0
33const TC_C_PRESENT: i64 = 1
34const TC_C_ABSENT: i64 = 2
35const TC_C_UNJUDGED: i64 = 3
36const TC_DIR: *u8 = "knowledge/twincard"
37const TC_CANON: *u8 = "knowledge/facecanon.conf"
38const TC_SCHEMA_V: i64 = 1
39const TC_FACE: *u8 = "face"
40const TC_METHODS: *u8 = " measured observed declared generated "
41const TC_CLASSES: *u8 = " real anime fantasy synth "
42const TC_SEXES: *u8 = " F M X "
43const TC_LICENCES: *u8 = " REVIEW SHIP_OK REFUSED "
44const TC_SIDES: *u8 = " L R C "
45const TC_SIDE_C: *u8 = "C"
46const TC_SIDE_L: *u8 = "L"
47const TC_SIDE_R: *u8 = "R"
48const TC_FEATURE_KINDS: *u8 = " freckle mole scar vein tattoo birthmark "
49const TC_UNIT_CLASS: *u8 = "class"
50const TC_DASHWORD: *u8 = "-"
51const TC_STAR: *u8 = "*"
52const TC_LISTB: i64 = 8192
53const TC_POS_N: i64 = 2
54const TC_PERMIL: i64 = 1000
55const TC_UV_MAX: i64 = 1000
56const TC_DIAM_MAX: i64 = 100000
57const TC_LAB_L_MAX: i64 = 1000
58const TC_LAB_AB: i64 = 500
60const TC_F_SECTION: i64 = 1
61const TC_F_ID: i64 = 2
62const TC_F_SIDE: i64 = 3
63const TC_F_VALUE: i64 = 4
64const TC_F_METHOD: i64 = 5
65const TC_F_SOURCE: i64 = 6
66const TC_F_WHEN: i64 = 7
68const TC_F_CARD_SLUG: i64 = 1
69const TC_F_CARD_DISPLAY: i64 = 2
70const TC_F_CARD_CLASS: i64 = 3
71const TC_F_CARD_SEX: i64 = 4
72const TC_F_CARD_LIC: i64 = 5
73const TC_F_REF_KEY: i64 = 1
74const TC_F_REF_MIRROR: i64 = 2
75const TC_F_REF_SHA: i64 = 3
76const TC_F_REF_LIC: i64 = 4
77const TC_F_SHOT_REF: i64 = 1
79const TC_F_SHOT_STATE0: i64 = 10
80const TC_SHOT_STATE_N: i64 = 4
81const TC_SHOT: *u8 = "shot"
83const TC_F_FEAT_KIND: i64 = 1
84const TC_F_FEAT_SIDE: i64 = 2
85const TC_F_FEAT_REGION: i64 = 3
86const TC_F_FEAT_U: i64 = 4
87const TC_F_FEAT_V: i64 = 5
88const TC_F_FEAT_DIAM: i64 = 6
89const TC_F_FEAT_L: i64 = 7
90const TC_F_FEAT_A: i64 = 8
91const TC_F_FEAT_B: i64 = 9
92const TC_F_FEAT_METHOD: i64 = 10
94const TC_F_SCHEMA_UNIT: i64 = 3
95const TC_F_SCHEMA_LO: i64 = 4
96const TC_F_SCHEMA_HI: i64 = 5
97const TC_F_SCHEMA_PAIRED: i64 = 6
98const TC_F_RULER_ORGAN: i64 = 3
99const TC_F_RULER_SYMBOL: i64 = 4
101const TC_R_AXES: i64 = 0
102const TC_R_VALID: i64 = 1
103const TC_R_UNDECLARED: i64 = 2
104const TC_R_RANGE: i64 = 3
105const TC_R_METHOD: i64 = 4
106const TC_R_CLASSWORD: i64 = 5
107const TC_R_DUP: i64 = 6
108const TC_R_MEASURED: i64 = 7
109const TC_R_OBSERVED: i64 = 8
110const TC_R_DECLARED: i64 = 9
111const TC_R_GENERATED: i64 = 10
112const TC_R_HEADER: i64 = 11
113const TC_R_REFS: i64 = 12
114const TC_R_BADREF: i64 = 13
115const TC_R_SHOTS: i64 = 14
116const TC_R_BADSHOT: i64 = 15
117const TC_R_CARDS: i64 = 16
118const TC_R_SIDE: i64 = 17
119const TC_R_FEATURES: i64 = 18
120const TC_R_BADFEATURE: i64 = 19
121const TC_R_N: i64 = 20
123const TC_RULER_NONE: i64 = 0
124const TC_RULER_EXACT: i64 = 1
125const TC_RULER_WILDCARD: i64 = 2

functions

128func tc_card_check() -> i64 { return TC_SCHEMA_V }
131func tc_word_in(list: *u8, w: *u8) -> i64
140func tc_atoi_signed(s: *u8) -> i64
144func tc_in_band(v: i64, lo: i64, hi: i64) -> i64
149func tc_permil(num: i64, den: i64) -> i64
153func tc_card_path(slug: *u8, out: *u8) -> i64
161func tc_row_find(buf: *u8, n: i64, prefix: *u8, pos: *i64) -> i64
172func tc_count_prefix(buf: *u8, n: i64, prefix: *u8) -> i64
183func tc_key1(out: *u8, kind: *u8, a: *u8) -> i64
191func tc_key2(out: *u8, kind: *u8, a: *u8, b: *u8) -> i64
198func tc_key3(out: *u8, kind: *u8, a: *u8, b: *u8, c: *u8) -> i64
206func tc_axis_declared(schema: *u8, sn: i64, canon: *u8, kn: i64, section: *u8, id: *u8, pos: *i64) -> i64
216func tc_unit_band(schema: *u8, sn: i64, section: *u8, id: *u8, unit: *u8, lo: *i64, hi: *i64, paired: *i64) -> i64
231func tc_paired(schema: *u8, sn: i64, section: *u8, id: *u8) -> i64
called by 1: main calls 2: sys_mmaptc_unit_band
240func tc_class_ok(schema: *u8, sn: i64, section: *u8, id: *u8, word: *u8) -> i64
246func tc_region_ok(schema: *u8, sn: i64, word: *u8) -> i64
253func tc_ruler_for(schema: *u8, sn: i64, section: *u8, id: *u8, organ: *u8, symbol: *u8) -> i64
267func tc_ref_exists(card: *u8, cn: i64, key: *u8) -> i64
274func tc_dup_before(card: *u8, upto: i64, section: *u8, id: *u8, side: *u8) -> i64
286func tc_dup_id_before(card: *u8, upto: i64, section: *u8, id: *u8) -> i64
298func tc_shot_axis(k: i64) -> *u8
called by 1: tc_validate
306func tc_ruler_coverage(schema: *u8, sn: i64, canon: *u8, kn: i64, announce: i64, out: *i64) -> i64
344func tc_bad(bad: *u8, section: *u8, id: *u8) -> i64
called by 1: tc_validate calls 1: ri_cat
352func tc_side_ok(section: *u8, paired: i64, side: *u8) -> i64
called by 2: maintc_validate calls 2: tc_word_inri_streq
363func tc_feature_ok(card: *u8, i: i64, e: i64, schema: *u8, sn: i64) -> i64
389func tc_validate(card: *u8, cn: i64, schema: *u8, sn: i64, canon: *u8, kn: i64, rep: *i64, bad: *u8) -> i64
503func tc_declared_count(schema: *u8, sn: i64, canon: *u8, kn: i64, section: *u8) -> i64
522func tc_filled_count(card: *u8, cn: i64, schema: *u8, sn: i64, canon: *u8, kn: i64, section: *u8) -> i64
548func tc_pairs_complete(card: *u8, cn: i64, schema: *u8, sn: i64, pairs: *i64) -> i64
579func tc_ruler_census(schema: *u8, sn: i64, out: *i64) -> i64
609func tc_list_has(list: *u8, count: i64, w: *u8) -> i64
called by 1: tc_sections calls 2: ri_streqri_slen
619func tc_list_at(list: *u8, k: i64) -> *u8
called by 2: tcc_coveragemain calls 1: ri_slen
627func tc_sections(schema: *u8, sn: i64, out: *u8, cap: i64) -> i64