code wiki / (root) / nx_compare_feed_lib.nx

nx_compare_feed_lib.nx

buildroot/runtime/nx_compare_feed_lib.nx

28611 B547 linesdepth 5pulls 8 transitivereach 3 importersview sourcekind librarytopic compare
docsdependenciesstructsconstsfunctions

about

nx_compare_feed_lib.nx -- THE COMPARE FEED (ecosystem EC47, 2026-09-16): every /compare board's daily place on the four-quadrant map and the board rows journaled that day, emitted as ONE RSS 2.0 feed the regenerator publishes at /compare/feed.xml on the same beat that republishes the pages. Operator (goal, 2026-09-15): "where we are and our competitors and where we are moving as time goes on daily like the rss feed with more and more expansive reviews". INPUTS -- all data the estate already writes, nothing typed here: knowledge/compare/regen.list the boards knowledge/status/cdmap/<dom>.spine cd|<epoch>|<day>|<player>|<C>|<D>|<breadth-points>|<rows>|<players>|<held> one row per player per calendar day, written by the FIRST publish of the day knowledge/compare/<dom>.plan log|<epoch>|<rung>|<kind>|<text> rows, the board's own worked ledger OUTPUT: one <item> per board per spine day inside the window (CF_WINDOW_DAYS), board-major and newest day first inside a board; every item carries its own pubDate (the spine row's epoch) so a reader orders them by time. The title carries Nishi's centrality, distinctiveness and quadrant and the move since the previous spine day; the body lists every player's position, quadrant and move, then the board rows journaled on that day -- so the review grows with the board. THE QUADRANT IS THE MAP'S OWN RULE: cd_quadrant over the day's player means (nx_cdmap_lib), never a second cut. Composes nx_rss_lib (the estate's RSS 2.0 builder), nx_timefmt (civil dates) and nx_cdmap_lib (the quadrant rule). Pure over the root it is pointed at (root prefix + the relative paths above), so nx_compare_feed_gate drives it on a fixture root. Every count it decides on is published in st[] (partition: items = distinct in-window (board, day) pairs). A spine or plan larger than its index is announced as OVERFLOW and read as a prefix, never silently. A body that would not fit its scratch is announced as SHORT and the board's item is not emitted (a truncated feed is not a feed). license_tier: ORIGINAL. No hw writes (Rule 26).

dependencies 4 imports · 2 importers

nx_syscalls.nx nx_rss_lib.nx nx_cdmap_lib.nx nx_timefmt.nx nx_compare_feed_lib.nx nx_compare_feed_gate.nx nx_compare_regen.nx

imports: nx_syscalls.nxnx_rss_lib.nxnx_cdmap_lib.nxnx_timefmt.nx

imported by: nx_compare_feed_gate.nxnx_compare_regen.nx

structs

none

consts

