-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.h
47 lines (33 loc) · 1.21 KB
/
function.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "value.h"
struct atoken;
struct closure;
struct function
{
struct value _base;
bool native;
char* name;
};
struct function__lambda
{
struct function _base;
int nargs;
struct atoken* body;
struct closure* closure;
};
struct function__native
{
struct function _base;
struct value* (*func)(int, struct value**);
};
struct function* function_create_lambda (int nargs, struct atoken* body, struct closure* closure);
struct function* function_create_native (char* name, struct value* (*func)(int, struct value**));
void function_register_native (char* name, struct value* (*func)(int, struct value**));
extern void register_native_functions ();
extern void register_sdl_functions ();
extern void args_check_all (int argc, struct value** argv, enum value_type type, const char* name);
extern void args_check (int argc, struct value** argv, int nargc, const enum value_type* types, const char* name);
void function_check_arguments (struct function__lambda* f, int argc);
struct value* function_apply (struct function* f, int argc, struct value** argv);
//struct value* function_apply (struct function* f, int argc, struct value** argv);
//#define function_apply(f,a,v) function_apply_closure(f,a,v,NULL)