diff options
Diffstat (limited to 'sloth.c')
-rw-r--r-- | sloth.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -1,6 +1,7 @@ #include "sloth.h" #include <stdio.h> #include <stdlib.h> +#include <string.h> void sloth_deinit(Sloth *ctx) { @@ -10,6 +11,23 @@ void sloth_deinit(Sloth *ctx) } } +SlothError sloth_exec(Sloth *ctx, const char *s) +{ + printf("exec %s\n", s); + return NULL; +} + +SlothError sloth_exec_line(Sloth *ctx, char *s) +{ + static const char *sep = "\t\n\v\f\r "; + for (char *tok = strtok(s, sep); tok != NULL; tok = strtok(NULL, sep)) { + const SlothError err = sloth_exec(ctx, tok); + if (err != NULL) + return err; + } + return NULL; +} + SlothError sloth_pop(Sloth *ctx, SlothByte *v) { if (ctx->stack_size == 0) |