Line | |
---|
1 | /* Copyright Vladimir Prus 2003. Distributed under the Boost */ |
---|
2 | /* Software License, Version 1.0. (See accompanying */ |
---|
3 | /* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ |
---|
4 | |
---|
5 | #include "native.h" |
---|
6 | #include "hash.h" |
---|
7 | |
---|
8 | # define P0 (PARSE *)0 |
---|
9 | # define C0 (char *)0 |
---|
10 | |
---|
11 | |
---|
12 | void declare_native_rule(char* module, char* rule, char** args, |
---|
13 | LIST*(*f)(PARSE*, FRAME*)) |
---|
14 | |
---|
15 | { |
---|
16 | module_t* m = bindmodule(module); |
---|
17 | if (m->native_rules == 0) { |
---|
18 | m->native_rules = hashinit( sizeof( native_rule_t ), "native rules"); |
---|
19 | } |
---|
20 | |
---|
21 | { |
---|
22 | native_rule_t n, *np = &n; |
---|
23 | n.name = rule; |
---|
24 | if (args) |
---|
25 | { |
---|
26 | n.arguments = args_new(); |
---|
27 | lol_build( n.arguments->data, args ); |
---|
28 | } |
---|
29 | else |
---|
30 | { |
---|
31 | n.arguments = 0; |
---|
32 | } |
---|
33 | n.procedure = parse_make( f, P0, P0, P0, C0, C0, 0 ); |
---|
34 | hashenter(m->native_rules, (HASHDATA**)&np); |
---|
35 | } |
---|
36 | } |
---|
37 | |
---|
Note: See
TracBrowser
for help on using the repository browser.