code wiki / _hdl_build / nx_meal_plan.nx

nx_meal_plan.nx

buildroot/runtime/_hdl_build/nx_meal_plan.nx

13804 B380 linesdepth 4pulls 6 transitivereach 11 importersview sourcekind librarytopic meal
docsdependenciesstructsconstsfunctions

about

nx_meal_plan.nx -- LIB: the RECIPE + UNIT spine of the meal planner. A UNIT is whoever is cooking -- a family, one person, a restaurant. The estate's inventory engine is already domain-keyed, so all three are the SAME engine over a different `domain` string; this file only gives them names, kinds and an area so a surface can offer "cooking for: the Wests / Ana / Sichuan Spice House" without any of them being a special case. Nothing here is per-kind. SIMILARITY IS EXPLAINABLE ON PURPOSE. "More like this" is integer-permille Jaccard over shared ingredients (1000 * shared / union), so the page can say "shares 6 of 9 ingredients" instead of showing an opaque affinity score a cook cannot argue with. No float; deterministic; identical inputs always rank identically. Schema (prefix passed in, e.g. knowledge/store/meal-): meal:recids -> TAB list of recipe ids meal:rec:<rid> -> title <t> blurb <t> serves <t> SPACE-separated ingredient ids meal:units -> TAB list of unit ids meal:unit:<uid> -> label <t> kind <t> inventory-domain <t> price-area license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 8 importers

nx_food_science.nx nx_inventory.nx nx_seg_store.nx nx_syscalls.nx nx_meal_plan.nx nx_meal_effort.nx nx_meal_emit.nx nx_meal_page.nx nx_meal_plan_gate.nx nx_meal_skills_page.nx nx_skill_request.nx nx_skill_video.nx nx_skills_emit.nx

imports: nx_food_science.nxnx_inventory.nxnx_seg_store.nxnx_syscalls.nx

imported by: nx_meal_effort.nxnx_meal_emit.nxnx_meal_page.nxnx_meal_plan_gate.nxnx_meal_skills_page.nxnx_skill_request.nxnx_skill_video.nxnx_skills_emit.nx

structs

none

consts

23const MP_TAB: i64 = 9
24const MP_SP: i64 = 32
25const MP_KEYCAP: i64 = 160
26const MP_VALCAP: i64 = 4096
27const MP_LISTCAP: i64 = 8192
28const MP_TOKCAP: i64 = 96
29const MP_MAXITEMS: i64 = 128
30const MP_MAXREC: i64 = 512
31const MP_PERMILLE: i64 = 1000
34const MP_F_TITLE: i64 = 0
35const MP_F_BLURB: i64 = 1
36const MP_F_SERVES: i64 = 2
37const MP_F_ITEMS: i64 = 3
40const MP_U_LABEL: i64 = 0
41const MP_U_KIND: i64 = 1
42const MP_U_DOMAIN: i64 = 2
43const MP_U_AREA: i64 = 3

functions

48func mp_keybuf() -> *u8 { if MP_KB == 0 { MP_KB = sys_mmap(MP_KEYCAP) as i64 } return MP_KB as *u8 }
49func mp_pq() -> *i64 { if MP_PQ == 0 { MP_PQ = sys_mmap(16) as i64 } return MP_PQ as *i64 }
50func mp_lq() -> *i64 { if MP_LQ == 0 { MP_LQ = sys_mmap(16) as i64 } return MP_LQ as *i64 }
52func mp_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: mp_put
54func mp_put(prefix: *u8, key: *u8, val: *u8) -> i64
65func mp_split(buf: *u8, len: i64, sep: i64, outtoks: *i64) -> i64
90func mp_list_add(prefix: *u8, key: *u8, token: *u8) -> i64
114func mp_rec_key(rid: *u8, out: *u8) -> i64
called by 2: mp_add_recipemp_field calls 1: as_append
123func mp_add_recipe(prefix: *u8, rid: *u8, title: *u8, blurb: *u8, serves: i64, itemlist: *u8) -> i64
138func mp_field(prefix: *u8, rid: *u8, f: i64, out: *u8) -> i64
147func mp_serves(prefix: *u8, rid: *u8) -> i64
155func mp_items(prefix: *u8, rid: *u8, outtoks: *i64) -> i64
162func mp_recipes(prefix: *u8, outtoks: *i64) -> i64
174func mp_ing_key(id: *u8, out: *u8) -> i64
182func mp_add_ingredient(prefix: *u8, id: *u8, name: *u8) -> i64
190func mp_ing_name(prefix: *u8, id: *u8, out: *u8) -> i64
206func mp_unit_key(uid: *u8, out: *u8) -> i64
called by 2: mp_add_unitmp_unit_field calls 1: as_append
214func mp_add_unit(prefix: *u8, uid: *u8, label: *u8, kind: *u8, domain: *u8, area: *u8) -> i64
229func mp_unit_field(prefix: *u8, uid: *u8, f: i64, out: *u8) -> i64
238func mp_units(prefix: *u8, outtoks: *i64) -> i64
called by 1: main calls 4: mp_pqmp_lqss_getmp_split
247func mp_has_item(items: *i64, n: i64, id: *u8) -> i64
called by 2: mp_sharedmp_similarity calls 1: fd_streq
254func mp_shared(prefix: *u8, a: *u8, b: *u8) -> i64
267func mp_similarity(prefix: *u8, a: *u8, b: *u8) -> i64
284func mp_similar(prefix: *u8, rid: *u8, out_rids: *i64, out_scores: *i64, max: i64) -> i64
325func mp_missing(inv_prefix: *u8, domain: *u8, prefix: *u8, rid: *u8) -> i64
336func mp_can_cook(inv_prefix: *u8, domain: *u8, prefix: *u8, rid: *u8) -> i64
345func mp_cookable(inv_prefix: *u8, domain: *u8, prefix: *u8, out_rids: *i64, max: i64) -> i64
called by 1: main calls 3: sys_mmapmp_recipesmp_can_cook
361func mp_nearly(inv_prefix: *u8, domain: *u8, prefix: *u8, slack: i64, out_rids: *i64, out_missing: *i64, max: i64) -> i64