summaryrefslogtreecommitdiff
path: root/jam-files/engine/native.c
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2012-05-12 14:01:52 -0400
committerKenneth Heafield <github@kheafield.com>2012-05-12 14:01:52 -0400
commit1a3cb9d9b0ab24d21d7e4edb70bb4a939f621082 (patch)
tree96f5cbfad3cbb0b8e89c26d6fa2e1a72a9039439 /jam-files/engine/native.c
parentdba1128114d68ed46cdea98ecb887c7657a78474 (diff)
Give in and copy bjam into cdec source code
Diffstat (limited to 'jam-files/engine/native.c')
-rw-r--r--jam-files/engine/native.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/jam-files/engine/native.c b/jam-files/engine/native.c
new file mode 100644
index 00000000..4c289959
--- /dev/null
+++ b/jam-files/engine/native.c
@@ -0,0 +1,36 @@
+/* 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*), int version)
+{
+ 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 );
+ n.version = version;
+ hashenter(m->native_rules, (HASHDATA**)&np);
+ }
+}