Python: cleaner boost dependency

This commit is contained in:
Philippe Tillet
2015-08-06 23:42:55 -07:00
parent 14e5ca0ca8
commit bf866978ad
4317 changed files with 134410 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
/*
(c) 2014 Glen Joseph Fernandes
glenjofe at gmail dot com
Distributed under the Boost Software
License, Version 1.0.
http://boost.org/LICENSE_1_0.txt
*/
#ifndef BOOST_ALIGN_ALIGN_HPP
#define BOOST_ALIGN_ALIGN_HPP
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_STD_ALIGN)
#include <boost/align/detail/align_cxx11.hpp>
#else
#include <boost/align/detail/align.hpp>
#endif
#endif

View File

@@ -0,0 +1,27 @@
/*
(c) 2014 Glen Joseph Fernandes
glenjofe at gmail dot com
Distributed under the Boost Software
License, Version 1.0.
http://boost.org/LICENSE_1_0.txt
*/
#ifndef BOOST_ALIGN_DETAIL_ADDRESS_HPP
#define BOOST_ALIGN_DETAIL_ADDRESS_HPP
#include <boost/cstdint.hpp>
#include <cstddef>
namespace boost {
namespace alignment {
namespace detail {
#if defined(BOOST_HAS_INTPTR_T)
typedef boost::uintptr_t address_t;
#else
typedef std::size_t address_t;
#endif
}
}
}
#endif

View File

@@ -0,0 +1,38 @@
/*
(c) 2014 Glen Joseph Fernandes
glenjofe at gmail dot com
Distributed under the Boost Software
License, Version 1.0.
http://boost.org/LICENSE_1_0.txt
*/
#ifndef BOOST_ALIGN_DETAIL_ALIGN_HPP
#define BOOST_ALIGN_DETAIL_ALIGN_HPP
#include <boost/assert.hpp>
#include <boost/align/detail/address.hpp>
#include <boost/align/detail/is_alignment.hpp>
#include <cstddef>
namespace boost {
namespace alignment {
inline void* align(std::size_t alignment, std::size_t size,
void*& ptr, std::size_t& space)
{
BOOST_ASSERT(detail::is_alignment(alignment));
std::size_t n = detail::address_t(ptr) & (alignment - 1);
if (n != 0) {
n = alignment - n;
}
void* p = 0;
if (n <= space && size <= space - n) {
p = static_cast<char*>(ptr) + n;
ptr = p;
space -= n;
}
return p;
}
}
}
#endif

View File

@@ -0,0 +1,20 @@
/*
(c) 2014 Glen Joseph Fernandes
glenjofe at gmail dot com
Distributed under the Boost Software
License, Version 1.0.
http://boost.org/LICENSE_1_0.txt
*/
#ifndef BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP
#define BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP
#include <memory>
namespace boost {
namespace alignment {
using std::align;
}
}
#endif

View File

@@ -0,0 +1,27 @@
/*
(c) 2014 Glen Joseph Fernandes
glenjofe at gmail dot com
Distributed under the Boost Software
License, Version 1.0.
http://boost.org/LICENSE_1_0.txt
*/
#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP
#define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP
#include <boost/config.hpp>
#include <cstddef>
namespace boost {
namespace alignment {
namespace detail {
BOOST_CONSTEXPR inline bool is_alignment(std::size_t
value) BOOST_NOEXCEPT
{
return (value > 0) && ((value & (value - 1)) == 0);
}
}
}
}
#endif

View File

@@ -0,0 +1,98 @@
#ifndef BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP
#define BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// helper_collection.hpp: archive support for run-time helpers
// (C) Copyright 2002-2008 Robert Ramey and Joaquin M Lopez Munoz
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#include <cstddef> // NULL
#include <vector>
#include <utility>
#include <memory>
#include <algorithm>
#include <boost/config.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared.hpp>
namespace boost {
namespace archive {
namespace detail {
class helper_collection
{
helper_collection(const helper_collection&); // non-copyable
helper_collection& operator = (const helper_collection&); // non-copyable
// note: we dont' actually "share" the function object pointer
// we only use shared_ptr to make sure that it get's deleted
typedef std::pair<
const void *,
boost::shared_ptr<void>
> helper_value_type;
template<class T>
boost::shared_ptr<void> make_helper_ptr(){
// use boost::shared_ptr rather than std::shared_ptr to maintain
// c++03 compatibility
return boost::make_shared<T>();
}
typedef std::vector<helper_value_type> collection;
collection m_collection;
struct predicate {
const void * const m_ti;
bool operator()(helper_value_type const &rhs) const {
return m_ti == rhs.first;
}
predicate & operator=(const void * ti); // to suppress warning
predicate(const void * ti) :
m_ti(ti)
{}
};
protected:
helper_collection(){}
~helper_collection(){}
public:
template<typename Helper>
Helper& get_helper(void * const id = 0) {
collection::const_iterator it =
std::find_if(
m_collection.begin(),
m_collection.end(),
predicate(id)
);
void * rval = 0;
if(it == m_collection.end()){
m_collection.push_back(
std::make_pair(id, make_helper_ptr<Helper>())
);
rval = m_collection.back().second.get();
}
else{
rval = it->second.get();
}
return *static_cast<Helper *>(rval);
}
};
} // namespace detail
} // namespace serialization
} // namespace boost
#endif // BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP

Some files were not shown because too many files have changed in this diff Show More