code wiki / (root) / nx_motion_lib.nx

nx_motion_lib.nx

buildroot/runtime/nx_motion_lib.nx

41671 B767 linesdepth 2pulls 2 transitivereach 4 importersview sourcekind librarytopic motion
docsdependenciesstructsconstsfunctions

about

nx_motion_lib.nx -- THE /motion SURFACE'S ONE SET OF RULERS (2026-09-06): content typing by MAGIC, the multipart upload parser, query and form decoding, the job status rows, the row-file readers, the page renderers and the fork runner -- shared by the daemon (nx_motion_serve), the job (nx_motion_rig) and the gate (nx_motion_serve_gate) so a parse fixed in one cannot stay broken in another. Every function is pure over buffers except the named reads. WHY A LIB AND NOT THREE COPIES: the estate has measured, more than once, what happens when two organs must agree by discipline -- they do not. The upload door types a file by its first bytes; the job names the same kinds; the gate plants the same magics. One ruler, three callers. license_tier: ORIGINAL

dependencies 1 imports · 4 importers

nx_syscalls.nx nx_motion_lib.nx nx_motion_gate.nx nx_motion_rig.nx nx_motion_serve.nx nx_motion_serve_gate.nx

imports: nx_syscalls.nx

imported by: nx_motion_gate.nxnx_motion_rig.nxnx_motion_serve.nxnx_motion_serve_gate.nx

structs

none

consts

13const MO_KIND_UNKNOWN: i64 = 0
14const MO_KIND_GLB: i64 = 1
15const MO_KIND_FBX: i64 = 2
16const MO_KIND_NXA: i64 = 3
17const MO_KIND_OBJ: i64 = 4 // recognised so it can be REFUSED BY NAME: no sovereign OBJ door is composed yet (MO2)
22const MO_UPLOAD_CAP: i64 = 8388608
23const MO_HDR_RESERVE: i64 = 65536
24const MO_REQ_CAP: i64 = 8453120 // MO_UPLOAD_CAP + MO_HDR_RESERVE, derived, so the request buffer cannot be a second guess
25const MO_PATH_CAP: i64 = 1024
26const MO_VAL_CAP: i64 = 512
27const MO_ROWS_CAP: i64 = 262144
28const MO_PAGE_CAP: i64 = 1048576
29const MO_ARGV_CAP: i64 = 16
30const MO_JOBS_DIR: *u8 = "knowledge/motion/jobs/"
31const MO_DEMOS_DIR: *u8 = "knowledge/motion/demos/"
32const MO_CLIPS_ROWS: *u8 = "knowledge/motion_clips.rows"
33const MO_DEMOS_ROWS: *u8 = "knowledge/motion_demos.rows"
34const MO_TMPL: *u8 = "knowledge/motion_page.tmpl"
35const MO_VERDICTS: *u8 = "knowledge/motion/verdicts.jrnl"
36const MO_A_NL: i64 = 10
37const MO_A_CR: i64 = 13
38const MO_A_SP: i64 = 32
39const MO_A_QUOTE: i64 = 34
40const MO_A_AMP: i64 = 38
41const MO_A_PLUS: i64 = 43
42const MO_A_DASH: i64 = 45
43const MO_A_DOT: i64 = 46
44const MO_A_SLASH: i64 = 47
45const MO_A_D0: i64 = 48
46const MO_A_D9: i64 = 57
47const MO_A_SEMI: i64 = 59
48const MO_A_LT: i64 = 60
49const MO_A_EQ: i64 = 61
50const MO_A_GT: i64 = 62
51const MO_A_QMARK: i64 = 63
52const MO_A_AT: i64 = 64
53const MO_A_PCT: i64 = 37
54const MO_A_PIPE: i64 = 124
55const MO_A_UNDER: i64 = 95
56const MO_O_APPEND_CREATE_WR: i64 = 1089 // O_WRONLY 1 + O_CREAT 64 + O_APPEND 1024, the estate's append-only journal open
57const MO_AT_FDCWD: i64 = 0 - 100
58const MO_SYS_OPENAT: i64 = 257

functions

