| @@ -1,106 +0,0 @@ |
| 1 | | −--- |
| 2 | | −source: crates/louise_bindgen/tests/generate.rs |
| 3 | | −assertion_line: 13 |
| 4 | | −expression: b.louise |
| 5 | | −--- |
| 6 | | −/// Bindings for `kitchen.h`, generated by `louise bindgen` with their C shim: |
| 7 | | −/// do not edit, regenerate. |
| 8 | | −/// |
| 9 | | −/// Not bound, or worth knowing: |
| 10 | | −/// - line 34, `struct k_buf`: no finalizer found: `KBuf` resources are never freed. |
| 11 | | −/// - line 37, `k_map_free`: the finalizer of `KMap`, not bound. |
| 12 | | −/// - line 39, `k_map_parent`: returns a pointer it may still own: only functions named like constructors (_new, _create, _open, _copy, _clone) return a `Resource`. |
| 13 | | −/// - line 49, `struct k_point`: a struct with fields. |
| 14 | | −/// - line 50, `k_origin`: `k_point`: only pointers to opaque structs are supported. |
| 15 | | −/// - line 51, `k_norm`: `const k_point *`: only pointers to opaque structs are supported. |
| 16 | | −/// - line 52, `k_sort`: the callback `int (*)(const void *, const void *)` needs exactly one `void *` parameter, its environment. |
| 17 | | −/// - line 53, `k_both`: more than one callback. |
| 18 | | −/// - line 54, `k_untyped`: a `void *` parameter. |
| 19 | | −/// - line 55, `k_fill`: `char *`, which C may write to (only `const char *` is supported). |
| 20 | | −/// - line 56, `k_printf`: a variadic function. |
| 21 | | −/// - line 57, `k_matrix`: unsupported type `double m[4]`. |
| 22 | | −/// - line 58, `k_tables`: unsupported type `const char **`. |
| 23 | | −/// - line 59, `enum k_color { K_RED, K_GREEN };`: not a supported declaration. |
| 24 | | −/// - line 60, `k_favourite`: the enum `enum k_color`. |
| 25 | | −/// - line 61, `k_macro_declared`: unknown type `API int` (macros are not expanded). |
| 26 | | −/// - line 62, `static inline int k_inline(void) { return 1; }`: not a supported declaration. |
| 27 | | −/// - line 63, `K_Shout`: its name is not a Louise function name. |
| 28 | | −/// - line 64, `match`: its name is not a Louise function name. |
| 29 | | −/// - line 65, `k_map_find`: returns a pointer it may still own: only functions named like constructors (_new, _create, _open, _copy, _clone) return a `Resource`. |
| 30 | | −/// - line 66, `extern int k_counter;`: not a supported declaration. |
| 31 | | − |
| 32 | | −import std/ffi.{type Resource} |
| 33 | | − |
| 34 | | −/// `struct k_buf`, opaque. |
| 35 | | −pub type KBuf {} |
| 36 | | − |
| 37 | | −/// `struct k_map`, opaque. |
| 38 | | −pub type KMap {} |
| 39 | | − |
| 40 | | −/// C: `int k_add(int a, int b)` |
| 41 | | −@extern(c, "louise_k_add") |
| 42 | | −pub fn k_add(a: Int, b: Int) -> Int / <ffi> |
| 43 | | − |
| 44 | | −/// C: `unsigned long k_hash(uint64_t seed, short salt)` |
| 45 | | −@extern(c, "louise_k_hash") |
| 46 | | −pub fn k_hash(seed: Int, salt: Int) -> Int / <ffi> |
| 47 | | − |
| 48 | | −/// C: `long long k_wide(long long x)` |
| 49 | | −@extern(c, "louise_k_wide") |
| 50 | | −pub fn k_wide(x: Int) -> Int / <ffi> |
| 51 | | − |
| 52 | | −/// C: `double k_scale(double x, float by)` |
| 53 | | −@extern(c, "louise_k_scale") |
| 54 | | −pub fn k_scale(x: Float, by: Float) -> Float / <ffi> |
| 55 | | − |
| 56 | | −/// C: `bool k_is_even(int64_t n)` |
| 57 | | −@extern(c, "louise_k_is_even") |
| 58 | | −pub fn k_is_even(n: Int) -> Bool / <ffi> |
| 59 | | − |
| 60 | | −/// C: `void k_reset(void)` |
| 61 | | −@extern(c, "louise_k_reset") |
| 62 | | −pub fn k_reset() -> () / <ffi> |
| 63 | | − |
| 64 | | −/// C: `k_code k_last_error(void)` |
| 65 | | −@extern(c, "louise_k_last_error") |
| 66 | | −pub fn k_last_error() -> Int / <ffi> |
| 67 | | − |
| 68 | | −/// C: `size_t k_count(const char *text, size_t text_len, char c)` |
| 69 | | −@extern(c, "louise_k_count") |
| 70 | | −pub fn k_count(text: String, c: Int) -> Int / <ffi> |
| 71 | | − |
| 72 | | −/// C: `int k_parse(const char *s)` |
| 73 | | −@extern(c, "louise_k_parse") |
| 74 | | −pub fn k_parse(s: String) -> Int / <ffi> |
| 75 | | − |
| 76 | | −/// C: `const char *k_name(int code)` |
| 77 | | −@extern(c, "louise_k_name") |
| 78 | | −pub fn k_name(code: Int) -> String / <ffi> |
| 79 | | − |
| 80 | | −/// C: `k_map *k_map_new(size_t capacity)` |
| 81 | | −@extern(c, "louise_k_map_new") |
| 82 | | −pub fn k_map_new(capacity: Int) -> Resource<KMap> / <ffi> |
| 83 | | − |
| 84 | | −/// C: `k_map *k_map_copy(const k_map *m)` |
| 85 | | −@extern(c, "louise_k_map_copy") |
| 86 | | −pub fn k_map_copy(m: Resource<KMap>) -> Resource<KMap> / <ffi> |
| 87 | | − |
| 88 | | −/// C: `bool k_map_put(k_map *m, const char *key, int64_t value)` |
| 89 | | −@extern(c, "louise_k_map_put") |
| 90 | | −pub fn k_map_put(m: Resource<KMap>, key: String, value: Int) -> Bool / <ffi> |
| 91 | | − |
| 92 | | −/// C: `struct k_buf *k_buf_create(void)` |
| 93 | | −@extern(c, "louise_k_buf_create") |
| 94 | | −pub fn k_buf_create() -> Resource<KBuf> / <ffi> |
| 95 | | − |
| 96 | | −/// C: `void k_buf_append(struct k_buf *b, const char *bytes, size_t n)` |
| 97 | | −@extern(c, "louise_k_buf_append") |
| 98 | | −pub fn k_buf_append(b: Resource<KBuf>, bytes: String) -> () / <ffi> |
| 99 | | − |
| 100 | | −/// C: `void k_map_each(k_map *m, void (*visit)(const char *key, int64_t value, void *env), void *env)` |
| 101 | | −@extern(c, "louise_k_map_each") |
| 102 | | −pub fn k_map_each(m: Resource<KMap>, visit: fn(String, Int) -> () / <ffi>) -> () / <ffi> |
| 103 | | − |
| 104 | | −/// C: `double k_integrate(k_weight f, void *data, double from, double to)` |
| 105 | | −@extern(c, "louise_k_integrate") |
| 106 | | −pub fn k_integrate(f: fn(Float, Bool) -> Float / <ffi>, from: Float, to: Float) -> Float / <ffi> |