code wiki / _hdl_build / nx_galx_viewadd_lib.nx

nx_galx_viewadd_lib.nx

buildroot/runtime/_hdl_build/nx_galx_viewadd_lib.nx

2946 B77 linesdepth 2pulls 2 transitivereach 3 importersview sourcekind librarytopic galx
docsdependenciesstructsconstsfunctions

about

nx_galx_viewadd_lib.nx -- prepend a cid to the gallery's VIEW index. ONE implementation. This is a library, not a copy: nx_galx_viewadd (the CLI) and nx_gen_ingest (the pipeline) both call it. Two writers of a FIXED-WIDTH file that disagreed by one byte would shift every record after the insertion point and scramble 226,576 images -- and it would look like the gallery had been shuffled, not like a write bug. ★ WHEN TWO CALLERS MUST AGREE ON A BYTE LAYOUT, THEY MUST SHARE THE CODE, NOT THE COMMENT. Format (measured): 70-byte records = 69-char cid + '\n', NEWEST-FIRST, so a new gen PREPENDS. Returns 1 = added, 0 = already present, negative = refused/error. license_tier: ORIGINAL

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_galx_viewadd_lib.nx nx_galx_saveimg.nx nx_galx_viewadd.nx nx_gen_ingest.nx

imports: nx_syscalls.nx

imported by: nx_galx_saveimg.nxnx_galx_viewadd.nxnx_gen_ingest.nx

structs

none

consts

14const NXV_MAGIC_1024: i64 = 1024
16const NXV_REC: i64 = 70
17const NXV_CIDLEN: i64 = 69
19const NXV_ADDED: i64 = 1
20const NXV_PRESENT: i64 = 0
21const NXV_EREAD: i64 = 0 - 1
22const NXV_ECORRUPT:i64 = 0 - 2 // file size not a multiple of the record
23const NXV_EBADCID: i64 = 0 - 3 // cid not exactly 69 chars
24const NXV_EWRITE: i64 = 0 - 4

functions

26func _nxv_len(s: *u8) -> i64
32func nx_galx_view_present(buf: *u8, n: i64, cid: *u8) -> i64
47func nx_galx_view_prepend(path: *u8, cid: *u8) -> i64