nx_queries_merge_lib.nx
buildroot/runtime/nx_queries_merge_lib.nx
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
imports: nx_syscalls.nx
imported by: nx_queries_merge.nxnx_queries_merge_gate.nx
structs
| none |
consts
| 5 | const QM_I64: i64 = 8 |
| 6 | const 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 |
| 7 | const QM_ROW_SLOTS: i64 = 4 // [0]=line start [1]=line end (CR trimmed) [2]=first TAB or line end [3]=NL index or n |
| 8 | const QM_EXIT_OK: i64 = 0 |
| 9 | const QM_EXIT_USAGE: i64 = 2 |
| 10 | const QM_EXIT_REFUSED: i64 = 3 |
| 11 | const QM_EXIT_IO: i64 = 4 |
| 12 | const QM_TAB: i64 = 9 |
| 13 | const QM_NL: i64 = 10 |
| 14 | const QM_CR: i64 = 13 |
| 15 | const QM_SPACE: i64 = 32 |
| 16 | const QM_FILE_MODE: i64 = 420 |
| 17 | const QM_TMP_SUFFIX: *u8 = ".tmp" as *u8 |
| 18 | const QM_PATH_CAP: i64 = 1024 |
| 19 | const QM_STDOUT: i64 = 1 |
functions
| 21 | func qm_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 22 | func qm_puts(s: *u8) -> i64 { let n: i64 = qm_slen(s); if n > 0 { sys_write(QM_STDOUT, s, n) } return 0 } |
| 23 | func qm_putn(v: i64) -> i64 |
| 36 | func 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 } |
| 37 | func qm_count_rows(buf: *u8, n: i64) -> i64 called by 1: qm_merge |
| 45 | func qm_row_at(buf: *u8, n: i64, p: i64, o4: *i64) -> i64 called by 1: qm_merge |
| 58 | func qm_ids_equal(a: *u8, a0: i64, a1: i64, b: *u8, b0: i64, b1: i64) -> i64 called by 1: qm_merge |
| 64 | func qm_write_all(fd: i64, buf: *u8, n: i64) -> i64 |
| 70 | func qm_merge(out: *u8, ins: *i64, n_in: i64, st: *i64) -> i64 |
| 135 | func qm_report(out: *u8, n_in: i64, st: *i64, rc: i64) -> i64 |