Move to using the new constructor that searched for the stdlib
to improve compile time.
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <chaiscript/chaiscript.hpp>
|
#include <chaiscript/chaiscript.hpp>
|
||||||
#include <chaiscript/chaiscript_stdlib.hpp>
|
#include <chaiscript/dispatchkit/bootstrap_stl.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)
|
||||||
@@ -67,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(Std_Lib::library());
|
ChaiScript chai;
|
||||||
|
|
||||||
//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,6 +1,5 @@
|
|||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
|
|
||||||
#include <chaiscript/chaiscript_stdlib.hpp>
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -9,7 +8,7 @@ int main()
|
|||||||
// in an std::function or provide the signature
|
// in an std::function or provide the signature
|
||||||
|
|
||||||
|
|
||||||
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
|
|
||||||
// provide the signature
|
// provide the signature
|
||||||
chai.add(chaiscript::fun<std::string ()>([] { return "hello"; } ), "f1");
|
chai.add(chaiscript::fun<std::string ()>([] { return "hello"; } ), "f1");
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#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>
|
||||||
@@ -16,7 +15,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,11 +1,10 @@
|
|||||||
// 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::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chai.eval("throw(runtime_error(\"error\"));");
|
chai.eval("throw(runtime_error(\"error\"));");
|
||||||
@@ -23,7 +22,7 @@ int test_generic()
|
|||||||
|
|
||||||
int test_1()
|
int test_1()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chai.eval("throw(1)", chaiscript::exception_specification<int>());
|
chai.eval("throw(1)", chaiscript::exception_specification<int>());
|
||||||
@@ -40,7 +39,7 @@ int test_1()
|
|||||||
|
|
||||||
int test_2()
|
int test_2()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chai.eval("throw(1.0)", chaiscript::exception_specification<int, double>());
|
chai.eval("throw(1.0)", chaiscript::exception_specification<int, double>());
|
||||||
@@ -57,7 +56,7 @@ int test_2()
|
|||||||
|
|
||||||
int test_5()
|
int test_5()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
|
|
||||||
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 &>());
|
||||||
@@ -83,7 +82,7 @@ int test_5()
|
|||||||
|
|
||||||
int test_unhandled()
|
int test_unhandled()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
|
|
||||||
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,7 +1,6 @@
|
|||||||
// 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 &)
|
||||||
{
|
{
|
||||||
@@ -15,7 +14,7 @@ int test_two(int &)
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
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,5 +1,4 @@
|
|||||||
#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)
|
||||||
{
|
{
|
||||||
@@ -9,7 +8,7 @@ double test_call(const std::function<double (int)> &f, int val)
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
|
|
||||||
chai.add(chaiscript::fun(&test_call), "test_call");
|
chai.add(chaiscript::fun(&test_call), "test_call");
|
||||||
|
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
|
|
||||||
#include <chaiscript/chaiscript_stdlib.hpp>
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
|
|
||||||
chai.eval("def func() { print(\"Hello World\"); } ");
|
chai.eval("def func() { print(\"Hello World\"); } ");
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
#include <chaiscript/chaiscript_stdlib.hpp>
|
|
||||||
|
|
||||||
class Test
|
class Test
|
||||||
{
|
{
|
||||||
@@ -37,7 +36,7 @@ int main()
|
|||||||
{ {chaiscript::fun(&Test::count), "count"} }
|
{ {chaiscript::fun(&Test::count), "count"} }
|
||||||
);
|
);
|
||||||
|
|
||||||
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
chai.add(m);
|
chai.add(m);
|
||||||
// chai.add(chaiscript::fun(&Test::count), "count");
|
// chai.add(chaiscript::fun(&Test::count), "count");
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#include <chaiscript/utility/utility.hpp>
|
#include <chaiscript/utility/utility.hpp>
|
||||||
#include <chaiscript/chaiscript_stdlib.hpp>
|
|
||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
public:
|
public:
|
||||||
@@ -13,7 +12,7 @@ class Test {
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
chaiscript::ChaiScript chai;
|
||||||
chai.add(chaiscript::user_type<Test>(), "Test");
|
chai.add(chaiscript::user_type<Test>(), "Test");
|
||||||
chai.add(chaiscript::constructor<Test()>(), "Test");
|
chai.add(chaiscript::constructor<Test()>(), "Test");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user