-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathfunction.h
69 lines (59 loc) · 1.49 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef FUNCTION_H
#define FUNCTION_H
/* It is usually better to include "lpc_incl.h" instead of including this
directly */
/* FP_LOCAL */
typedef struct {
short index;
} local_ptr_t;
/* FP_SIMUL */
typedef local_ptr_t simul_ptr_t;
/* FP_EFUN */
typedef local_ptr_t efun_ptr_t;
/* FP_FUNCTIONAL */
typedef struct {
/* these two must come first */
unsigned char num_arg;
unsigned char num_local;
#ifndef LPC_TO_C
short offset;
#else
POINTER_INT offset;
#endif
struct program_s *prog;
short fio, vio;
} functional_t;
/* common header */
typedef struct {
unsigned short ref;
short type; /* FP_* is used */
#ifdef DEBUG
int extra_ref;
#endif
struct object_s *owner;
struct array_s *args;
} funptr_hdr_t;
typedef struct funptr_s {
funptr_hdr_t hdr;
union {
efun_ptr_t efun;
local_ptr_t local;
simul_ptr_t simul;
functional_t functional;
} f;
} funptr_t;
union string_or_func {
funptr_t *f;
char *s;
};
void dealloc_funp PROT((funptr_t *));
void push_refed_funp PROT((funptr_t *));
INLINE void push_funp PROT((funptr_t *));
INLINE void free_funp PROT((funptr_t *));
int merge_arg_lists PROT((int, struct array_s *, int));
INLINE funptr_t *make_efun_funp PROT((int, struct svalue_s *));
INLINE funptr_t *make_lfun_funp PROT((int, struct svalue_s *));
INLINE funptr_t *make_simul_funp PROT((int, struct svalue_s *));
INLINE funptr_t *make_functional_funp PROT((short, short, short,
struct svalue_s *, int));
#endif