tobogganSe connecter

louise

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

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