Skip to content
Browse files

Fixed issues with binaries.

  • Loading branch information...
1 parent f277f6a commit c53c7faacb3fd86884f27984f0593743ef23b3f2 @clemahieu committed Jul 28, 2012
View
5 mu/binary_test/entry.cpp
@@ -1,9 +1,8 @@
#include <boost/cstdint.hpp>
-#include <mu/io/analyzer/extensions/extensions.h>
#include <mu/script/extensions/node.h>
#include <mu/script/identity/operation.h>
-#include <mu/io/analyzer/extensions/global.h>
+#include <mu/io/keywording/extensions.h>
#include <gc_cpp.h>
@@ -20,6 +19,6 @@ __declspec (dllexport)
void * extensions ()
{
auto result (new (GC) mu::script::extensions::node);
- (*result->extensions) (mu::string (U"identity"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::script::identity::operation));
+ (*result->extensions) (mu::string (U"identity"), new (GC) mu::script::identity::operation);
return result;
}
View
4 mu/io/ast/builder.cpp
@@ -7,12 +7,14 @@
#include <mu/io/ast/node.h>
#include <mu/io/ast/expression.h>
#include <mu/core/errors/error_list.h>
+#include <mu/io/keywording/extensions.h>
#include <gc_cpp.h>
mu::io::ast::builder::builder ()
: parser (errors, boost::bind (&mu::io::ast::builder::add, this, _1)),
- lexer (errors, boost::bind (&mu::io::parser::parser::operator (), &parser, _1, _2)),
+ keywording (errors, [this] (mu::io::tokens::token * token_a, mu::io::debugging::context context_a) { parser (token_a, context_a); }, new (GC) mu::io::keywording::extensions),
+ lexer (errors, [this] (mu::io::tokens::token * token_a, mu::io::debugging::context context_a) {keywording (token_a, context_a);}),
cluster (new mu::io::ast::cluster)
{
}
View
2 mu/io/ast/builder.h
@@ -5,6 +5,7 @@
#include <mu/io/analyzer/analyzer.h>
#include <mu/io/ast/visitor.h>
#include <mu/core/errors/error_list.h>
+#include <mu/io/keywording/keywording.h>
#include <vector>
@@ -34,6 +35,7 @@ namespace mu
void operator () (mu::io::lexer::context const & context_a);
mu::core::errors::error_list errors;
mu::io::parser::parser parser;
+ mu::io::keywording::keywording keywording;
mu::io::lexer::lexer lexer;
void add (mu::io::ast::cluster * node_a);
mu::io::ast::cluster * cluster;
View
60 mu/llvm_binary/entry.cpp
@@ -1,8 +1,6 @@
#include <boost/cstdint.hpp>
-#include <mu/io/analyzer/extensions/extensions.h>
#include <mu/script/extensions/node.h>
-#include <mu/io/analyzer/extensions/global.h>
#include <mu/llvm_/synthesizer/operation.h>
#include <mu/llvm_/apint/create.h>
#include <mu/llvm_/cluster/get.h>
@@ -31,6 +29,7 @@
#include <mu/llvm_/pointer_type/create.h>
#include <mu/llvm_/value/get_context.h>
#include <mu/llvm_/value/set_name.h>
+#include <mu/io/keywording/extensions.h>
#include <llvm/ExecutionEngine/JIT.h>
#include <llvm/Support/TargetSelect.h>
@@ -52,33 +51,34 @@ void * extensions ()
llvm::InitializeNativeTarget ();
llvm::InitializeNativeTargetAsmPrinter();
auto result (new (GC) mu::script::extensions::node);
- (*result->extensions) (mu::string (U"apint/create"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::apint::create));
- (*result->extensions) (mu::string (U"cluster/get"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::cluster::get));
- (*result->extensions) (mu::string (U"compile/operation"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::compile::operation));
- (*result->extensions) (mu::string (U"context/create"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::context::create));
- (*result->extensions) (mu::string (U"execution_engine/create_jit"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::execution_engine::create_jit));
- (*result->extensions) (mu::string (U"execution_engine/run_function"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::execution_engine::run_function));
- (*result->extensions) (mu::string (U"execution_engine/generic_value/create_int"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::execution_engine::generic_value::create_int));
- (*result->extensions) (mu::string (U"function/create"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::function::create));
- (*result->extensions) (mu::string (U"function_type/create"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::function_type::create));
- (*result->extensions) (mu::string (U"global_value/set_linkage"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::global_value::set_linkage));
- (*result->extensions) (mu::string (U"global_variable/create"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::global_variable::create));
- (*result->extensions) (mu::string (U"integer_type/create"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::integer_type::create));
- (*result->extensions) (mu::string (U"linkage_types/external"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::linkage_types::node (llvm::GlobalValue::ExternalLinkage)));
- (*result->extensions) (mu::string (U"linker/link_modules"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::linker::link_modules));
- (*result->extensions) (mu::string (U"module/add_function"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::module::add_function));
- (*result->extensions) (mu::string (U"module/add_global_variable"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::module::add_global_variable));
- (*result->extensions) (mu::string (U"module/add_package"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::module::add_package));
- (*result->extensions) (mu::string (U"module/assemble"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::module::assemble));
- (*result->extensions) (mu::string (U"module/create"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::module::create));
- (*result->extensions) (mu::string (U"module/get_function"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::module::get_function));
- (*result->extensions) (mu::string (U"module/get_package"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::module::get_package));
- (*result->extensions) (mu::string (U"module/merge"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::module::merge));
- (*result->extensions) (mu::string (U"module/print"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::module::print));
- (*result->extensions) (mu::string (U"module/verify"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::module::verify));
- (*result->extensions) (mu::string (U"pointer_type/create"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::pointer_type::create));
- (*result->extensions) (mu::string (U"synthesizer/operation"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::synthesizer::operation));
- (*result->extensions) (mu::string (U"value/get_context"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::value::get_context));
- (*result->extensions) (mu::string (U"value/set_name"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::llvm_::value::set_name));
+ mu::io::keywording::extensions & extensions (*result->extensions);
+ extensions (mu::string (U"apint/create"), new (GC) mu::llvm_::apint::create);
+ extensions (mu::string (U"cluster/get"), new (GC) mu::llvm_::cluster::get);
+ extensions (mu::string (U"compile/operation"), new (GC) mu::llvm_::compile::operation);
+ extensions (mu::string (U"context/create"), new (GC) mu::llvm_::context::create);
+ extensions (mu::string (U"execution_engine/create_jit"), new (GC) mu::llvm_::execution_engine::create_jit);
+ extensions (mu::string (U"execution_engine/run_function"), new (GC) mu::llvm_::execution_engine::run_function);
+ extensions (mu::string (U"execution_engine/generic_value/create_int"), new (GC) mu::llvm_::execution_engine::generic_value::create_int);
+ extensions (mu::string (U"function/create"), new (GC) mu::llvm_::function::create);
+ extensions (mu::string (U"function_type/create"), new (GC) mu::llvm_::function_type::create);
+ extensions (mu::string (U"global_value/set_linkage"), new (GC) mu::llvm_::global_value::set_linkage);
+ extensions (mu::string (U"global_variable/create"), new (GC) mu::llvm_::global_variable::create);
+ extensions (mu::string (U"integer_type/create"), new (GC) mu::llvm_::integer_type::create);
+ extensions (mu::string (U"linkage_types/external"), new (GC) mu::llvm_::linkage_types::node (llvm::GlobalValue::ExternalLinkage));
+ extensions (mu::string (U"linker/link_modules"), new (GC) mu::llvm_::linker::link_modules);
+ extensions (mu::string (U"module/add_function"), new (GC) mu::llvm_::module::add_function);
+ extensions (mu::string (U"module/add_global_variable"), new (GC) mu::llvm_::module::add_global_variable);
+ extensions (mu::string (U"module/add_package"), new (GC) mu::llvm_::module::add_package);
+ extensions (mu::string (U"module/assemble"), new (GC) mu::llvm_::module::assemble);
+ extensions (mu::string (U"module/create"), new (GC) mu::llvm_::module::create);
+ extensions (mu::string (U"module/get_function"), new (GC) mu::llvm_::module::get_function);
+ extensions (mu::string (U"module/get_package"), new (GC) mu::llvm_::module::get_package);
+ extensions (mu::string (U"module/merge"), new (GC) mu::llvm_::module::merge);
+ extensions (mu::string (U"module/print"), new (GC) mu::llvm_::module::print);
+ extensions (mu::string (U"module/verify"), new (GC) mu::llvm_::module::verify);
+ extensions (mu::string (U"pointer_type/create"), new (GC) mu::llvm_::pointer_type::create);
+ extensions (mu::string (U"synthesizer/operation"), new (GC) mu::llvm_::synthesizer::operation);
+ extensions (mu::string (U"value/get_context"), new (GC) mu::llvm_::value::get_context);
+ extensions (mu::string (U"value/set_name"), new (GC) mu::llvm_::value::set_name);
return result;
}
View
23 mu/test_entry/llvm_/constant_string/extension.cpp
@@ -2,14 +2,15 @@
#include <mu/io/ast/builder.h>
#include <mu/io/source.h>
#include <mu/llvm_/constant_string/extension.h>
-#include <mu/io/ast/cluster.h>
-#include <mu/io/ast/expression.h>
#include <mu/io/analyzer/expression.h>
#include <mu/io/analyzer/routine.h>
#include <mu/io/analyzer/analyzer.h>
#include <mu/core/expression.h>
#include <mu/llvm_/context/node.h>
#include <mu/llvm_/module/node.h>
+#include <mu/io/ast/cluster.h>
+#include <mu/io/ast/expression.h>
+#include <mu/io/keywording/extensions.h>
#include <boost/bind.hpp>
@@ -27,21 +28,15 @@ static void junk (mu::core::cluster * cluster_a)
TEST (llvm_test, constant_string_extension1)
{
+ llvm::LLVMContext context;
+ auto ctx (new (GC) mu::llvm_::context::node (&context));
+ auto module (new (GC) mu::llvm_::module::node (new llvm::Module (llvm::StringRef (""), context)));
mu::io::ast::builder builder;
+ (*builder.keywording.extensions) (mu::string (U"`"), [module] (mu::io::keywording::keywording & keywording_a) {return new (GC) mu::llvm_::constant_string::extension (keywording_a, module);}, false);
mu::io::process (builder, U"[` test_string]");
EXPECT_TRUE (builder.errors.errors.empty ());
auto cluster (builder.cluster);
- EXPECT_EQ (cluster->expressions.size (), 1);
+ EXPECT_TRUE (cluster->expressions.size () == 1);
auto expression (cluster->expressions [0]);
- EXPECT_EQ (expression->values.size (), 2);
- mu::io::analyzer::analyzer analyzer (boost::bind (&junk, _1), builder.errors);
- mu::io::analyzer::routine rout (analyzer, expression);
- auto self (new (GC) mu::core::expression);
- llvm::LLVMContext context;
- auto ctx (new (GC) mu::llvm_::context::node (&context));
- auto module (new (GC) mu::llvm_::module::node (new llvm::Module (llvm::StringRef (""), context)));
- ASSERT_TRUE (false);/*
- (*analyzer.extensions) (mu::string (U"`"), [module] (mu::io::keywording::keywording & keywording_a) {return new (GC) mu::llvm_::constant_string::extension (module, keywording_a);}, false);
- mu::io::analyzer::expression exp (rout, expression, self);
- EXPECT_TRUE (builder.errors.errors.empty ());*/
+ EXPECT_TRUE (expression->values.size () == 1);
}
View
6 mu/test_entry/script/debugging/trace_target.cpp
@@ -7,6 +7,7 @@
#include <mu/script/cluster/node.h>
#include <mu/script/runtime/routine.h>
#include <mu/script/values/operation.h>
+#include <mu/io/keywording/extensions.h>
#include <boost/bind.hpp>
@@ -20,8 +21,7 @@ TEST (script_test, trace_target1)
{
mu::script::context context (*new (GC) mu::script::debugging::trace_target (new (GC) mu::core::errors::error_list, context));
mu::script::builder builder;
- ASSERT_TRUE (false);/*
- (*builder.analyzer.extensions) (mu::string (U"fail"), new (GC) mu::io::analyzer::extensions::global (new (GC) mu::script::fail::operation));
+ (*builder.keywording.extensions) (mu::string (U"fail"), new (GC) mu::script::fail::operation);
mu::io::process (builder, U"[fail]");
ASSERT_TRUE (builder.errors.errors.empty ());
auto cluster (builder.cluster);
@@ -33,5 +33,5 @@ TEST (script_test, trace_target1)
EXPECT_EQ (context.working_size (), 0);
mu::stringstream message;
context.errors.print (message);
- mu::string mess (message.str ());*/
+ mu::string mess (message.str ());
}

0 comments on commit c53c7fa

Please sign in to comment.
Something went wrong with that request. Please try again.