mirror of
https://git.pumpin.online/funkpower/typikon.git
synced 2026-10-23 03:07:12 +00:00
a C ABI, so this can be embedded rather than spawned
Every desktop shell that reads typikon today runs the binary and parses its JSON. That costs about 1.5ms and is the right answer for a calendar that changes once a day, but it is the wrong shape for anything with an FFI and no business spawning a process on every redraw. Dates cross as Julian Day Numbers, so no struct layout is part of the contract. A day is opaque and owns its strings, built once when it is reckoned: an accessor returns the same borrowed pointer every time, so a statusline polling one in a loop allocates nothing. The accessors carry every field of the JSON, so nothing on the other side needs a parser. The Python bindings and this were resolving a jurisdiction by two copies of the same logic, and the copy here leaked one per call. Both now share jurisdictions::resolve_full, which interns the combinations instead. The header is a promise made in a second file, and a second file drifts: a test reads both and fails if either has a symbol the other does not, and does the same for the LuaJIT cdef, where a stale declaration is a segfault rather than a compile error.
This commit is contained in:
@@ -35,3 +35,6 @@ crate-type = ["cdylib", "rlib"]
|
||||
# symbols to be resolved by the interpreter at load time, so a normal `cargo
|
||||
# build` of the CLI would fail to link if it were on by default.
|
||||
python = ["dep:pyo3"]
|
||||
# The C ABI. Off by default so an ordinary `cargo build` of the CLI does not
|
||||
# also compile and link a shared library nobody asked for.
|
||||
capi = []
|
||||
|
||||
Reference in New Issue
Block a user