Boost eradicated from ChaiScript

This commit is contained in:
Jason Turner
2011-09-21 08:36:46 -06:00
parent d6b475239a
commit 12bd5b0af5
16 changed files with 63 additions and 31 deletions

View File

@@ -74,16 +74,16 @@
/// <hr>
/// \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.
///
/// \subsubsection compilinggcc Compiling with GCC
///
/// 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
/// gcc main.cpp -I/path/to/chaiscript/headers -ldl -lboost_threads
/// gcc main.cpp -I/path/to/chaiscript/headers -ldl
/// \endcode
///
/// Alternatively, you may compile without threading support.
@@ -245,7 +245,9 @@
///
/// 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), "+");
@@ -407,7 +409,7 @@
///
/// 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>
///
@@ -743,6 +745,8 @@
/// \namespace chaiscript::detail
/// \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/bootstrap.hpp"
#include "dispatchkit/bootstrap_stl.hpp"
@@ -750,7 +754,7 @@
#include "dispatchkit/dynamic_object.hpp"
#include "dispatchkit/boxed_number.hpp"
#ifdef BOOST_HAS_DECLSPEC
#ifdef CHAISCRIPT_HAS_DECLSPEC
#define CHAISCRIPT_MODULE_EXPORT extern "C" __declspec(dllexport)
#else
#define CHAISCRIPT_MODULE_EXPORT extern "C"

View 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

View File

@@ -26,7 +26,7 @@ namespace chaiscript
{
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.
/// This allows us to avoid \#ifdef code in the sections that need thread safety.
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.
///
/// \todo move to thread_local when it exists
template<typename T>
class Thread_Storage
{

View File

@@ -7,6 +7,8 @@
#ifndef CHAISCRIPT_BOXED_CAST_HPP_
#define CHAISCRIPT_BOXED_CAST_HPP_
#include "../chaiscript_defines.hpp"
#include "type_info.hpp"
#include "boxed_value.hpp"
#include "boxed_cast_helper.hpp"
@@ -66,7 +68,7 @@ namespace chaiscript
return detail::Cast_Helper<Type>::cast(bv);
} 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
// statment in THIS VERSION of the template instantiation
#pragma warning(push)
@@ -88,7 +90,7 @@ namespace chaiscript
throw exception::bad_boxed_cast(bv.get_type_info(), typeid(Type));
}
#ifdef BOOST_MSVC
#ifdef CHAISCRIPT_MSVC
#pragma warning(pop)
#endif

View File

@@ -7,6 +7,8 @@
#ifndef CHAISCRIPT_OPERATORS_HPP_
#define CHAISCRIPT_OPERATORS_HPP_
#include "../chaiscript_defines.hpp"
namespace chaiscript
{
namespace bootstrap
@@ -154,7 +156,7 @@ namespace chaiscript
template<typename Ret, typename L>
Ret unary_minus(L l)
{
#ifdef BOOST_MSVC
#ifdef CHAISCRIPT_MSVC
#pragma warning(push)
#pragma warning(disable : 4146)
return (-l);

View File

@@ -7,7 +7,7 @@
#ifndef CHAISCRIPT_ALGEBRAIC_HPP_
#define CHAISCRIPT_ALGEBRAIC_HPP_
#include <chaiscript/dispatchkit/dispatchkit.hpp>
#include "../dispatchkit/dispatchkit.hpp"
namespace chaiscript
{

View File

@@ -7,7 +7,7 @@
#ifndef CHAISCRIPT_COMMON_HPP_
#define CHAISCRIPT_COMMON_HPP_
#include <chaiscript/dispatchkit/dispatchkit.hpp>
#include "../dispatchkit/dispatchkit.hpp"
namespace chaiscript
{

View File

@@ -10,12 +10,13 @@
#include <exception>
#include <fstream>
#include <chaiscript/language/chaiscript_common.hpp>
#include "../chaiscript_defines.hpp"
#include "chaiscript_common.hpp"
#ifdef _POSIX_VERSION
#include <dlfcn.h>
#else
#ifdef BOOST_WINDOWS
#ifdef CHAISCRIPT_WINDOWS
#define VC_EXTRA_LEAN
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
@@ -23,8 +24,8 @@
#endif
#include <chaiscript/language/chaiscript_prelude.hpp>
#include <chaiscript/language/chaiscript_parser.hpp>
#include "chaiscript_prelude.hpp"
#include "chaiscript_parser.hpp"
#include "../dispatchkit/exception_specification.hpp"
namespace chaiscript

View File

@@ -9,7 +9,7 @@
#include <map>
#include <chaiscript/language/chaiscript_common.hpp>
#include "chaiscript_common.hpp"
namespace chaiscript
{