code wiki / (root) / nx_queries_merge_lib.nx

nx_queries_merge_lib.nx

buildroot/runtime/nx_queries_merge_lib.nx

6671 B144 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_queries_merge_lib.nx -- the row-aligned union of K query files (see nx_queries_merge.nx). LIB (no main) so the gate drives qm_merge in-process on fixtures. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_queries_merge_lib.nx nx_queries_merge.nx nx_queries_merge_gate.nx

imports: nx_syscalls.nx

imported by: nx_queries_merge.nxnx_queries_merge_gate.nx

structs

none

consts

5const QM_I64: i64 = 8
6const QM_ST_SLOTS: i64 = 8 // [0]=rows [1]=bytes_out [2]=bad_row (1-based, 0 = none) [3]=bad_file (0-based) [4]=rows_in_bad_file
7const QM_ROW_SLOTS: i64 = 4 // [0]=line start [1]=line end (CR trimmed) [2]=first TAB or line end [3]=NL index or n
8const QM_EXIT_OK: i64 = 0
9const QM_EXIT_USAGE: i64 = 2
10const QM_EXIT_REFUSED: i64 = 3
11const QM_EXIT_IO: i64 = 4
12const QM_TAB: i64 = 9
13const QM_NL: i64 = 10
14const QM_CR: i64 = 13
15const QM_SPACE: i64 = 32
16const QM_FILE_MODE: i64 = 420
17const QM_TMP_SUFFIX: *u8 = ".tmp" as *u8
18const QM_PATH_CAP: i64 = 1024
19const QM_STDOUT: i64 = 1

functions

21func qm_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
22func qm_puts(s: *u8) -> i64 { let n: i64 = qm_slen(s); if n > 0 { sys_write(QM_STDOUT, s, n) } return 0 }
called by 2: mainqm_report calls 2: qm_slensys_write
23func qm_putn(v: i64) -> i64
called by 1: qm_report calls 2: sys_mmapsys_write
36func qm_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; var o: i64 = off; while s[i] != (0 as u8) { dst[o] = s[i]; o = o + 1; i = i + 1 } dst[o] = 0 as u8; return o }
called by 2: mainqm_merge
37func qm_count_rows(buf: *u8, n: i64) -> i64
called by 1: qm_merge
45func qm_row_at(buf: *u8, n: i64, p: i64, o4: *i64) -> i64
called by 1: qm_merge
58func qm_ids_equal(a: *u8, a0: i64, a1: i64, b: *u8, b0: i64, b1: i64) -> i64
called by 1: qm_merge
64func qm_write_all(fd: i64, buf: *u8, n: i64) -> i64
called by 2: qg_writeqm_merge calls 1: sys_write
70func qm_merge(out: *u8, ins: *i64, n_in: i64, st: *i64) -> i64
135func qm_report(out: *u8, n_in: i64, st: *i64, rc: i64) -> i64
called by 1: main calls 2: qm_putsqm_putn