native.c

来自「C++的一个好库。。。现在很流行」· C语言 代码 · 共 38 行

C
38
字号
/* Copyright Vladimir Prus 2003. Distributed under the Boost */
/* Software License, Version 1.0. (See accompanying */
/* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */

#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);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?