Reader
This commit is contained in:
33
src/function.h
Normal file
33
src/function.h
Normal 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
|
||||
Reference in New Issue
Block a user