2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 13:22:11 +00:00
Files
build/v2/engine/native.c
Steven Watanabe ceacd17a2c Fix alias violations in hash.
[SVN r77190]
2012-03-03 21:46:53 +00:00

49 lines
1.3 KiB
C

/* 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"
#include "object.h"
#include "assert.h"
void declare_native_rule( const char * module, const char * rule, const char * * args,
LIST * (*f)( FRAME *, int ), int version )
{
OBJECT * module_obj = 0;
module_t * m;
if ( module )
{
module_obj = object_new( module );
}
m = bindmodule( module_obj );
if ( module_obj )
{
object_free( module_obj );
}
if (m->native_rules == 0)
{
m->native_rules = hashinit( sizeof( native_rule_t ), "native rules");
}
{
native_rule_t *np;
OBJECT * name = object_new( rule );
int found;
np = (native_rule_t *)hash_insert( m->native_rules, name, &found );
np->name = name;
assert( !found );
if ( args )
{
np->arguments = args_new();
lol_build( np->arguments->data, args );
}
else
{
np->arguments = 0;
}
np->procedure = function_builtin( f, 0 );
np->version = version;
}
}