Boost eradicated from ChaiScript
This commit is contained in:
@@ -50,7 +50,7 @@ function run_test
|
|||||||
# Run multithreaded tests
|
# Run multithreaded tests
|
||||||
echo "****Building multithreaded test"
|
echo "****Building multithreaded test"
|
||||||
pushd src
|
pushd src
|
||||||
g++ multithreaded.cpp -lboost_thread-mt -ldl -omultithreaded -I../include -O3
|
g++ multithreaded.cpp -ldl -omultithreaded -I../include -O3
|
||||||
echo "****Testing 1 thread runtime"
|
echo "****Testing 1 thread runtime"
|
||||||
/usr/bin/time -p ./multithreaded 1 2> ../../r$1-1threadruntime.out
|
/usr/bin/time -p ./multithreaded 1 2> ../../r$1-1threadruntime.out
|
||||||
echo "****Testing 2 thread runtime"
|
echo "****Testing 2 thread runtime"
|
||||||
|
@@ -74,16 +74,16 @@
|
|||||||
/// <hr>
|
/// <hr>
|
||||||
/// \subsection compiling Compiling ChaiScript Applications
|
/// \subsection compiling Compiling ChaiScript Applications
|
||||||
///
|
///
|
||||||
/// ChaiScript is a header only library with only two dependecies. boost::threads (optional) and the
|
/// ChaiScript is a header only library with only one dependecy: The
|
||||||
/// operating system provided dynamic library loader, which has to be specified on some platforms.
|
/// operating system provided dynamic library loader, which has to be specified on some platforms.
|
||||||
///
|
///
|
||||||
/// \subsubsection compilinggcc Compiling with GCC
|
/// \subsubsection compilinggcc Compiling with GCC
|
||||||
///
|
///
|
||||||
/// To compile the above application on a Unix like operating system (MacOS, Linux) with GCC you need to link
|
/// To compile the above application on a Unix like operating system (MacOS, Linux) with GCC you need to link
|
||||||
/// both boost::threads and the dynamic loader. For example:
|
/// the dynamic loader. For example:
|
||||||
///
|
///
|
||||||
/// \code
|
/// \code
|
||||||
/// gcc main.cpp -I/path/to/chaiscript/headers -ldl -lboost_threads
|
/// gcc main.cpp -I/path/to/chaiscript/headers -ldl
|
||||||
/// \endcode
|
/// \endcode
|
||||||
///
|
///
|
||||||
/// Alternatively, you may compile without threading support.
|
/// Alternatively, you may compile without threading support.
|
||||||
@@ -245,7 +245,9 @@
|
|||||||
///
|
///
|
||||||
/// std::string append_string_int(const std::string &t_lhs, int t_rhs)
|
/// std::string append_string_int(const std::string &t_lhs, int t_rhs)
|
||||||
/// {
|
/// {
|
||||||
/// return t_lhs + boost::lexical_cast<std::string>(t_rhs);
|
/// std::stringstream ss;
|
||||||
|
/// ss << t_lhs << t_rhs;
|
||||||
|
/// return ss.str();
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// chai.add(fun(append_string_int), "+");
|
/// chai.add(fun(append_string_int), "+");
|
||||||
@@ -407,7 +409,7 @@
|
|||||||
///
|
///
|
||||||
/// Thread safety can be disabled by defining CHAISCRIPT_NO_THREADS when using the library.
|
/// Thread safety can be disabled by defining CHAISCRIPT_NO_THREADS when using the library.
|
||||||
///
|
///
|
||||||
/// Disabling thread safety increases performance and removes the requirement for boost_threads.
|
/// Disabling thread safety increases performance in many cases.
|
||||||
///
|
///
|
||||||
/// <hr>
|
/// <hr>
|
||||||
///
|
///
|
||||||
@@ -743,6 +745,8 @@
|
|||||||
/// \namespace chaiscript::detail
|
/// \namespace chaiscript::detail
|
||||||
/// \brief Classes and functions reserved for internal use. Items in this namespace are not supported.
|
/// \brief Classes and functions reserved for internal use. Items in this namespace are not supported.
|
||||||
|
|
||||||
|
#include "chaiscript_defines.hpp"
|
||||||
|
|
||||||
#include "dispatchkit/dispatchkit.hpp"
|
#include "dispatchkit/dispatchkit.hpp"
|
||||||
#include "dispatchkit/bootstrap.hpp"
|
#include "dispatchkit/bootstrap.hpp"
|
||||||
#include "dispatchkit/bootstrap_stl.hpp"
|
#include "dispatchkit/bootstrap_stl.hpp"
|
||||||
@@ -750,7 +754,7 @@
|
|||||||
#include "dispatchkit/dynamic_object.hpp"
|
#include "dispatchkit/dynamic_object.hpp"
|
||||||
#include "dispatchkit/boxed_number.hpp"
|
#include "dispatchkit/boxed_number.hpp"
|
||||||
|
|
||||||
#ifdef BOOST_HAS_DECLSPEC
|
#ifdef CHAISCRIPT_HAS_DECLSPEC
|
||||||
#define CHAISCRIPT_MODULE_EXPORT extern "C" __declspec(dllexport)
|
#define CHAISCRIPT_MODULE_EXPORT extern "C" __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define CHAISCRIPT_MODULE_EXPORT extern "C"
|
#define CHAISCRIPT_MODULE_EXPORT extern "C"
|
||||||
|
20
include/chaiscript/chaiscript_defines.hpp
Normal file
20
include/chaiscript/chaiscript_defines.hpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// This file is distributed under the BSD License.
|
||||||
|
// See "license.txt" for details.
|
||||||
|
// Copyright 2009-2011, Jonathan Turner (jonathan@emptycrate.com)
|
||||||
|
// and Jason Turner (jason@emptycrate.com)
|
||||||
|
// http://www.chaiscript.com
|
||||||
|
|
||||||
|
#ifndef CHAISCRIPT_DEFINES_HPP_
|
||||||
|
#define CHAISCRIPT_DEFINES_HPP_
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define CHAISCRIPT_MSVC _MSC_VER
|
||||||
|
#define CHAISCRIPT_HAS_DECLSPEc
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define CHAISCRIPT_WINDOWS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@@ -26,7 +26,7 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
/// If threading is enabled, then this namespace contains boost::thread classes.
|
/// If threading is enabled, then this namespace contains std thread classes.
|
||||||
/// If threading is not enabled, then stubbed in wrappers that do nothing are provided.
|
/// If threading is not enabled, then stubbed in wrappers that do nothing are provided.
|
||||||
/// This allows us to avoid \#ifdef code in the sections that need thread safety.
|
/// This allows us to avoid \#ifdef code in the sections that need thread safety.
|
||||||
namespace threading
|
namespace threading
|
||||||
@@ -64,8 +64,10 @@ namespace chaiscript
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Typesafe thread specific storage. If threading is enabled, this class uses boost::thread_specific_ptr<T>. If
|
/// Typesafe thread specific storage. If threading is enabled, this class uses a mutex protected map. If
|
||||||
/// threading is not enabled, the class always returns the same data, regardless of which thread it is called from.
|
/// threading is not enabled, the class always returns the same data, regardless of which thread it is called from.
|
||||||
|
///
|
||||||
|
/// \todo move to thread_local when it exists
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class Thread_Storage
|
class Thread_Storage
|
||||||
{
|
{
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
#ifndef CHAISCRIPT_BOXED_CAST_HPP_
|
#ifndef CHAISCRIPT_BOXED_CAST_HPP_
|
||||||
#define CHAISCRIPT_BOXED_CAST_HPP_
|
#define CHAISCRIPT_BOXED_CAST_HPP_
|
||||||
|
|
||||||
|
#include "../chaiscript_defines.hpp"
|
||||||
|
|
||||||
#include "type_info.hpp"
|
#include "type_info.hpp"
|
||||||
#include "boxed_value.hpp"
|
#include "boxed_value.hpp"
|
||||||
#include "boxed_cast_helper.hpp"
|
#include "boxed_cast_helper.hpp"
|
||||||
@@ -66,7 +68,7 @@ namespace chaiscript
|
|||||||
return detail::Cast_Helper<Type>::cast(bv);
|
return detail::Cast_Helper<Type>::cast(bv);
|
||||||
} catch (const chaiscript::detail::exception::bad_any_cast &) {
|
} catch (const chaiscript::detail::exception::bad_any_cast &) {
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
//Thank you MSVC, yes we know that a constant value is being used in the if
|
//Thank you MSVC, yes we know that a constant value is being used in the if
|
||||||
// statment in THIS VERSION of the template instantiation
|
// statment in THIS VERSION of the template instantiation
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
@@ -88,7 +90,7 @@ namespace chaiscript
|
|||||||
throw exception::bad_boxed_cast(bv.get_type_info(), typeid(Type));
|
throw exception::bad_boxed_cast(bv.get_type_info(), typeid(Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
#ifndef CHAISCRIPT_OPERATORS_HPP_
|
#ifndef CHAISCRIPT_OPERATORS_HPP_
|
||||||
#define CHAISCRIPT_OPERATORS_HPP_
|
#define CHAISCRIPT_OPERATORS_HPP_
|
||||||
|
|
||||||
|
#include "../chaiscript_defines.hpp"
|
||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
{
|
{
|
||||||
namespace bootstrap
|
namespace bootstrap
|
||||||
@@ -154,7 +156,7 @@ namespace chaiscript
|
|||||||
template<typename Ret, typename L>
|
template<typename Ret, typename L>
|
||||||
Ret unary_minus(L l)
|
Ret unary_minus(L l)
|
||||||
{
|
{
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4146)
|
#pragma warning(disable : 4146)
|
||||||
return (-l);
|
return (-l);
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
#ifndef CHAISCRIPT_ALGEBRAIC_HPP_
|
#ifndef CHAISCRIPT_ALGEBRAIC_HPP_
|
||||||
#define CHAISCRIPT_ALGEBRAIC_HPP_
|
#define CHAISCRIPT_ALGEBRAIC_HPP_
|
||||||
|
|
||||||
#include <chaiscript/dispatchkit/dispatchkit.hpp>
|
#include "../dispatchkit/dispatchkit.hpp"
|
||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
{
|
{
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
#ifndef CHAISCRIPT_COMMON_HPP_
|
#ifndef CHAISCRIPT_COMMON_HPP_
|
||||||
#define CHAISCRIPT_COMMON_HPP_
|
#define CHAISCRIPT_COMMON_HPP_
|
||||||
|
|
||||||
#include <chaiscript/dispatchkit/dispatchkit.hpp>
|
#include "../dispatchkit/dispatchkit.hpp"
|
||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
{
|
{
|
||||||
|
@@ -10,12 +10,13 @@
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include <chaiscript/language/chaiscript_common.hpp>
|
#include "../chaiscript_defines.hpp"
|
||||||
|
#include "chaiscript_common.hpp"
|
||||||
|
|
||||||
#ifdef _POSIX_VERSION
|
#ifdef _POSIX_VERSION
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#else
|
#else
|
||||||
#ifdef BOOST_WINDOWS
|
#ifdef CHAISCRIPT_WINDOWS
|
||||||
#define VC_EXTRA_LEAN
|
#define VC_EXTRA_LEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
@@ -23,8 +24,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <chaiscript/language/chaiscript_prelude.hpp>
|
#include "chaiscript_prelude.hpp"
|
||||||
#include <chaiscript/language/chaiscript_parser.hpp>
|
#include "chaiscript_parser.hpp"
|
||||||
#include "../dispatchkit/exception_specification.hpp"
|
#include "../dispatchkit/exception_specification.hpp"
|
||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include <chaiscript/language/chaiscript_common.hpp>
|
#include "chaiscript_common.hpp"
|
||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
{
|
{
|
||||||
|
@@ -13,7 +13,7 @@ ChaiScript is one of the only embedded scripting language designed from the grou
|
|||||||
|
|
||||||
[Requirements]
|
[Requirements]
|
||||||
|
|
||||||
ChaiScript requires a recent version of Boost (http://www.boost.org) to build.
|
ChaiScript requires a C++11 compiler to build with support for variadic templates.
|
||||||
|
|
||||||
[Usage]
|
[Usage]
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ char* readline(const char* p)
|
|||||||
std::string retval;
|
std::string retval;
|
||||||
std::cout << p ;
|
std::cout << p ;
|
||||||
std::getline(std::cin, retval);
|
std::getline(std::cin, retval);
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
return std::cin.eof() ? NULL : _strdup(retval.c_str());
|
return std::cin.eof() ? NULL : _strdup(retval.c_str());
|
||||||
#else
|
#else
|
||||||
return std::cin.eof() ? NULL : strdup(retval.c_str());
|
return std::cin.eof() ? NULL : strdup(retval.c_str());
|
||||||
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
|
|||||||
std::vector<std::string> modulepaths;
|
std::vector<std::string> modulepaths;
|
||||||
|
|
||||||
// Disable deprecation warning for getenv call.
|
// Disable deprecation warning for getenv call.
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
#endif
|
#endif
|
||||||
@@ -160,7 +160,7 @@ int main(int argc, char *argv[])
|
|||||||
const char *usepath = getenv("CHAI_USE_PATH");
|
const char *usepath = getenv("CHAI_USE_PATH");
|
||||||
const char *modulepath = getenv("CHAI_MODULE_PATH");
|
const char *modulepath = getenv("CHAI_MODULE_PATH");
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -14,8 +14,9 @@
|
|||||||
void do_work(chaiscript::ChaiScript &c)
|
void do_work(chaiscript::ChaiScript &c)
|
||||||
{
|
{
|
||||||
// c("use(\"work.chai\"); do_chai_work(num_iterations);");
|
// c("use(\"work.chai\"); do_chai_work(num_iterations);");
|
||||||
std::string name = "MyVar" + boost::lexical_cast<std::string>(rand());
|
std::stringstream ss;
|
||||||
c.add(chaiscript::var(5), name);
|
ss << "MyVar" << rand();
|
||||||
|
c.add(chaiscript::var(5), ss.str());
|
||||||
c("use(\"work.chai\"); do_chai_work(10000);");
|
c("use(\"work.chai\"); do_chai_work(10000);");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// MSVC doesn't like that we are using C++ return types from our C declared module
|
// MSVC doesn't like that we are using C++ return types from our C declared module
|
||||||
// but this is the best way to do it for cross platform compatibility
|
// but this is the best way to do it for cross platform compatibility
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4190)
|
#pragma warning(disable : 4190)
|
||||||
#endif
|
#endif
|
||||||
@@ -96,6 +96,6 @@ CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_reflect
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
// MSVC doesn't like that we are using C++ return types from our C declared module
|
// MSVC doesn't like that we are using C++ return types from our C declared module
|
||||||
// but this is the best way to do it for cross platform compatibility
|
// but this is the best way to do it for cross platform compatibility
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4190)
|
#pragma warning(disable : 4190)
|
||||||
#endif
|
#endif
|
||||||
@@ -16,6 +16,6 @@ CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_stl_extr
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
@@ -42,7 +42,7 @@ int *get_new_int()
|
|||||||
|
|
||||||
// MSVC doesn't like that we are using C++ return types from our C declared module
|
// MSVC doesn't like that we are using C++ return types from our C declared module
|
||||||
// but this is the best way to do it for cross platform compatibility
|
// but this is the best way to do it for cross platform compatibility
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4190)
|
#pragma warning(disable : 4190)
|
||||||
#endif
|
#endif
|
||||||
@@ -82,6 +82,6 @@ CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_test_mo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
#ifdef CHAISCRIPT_MSVC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user