/* Every shape `louise bindgen` binds, and some it reports and skips. */ #ifndef KITCHEN_H #define KITCHEN_H #include #include #include #define API #define KITCHEN_MAX(a, b) \ ((a) > (b) ? (a) : (b)) #ifdef __cplusplus extern "C" { #endif /* Scalars. */ int k_add(int a, int b); unsigned long k_hash(uint64_t seed, short salt); long long k_wide(long long x); double k_scale(double x, float by); bool k_is_even(int64_t n); void k_reset(void); typedef int32_t k_code; k_code k_last_error(void); /* Strings: with a length, alone, and returned. */ size_t k_count(const char *text, size_t text_len, char c); int k_parse(const char *s); const char *k_name(int code); /* Opaque types, with and without a typedef. */ typedef struct k_map k_map; struct k_buf; k_map *k_map_new(size_t capacity); k_map *k_map_copy(const k_map *m); void k_map_free(k_map *m); bool k_map_put(k_map *m, const char *key, int64_t value); k_map *k_map_parent(k_map *m); struct k_buf *k_buf_create(void); void k_buf_append(struct k_buf *b, const char *bytes, size_t n); /* Callbacks: inline, through a typedef, with every argument kind. */ void k_map_each(k_map *m, void (*visit)(const char *key, int64_t value, void *env), void *env); typedef double (*k_weight)(void *env, double x, bool heavy); double k_integrate(k_weight f, void *data, double from, double to); /* Reported and skipped. */ typedef struct k_point { int x, y; } k_point; k_point k_origin(void); double k_norm(const k_point *p); void k_sort(void *base, size_t n, int (*cmp)(const void *, const void *)); void k_both(int (*f)(void *), int (*g)(void *), void *env); void k_untyped(void *p); void k_fill(char *out, size_t n); int k_printf(const char *fmt, ...); void k_matrix(double m[4]); int k_tables(const char **names); enum k_color { K_RED, K_GREEN }; enum k_color k_favourite(void); API int k_macro_declared(void); static inline int k_inline(void) { return 1; } int K_Shout(void); int match(int x); k_map *k_map_find(k_map *m, bool (*keep)(int64_t value, void *env), void *env); extern int k_counter; #ifdef __cplusplus } #endif #endif