Type errors
This commit is contained in:
+30
-1
@@ -157,7 +157,8 @@ LispVal *make_builtin_function(LispVal *name, LispVal *(*cfunc)(),
|
||||
LispVal *docstr) {
|
||||
LispFunction *obj = lisp_alloc_object(sizeof(LispFunction), TYPE_FUNCTION);
|
||||
obj->name = name;
|
||||
obj->is_native = true;
|
||||
obj->flags.type = FUNCTION_NATIVE;
|
||||
obj->flags.no_eval_args = false;
|
||||
obj->docstr = docstr;
|
||||
obj->impl.native.zero = cfunc;
|
||||
ReadStream stream;
|
||||
@@ -182,3 +183,31 @@ LispVal *make_builtin_function(LispVal *name, LispVal *(*cfunc)(),
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Calling functions
|
||||
static ALWAYS_INLINE LispVal *call_native(LispVal *orig_func,
|
||||
LispFunction *fobj, LispVal *args) {
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
DEFUN(funcall, "funcall", (LispVal * func, LispVal *args), "(func &rest args)",
|
||||
"") {
|
||||
CHECK_TYPE(func, TYPE_FUNCTION, TYPE_SYMBOL);
|
||||
LispFunction *fobj = func;
|
||||
if (SYMBOLP(func)) {
|
||||
fobj = Fsymbol_function(func, Qt);
|
||||
}
|
||||
if (!FUNCTIONP(fobj)) {
|
||||
// TODO error
|
||||
abort();
|
||||
}
|
||||
switch (fobj->flags.type) {
|
||||
case FUNCTION_NATIVE:
|
||||
return call_native(func, fobj, args);
|
||||
case FUNCTION_INTERP:
|
||||
case FUNCTION_BYTECOMP:
|
||||
default:
|
||||
// TODO implement
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user