osekit
The layer between libose and a host: name lookup, extended types, and runtime module loading.
libose deliberately knows nothing about how names are resolved or how a host extends it. osekit supplies the parts a real program needs and libose leaves open.
Nothing outside the bundle, ever
osekit keeps no state of its own, and neither does libose. A machine’s
registers, and bundles reached through them, are the only places state
lives: no file-scope or function-static variable written at run time, for
any reason, behind any option. A host keeps its own memory where its
platform says (in Max, a symbol’s s_thing) and hands it over through a
bundle.
Two copies of osekit can share a process (each Max external links one, and
o.se.modloader carries another), and a module loaded once calls whichever
the loader found first. That is harmless only because neither copy keeps
anything. The asoma workspace’s tools/checks/check_globals.py fails on any
writable global.
The one thing that may hang off a machine is a cache, and a machine runs
identically without it, only slower. A cache belongs to one machine and is
reached only through it (osekit_machine_local()), carries a layout version,
and can be thrown away at any moment and rebuilt from the bundle. A counter,
a setting or a destination fails that test: it is state, and lives in the
bundle.
What it adds
osekit_lookup— resolving a name to something callable, backed by a radix tree (thirdparty/rax) so lookup does not walk the environment linearly. Includes the near-miss handler that answers an unbound name with “did you mean …?”osekit_types— the extended OSC types beyond the four required ones: doubles, timetags, symbols, 8/16/64-bit ints, and the unit types.osekit_load—dlopen-based module loading, so a host can pick up.somodules at runtime. Hosts withoutdlopen— the browser, a microcontroller — link their modules statically instead and leave this out.
Building
make # -> build/default/libosekit.a
make BUILD_ID=myhost # -> build/myhost/libosekit.a, linking the matching libose
make check-build # answered by libose, where the dependency machinery lives
BUILD_ID is passed down to libose so that the archive this links is the one
built with these flags. See source/libose/README.md
for why that matters.
Testing
make -C test check
Where this sits
libose the VM and OSC (allocates nothing, knows no host)
osekit lookup, types, dlopen <- you are here
o.se.stdlib the C stdlib, bound in
o.se.osen osen, the language
Hosts sit above all four: the command line (o.se), Max (max.o.se), the
browser (web.o.se), the microcontroller (MicrOSCript), and Python
(osepy).
Licence
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.