Surface §5 geometry operators to compiled El

Register the six engram_geo_*_json operators in the compiler builtin_arity
table (bare heavy-runtime names + __ seed names, mirroring engram_activate_json)
and add the engram.el module wrappers, so a compiled El (CGI) program can call
them by name. The heavy-runtime C functions already existed (el_runtime.c:12287+,
declared el_runtime.h:627-632); this completes the EL call surface.

The shipped elc already emits a direct C call for these builtins (unknown
ident-calls pass through), so no self-host compiler fold — the memory-heavy,
drift-prone step — was required. Demonstrated end-to-end: a compiled geo_ops_demo.el
booted a copy of the store (13,036 nodes) and produced real subtract/distance JSON
on two real neighborhoods; test_geo_ops.c stays 20/20, ASan/UBSan clean.

Also brace the centroid_unit normalization if/else in engram_geometry.c to clear
the misleading-indentation warning (behavior-neutral).
This commit is contained in:
2026-08-13 00:50:56 -05:00
parent 5336cfe0a6
commit 85eee42106
4 changed files with 81 additions and 1 deletions
+36
View File
@@ -6748,6 +6748,24 @@ el_val_t builtin_arity(el_val_t name) {
if (str_eq(name, EL_STR("__engram_activate_json"))) {
return 2;
}
if (str_eq(name, EL_STR("__engram_geo_descriptor_json"))) {
return 1;
}
if (str_eq(name, EL_STR("__engram_geo_overlap_json"))) {
return 2;
}
if (str_eq(name, EL_STR("__engram_geo_subtract_json"))) {
return 3;
}
if (str_eq(name, EL_STR("__engram_geo_combine_json"))) {
return 2;
}
if (str_eq(name, EL_STR("__engram_geo_distance_json"))) {
return 2;
}
if (str_eq(name, EL_STR("__engram_geo_analogy_json"))) {
return 2;
}
if (str_eq(name, EL_STR("__engram_scan_nodes_json"))) {
return 2;
}
@@ -6991,6 +7009,24 @@ el_val_t builtin_arity(el_val_t name) {
if (str_eq(name, EL_STR("engram_activate_json"))) {
return 2;
}
if (str_eq(name, EL_STR("engram_geo_descriptor_json"))) {
return 1;
}
if (str_eq(name, EL_STR("engram_geo_overlap_json"))) {
return 2;
}
if (str_eq(name, EL_STR("engram_geo_subtract_json"))) {
return 3;
}
if (str_eq(name, EL_STR("engram_geo_combine_json"))) {
return 2;
}
if (str_eq(name, EL_STR("engram_geo_distance_json"))) {
return 2;
}
if (str_eq(name, EL_STR("engram_geo_analogy_json"))) {
return 2;
}
if (str_eq(name, EL_STR("engram_stats_json"))) {
return 0;
}