aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/stdlib.h
blob: 134f8ffa34d8682a9be185b7ba7065c1dfc3ce53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Built-in functions

#pragma once

#include <stdbool.h>
#include <stdint.h>

#include "datatypes.h"
#include "types.h"

extern bool USE_COLOR;
extern Text_t TOMO_VERSION_TEXT;

void tomo_configure(void);
void tomo_init(void);
void tomo_at_cleanup(Closure_t fn);
void tomo_cleanup(void);

__attribute__((nonnull)) void start_inspect(const char *filename, int64_t start, int64_t end);
void end_inspect(const void *expr, const TypeInfo_t *type);
#define inspect(type, expr, typeinfo, start, end)                                                                      \
    {                                                                                                                  \
        start_inspect(__SOURCE_FILE__, start, end);                                                                    \
        type _expr = expr;                                                                                             \
        end_inspect(&_expr, typeinfo);                                                                                 \
    }
#define inspect_void(expr, typeinfo, start, end)                                                                       \
    {                                                                                                                  \
        start_inspect(__SOURCE_FILE__, start, end);                                                                    \
        expr;                                                                                                          \
        end_inspect(NULL, typeinfo);                                                                                   \
    }

void say(Text_t text, bool newline);
Text_t ask(Text_t prompt, bool bold, bool force_tty);
_Noreturn void tomo_exit(Text_t text, int32_t status);

Closure_t spawn(Closure_t fn);
void sleep_seconds(double seconds);
OptionalText_t getenv_text(Text_t name);
void setenv_text(Text_t name, Text_t value);