diff options
| author | Mistivia <i@mistivia.com> | 2025-06-26 19:18:56 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-06-26 19:33:00 +0800 |
| commit | 0ba662762023b7e3788690d9990ab39e89fd6f34 (patch) | |
| tree | ade9d378c7a8e7c04ed7242626c07f889686e2a5 /src/interp.c | |
| parent | e05a649c3b5b97f04756d8d08f8b8d6b5d8e672c (diff) | |
add webassembly build; readline dep is optional
Diffstat (limited to 'src/interp.c')
| -rw-r--r-- | src/interp.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/interp.c b/src/interp.c index 9749b6d..5a4c9b6 100644 --- a/src/interp.c +++ b/src/interp.c @@ -41,6 +41,19 @@ HASH_TABLE_IMPL(SExpRef, SExpRef); #define UNBOUND ((SExpRef){-1}) +// for wasm +Interp *new_interp() { + Interp *ret = malloc(sizeof(Interp)); + Interp_init(ret); + return ret; +} + +// for wasm +void print_lisp_error(Interp *interp, SExpRef err) { + if (VALTYPE(err) != kErrSignal) return; + fprintf(stderr, "Error: %s", REF(err)->str); +} + void Interp_init(Interp *self) { self->recursion_depth = 0; self->gensym_cnt = 42; @@ -213,6 +226,7 @@ void Interp_init(Interp *self) { } } + SExpRef Interp_eval_string(Interp *interp, const char * str) { Parser_set_string(interp->parser, str); SExpRef sexp, ret; |
