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 | | |
70 | | |
71 | | |
72 | | |
73 | | |
74 | | |
75 | | |
76 | | |
77 | | |
78 | | |
79 | | |
80 | | |
81 | | |
82 | | |
83 | | |
84 | | |
85 | | |
86 | | |
87 | | |
88 | | |
89 | | |
90 | | |
91 | | |
92 | | |
93 | | |
94 | | |
95 | | |
96 | | |
97 | | |
| | | | | | | | | | #ifndef ADD_EFUN_H | #define ADD_EFUN_H | | #include "svalue.h" | #include "hashtable.h" | #include "las.h" /* For OPT_SIDE_EFFECT etc. */ | #include "block_alloc_h.h" | | typedef int (*docode_fun)(node *n); | typedef node *(*optimize_fun)(node *n); | | #define CALLABLE_DYNAMIC 1 | | struct callable | { | PIKE_MEMORY_OBJECT_MEMBERS; | c_fun function; | struct pike_type *type; | struct pike_string *name; | INT16 flags; | INT16 internal_flags; | #ifdef PIKE_DEBUG | INT8 may_return_void; | long compiles; | long runs; | #endif | optimize_fun optimize; | docode_fun docode; | struct callable *next; | }; | | | PMOD_EXPORT struct mapping *get_builtin_constants(void); | void low_add_efun(struct pike_string *name, struct svalue *fun); | void low_add_constant(char *name, struct svalue *fun); | PMOD_EXPORT void add_global_program(char *name, struct program *p); | BLOCK_ALLOC(callable,128) | PMOD_EXPORT struct callable *low_make_callable(c_fun fun, | struct pike_string *name, | struct pike_type *type, | INT16 flags, | optimize_fun optimize, | docode_fun docode); | PMOD_EXPORT struct callable *make_callable(c_fun fun, | char *name, | char *type, | INT16 flags, | optimize_fun optimize, | docode_fun docode); | PMOD_EXPORT struct callable *add_efun2(char *name, | c_fun fun, | char *type, | INT16 flags, | optimize_fun optimize, | docode_fun docode); | PMOD_EXPORT struct callable *add_efun(char *name, c_fun fun, char *type, INT16 flags); | PMOD_EXPORT struct callable *quick_add_efun(char *name, ptrdiff_t name_length, | c_fun fun, | char *type, ptrdiff_t type_length, | INT16 flags, | optimize_fun optimize, | docode_fun docode); | void cleanup_added_efuns(void); | | | | #include "pike_macros.h" | | #define ADD_EFUN(NAME,FUN,TYPE,FLAGS) \ | quick_add_efun(NAME,CONSTANT_STRLEN(NAME),FUN,TYPE,CONSTANT_STRLEN(TYPE),FLAGS,0,0) | | #define ADD_EFUN2(NAME,FUN,TYPE,FLAGS,OPTIMIZE,DOCODE) \ | quick_add_efun(NAME,CONSTANT_STRLEN(NAME),FUN,TYPE,CONSTANT_STRLEN(TYPE),FLAGS,OPTIMIZE,DOCODE) | | #define ADD_EFUN_DTYPE(NAME,FUN,DTYPE,FLAGS) do { \ | DTYPE_START; \ | {DTYPE} \ | { \ | struct pike_string *_t; \ | DTYPE_END(_t); \ | quick_add_efun(NAME,CONSTANT_STRLEN(NAME),FUN,_t->str,_t->len,FLAGS,0,0); \ | free_string(_t); \ | } \ | } while (0) | | #endif | | |
|