code wiki / _hdl_build / nx_charjudge.nx

nx_charjudge.nx

buildroot/runtime/_hdl_build/nx_charjudge.nx

7904 B143 linesdepth 8pulls 13 transitivereach 1 importersview sourcekind tooltopic charjudge
docsdependenciesstructsconstsfunctions

about

nx_charjudge.nx -- CLI for the v2 character-image judge (core = nx_charjudge_lib, gate = nx_charjudge_gate). Decodes a PNG sovereignly, judges it, prints all axes as JSON. HEADLINE = MIN(composition, palette, contour, face) -- see the lib header for why each axis exists and which adversarial input it kills. Thresholds ride knowledge/charjudge.conf. license_tier: ORIGINAL nx_charjudge <img.png> <label>

dependencies 4 imports · 1 importers

nx_syscalls.nx nx_itoa_lib.nx nx_png_decoder.nx nx_charjudge_lib.nx nx_charjudge.nx nx_charjudge_frame_gate.nx

imports: nx_syscalls.nxnx_itoa_lib.nxnx_png_decoder.nxnx_charjudge_lib.nx

imported by: nx_charjudge_frame_gate.nx

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

main cjc_abstain cjc_hw sys_write cjc_guard_name 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 ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close cjc_hw ↻ nx_png_decode sys_mmap ↻ _png_check_signature _png_read_u32_be nx_crc32 nx_crc32_update nx_crc32_init nx_crc32_table_at _png_n_channels _png_bytes_per_pixel _png_n_channels ↻ _png_a7_expected

structs

none

consts

21const CJG_OK: i64 = 0
22const CJG_NO_LABEL: i64 = 1 // argv[2] absent: the terminator, and the historical crash
23const CJG_NO_PATH: i64 = 2
24const CJG_NO_HEADER: i64 = 3
25const CJG_NO_PIXELS: i64 = 4
26const CJG_BAD_DIMS: i64 = 5 // w or h non-positive -- h was never checked before
27const CJG_BAD_CHANNELS: i64 = 6
28const CJG_SHORT_BUFFER: i64 = 7 // the decoder returned fewer bytes than w*h*ch implies
29const CJG_AREA_OVERFLOW: i64 = 8 // w*h*8 would not fit in i64
30const CJG_ALLOC_FAILED: i64 = 9
31const CJG_N: i64 = 10
35const CJG_MAX_AREA: i64 = 1152921504606846975
36const CJG_MAX_CHANNELS: i64 = 4
37const CJG_EXIT_OK: i64 = 0
38const CJG_EXIT_ABSTAIN: i64 = 4 // distinct from graded(0), read(2) and decode(3): a THIRD state

functions

40func cjc_hw(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 2: cjc_abstainmain calls 1: sys_write
41func cjc_pn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
43func cjc_guard_name(c: i64) -> *u8
called by 1: cjc_abstain
60func cjc_frame_guard(path_p: i64, label_p: i64, hdr_p: i64, px_p: i64,
called by 2: mainmain
76func cjc_abstain(label_p: i64, code: i64) -> i64
called by 1: main calls 2: cjc_hwcjc_guard_name
83func main(argc: i64, argv: *i64) -> i64