File: native.c

package info (click to toggle)
boost-jam 3.1.10-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,004 kB
  • ctags: 1,703
  • sloc: ansic: 11,378; yacc: 456; sh: 192; makefile: 43
file content (34 lines) | stat: -rw-r--r-- 753 bytes parent folder | download
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

#include "native.h"
#include "hash.h"

# define P0 (PARSE *)0
# define C0 (char *)0


void declare_native_rule(char* module, char* rule, char** args, 
                         LIST*(*f)(PARSE*, FRAME*))

{
    module_t* m = bindmodule(module);
    if (m->native_rules == 0) {
        m->native_rules = hashinit( sizeof( native_rule_t ), "native rules");
    }
    
    {
        native_rule_t n, *np = &n;
        n.name = rule;
        if (args)
        {
            n.arguments = args_new();
            lol_build( n.arguments->data, args );
        }   
        else
        {
            n.arguments = 0;
        }
        n.procedure = parse_make( f, P0, P0, P0, C0, C0, 0 );        
        hashenter(m->native_rules, (HASHDATA**)&np);
    }
}