26const CF_MAX_ROWS: i64 = 4096 // spine rows indexed per board (16 players x 256 days); beyond = OVERFLOW, prefix read
27const CF_MAX_LOG: i64 = 8192 // plan log rows indexed per board; beyond = OVERFLOW, prefix read
28const CF_MAX_DAYS: i64 = 512 // distinct spine days a board may carry in the index
29const CF_WINDOW_DAYS: i64 = 14 // days of history the feed covers, newest first
30const CF_TEXT_MAX: i64 = 480 // bytes of one board row quoted in an item (cut at a UTF-8 boundary, announced with ...)
31const CF_DAY_S: i64 = 86400
32const CF_PATH_MAX: i64 = 1024
33const CF_LINE_MAX: i64 = 4096 // scratch for a title, a link, a guid or one list line
34const CF_BODY_BASE: i64 = 65536 // body scratch base; grown by the rows a board can quote
35const CF_ROW_QUOTE: i64 = 640 // scratch per quoted row: CF_TEXT_MAX escaped (worst case x6 for '&') is bounded by this x6 below
36const CF_ESC_X: i64 = 6 // worst-case expansion of html escaping ('&' -> '&amp;')
37const CF_OUT_START: i64 = 262144 // the growable output's first capacity; doubled as needed, never a cap
38const CF_OUT_HEAD: i64 = 8192 // headroom kept for the channel open and close
39const CF_ST_SLOTS: i64 = 10
40const CF_ST_DOMAINS: i64 = 0
41const CF_ST_SPINES: i64 = 1
42const CF_ST_ITEMS: i64 = 2
43const CF_ST_ROWS: i64 = 3
44const CF_ST_MALFORMED: i64 = 4
45const CF_ST_OVERFLOW: i64 = 5
46const CF_ST_BYTES: i64 = 6
47const CF_ST_SHORT: i64 = 7
48const CF_ST_NEWEST: i64 = 8
49const CF_ST_WINDOW: i64 = 9
50const CF_ROW_W: i64 = 8
51const CF_R_EPOCH: i64 = 0
52const CF_R_DAY: i64 = 1
53const CF_R_NOFF: i64 = 2
54const CF_R_NLEN: i64 = 3
55const CF_R_C: i64 = 4
56const CF_R_D: i64 = 5
57const CF_R_HELD: i64 = 6
58const CF_LOG_W: i64 = 4
59const CF_L_EPOCH: i64 = 0
60const CF_L_DAY: i64 = 1
61const CF_L_OFF: i64 = 2
62const CF_L_LEN: i64 = 3
63const CF_PIPE: i64 = 124
64const CF_LF: i64 = 10
65const CF_HASHB: i64 = 35
66const CF_DOT: i64 = 46
67const CF_ZERO: i64 = 48
68const CF_NINE: i64 = 57
69const CF_MINUS: i64 = 45
70const CF_UTF8_CONT_LO: i64 = 128 // a UTF-8 continuation byte is 10xxxxxx: 128..191 (tested arithmetically, no bitwise op)
71const CF_UTF8_CONT_HI: i64 = 192
72const CF_FEED_TITLE: *u8 = "Nishi /compare -- daily positions and reviews" as *u8
73const CF_FEED_LINK: *u8 = "https://nishifamily.com/compare/" as *u8
74const CF_FEED_DESC: *u8 = "Every /compare board's place on the four-quadrant centrality-distinctiveness map, its move since the previous day, and the board rows journaled that day. Emitted by nx_compare_regen on the compare beat; positions are measured from the boards, never typed." as *u8
75const CF_GUID_SEP: *u8 = "cd-" as *u8 // written after a CF_HASHB byte: the lexer keeps that byte out of literals
76const CF_SPINE_DIR: *u8 = "knowledge/status/cdmap/" as *u8
77const CF_SPINE_EXT: *u8 = ".spine" as *u8
78const CF_PLAN_DIR: *u8 = "knowledge/compare/" as *u8
79const CF_PLAN_EXT: *u8 = ".plan" as *u8
80const CF_LIST_PATH: *u8 = "knowledge/compare/regen.list" as *u8
81const CF_NISHI: *u8 = "Nishi" as *u8
82const CF_ROW_TAG: *u8 = "cd|" as *u8
83const CF_LOG_TAG: *u8 = "log|" as *u8
84const CF_SPINE_F_EPOCH: i64 = 1
85const CF_SPINE_F_DAY: i64 = 2
86const CF_SPINE_F_NAME: i64 = 3
87const CF_SPINE_F_C: i64 = 4
88const CF_SPINE_F_D: i64 = 5
89const CF_SPINE_F_HELD: i64 = 9
90const CF_LOG_F_EPOCH: i64 = 1
91const CF_LOG_F_RUNG: i64 = 2
92const CF_LOG_F_KIND: i64 = 3
93const CF_LOG_F_TEXT: i64 = 4

functions

95func cf_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
96func cf_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } return p }
97func cf_catb(d: *u8, o: i64, s: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { d[o + i] = s[i]; i = i + 1 } return o + n }
98func cf_catn(d: *u8, o: i64, v: i64) -> i64
112func cf_catsigned(d: *u8, o: i64, v: i64) -> i64
118func cf_date(d: *u8, o: i64, day: i64) -> i64
133func cf_atoi(buf: *u8, off: i64, end: i64) -> i64
151func cf_field(buf: *u8, start: i64, end: i64, k: i64, out2: *i64) -> i64
167func cf_starts(buf: *u8, off: i64, end: i64, tag: *u8) -> i64
172func cf_name_eq(buf: *u8, off: i64, n: i64, s: *u8) -> i64
178func cf_names_eq(a: *u8, ao: i64, an: i64, b: *u8, bo: i64, bn: i64) -> i64
185func cf_eol(buf: *u8, n: i64, i: i64) -> i64
191func cf_path(dst: *u8, root: *u8, dir: *u8, dom: *u8, domlen: i64, ext: *u8) -> i64
200func cf_load_spine(buf: *u8, n: i64, rows: *i64, cap: i64, st: *i64) -> i64
241func cf_load_log(buf: *u8, n: i64, idx: *i64, cap: i64, st: *i64) -> i64
264func cf_row_of(buf: *u8, rows: *i64, nr: i64, day: i64, noff: i64, nlen: i64) -> i64
274func cf_quote_text(body: *u8, bcap: i64, bo: i64, buf: *u8, off: i64, len: i64) -> i64
293func cf_board(root: *u8, dom: *u8, domlen: i64, today: i64, outp: *i64, ocap: *i64, olen: i64, st: *i64) -> i64
499func cf_build(root: *u8, listpath: *u8, today: i64, st: *i64, outp: *i64) -> i64