diff options
| author | Mistivia <i@mistivia.com> | 2025-06-19 22:02:56 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-06-19 22:02:56 +0800 |
| commit | b7faf6f020743afb1c06161bc1696f66e0b788e0 (patch) | |
| tree | 261b4638c9545f14858cd8eed0ea9703cbdacec7 /src/interp.h | |
| parent | 8e51de8109a682068b4e7ac5f57adf8e450b1415 (diff) | |
add userfunc
Diffstat (limited to 'src/interp.h')
| -rw-r--r-- | src/interp.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/interp.h b/src/interp.h index 5d408e8..221eb19 100644 --- a/src/interp.h +++ b/src/interp.h @@ -39,18 +39,22 @@ void Interp_free(Interp *self); SExp* Interp_ref(Interp *self, SExpRef ref); void Interp_gc(Interp *self, SExpRef tmp_root); void Interp_add_primitive(Interp *self, const char *name, LispPrimitive fn); +void Interp_add_userfunc(Interp *self, const char *name, LispUserFunc fn); +SExpRef primitive_if(Interp *interp, SExpRef sexp); SExpRef primitive_cond(Interp *interp, SExpRef sexp); -SExpRef primitive_list(Interp *interp, SExpRef sexp); SExpRef primitive_progn(Interp *interp, SExpRef sexp); SExpRef primitive_setq(Interp *interp, SExpRef sexp); SExpRef primitive_let(Interp *interp, SExpRef sexp); -SExpRef primitive_car(Interp *interp, SExpRef sexp); -SExpRef primitive_cdr(Interp *interp, SExpRef sexp); -SExpRef primitive_cons(Interp *interp, SExpRef sexp); -SExpRef primitive_add(Interp *interp, SExpRef sexp); -SExpRef primitive_sub(Interp *interp, SExpRef sexp); +SExpRef userfunc_list(Interp *interp, SExpRef sexp); +SExpRef userfunc_car(Interp *interp, SExpRef sexp); +SExpRef userfunc_cdr(Interp *interp, SExpRef sexp); +SExpRef userfunc_cons(Interp *interp, SExpRef sexp); +SExpRef userfunc_add(Interp *interp, SExpRef sexp); +SExpRef userfunc_sub(Interp *interp, SExpRef sexp); + +void lisp_defun(Interp *interp, const char *name, SExpRef val); void lisp_print(Interp *interp, SExpRef obj, FILE *fp); SExpRef lisp_lookup(Interp *interp, const char *name); SExpRef lisp_lookup_func(Interp *interp, const char *name); @@ -76,6 +80,7 @@ SExpRef new_string(Interp *ctx, const char *val); SExpRef new_symbol(Interp *ctx, const char *val); SExpRef new_env(Interp *ctx); SExpRef new_binding(Interp *ctx, SExpRef name, SExpRef val); +SExpRef new_userfunc(Interp *interp, LispUserFunc val); SExpRef new_list1(Interp *ctx, SExpRef e1); SExpRef new_list2(Interp *ctx, SExpRef e1, SExpRef e2); SExpRef new_list3(Interp *ctx, SExpRef e1, SExpRef e2, SExpRef e3); |
