code wiki / (root) / nx_math_serve.nx

nx_math_serve.nx

buildroot/runtime/nx_math_serve.nx

7508 B179 linesdepth 7pulls 18 transitivereach 0 importersview sourcekind servicetopic math
docsdependenciesstructsconstsfunctions

about

nx_math_serve.nx -- /math AS A TOOL, NOT A BROCHURE. WHY THIS EXISTS. The operator asked for a UI where you can DO mathematics; what shipped first was a page whose formulas were typeset at publish time and whose worked solutions were three hardcoded equations. Their words: "/math is just static output how does that match what i asked for". It did not. A page that DEMONSTRATES a capability is a different artifact from one that PROVIDES it, and only the second is a UI. WHAT MAKES IT INTERACTIVE, AND WHY THIS SHAPE. A visitor types an equation into a PLAIN GET FORM. There is no script, no fetch and no client runtime: the estate's document portal reached the same conclusion (portal actions as plain forms), and a GET form has three properties a script cannot match here -- it works with JavaScript off, every solved equation gets a SHAREABLE URL a teacher can hand to a class, and there is no third-party anything in the path. ONE RENDERER, TWO ENTRY POINTS. This daemon calls mp_render from nx_math_page, the SAME function the static build calls. Two renderers for one surface is the duplicate-ruler defect wearing HTML, and it would drift the moment either was edited. The static file remains as the fallback a reader gets if this daemon is down, and it is byte-identical to what this serves for an empty form. ⚠BINDS LOOPBACK, DELIBERATELY. A daemon binding INADDR_ANY is on the LAN the instant it starts; the estate has measured that. The edge proxies to it, so it is never directly exposed. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

syscalls.nx nx_http_server.nx nx_math_page.nx nx_math_serve.nx

imports: syscalls.nxnx_http_server.nxnx_math_page.nx

imported by: nobody (leaf or entry point)

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

main nx_http_server_addr_loopba nx_http_server_make_sockad nx_http_server_listen sys_ignore_sigpipe 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_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close sys_listen nxs_verdict_name ms_slen nx_http_server_accept_one sys_accept nx_http_server_read_reques sys_read nx_http_parse_request ms_extract_eq ms_urldecode ms_hexval mp_render mp_put mp_slen mp_style

structs

none

consts

27const MS_PORT_DEFAULT: i64 = 18131
28const MS_REQ_CAP: i64 = 16384
29const MS_EQ_CAP: i64 = 1024
30const MS_BACKLOG: i64 = 64
33const MS_HDR_RESERVE: i64 = 512

functions

35func ms_slen(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { i = i + 1 } return i }
called by 2: ms_putmain
37func ms_hexval(c: i64) -> i64
called by 1: ms_urldecode
47func ms_urldecode(src: *u8, n: i64, out: *u8, cap: i64) -> i64
called by 1: ms_extract_eq calls 1: ms_hexval
73func ms_extract_eq(path: *u8, plen: i64, out: *u8, cap: i64) -> i64
called by 1: main calls 1: ms_urldecode
94func ms_put(b: *u8, off: i64, s: *u8) -> i64
called by 1: main calls 1: ms_slen
101func ms_num(b: *u8, off: i64, v: i64) -> i64
called by 1: main
114func main(argc: i64, argv: *i64) -> i64