This commit is contained in:
2026-01-16 03:20:38 -08:00
parent e0d8693840
commit 94d5749d31
19 changed files with 1358 additions and 3 deletions

33
src/function.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef INCLUDED_FUNCTION_H
#define INCLUDED_FUNCTION_H
#include "base.h"
struct LambdaList {
size_t n_req;
size_t n_opt;
size_t n_kw;
LispVal *req; // list of symbols
LispVal *opt; // list of lists of (name default has-p-name)
LispVal *kw; // ditto opt
LispVal *rest; // symbom (non-nil if we have a rest arg)
};
union native_function {
LispVal *(*zero)(void);
LispVal *(*one)(LispVal *);
LispVal *(*two)(LispVal *, LispVal *);
LispVal *(*three)(LispVal *, LispVal *, LispVal *);
LispVal *(*four)(LispVal *, LispVal *, LispVal *, LispVal *);
LispVal *(*five)(LispVal *, LispVal *, LispVal *, LispVal *, LispVal *);
};
DEFOBJTYPE(Function, FUNCTION, FUNCTIONP, {
bool is_native;
struct LambdaList args;
union {
union native_function native;
} impl;
});
#endif