]> git.lizzy.rs Git - nothing.git/blobdiff - src/script/repl.c
TODO(#391)
[nothing.git] / src / script / repl.c
index 42a3c0fa76ee602139564a0b8eaabd800edeea58..2e794bbc745efe7e5d2521604cc5df7b428c6aa8 100644 (file)
@@ -8,12 +8,13 @@
 
 #define REPL_BUFFER_MAX 1024
 
-static struct EvalResult f(Gc *gc, struct Scope *scope, struct Expr args)
+static struct EvalResult quit(void *param, Gc *gc, struct Scope *scope, struct Expr args)
 {
     assert(scope);
     (void) args;
+    (void) param;
 
-    printf("Hello from C!\n");
+    exit(0);
 
     return eval_success(NIL(gc));
 }
@@ -27,10 +28,10 @@ int main(int argc, char *argv[])
 
     Gc *gc = create_gc();
     struct Scope scope = {
-        .expr = NIL(gc)
+        .expr = CONS(gc, NIL(gc), NIL(gc))
     };
 
-    set_scope_value(gc, &scope, SYMBOL(gc, "f"), NATIVE(gc, f));
+    set_scope_value(gc, &scope, SYMBOL(gc, "quit"), NATIVE(gc, quit, NULL));
 
     while (true) {
         printf("> ");