@PerMap and @Chunked(n) registries: rows read per map, a state and verbs written, every map checked

- @PerMap registry R of T from "file.lres" reads <maps root>/<map>/file.lres at run time
  (package.ludic's new `maps` line, default assets/maps); @Chunked(n) one file per chunk,
  {cx}/{cz} in its name. No as PREFIX, no constants, no def, never open.
- permap_gen: state R, r_load/_clear/_find/_path; chunked: RChunk, r_in/_out/_slot/_find/
  _clear/_path; a typed reset and fill per record over lres.ludic, rows, lists and list
  records pooled per table / chunk slot, @alloc_ok on what grows at high water.
- permap_consts: lres_consts__(), the program's int and float constants by name.
- permap_check: ludicc --check reads every map directory (fields, types, constants, fn,
  @OneOf/@Range/@Ref, cross-row @Ref keys in the same map, a key twice); --no-maps skips.
- @Ref(PerMapTable) is refused on a non-string field; the schema says scope/chunk per
  registry and scope map on such a Ref, and lists the canonical @Unit spellings; any other
  @Unit spelling is a warning naming the canonical one.
- reseeded (mac + win seeds; bootstrap-cfree out.ll == seed.ll).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 21:03:02 +03:00
parent 7170c31304
commit 2f4860ae71
14 changed files with 137400 additions and 100393 deletions

View file

@ -43,7 +43,9 @@ function schema_buf() -> Buf {
sc_components(b)
buf_puts(b, "\n ],\n \"natives\": [")
sc_natives(b)
buf_puts(b, "\n ]\n}\n")
buf_puts(b, "\n ],\n \"units\": [")
sc_units(b)
buf_puts(b, "]\n}\n")
return b
}
@ -189,6 +191,7 @@ function sc_attrs(b: Buf, g: int) -> void {
buf_puts(b, ", \"args\": ")
buf_puts(b, g_at_args[j])
if g_at_unres[j] { buf_puts(b, ", \"unresolved\": true") }
if (g_at_name[j] == "Ref") and g_at_first[j] != null and pm_named(g_at_first[j]) { buf_puts(b, ", \"scope\": \"map\"") }
buf_puts(b, "}")
j += 1
}
@ -365,7 +368,7 @@ function sc_registry(b: Buf, r: int, first: bool) -> void {
buf_puts(b, ", \"record\": ")
jq_put(b, sc_ty(g_rg_type[r]))
buf_puts(b, ", \"prefix\": ")
jq_put(b, g_rg_prefix[r])
if pm_is(r) { buf_puts(b, "null") } else { jq_put(b, g_rg_prefix[r]) } # a map's rows have no constants
buf_puts(b, ", \"source\": ")
sc_str(b, g_rg_from[r])
buf_puts(b, ", \"open\": ")
@ -374,6 +377,14 @@ function sc_registry(b: Buf, r: int, first: bool) -> void {
sc_bool(b, v.vis == 1)
buf_puts(b, ", \"module\": ")
sc_str(b, sc_mod(v.file))
if pm_is(r) { # permap.ludic: read per map at run time, per chunk when chunked
buf_puts(b, ", \"scope\": \"map\", \"chunk\": ")
if g_rg_chunk[r] > 0 { buf_puti(b, g_rg_chunk[r]) } else { buf_puts(b, "null") }
buf_puts(b, ", \"maps\": ")
jq_put(b, g_pm_root)
} else {
buf_puts(b, ", \"scope\": \"game\", \"chunk\": null")
}
buf_puts(b, ",\n ")
sc_at(b, v.file, v.line, v.col)
buf_puts(b, ", \"attributes\": ")
@ -605,3 +616,14 @@ function sc_function(b: Buf, d: Node, first: bool) -> void {
sc_str(b, sc_doc(d.file, d.pos))
buf_puts(b, "}")
}
# @Unit's canonical spellings (attrs.ludic): what an editor offers and a converter reads
function sc_units(b: Buf) -> void {
let us = at_units()
var i = 0
while i < len(us) {
if i > 0 { buf_puts(b, ", ") }
jq_put(b, us[i])
i += 1
}
}