]> git.lizzy.rs Git - nothing.git/blob - src/system/log_script.c
(#523) Remove show-label
[nothing.git] / src / system / log_script.c
1 #include <assert.h>
2
3 #include "ebisp/gc.h"
4 #include "ebisp/scope.h"
5 #include "ebisp/interpreter.h"
6 #include "log_script.h"
7 #include "log.h"
8
9 static struct EvalResult
10 print(void *param, Gc *gc, struct Scope *scope, struct Expr args)
11 {
12     assert(gc);
13     assert(scope);
14     (void) param;
15
16     const char *s = NULL;
17     struct EvalResult result = match_list(gc, "s", args, &s);
18     if (result.is_error) {
19         return result;
20     }
21
22     log_info("%s\n", s);
23
24     return eval_success(NIL(gc));
25 }
26
27 void load_log_library(Gc *gc, struct Scope *scope)
28 {
29     set_scope_value(gc, scope, SYMBOL(gc, "print"), NATIVE(gc, print, NULL));
30 }