Work on functions
This commit is contained in:
@ -30,10 +30,14 @@ union native_function {
|
||||
LispVal *(*five)(LispVal *, LispVal *, LispVal *, LispVal *, LispVal *);
|
||||
};
|
||||
|
||||
struct interp_function {
|
||||
LispVal *body; // list of forms
|
||||
LispVal *lexenv;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
FUNCTION_NATIVE,
|
||||
FUNCTION_INTERP,
|
||||
FUNCTION_BYTECOMP,
|
||||
} LispFunctionType;
|
||||
|
||||
struct function_flags {
|
||||
@ -48,6 +52,7 @@ DEFOBJTYPE(Function, FUNCTION, FUNCTIONP, {
|
||||
LispVal *docstr;
|
||||
union {
|
||||
union native_function native;
|
||||
struct interp_function interp;
|
||||
} impl;
|
||||
});
|
||||
|
||||
@ -89,4 +94,9 @@ LispVal *make_builtin_function(LispVal *name, LispVal *(*func)(void),
|
||||
DECLARE_FUNCTION(funcall, (LispVal * func, LispVal *args));
|
||||
#define CALL(func, ...) (Ffuncall((func), LIST(__VA_ARGS__)))
|
||||
|
||||
DECLARE_FUNCTION(lambda, (LispVal * args, LispVal *body));
|
||||
|
||||
DECLARE_SYMBOL(declare);
|
||||
DECLARE_SYMBOL(name);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user