Will Anderson
|
53f2df500d
|
runtime: add dharma-required functions to el_runtime.c and runtime/*.el
Add the following functions that dharma registry calls but were missing
from the El runtime:
el_runtime.c (consumed by the old build system via released SDK):
- list_len, list_get — aliases for el_list_len/el_list_get (handlers.el)
- json_array_push — append pre-encoded element to JSON array string
- now_millis, unix_timestamp_ms, time_now_ms — ms-since-epoch aliases
- log_info, log_warn — structured stderr log helpers
- config — reads config from environment (alias for getenv)
- http_patch — HTTP PATCH with Content-Type: application/json
- http_post_engram — HTTP POST with optional X-API-Key header
- http_get_engram — HTTP GET with optional X-API-Key header
- str_to_bytes — encode string as JSON byte array [72,101,...]
- bytes_to_str — decode JSON byte array back to string
- hash_sha256 — SHA-256 hex digest using built-in sha256 impl
runtime/*.el (consumed by the new build system):
- http.el: http_patch, http_post_engram, http_get_engram
- time.el: now_millis, unix_timestamp_ms, time_now_ms
- env.el: config, log_info, log_warn, list_len, list_get
- json.el: json_array_push, bytes_to_str
- string.el: str_to_bytes, hash_sha256 (via __sha256_hex seed)
el_seed.h / el_seed.c:
- __sha256_hex primitive with self-contained SHA-256 implementation
|
2026-05-04 19:07:08 -05:00 |
|
Will Anderson
|
5678745381
|
add runtime/time.el, math.el, state.el — time, math, and state in El
Migrates the time, math/float, and in-process state surfaces from
el-compiler/runtime/legacy/el_runtime.c to self-hosted El source:
- runtime/time.el: time_now, sleep_secs/ms, time_to_parts (via pure-El
Gregorian civil_from_days decomposition), time_format (ISO + strftime
subset), time_add, time_diff, time_from_parts; full Instant/Duration
nanosecond API (now, unix_seconds/millis, duration_seconds/millis,
instant_to_iso8601, sleep_duration); TTL cache (ttl_cache_set/get/age
backed by state); uuid_new / uuid_v4 via __uuid_v4 seed.
- runtime/math.el: el_abs, el_max, el_min (Int); math_sqrt/log/ln/sin/cos/pi
(Float seed wrappers); float_to_str, int_to_float, float_to_int, str_to_float,
format_float (__format_float seed), decimal_round (half-away-from-zero via
pure-El _pow10/_floor_f helpers).
- runtime/state.el: state_set/get/del/keys thin wrappers over __state_* seeds;
convenience helpers state_has and state_get_or.
|
2026-05-03 15:39:48 -05:00 |
|