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:
@@ -4,6 +4,23 @@ Notable changes, in the terms [docs/versioning.md](docs/versioning.md) sets out.
|
||||
**Calendar** entries change what a day reports, whatever the version number
|
||||
does.
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
|
||||
- A C ABI, behind the `capi` feature, with a header in `include/typikon.h`.
|
||||
Dates cross it as Julian Day Numbers, so no struct layout is part of the
|
||||
contract. A day is opaque and owns its strings: an accessor returns the same
|
||||
borrowed pointer every time and allocates nothing, so reading one in a render
|
||||
loop is free. The accessors carry every field of the JSON, so a statusline
|
||||
does not need a parser. Errors go to a thread-local `typikon_last_error()`.
|
||||
- A LuaJIT FFI binding in `examples/lua/typikon.lua`, for AwesomeWM, WezTerm
|
||||
and Neovim, and a worked C example in `examples/c/demo.c`.
|
||||
- `jurisdictions::resolve_full`, which resolves a jurisdiction together with
|
||||
the usage and the discipline. The Python bindings and the C ABI now share it
|
||||
rather than each keeping a copy, and it interns the combinations instead of
|
||||
leaking one per call.
|
||||
|
||||
## 1.0.0
|
||||
|
||||
First stable release. The public surface is now the one described in
|
||||
|
||||
Reference in New Issue
Block a user