61func mo_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
62func mo_cat(b: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { b[p] = s[i]; p = p + 1; i = i + 1 } return p }
63func mo_catb(b: *u8, o: i64, src: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { b[o + i] = src[i]; i = i + 1 } return o + n }
64func mo_num(b: *u8, o: i64, v: i64) -> i64
76func mo_atoi(s: *u8, n: i64) -> i64
90func mo_streq(a: *u8, b: *u8) -> i64
97func mo_findfrom(buf: *u8, n: i64, from: i64, needle: *u8, nl: i64) -> i64
109func mo_find(buf: *u8, n: i64, needle: *u8) -> i64 { return mo_findfrom(buf, n, 0, needle, mo_slen(needle)) }
110func mo_starts(buf: *u8, n: i64, pre: *u8) -> i64
called by 3: mainmo_kind_ofmain
116func mo_digits_only(s: *u8) -> i64
129func mo_safe_name(s: *u8) -> i64
149func mo_esc(b: *u8, o: i64, s: *u8, n: i64) -> i64
169func mo_kind_of(b: *u8, n: i64) -> i64
called by 3: mainms_uploadmain calls 1: mo_starts
192func mo_kind_name(k: i64) -> *u8
called by 1: ms_upload
199func mo_kind_from_name(s: *u8) -> i64
called by 1: mr_rig calls 1: mo_streq
209func mo_boundary(req: *u8, hend: i64, out: *u8, cap: i64) -> i64
called by 3: mainms_uploadmain calls 1: mo_find
230func mo_part_find(body: *u8, n: i64, bnd: *u8, blen: i64, name: *u8, out_off: *i64, out_len: *i64) -> i64
273func mo_hexval(c: i64) -> i64
called by 1: mo_urldecode
280func mo_urldecode(src: *u8, n: i64, out: *u8, cap: i64) -> i64
called by 3: mainmo_kvmain calls 1: mo_hexval
304func mo_kv(s: *u8, n: i64, key: *u8, out: *u8, cap: i64) -> i64
324func mo_qparam(path: *u8, plen: i64, key: *u8, out: *u8, cap: i64) -> i64
called by 3: mainms_animmain calls 1: mo_kv
334func mo_path_has(path: *u8, plen: i64, seg: *u8) -> i64
called by 3: mainmainmain calls 2: mo_findfrommo_slen
342func mo_last_seg(path: *u8, plen: i64, out: *u8, cap: i64) -> i64
355func mo_prev_seg(path: *u8, plen: i64, out: *u8, cap: i64) -> i64
called by 3: mainms_artmain
373func mo_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
374func mo_size(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 } let n: i64 = sys_lseek(fd, 0, 2); sys_close(fd); return n }
376func mo_write_all(path: *u8, b: *u8, n: i64) -> i64
389func mo_append(path: *u8, b: *u8, n: i64) -> i64
397func mo_read(path: *u8, lp: *i64) -> *u8 { lp[0] = 0; let b: *u8 = sys_read_file(path, lp); if (b as i64) == 0 { lp[0] = 0 } return b }
399func mo_join(dir: *u8, name: *u8) -> *u8
410func mo_status_field(buf: *u8, n: i64, key: *u8) -> i64
called by 3: mainmo_body_jobmain calls 2: mo_slenmo_atoi
427func mo_status_str(buf: *u8, n: i64, key: *u8, out: *u8, cap: i64) -> i64
called by 3: mainmo_body_jobmain calls 1: mo_slen
451func mo_log_field(buf: *u8, n: i64, key: *u8) -> i64
465func mo_row_find(buf: *u8, n: i64, key: *u8) -> i64
called by 1: ms_anim calls 1: mo_slen
482func mo_row_field(buf: *u8, n: i64, rs: i64, idx: i64, out: *u8, cap: i64) -> i64
503func mo_row_next(buf: *u8, n: i64, pos: i64) -> i64
517func mo_run(elf: *u8, words: *i64, nw: i64, logpath: *u8) -> i64
540func mo_run_detached(elf: *u8, words: *i64, nw: i64, logpath: *u8) -> i64
567func mo_splice(out: *u8, cap: i64, tmpl: *u8, tn: i64, head: *u8, hn: i64, body: *u8, bn: i64) -> i64
583func mo_clip_options(b: *u8, o: i64, rows: *u8, rn: i64) -> i64
609func mo_clip_list(b: *u8, o: i64, rows: *u8, rn: i64) -> i64
643func mo_demo_cards(b: *u8, o: i64, rows: *u8, rn: i64) -> i64
677func mo_body_index(b: *u8, clips: *u8, cn: i64, demos: *u8, dn: i64) -> i64
697func mo_body_job(b: *u8, id: *u8, st: *u8, sn: i64, done: i64, clips: *u8, cn: i64, applied: *u8, an: i64, verdicts: *u8, vn: i64) -> i64