Reduce cost of including chaiscript.hpp
- ChaiScript no longer includes or automatically instantiates std lib - ChaiScript constructor now requires an std lib instance in the form of a ModulePtr object - This new layout facilitates better usage of compilation firewalls and factories for reducing the overall impact of ChaiScript on a project
This commit is contained in:
parent
9a9d4e1ae0
commit
136b877afa
@ -748,8 +748,6 @@
|
|||||||
#include "chaiscript_defines.hpp"
|
#include "chaiscript_defines.hpp"
|
||||||
|
|
||||||
#include "dispatchkit/dispatchkit.hpp"
|
#include "dispatchkit/dispatchkit.hpp"
|
||||||
#include "dispatchkit/bootstrap.hpp"
|
|
||||||
#include "dispatchkit/bootstrap_stl.hpp"
|
|
||||||
#include "dispatchkit/function_call.hpp"
|
#include "dispatchkit/function_call.hpp"
|
||||||
#include "dispatchkit/dynamic_object.hpp"
|
#include "dispatchkit/dynamic_object.hpp"
|
||||||
#include "dispatchkit/boxed_number.hpp"
|
#include "dispatchkit/boxed_number.hpp"
|
||||||
|
@ -478,7 +478,7 @@ namespace chaiscript
|
|||||||
m->add(Proxy_Function(new dispatch::Dynamic_Proxy_Function(std::bind(&call_exists, std::placeholders::_1))),
|
m->add(Proxy_Function(new dispatch::Dynamic_Proxy_Function(std::bind(&call_exists, std::placeholders::_1))),
|
||||||
"call_exists");
|
"call_exists");
|
||||||
|
|
||||||
m->add(fun(&type_match), "type_match");
|
m->add(fun(&Boxed_Value::type_match), "type_match");
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#define CHAISCRIPT_BOOTSTRAP_STL_HPP_
|
#define CHAISCRIPT_BOOTSTRAP_STL_HPP_
|
||||||
|
|
||||||
#include "dispatchkit.hpp"
|
#include "dispatchkit.hpp"
|
||||||
|
#include "bootstrap.hpp"
|
||||||
#include "register_function.hpp"
|
#include "register_function.hpp"
|
||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
|
@ -263,6 +263,12 @@ namespace chaiscript
|
|||||||
return m_data->m_const_data_ptr;
|
return m_data->m_const_data_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \returns true if the two Boxed_Values share the same internal type
|
||||||
|
static bool type_match(Boxed_Value l, Boxed_Value r)
|
||||||
|
{
|
||||||
|
return l.get_type_info() == r.get_type_info();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Data> m_data;
|
std::shared_ptr<Data> m_data;
|
||||||
};
|
};
|
||||||
@ -361,11 +367,6 @@ namespace chaiscript
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// \returns true if the two Boxed_Values share the same internal type
|
|
||||||
static bool type_match(Boxed_Value l, Boxed_Value r)
|
|
||||||
{
|
|
||||||
return l.get_type_info() == r.get_type_info();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#ifndef CHAISCRIPT_COMMON_HPP_
|
#ifndef CHAISCRIPT_COMMON_HPP_
|
||||||
#define CHAISCRIPT_COMMON_HPP_
|
#define CHAISCRIPT_COMMON_HPP_
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
#include "../dispatchkit/dispatchkit.hpp"
|
#include "../dispatchkit/dispatchkit.hpp"
|
||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
|
@ -324,8 +324,7 @@ namespace chaiscript
|
|||||||
/**
|
/**
|
||||||
* Builds all the requirements for ChaiScript, including its evaluator and a run of its prelude.
|
* Builds all the requirements for ChaiScript, including its evaluator and a run of its prelude.
|
||||||
*/
|
*/
|
||||||
void build_eval_system() {
|
void build_eval_system(const ModulePtr &t_lib) {
|
||||||
using namespace bootstrap;
|
|
||||||
m_engine.add_reserved_word("def");
|
m_engine.add_reserved_word("def");
|
||||||
m_engine.add_reserved_word("fun");
|
m_engine.add_reserved_word("fun");
|
||||||
m_engine.add_reserved_word("while");
|
m_engine.add_reserved_word("while");
|
||||||
@ -342,7 +341,7 @@ namespace chaiscript
|
|||||||
m_engine.add_reserved_word("false");
|
m_engine.add_reserved_word("false");
|
||||||
m_engine.add_reserved_word("_");
|
m_engine.add_reserved_word("_");
|
||||||
|
|
||||||
add(Bootstrap::bootstrap());
|
add(t_lib);
|
||||||
|
|
||||||
m_engine.add(fun(&chaiscript::detail::Dispatch_Engine::dump_system, std::ref(m_engine)), "dump_system");
|
m_engine.add(fun(&chaiscript::detail::Dispatch_Engine::dump_system, std::ref(m_engine)), "dump_system");
|
||||||
m_engine.add(fun(&chaiscript::detail::Dispatch_Engine::dump_object, std::ref(m_engine)), "dump_object");
|
m_engine.add(fun(&chaiscript::detail::Dispatch_Engine::dump_object, std::ref(m_engine)), "dump_object");
|
||||||
@ -359,11 +358,6 @@ namespace chaiscript
|
|||||||
m_engine.add(fun(static_cast<load_mod_1>(&ChaiScript::load_module), this), "load_module");
|
m_engine.add(fun(static_cast<load_mod_1>(&ChaiScript::load_module), this), "load_module");
|
||||||
m_engine.add(fun(static_cast<load_mod_2>(&ChaiScript::load_module), this), "load_module");
|
m_engine.add(fun(static_cast<load_mod_2>(&ChaiScript::load_module), this), "load_module");
|
||||||
|
|
||||||
add(standard_library::vector_type<std::vector<Boxed_Value> >("Vector"));
|
|
||||||
add(standard_library::string_type<std::string>("string"));
|
|
||||||
add(standard_library::map_type<std::map<std::string, Boxed_Value> >("Map"));
|
|
||||||
add(standard_library::pair_type<std::pair<Boxed_Value, Boxed_Value > >("Pair"));
|
|
||||||
|
|
||||||
m_engine.add(fun(&ChaiScript::use, this), "use");
|
m_engine.add(fun(&ChaiScript::use, this), "use");
|
||||||
m_engine.add(fun(&ChaiScript::internal_eval, this), "eval");
|
m_engine.add(fun(&ChaiScript::internal_eval, this), "eval");
|
||||||
m_engine.add(fun(&ChaiScript::internal_eval_ast, this), "eval");
|
m_engine.add(fun(&ChaiScript::internal_eval_ast, this), "eval");
|
||||||
@ -398,9 +392,11 @@ namespace chaiscript
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief Constructor for ChaiScript
|
/// \brief Constructor for ChaiScript
|
||||||
|
/// \param[in] t_lib Standard library to apply to this ChaiScript instance
|
||||||
/// \param[in] t_modulepaths Vector of paths to search when attempting to load a binary module
|
/// \param[in] t_modulepaths Vector of paths to search when attempting to load a binary module
|
||||||
/// \param[in] t_usepaths Vector of paths to search when attempting to "use" an included ChaiScript file
|
/// \param[in] t_usepaths Vector of paths to search when attempting to "use" an included ChaiScript file
|
||||||
ChaiScript(const std::vector<std::string> &t_modulepaths = std::vector<std::string>(),
|
ChaiScript(const ModulePtr &t_lib,
|
||||||
|
const std::vector<std::string> &t_modulepaths = std::vector<std::string>(),
|
||||||
const std::vector<std::string> &t_usepaths = std::vector<std::string>())
|
const std::vector<std::string> &t_usepaths = std::vector<std::string>())
|
||||||
: m_modulepaths(t_modulepaths), m_usepaths(t_usepaths)
|
: m_modulepaths(t_modulepaths), m_usepaths(t_usepaths)
|
||||||
{
|
{
|
||||||
@ -414,7 +410,7 @@ namespace chaiscript
|
|||||||
m_usepaths.push_back("");
|
m_usepaths.push_back("");
|
||||||
}
|
}
|
||||||
|
|
||||||
build_eval_system();
|
build_eval_system(t_lib);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Adds a constant object that is available in all contexts and to all threads
|
/// \brief Adds a constant object that is available in all contexts and to all threads
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "chaiscript_common.hpp"
|
#include "chaiscript_common.hpp"
|
||||||
|
#include "../dispatchkit/register_function.hpp"
|
||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <chaiscript/chaiscript.hpp>
|
#include <chaiscript/chaiscript.hpp>
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
#include <chaiscript/dispatchkit/function_call.hpp>
|
#include <chaiscript/dispatchkit/function_call.hpp>
|
||||||
|
|
||||||
void log(const std::string &msg)
|
void log(const std::string &msg)
|
||||||
@ -66,7 +67,7 @@ void take_shared_ptr(const std::shared_ptr<const std::string> &p)
|
|||||||
int main(int /*argc*/, char * /*argv*/[]) {
|
int main(int /*argc*/, char * /*argv*/[]) {
|
||||||
using namespace chaiscript;
|
using namespace chaiscript;
|
||||||
|
|
||||||
ChaiScript chai;
|
ChaiScript chai(Std_Lib::library());
|
||||||
|
|
||||||
//Create a new system object and share it with the chaiscript engine
|
//Create a new system object and share it with the chaiscript engine
|
||||||
System system;
|
System system;
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "chaiscript/chaiscript.hpp"
|
#include <chaiscript/chaiscript.hpp>
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
|
|
||||||
#ifdef READLINE_AVAILABLE
|
#ifdef READLINE_AVAILABLE
|
||||||
#include <readline/readline.h>
|
#include <readline/readline.h>
|
||||||
#include <readline/history.h>
|
#include <readline/history.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
using namespace chaiscript;
|
|
||||||
|
|
||||||
std::string get_next_command() {
|
std::string get_next_command() {
|
||||||
#ifdef READLINE_AVAILABLE
|
#ifdef READLINE_AVAILABLE
|
||||||
@ -30,30 +31,32 @@ void fuction(void)
|
|||||||
|
|
||||||
class test
|
class test
|
||||||
{
|
{
|
||||||
ChaiScript chai;
|
chaiscript::ChaiScript chai;
|
||||||
ChaiScript::State backupState;
|
chaiscript::ChaiScript::State backupState;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
test()
|
test()
|
||||||
{
|
: chai(chaiscript::Std_Lib::library())
|
||||||
backupState = chai.get_state();
|
{
|
||||||
}
|
backupState = chai.get_state();
|
||||||
~test(){}
|
|
||||||
|
|
||||||
void ResetState()
|
|
||||||
{
|
|
||||||
chai.set_state(backupState);
|
|
||||||
chai.add(fun(&fuction),"Whatever()");
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunFile(std::string sFile)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
chaiscript::Boxed_Value val = chai.eval_file(sFile);
|
|
||||||
}
|
}
|
||||||
catch (std::exception &e) {
|
~test(){}
|
||||||
std::cout << e.what() << std::endl;
|
|
||||||
|
void ResetState()
|
||||||
|
{
|
||||||
|
chai.set_state(backupState);
|
||||||
|
chai.add(chaiscript::fun(&fuction),"Whatever()");
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunFile(std::string sFile)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
chaiscript::Boxed_Value val = chai.eval_file(sFile);
|
||||||
|
}
|
||||||
|
catch (std::exception &e) {
|
||||||
|
std::cout << e.what() << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#include <chaiscript/chaiscript.hpp>
|
#include <chaiscript/chaiscript.hpp>
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
|
|
||||||
#ifdef READLINE_AVAILABLE
|
#ifdef READLINE_AVAILABLE
|
||||||
#include <readline/readline.h>
|
#include <readline/readline.h>
|
||||||
@ -176,7 +177,7 @@ int main(int argc, char *argv[])
|
|||||||
modulepaths.push_back(modulepath);
|
modulepaths.push_back(modulepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
chaiscript::ChaiScript chai(modulepaths,usepaths);
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library(), modulepaths,usepaths);
|
||||||
|
|
||||||
chai.add(chaiscript::fun(&myexit), "exit");
|
chai.add(chaiscript::fun(&myexit), "exit");
|
||||||
chai.add(chaiscript::fun(&myexit), "quit");
|
chai.add(chaiscript::fun(&myexit), "quit");
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
#include <chaiscript/chaiscript.hpp>
|
#include <chaiscript/chaiscript.hpp>
|
||||||
|
#include <chaiscript/dispatchkit/bootstrap.hpp>
|
||||||
|
#include <chaiscript/dispatchkit/bootstrap_stl.hpp>
|
||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
#include <chaiscript/chaiscript.hpp>
|
#include <chaiscript/chaiscript.hpp>
|
||||||
|
#include <chaiscript/dispatchkit/bootstrap_stl.hpp>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
|
|
||||||
template<typename LHS, typename RHS>
|
template<typename LHS, typename RHS>
|
||||||
@ -14,8 +16,7 @@ void assert_equal(const LHS &lhs, const RHS &rhs)
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
chaiscript::ChaiScript chai;
|
|
||||||
|
|
||||||
chai("attr bob::z; def bob::bob() { this.z = 10 }; auto x = bob()");
|
chai("attr bob::z; def bob::bob() { this.z = 10 }; auto x = bob()");
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
// Tests to make sure that the order in which function dispatches occur is correct
|
// Tests to make sure that the order in which function dispatches occur is correct
|
||||||
|
|
||||||
#include <chaiscript/chaiscript.hpp>
|
#include <chaiscript/chaiscript.hpp>
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
|
|
||||||
int test_generic()
|
int test_generic()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chai.eval("throw(runtime_error(\"error\"));");
|
chai.eval("throw(runtime_error(\"error\"));");
|
||||||
@ -22,7 +23,7 @@ int test_generic()
|
|||||||
|
|
||||||
int test_1()
|
int test_1()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chai.eval("throw(1)", chaiscript::exception_specification<int>());
|
chai.eval("throw(1)", chaiscript::exception_specification<int>());
|
||||||
@ -39,7 +40,7 @@ int test_1()
|
|||||||
|
|
||||||
int test_2()
|
int test_2()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chai.eval("throw(1.0)", chaiscript::exception_specification<int, double>());
|
chai.eval("throw(1.0)", chaiscript::exception_specification<int, double>());
|
||||||
@ -56,7 +57,7 @@ int test_2()
|
|||||||
|
|
||||||
int test_5()
|
int test_5()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chai.eval("throw(runtime_error(\"error\"))", chaiscript::exception_specification<int, double, float, const std::string &, const std::exception &>());
|
chai.eval("throw(runtime_error(\"error\"))", chaiscript::exception_specification<int, double, float, const std::string &, const std::exception &>());
|
||||||
@ -82,7 +83,7 @@ int test_5()
|
|||||||
|
|
||||||
int test_unhandled()
|
int test_unhandled()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chai.eval("throw(\"error\")", chaiscript::exception_specification<int, double, float, const std::exception &>());
|
chai.eval("throw(\"error\")", chaiscript::exception_specification<int, double, float, const std::exception &>());
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Tests to make sure that the order in which function dispatches occur is correct
|
// Tests to make sure that the order in which function dispatches occur is correct
|
||||||
|
|
||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
|
|
||||||
int test_one(const int &)
|
int test_one(const int &)
|
||||||
{
|
{
|
||||||
@ -14,7 +15,7 @@ int test_two(int &)
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
chai.eval("def test_fun(x) { return 3; }");
|
chai.eval("def test_fun(x) { return 3; }");
|
||||||
chai.eval("def test_fun(x) : x == \"hi\" { return 4; }");
|
chai.eval("def test_fun(x) : x == \"hi\" { return 4; }");
|
||||||
chai.eval("def test_fun(x) { return 5; }");
|
chai.eval("def test_fun(x) { return 5; }");
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
|
|
||||||
double test_call(const std::function<double (int)> &f, int val)
|
double test_call(const std::function<double (int)> &f, int val)
|
||||||
{
|
{
|
||||||
@ -8,7 +9,7 @@ double test_call(const std::function<double (int)> &f, int val)
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
|
|
||||||
chai.add(chaiscript::fun(&test_call), "test_call");
|
chai.add(chaiscript::fun(&test_call), "test_call");
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
|
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
|
|
||||||
chai.eval("def func() { print(\"Hello World\"); } ");
|
chai.eval("def func() { print(\"Hello World\"); } ");
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#include "multifile_test_chai.hpp"
|
#include "multifile_test_chai.hpp"
|
||||||
|
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
|
|
||||||
Multi_Test_Chai::Multi_Test_Chai()
|
Multi_Test_Chai::Multi_Test_Chai()
|
||||||
: m_chai(new chaiscript::ChaiScript())
|
: m_chai(new chaiscript::ChaiScript(chaiscript::Std_Lib::library()))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
|
|
||||||
class Test
|
class Test
|
||||||
{
|
{
|
||||||
@ -36,7 +37,7 @@ int main()
|
|||||||
{ {chaiscript::fun(&Test::count), "count"} }
|
{ {chaiscript::fun(&Test::count), "count"} }
|
||||||
);
|
);
|
||||||
|
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
chai.add(m);
|
chai.add(m);
|
||||||
chai.add(chaiscript::fun(&Test::count), "count");
|
chai.add(chaiscript::fun(&Test::count), "count");
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
|
|
||||||
class Test
|
class Test
|
||||||
@ -33,7 +34,7 @@ int main()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());;
|
||||||
chai.add(m);
|
chai.add(m);
|
||||||
if (chai.eval<std::string>("auto t = Test(); t.function2(); ") == "Function2"
|
if (chai.eval<std::string>("auto t = Test(); t.function2(); ") == "Function2"
|
||||||
&& chai.eval<std::string>("auto t = Test(); t.functionOverload(1); ") == "int"
|
&& chai.eval<std::string>("auto t = Test(); t.functionOverload(1); ") == "int"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user