Working commit

This commit is contained in:
2025-06-20 11:21:38 +10:00
parent f9676a1436
commit 94e1cf2eb0
8 changed files with 1597 additions and 16 deletions

View File

@@ -32,7 +32,7 @@ unsafe extern "C" fn __is_utf8(ptr: *const u8, len: usize) -> bool {
}
const CACHE_LIBS: &[(&str, &str)] = &[
// preloaded
// libs in global
("table", "table"),
("string", "string"),
("math", "math"),
@@ -143,13 +143,18 @@ impl Registry {
}
pub fn declare<T: Type>(&mut self, name: impl Display) -> &mut Self {
self.include::<T>();
self.funcs
self.include::<T>()
.funcs
.insert(name.to_string())
.then(|| writeln!(self.cdef, "{};", T::cdecl(name)).unwrap());
self
}
pub fn preload<T: Type>(&mut self, name: impl Display) -> &mut Self {
self.include::<T>();
self
}
pub fn done(&self) -> String {
self.to_string()
}