nx_twincard_lib.nx
buildroot/runtime/nx_twincard_lib.nx
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
imports: nx_syscalls.nxnx_refintake_lib.nxnx_symdecl_lib.nx
imported by: nx_skinsample_lib.nxnx_twincard.nxnx_twincard_gate.nx
structs
| none |
consts
| 30 | const TC_AXES: *u8 = "knowledge/twincard.axes" |
| 31 | const TC_BUILDROOT: *u8 = "buildroot/" |
| 32 | const TC_C_ROWS: i64 = 0 |
| 33 | const TC_C_PRESENT: i64 = 1 |
| 34 | const TC_C_ABSENT: i64 = 2 |
| 35 | const TC_C_UNJUDGED: i64 = 3 |
| 36 | const TC_DIR: *u8 = "knowledge/twincard" |
| 37 | const TC_CANON: *u8 = "knowledge/facecanon.conf" |
| 38 | const TC_SCHEMA_V: i64 = 1 |
| 39 | const TC_FACE: *u8 = "face" |
| 40 | const TC_METHODS: *u8 = " measured observed declared generated " |
| 41 | const TC_CLASSES: *u8 = " real anime fantasy synth " |
| 42 | const TC_SEXES: *u8 = " F M X " |
| 43 | const TC_LICENCES: *u8 = " REVIEW SHIP_OK REFUSED " |
| 44 | const TC_SIDES: *u8 = " L R C " |
| 45 | const TC_SIDE_C: *u8 = "C" |
| 46 | const TC_SIDE_L: *u8 = "L" |
| 47 | const TC_SIDE_R: *u8 = "R" |
| 48 | const TC_FEATURE_KINDS: *u8 = " freckle mole scar vein tattoo birthmark " |
| 49 | const TC_UNIT_CLASS: *u8 = "class" |
| 50 | const TC_DASHWORD: *u8 = "-" |
| 51 | const TC_STAR: *u8 = "*" |
| 52 | const TC_LISTB: i64 = 8192 |
| 53 | const TC_POS_N: i64 = 2 |
| 54 | const TC_PERMIL: i64 = 1000 |
| 55 | const TC_UV_MAX: i64 = 1000 |
| 56 | const TC_DIAM_MAX: i64 = 100000 |
| 57 | const TC_LAB_L_MAX: i64 = 1000 |
| 58 | const TC_LAB_AB: i64 = 500 |
| 60 | const TC_F_SECTION: i64 = 1 |
| 61 | const TC_F_ID: i64 = 2 |
| 62 | const TC_F_SIDE: i64 = 3 |
| 63 | const TC_F_VALUE: i64 = 4 |
| 64 | const TC_F_METHOD: i64 = 5 |
| 65 | const TC_F_SOURCE: i64 = 6 |
| 66 | const TC_F_WHEN: i64 = 7 |
| 68 | const TC_F_CARD_SLUG: i64 = 1 |
| 69 | const TC_F_CARD_DISPLAY: i64 = 2 |
| 70 | const TC_F_CARD_CLASS: i64 = 3 |
| 71 | const TC_F_CARD_SEX: i64 = 4 |
| 72 | const TC_F_CARD_LIC: i64 = 5 |
| 73 | const TC_F_REF_KEY: i64 = 1 |
| 74 | const TC_F_REF_MIRROR: i64 = 2 |
| 75 | const TC_F_REF_SHA: i64 = 3 |
| 76 | const TC_F_REF_LIC: i64 = 4 |
| 77 | const TC_F_SHOT_REF: i64 = 1 |
| 79 | const TC_F_SHOT_STATE0: i64 = 10 |
| 80 | const TC_SHOT_STATE_N: i64 = 4 |
| 81 | const TC_SHOT: *u8 = "shot" |
| 83 | const TC_F_FEAT_KIND: i64 = 1 |
| 84 | const TC_F_FEAT_SIDE: i64 = 2 |
| 85 | const TC_F_FEAT_REGION: i64 = 3 |
| 86 | const TC_F_FEAT_U: i64 = 4 |
| 87 | const TC_F_FEAT_V: i64 = 5 |
| 88 | const TC_F_FEAT_DIAM: i64 = 6 |
| 89 | const TC_F_FEAT_L: i64 = 7 |
| 90 | const TC_F_FEAT_A: i64 = 8 |
| 91 | const TC_F_FEAT_B: i64 = 9 |
| 92 | const TC_F_FEAT_METHOD: i64 = 10 |
| 94 | const TC_F_SCHEMA_UNIT: i64 = 3 |
| 95 | const TC_F_SCHEMA_LO: i64 = 4 |
| 96 | const TC_F_SCHEMA_HI: i64 = 5 |
| 97 | const TC_F_SCHEMA_PAIRED: i64 = 6 |
| 98 | const TC_F_RULER_ORGAN: i64 = 3 |
| 99 | const TC_F_RULER_SYMBOL: i64 = 4 |
| 101 | const TC_R_AXES: i64 = 0 |
| 102 | const TC_R_VALID: i64 = 1 |
| 103 | const TC_R_UNDECLARED: i64 = 2 |
| 104 | const TC_R_RANGE: i64 = 3 |
| 105 | const TC_R_METHOD: i64 = 4 |
| 106 | const TC_R_CLASSWORD: i64 = 5 |
| 107 | const TC_R_DUP: i64 = 6 |
| 108 | const TC_R_MEASURED: i64 = 7 |
| 109 | const TC_R_OBSERVED: i64 = 8 |
| 110 | const TC_R_DECLARED: i64 = 9 |
| 111 | const TC_R_GENERATED: i64 = 10 |
| 112 | const TC_R_HEADER: i64 = 11 |
| 113 | const TC_R_REFS: i64 = 12 |
| 114 | const TC_R_BADREF: i64 = 13 |
| 115 | const TC_R_SHOTS: i64 = 14 |
| 116 | const TC_R_BADSHOT: i64 = 15 |
| 117 | const TC_R_CARDS: i64 = 16 |
| 118 | const TC_R_SIDE: i64 = 17 |
| 119 | const TC_R_FEATURES: i64 = 18 |
| 120 | const TC_R_BADFEATURE: i64 = 19 |
| 121 | const TC_R_N: i64 = 20 |
| 123 | const TC_RULER_NONE: i64 = 0 |
| 124 | const TC_RULER_EXACT: i64 = 1 |
| 125 | const TC_RULER_WILDCARD: i64 = 2 |
functions
| 128 | func tc_card_check() -> i64 { return TC_SCHEMA_V } |
| 131 | func tc_word_in(list: *u8, w: *u8) -> i64 |
| 140 | func tc_atoi_signed(s: *u8) -> i64 |
| 144 | func tc_in_band(v: i64, lo: i64, hi: i64) -> i64 |
| 149 | func tc_permil(num: i64, den: i64) -> i64 |
| 153 | func tc_card_path(slug: *u8, out: *u8) -> i64 |
| 161 | func tc_row_find(buf: *u8, n: i64, prefix: *u8, pos: *i64) -> i64 called by 8: pm_row_existssks_card_writetc_axis_declaredtc_unit_bandtc_region_oktc_ruler_for+2 calls 2: ri_line_endri_starts |
| 172 | func tc_count_prefix(buf: *u8, n: i64, prefix: *u8) -> i64 |
| 183 | func tc_key1(out: *u8, kind: *u8, a: *u8) -> i64 called by 6: tc_key2tc_axis_declaredtc_region_oktc_ref_existstc_declared_counttc_filled_count calls 1: ri_cat |
| 191 | func tc_key2(out: *u8, kind: *u8, a: *u8, b: *u8) -> i64 called by 6: tc_key3tc_axis_declaredtc_unit_bandtc_class_oktc_ruler_fortc_dup_id_before calls 2: tc_key1ri_cat |
| 198 | func tc_key3(out: *u8, kind: *u8, a: *u8, b: *u8, c: *u8) -> i64 |
| 206 | func tc_axis_declared(schema: *u8, sn: i64, canon: *u8, kn: i64, section: *u8, id: *u8, pos: *i64) -> i64 |
| 216 | func tc_unit_band(schema: *u8, sn: i64, section: *u8, id: *u8, unit: *u8, lo: *i64, hi: *i64, paired: *i64) -> i64 |
| 231 | func tc_paired(schema: *u8, sn: i64, section: *u8, id: *u8) -> i64 |
| 240 | func tc_class_ok(schema: *u8, sn: i64, section: *u8, id: *u8, word: *u8) -> i64 |
| 246 | func tc_region_ok(schema: *u8, sn: i64, word: *u8) -> i64 |
| 253 | func tc_ruler_for(schema: *u8, sn: i64, section: *u8, id: *u8, organ: *u8, symbol: *u8) -> i64 |
| 267 | func tc_ref_exists(card: *u8, cn: i64, key: *u8) -> i64 |
| 274 | func tc_dup_before(card: *u8, upto: i64, section: *u8, id: *u8, side: *u8) -> i64 |
| 286 | func tc_dup_id_before(card: *u8, upto: i64, section: *u8, id: *u8) -> i64 |
| 298 | func tc_shot_axis(k: i64) -> *u8 called by 1: tc_validate |
| 306 | func tc_ruler_coverage(schema: *u8, sn: i64, canon: *u8, kn: i64, announce: i64, out: *i64) -> i64 called by 2: tcc_ruler_coveragemain calls 6: sys_mmapri_line_endri_startsri_fieldtc_ruler_forri_puts |
| 344 | func tc_bad(bad: *u8, section: *u8, id: *u8) -> i64 |
| 352 | func tc_side_ok(section: *u8, paired: i64, side: *u8) -> i64 |
| 363 | func tc_feature_ok(card: *u8, i: i64, e: i64, schema: *u8, sn: i64) -> i64 |
| 389 | func tc_validate(card: *u8, cn: i64, schema: *u8, sn: i64, canon: *u8, kn: i64, rep: *i64, bad: *u8) -> i64 |
| 503 | func tc_declared_count(schema: *u8, sn: i64, canon: *u8, kn: i64, section: *u8) -> i64 |
| 522 | func tc_filled_count(card: *u8, cn: i64, schema: *u8, sn: i64, canon: *u8, kn: i64, section: *u8) -> i64 |
| 548 | func tc_pairs_complete(card: *u8, cn: i64, schema: *u8, sn: i64, pairs: *i64) -> i64 |
| 579 | func tc_ruler_census(schema: *u8, sn: i64, out: *i64) -> i64 |
| 609 | func tc_list_has(list: *u8, count: i64, w: *u8) -> i64 |
| 619 | func tc_list_at(list: *u8, k: i64) -> *u8 |
| 627 | func tc_sections(schema: *u8, sn: i64, out: *u8, cap: i64) -> i64 |