tomo/builtins/functions.h

33 lines
1.3 KiB
C
Raw Normal View History

2024-02-04 18:13:50 -08:00
#pragma once
2024-03-18 09:57:49 -07:00
// Built-in functions
2024-02-04 18:13:50 -08:00
#include <gc/cord.h>
#include <stdbool.h>
#include <stdint.h>
2024-08-11 11:47:34 -07:00
#include "datatypes.h"
2024-02-17 14:44:17 -08:00
#include "types.h"
2024-02-04 18:13:50 -08:00
void tomo_init(void);
2024-09-02 15:47:39 -07:00
void fail(const char *fmt, ...);
void fail_source(const char *filename, int64_t start, int64_t end, const char *fmt, ...);
Text_t builtin_last_err();
void start_test(const char *filename, int64_t start, int64_t end);
2024-09-04 10:50:59 -07:00
void end_test(const void *expr, const TypeInfo *type, const char *expected, const char *filename, int64_t start, int64_t end);
#define test(expr, typeinfo, expected, start, end) {\
start_test(__SOURCE_FILE__, start, end); \
end_test((__typeof__(expr)[1]){expr}, typeinfo, expected, __SOURCE_FILE__, start, end); }
2024-09-02 15:47:39 -07:00
void say(Text_t text, bool newline);
2024-09-04 11:55:00 -07:00
Text_t ask(Text_t prompt, bool bold, bool force_tty);
2024-02-04 18:13:50 -08:00
2024-09-02 15:47:39 -07:00
uint64_t generic_hash(const void *obj, const TypeInfo *type);
2024-02-17 14:44:17 -08:00
int32_t generic_compare(const void *x, const void *y, const TypeInfo *type);
bool generic_equal(const void *x, const void *y, const TypeInfo *type);
2024-09-02 15:47:39 -07:00
Text_t generic_as_text(const void *obj, bool colorize, const TypeInfo *type);
int generic_print(const void *obj, bool colorize, const TypeInfo *type);
2024-08-11 11:47:34 -07:00
closure_t spawn(closure_t fn);
2024-09-02 15:47:39 -07:00
bool pop_flag(char **argv, int *i, const char *flag, Text_t *result);
2024-02-17 14:44:17 -08:00
2024-02-04 18:13:50 -08:00
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0