[Bf-blender-cvs] [1c14ead] master: Carve bundler script cleanup
Sergey Sharybin
noreply at git.blender.org
Thu Nov 28 09:01:07 CET 2013
Commit: 1c14ead46f6aa7cc850033cf77d59127ca257b93
Author: Sergey Sharybin
Date: Thu Nov 28 13:47:51 2013 +0600
http://developer.blender.org/rB1c14ead46f6aa7cc850033cf77d59127ca257b93
Carve bundler script cleanup
- random.hpp was only removed from actual include
directory, but not from patches/files.
- Files list generator didn't ignore config.h file
which in fact is not needed.
===================================================================
M extern/carve/bundle.sh
M extern/carve/files.txt
M extern/carve/mkfiles.sh
D extern/carve/patches/files/random.hpp
===================================================================
diff --git a/extern/carve/bundle.sh b/extern/carve/bundle.sh
index c80bf64..05967d6 100755
--- a/extern/carve/bundle.sh
+++ b/extern/carve/bundle.sh
@@ -30,8 +30,6 @@ sources=`find ./lib -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' |
headers=`find ./lib -type f -iname '*.h' -or -iname '*.hpp' | sed -r 's/^\.\//\t/' | sort -d`
includes=`find ./include -type f -iname '*.h' -or -iname '*.hpp' | sed -r 's/^\.\//\t/' | sort -d`
-mkdir -p include/carve/external/boost
-cp patches/files/random.hpp include/carve/external/boost/random.hpp
cp patches/files/config.h include/carve/config.h
cat > CMakeLists.txt << EOF
diff --git a/extern/carve/files.txt b/extern/carve/files.txt
index 1084c7f..f7da603 100644
--- a/extern/carve/files.txt
+++ b/extern/carve/files.txt
@@ -25,7 +25,6 @@ include/carve/win32.h
include/carve/edge_impl.hpp
include/carve/carve.hpp
include/carve/polyline.hpp
-include/carve/config.h
include/carve/face_decl.hpp
include/carve/matrix.hpp
include/carve/classification.hpp
@@ -67,7 +66,6 @@ include/carve/djset.hpp
include/carve/vertex_decl.hpp
include/carve/csg_triangulator.hpp
include/carve/poly.hpp
-include/carve/external/boost/random.hpp
include/carve/timing.hpp
include/carve/octree_decl.hpp
include/carve/pointset_decl.hpp
diff --git a/extern/carve/mkfiles.sh b/extern/carve/mkfiles.sh
index d117d75..bd02266 100755
--- a/extern/carve/mkfiles.sh
+++ b/extern/carve/mkfiles.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-find ./include/ -type f | sed -r 's/^\.\///' > files.txt
+find ./include/ -type f | sed -r 's/^\.\///' | grep -v /config.h > files.txt
find ./lib/ -type f | sed -r 's/^\.\///' >> files.txt
diff --git a/extern/carve/patches/files/random.hpp b/extern/carve/patches/files/random.hpp
deleted file mode 100644
index 15866bb..0000000
--- a/extern/carve/patches/files/random.hpp
+++ /dev/null
@@ -1,773 +0,0 @@
-#pragma once
-
-#include <iostream>
-#include <vector>
-#include <limits>
-#include <stdexcept>
-#include <cmath>
-#include <algorithm>
-
-#if !defined(_MSC_VER)
-#include <stdint.h>
-#endif
-
-namespace boost {
-
-// type_traits could help here, but I don't want to depend on type_traits.
-template<class T>
-struct ptr_helper
-{
- typedef T value_type;
- typedef T& reference_type;
- typedef const T& rvalue_type;
- static reference_type ref(T& r) { return r; }
- static const T& ref(const T& r) { return r; }
-};
-
-template<class T>
-struct ptr_helper<T&>
-{
- typedef T value_type;
- typedef T& reference_type;
- typedef T& rvalue_type;
- static reference_type ref(T& r) { return r; }
- static const T& ref(const T& r) { return r; }
-};
-
-template<class T>
-struct ptr_helper<T*>
-{
- typedef T value_type;
- typedef T& reference_type;
- typedef T* rvalue_type;
- static reference_type ref(T * p) { return *p; }
- static const T& ref(const T * p) { return *p; }
-};
-
-template<class UniformRandomNumberGenerator>
-class pass_through_engine
-{
-private:
- typedef ptr_helper<UniformRandomNumberGenerator> helper_type;
-
-public:
- typedef typename helper_type::value_type base_type;
- typedef typename base_type::result_type result_type;
-
- explicit pass_through_engine(UniformRandomNumberGenerator rng)
- // make argument an rvalue to avoid matching Generator& constructor
- : _rng(static_cast<typename helper_type::rvalue_type>(rng))
- { }
-
- result_type min () const { return (base().min)(); }
- result_type max () const { return (base().max)(); }
- base_type& base() { return helper_type::ref(_rng); }
- const base_type& base() const { return helper_type::ref(_rng); }
-
- result_type operator()() { return base()(); }
-
-private:
- UniformRandomNumberGenerator _rng;
-};
-
-template<class RealType>
-class new_uniform_01
-{
-public:
- typedef RealType input_type;
- typedef RealType result_type;
- // compiler-generated copy ctor and copy assignment are fine
- result_type min () const { return result_type(0); }
- result_type max () const { return result_type(1); }
- void reset() { }
-
- template<class Engine>
- result_type operator()(Engine& eng) {
- for (;;) {
- typedef typename Engine::result_type base_result;
- result_type factor = result_type(1) /
- (result_type((eng.max)()-(eng.min)()) +
- result_type(std::numeric_limits<base_result>::is_integer ? 1 : 0));
- result_type result = result_type(eng() - (eng.min)()) * factor;
- if (result < result_type(1))
- return result;
- }
- }
-
- template<class CharT, class Traits>
- friend std::basic_ostream<CharT,Traits>&
- operator<<(std::basic_ostream<CharT,Traits>& os, const new_uniform_01&)
- {
- return os;
- }
-
- template<class CharT, class Traits>
- friend std::basic_istream<CharT,Traits>&
- operator>>(std::basic_istream<CharT,Traits>& is, new_uniform_01&)
- {
- return is;
- }
-};
-
-template<class UniformRandomNumberGenerator, class RealType>
-class backward_compatible_uniform_01
-{
- typedef ptr_helper<UniformRandomNumberGenerator> traits;
- typedef pass_through_engine<UniformRandomNumberGenerator> internal_engine_type;
-public:
- typedef UniformRandomNumberGenerator base_type;
- typedef RealType result_type;
-
- static const bool has_fixed_range = false;
-
- explicit backward_compatible_uniform_01(typename traits::rvalue_type rng)
- : _rng(rng),
- _factor(result_type(1) /
- (result_type((_rng.max)()-(_rng.min)()) +
- result_type(std::numeric_limits<base_result>::is_integer ? 1 : 0)))
- {
- }
- // compiler-generated copy ctor and copy assignment are fine
-
- result_type min () const { return result_type(0); }
- result_type max () const { return result_type(1); }
- typename traits::value_type& base() { return _rng.base(); }
- const typename traits::value_type& base() const { return _rng.base(); }
- void reset() { }
-
- result_type operator()() {
- for (;;) {
- result_type result = result_type(_rng() - (_rng.min)()) * _factor;
- if (result < result_type(1))
- return result;
- }
- }
-
- template<class CharT, class Traits>
- friend std::basic_ostream<CharT,Traits>&
- operator<<(std::basic_ostream<CharT,Traits>& os, const backward_compatible_uniform_01& u)
- {
- os << u._rng;
- return os;
- }
-
- template<class CharT, class Traits>
- friend std::basic_istream<CharT,Traits>&
- operator>>(std::basic_istream<CharT,Traits>& is, backward_compatible_uniform_01& u)
- {
- is >> u._rng;
- return is;
- }
-
-private:
- typedef typename internal_engine_type::result_type base_result;
- internal_engine_type _rng;
- result_type _factor;
-};
-
-// A definition is required even for integral static constants
-template<class UniformRandomNumberGenerator, class RealType>
-const bool backward_compatible_uniform_01<UniformRandomNumberGenerator, RealType>::has_fixed_range;
-
-template<class UniformRandomNumberGenerator>
-struct select_uniform_01
-{
- template<class RealType>
- struct apply
- {
- typedef backward_compatible_uniform_01<UniformRandomNumberGenerator, RealType> type;
- };
-};
-
-template<>
-struct select_uniform_01<float>
-{
- template<class RealType>
- struct apply
- {
- typedef new_uniform_01<float> type;
- };
-};
-
-template<>
-struct select_uniform_01<double>
-{
- template<class RealType>
- struct apply
- {
- typedef new_uniform_01<double> type;
- };
-};
-
-template<>
-struct select_uniform_01<long double>
-{
- template<class RealType>
- struct apply
- {
- typedef new_uniform_01<long double> type;
- };
-};
-
-// Because it is so commonly used: uniform distribution on the real [0..1)
-// range. This allows for specializations to avoid a costly int -> float
-// conversion plus float multiplication
-template<class UniformRandomNumberGenerator = double, class RealType = double>
-class uniform_01
- : public select_uniform_01<UniformRandomNumberGenerator>::template apply<RealType>::type
-{
- typedef typename select_uniform_01<UniformRandomNumberGenerator>::template apply<RealType>::type impl_type;
- typedef ptr_helper<UniformRandomNumberGenerator> traits;
-public:
-
- uniform_01() {}
-
- explicit uniform_01(typename traits::rvalue_type rng)
- : impl_type(rng)
- {
- }
-
- template<class CharT, class Traits>
- friend std::basic_ostream<CharT,Traits>&
- operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_01& u)
- {
- os << static_cast<const impl_type&>(u);
- return os;
- }
-
- template<class CharT, class Traits>
- friend std::basic_istream<CharT,Traits>&
- operator>>(std::basic_istream<CharT,Traits>& is, uniform_01& u)
- {
- is >> static_cast<impl_type&>(u);
- return is;
- }
-};
-
-template<class UniformRandomNumberGenerator, class IntType = unsigned long>
-class uniform_int_float
-{
-public:
- typedef UniformRandomNumberGenerator base_type;
- typedef IntType result_type;
-
- uniform_int_float(base_type rng, IntType min_arg = 0, IntType max_arg = 0xffffffff)
- : _rng(rng), _min(min_arg), _max(max_arg)
- {
- init();
- }
-
- result_type min () const { return _min; }
- result_type max () const { return _max; }
- base_type& base() { return _rng.base(); }
- const base_type& base() const { return _rng.base(); }
-
- result_type operator()()
- {
- return static_cast<IntType>(_rng() * _range) + _min;
- }
-
- template<class CharT, class Traits>
- friend std::basic_ostream<CharT,Traits>&
- operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_int_float& ud)
- {
- os << ud._min << " " << ud._max;
- return os;
- }
-
- template<class CharT, class Traits>
- friend std::basic_istream<CharT,Traits>&
- operator>>(std::basic_istream<CharT,Traits>& is, uniform_int_float& ud)
- {
- is >> std::ws >> ud._min >> std::ws >> ud._max;
- ud.init();
- return is;
- }
-
-private:
- void init()
- {
- _range = static_cast<base_result>(_max-_min)+1;
- }
-
- typedef typename base_type::result_type base_result;
- uniform_01<base_type> _rng;
- result_type _min, _max;
- base_result _range;
-};
-
-
-template<class UniformRandomNumberGenerator, class CharT, class Traits>
-std::basic_ostream<CharT,Traits>&
-operator<<(
- std::basic_ostream<CharT,Traits>& os
- , const pass_through_engine<Uni
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list