Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit db248438cc5bc98a1ff9fee87d702b34ee472945 Oliver Kowalke committed Jul 17, 2011
Showing with 14,411 additions and 0 deletions.
  1. +10 −0 .gitignore
  2. +15 −0 boost/context/all.hpp
  3. +267 −0 boost/context/context.hpp
  4. +31 −0 boost/context/detail/config.hpp
  5. +31 −0 boost/context/detail/context_base.hpp
  6. +217 −0 boost/context/detail/context_base_fctx_posix.hpp
  7. +226 −0 boost/context/detail/context_base_fctx_win32.hpp
  8. +241 −0 boost/context/detail/context_base_fctx_win64.hpp
  9. +263 −0 boost/context/detail/context_base_fiber.hpp
  10. +222 −0 boost/context/detail/context_base_uctx.hpp
  11. +138 −0 boost/context/detail/context_object.hpp
  12. +45 −0 boost/context/detail/fcontext_arm.hpp
  13. +45 −0 boost/context/detail/fcontext_i386.hpp
  14. +47 −0 boost/context/detail/fcontext_i386_win.hpp
  15. +51 −0 boost/context/detail/fcontext_mips.hpp
  16. +49 −0 boost/context/detail/fcontext_ppc.hpp
  17. +45 −0 boost/context/detail/fcontext_x86_64.hpp
  18. +47 −0 boost/context/detail/fcontext_x86_64_win.hpp
  19. +59 −0 boost/context/fcontext.hpp
  20. +71 −0 boost/context/protected_stack.hpp
  21. +44 −0 boost/context/stack_helper.hpp
  22. +1,087 −0 boost/move/move.hpp
  23. +224 −0 libs/context/build/Jamfile.v2
  24. +33 −0 libs/context/doc/Jamfile.v2
  25. +14 −0 libs/context/doc/acknowledgements.qbk
  26. +159 −0 libs/context/doc/asio.qbk
  27. +81 −0 libs/context/doc/config.qbk
  28. +74 −0 libs/context/doc/context.qbk
  29. +530 −0 libs/context/doc/context_ref.qbk
  30. +86 −0 libs/context/doc/continuation.qbk
  31. +122 −0 libs/context/doc/enumerator.qbk
  32. +14 −0 libs/context/doc/examples.qbk
  33. +150 −0 libs/context/doc/fcontext.qbk
  34. +49 −0 libs/context/doc/overview.qbk
  35. BIN libs/context/doc/pdf/arm-aapcs.pdf
  36. BIN libs/context/doc/pdf/arm-linux-aapcs.pdf
  37. BIN libs/context/doc/pdf/iso_c99.pdf
  38. BIN libs/context/doc/pdf/mips-o32.pdf
  39. BIN libs/context/doc/pdf/ppc32-sysv.pdf
  40. BIN libs/context/doc/pdf/ppc64-sysv.pdf
  41. BIN libs/context/doc/pdf/x86_32-sysv.pdf
  42. BIN libs/context/doc/pdf/x86_64-sysv.pdf
  43. +32 −0 libs/context/doc/performance.qbk
  44. +135 −0 libs/context/doc/rational.qbk
  45. +43 −0 libs/context/doc/reference.qbk
  46. +295 −0 libs/context/doc/stack_ref.qbk
  47. +74 −0 libs/context/doc/tested.qbk
  48. +12 −0 libs/context/doc/todo.qbk
  49. +112 −0 libs/context/example/Jamfile.v2
  50. +53 −0 libs/context/example/asio/continuation.h
  51. +63 −0 libs/context/example/asio/echo_client.cpp
  52. +106 −0 libs/context/example/asio/echo_server.cpp
  53. +72 −0 libs/context/example/base_api.cpp
  54. +60 −0 libs/context/example/continuation/continuation.h
  55. +43 −0 libs/context/example/continuation/echo.cpp
  56. +50 −0 libs/context/example/continuation/parallel.cpp
  57. +31 −0 libs/context/example/do_return.cpp
  58. +48 −0 libs/context/example/enumerator/enumerate_string.cpp
  59. +37 −0 libs/context/example/enumerator/enumerate_tree.cpp
  60. +78 −0 libs/context/example/enumerator/enumerator.h
  61. +83 −0 libs/context/example/enumerator/fringe.cpp
  62. +48 −0 libs/context/example/enumerator/power.cpp
  63. +116 −0 libs/context/example/enumerator/tree.h
  64. +31 −0 libs/context/example/exit.cpp
  65. +72 −0 libs/context/example/fcontext.cpp
  66. +31 −0 libs/context/example/float.cpp
  67. +52 −0 libs/context/example/link.cpp
  68. +40 −0 libs/context/example/swap.cpp
  69. +54 −0 libs/context/example/unwind.cpp
  70. +43 −0 libs/context/patches/llsc-mips.patch
  71. +66 −0 libs/context/performance/Jamfile.v2
  72. +12 −0 libs/context/performance/bind_processor.hpp
  73. +33 −0 libs/context/performance/bind_processor_aix.cpp
  74. +37 −0 libs/context/performance/bind_processor_freebsd.cpp
  75. +39 −0 libs/context/performance/bind_processor_hpux.cpp
  76. +39 −0 libs/context/performance/bind_processor_linux.cpp
  77. +34 −0 libs/context/performance/bind_processor_solaris.cpp
  78. +32 −0 libs/context/performance/bind_processor_windows.cpp
  79. +129 −0 libs/context/performance/performance.cpp
  80. +26 −0 libs/context/performance/performance.hpp
  81. +62 −0 libs/context/performance/performance_gcc_i386.hpp
  82. +62 −0 libs/context/performance/performance_gcc_x86-64.hpp
  83. +60 −0 libs/context/performance/performance_msvc_i386.hpp
  84. +101 −0 libs/context/src/asm/fcontext_arm_aapcs_elf_gas.S
  85. +135 −0 libs/context/src/asm/fcontext_i386_ms_pe_masm.asm
  86. +129 −0 libs/context/src/asm/fcontext_i386_sysv_elf_gas.S
  87. +151 −0 libs/context/src/asm/fcontext_mips32_o32_elf_gas.S
  88. +225 −0 libs/context/src/asm/fcontext_ppc32_sysv_elf_gas.S
  89. +239 −0 libs/context/src/asm/fcontext_ppc64_sysv_elf_gas.S
  90. +138 −0 libs/context/src/asm/fcontext_x86_64_ms_pe_masm.asm
  91. +119 −0 libs/context/src/asm/fcontext_x86_64_sysv_elf_gas.S
  92. +116 −0 libs/context/src/asm/fcontext_x86_64_sysv_macho_gas.S
  93. +116 −0 libs/context/src/protected_stack_posix.cpp
  94. +133 −0 libs/context/src/protected_stack_windows.cpp
  95. +69 −0 libs/context/src/seh.cpp
  96. +85 −0 libs/context/src/stack_helper_posix.cpp
  97. +89 −0 libs/context/src/stack_helper_windows.cpp
  98. +26 −0 libs/context/test/Jamfile.v2
  99. +208 −0 libs/context/test/test_context.cpp
  100. +89 −0 libs/context/test/test_protected_stack.cpp
  101. +38 −0 libs/move/doc/Jamfile.v2
  102. +538 −0 libs/move/doc/html/boostbook.css
  103. BIN libs/move/doc/html/images/blank.png
  104. BIN libs/move/doc/html/images/caution.png
  105. BIN libs/move/doc/html/images/draft.png
  106. BIN libs/move/doc/html/images/home.png
  107. BIN libs/move/doc/html/images/important.png
  108. BIN libs/move/doc/html/images/next.png
  109. BIN libs/move/doc/html/images/note.png
  110. BIN libs/move/doc/html/images/prev.png
  111. BIN libs/move/doc/html/images/tip.png
  112. BIN libs/move/doc/html/images/toc-blank.png
  113. BIN libs/move/doc/html/images/toc-minus.png
  114. BIN libs/move/doc/html/images/toc-plus.png
  115. BIN libs/move/doc/html/images/up.png
  116. BIN libs/move/doc/html/images/warning.png
  117. +13 −0 libs/move/doc/html/reference.css
  118. +860 −0 libs/move/doc/move.qbk
  119. +28 −0 libs/move/example/Jamfile.v2
  120. +46 −0 libs/move/example/copymovable.hpp
  121. +152 −0 libs/move/example/doc_clone_ptr.cpp
  122. +105 −0 libs/move/example/doc_construct_forward.cpp
  123. +87 −0 libs/move/example/doc_file_descriptor.cpp
  124. +60 −0 libs/move/example/doc_how_works.cpp
  125. +41 −0 libs/move/example/doc_move_algorithms.cpp
  126. +48 −0 libs/move/example/doc_move_inserter.cpp
  127. +39 −0 libs/move/example/doc_move_iterator.cpp
  128. +49 −0 libs/move/example/movable.hpp
  129. +130 −0 libs/move/proj/vc7ide/Move.sln
  130. +134 −0 libs/move/proj/vc7ide/back_move_inserter_test.vcproj
  131. +134 −0 libs/move/proj/vc7ide/construct_forward_test.vcproj
  132. +134 −0 libs/move/proj/vc7ide/copy_elision_test.vcproj
  133. +134 −0 libs/move/proj/vc7ide/copy_move_optimization.vcproj
  134. +139 −0 libs/move/proj/vc7ide/doc_clone_ptr.vcproj
  135. +139 −0 libs/move/proj/vc7ide/doc_construct_forward.vcproj
  136. +139 −0 libs/move/proj/vc7ide/doc_file_descriptor.vcproj
  137. +139 −0 libs/move/proj/vc7ide/doc_how_works.vcproj
  138. +139 −0 libs/move/proj/vc7ide/doc_move_algorithms.vcproj
  139. +139 −0 libs/move/proj/vc7ide/doc_move_inserter.vcproj
  140. +139 −0 libs/move/proj/vc7ide/doc_move_iterator.vcproj
  141. +134 −0 libs/move/proj/vc7ide/move_algorithm.vcproj
  142. +134 −0 libs/move/proj/vc7ide/move_iterator_test.vcproj
  143. +139 −0 libs/move/proj/vc7ide/move_test.vcproj
  144. +1 −0 libs/move/proj/vc7ide/todo.txt
  145. +28 −0 libs/move/test/Jamfile.v2
  146. +61 −0 libs/move/test/back_move_inserter.cpp
  147. +102 −0 libs/move/test/construct_forward.cpp
  148. +170 −0 libs/move/test/copy_elision_test.cpp
  149. +105 −0 libs/move/test/copy_move_optimization.cpp
  150. +135 −0 libs/move/test/move.cpp
  151. +55 −0 libs/move/test/move_algorithm.cpp
  152. +104 −0 libs/move/test/move_iterator.cpp
@@ -0,0 +1,10 @@
+bin.v2/**/*
+dist/**/*
+doc/**/*
+html/**/*
+stage/**/*
+docbook*
+*~
+*.html
+*.sw*
+*.xml
@@ -0,0 +1,15 @@
+
+// Copyright Oliver Kowalke 2009.
+// Distributed under 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)
+
+#ifndef BOOST_CONTEXTS_ALL_H
+#define BOOST_CONTEXTS_ALL_H
+
+#include <boost/context/context.hpp>
+#include <boost/context/fcontext.hpp>
+#include <boost/context/protected_stack.hpp>
+#include <boost/context/stack_helper.hpp>
+
+#endif // BOOST_CONTEXTS_ALL_H
@@ -0,0 +1,267 @@
+
+// Copyright Oliver Kowalke 2009.
+// Distributed under 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)
+
+#ifndef BOOST_CONTEXTS_CONTEXT_H
+#define BOOST_CONTEXTS_CONTEXT_H
+
+#include <boost/assert.hpp>
+#include <boost/bind.hpp>
+#include <boost/config.hpp>
+#include <boost/move/move.hpp>
+#include <boost/preprocessor/repetition.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/context/detail/context_base.hpp>
+#include <boost/context/detail/context_object.hpp>
+#include <boost/context/protected_stack.hpp>
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace contexts {
+
+template< typename StackT = protected_stack >
+class context
+{
+private:
+ typedef typename detail::context_base< StackT >::ptr_t base_ptr_t;
+
+ base_ptr_t impl_;
+
+ BOOST_MOVABLE_BUT_NOT_COPYABLE( context);
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+ static base_ptr_t make_context_(
+ void( * fn)(), StackT && stack, bool do_unwind, bool do_return)
+ {
+ return base_ptr_t(
+ new detail::context_object< void(*)(), StackT >(
+ fn, boost::move( stack), do_unwind, do_return) );
+ }
+
+ static base_ptr_t make_context_(
+ void( * fn)(), StackT && stack, bool do_unwind, context & nxt)
+ {
+ BOOST_ASSERT( nxt);
+ return base_ptr_t(
+ new detail::context_object< void(*)(), StackT >(
+ fn, boost::move( stack), do_unwind, nxt.impl_) );
+ }
+
+ template< typename Fn >
+ static base_ptr_t make_context_(
+ Fn && fn, StackT && stack, bool do_unwind, bool do_return)
+ {
+ return base_ptr_t(
+ new detail::context_object< typename remove_reference< Fn >::type, StackT >(
+ fn, boost::move( stack), do_unwind, do_return) );
+ }
+
+ template< typename Fn >
+ static base_ptr_t make_context_(
+ Fn && fn, StackT && stack, bool do_unwind, context & nxt)
+ {
+ BOOST_ASSERT( nxt);
+ return base_ptr_t(
+ new detail::context_object< typename remove_reference< Fn >::type, StackT >(
+ fn, boost::move( stack), do_unwind, nxt.impl_) );
+ }
+#else
+ template< typename Fn >
+ static base_ptr_t make_context_(
+ Fn fn, BOOST_RV_REF( StackT) stack, bool do_unwind, bool do_return)
+ {
+ return base_ptr_t(
+ new detail::context_object< Fn, StackT >(
+ fn, boost::move( stack), do_unwind, do_return) );
+ }
+
+ template< typename Fn >
+ static base_ptr_t make_context_(
+ Fn fn, BOOST_RV_REF( StackT) stack, bool do_unwind, context & nxt)
+ {
+ BOOST_ASSERT( nxt);
+ return base_ptr_t(
+ new detail::context_object< Fn, StackT >(
+ fn, boost::move( stack), do_unwind, nxt.impl_) );
+ }
+
+ template< typename Fn >
+ static base_ptr_t make_context_(
+ BOOST_RV_REF( Fn) fn, BOOST_RV_REF( StackT) stack, bool do_unwind, bool do_return)
+ {
+ return base_ptr_t(
+ new detail::context_object< Fn, StackT >(
+ fn, boost::move( stack), do_unwind, do_return) );
+ }
+
+ template< typename Fn >
+ static base_ptr_t make_context_(
+ BOOST_RV_REF( Fn) fn, BOOST_RV_REF( StackT) stack, bool do_unwind, context & nxt)
+ {
+ BOOST_ASSERT( nxt);
+ return base_ptr_t(
+ new detail::context_object< Fn, StackT >(
+ fn, boost::move( stack), do_unwind, nxt.impl_) );
+ }
+#endif
+
+public:
+ typedef void ( * unspecified_bool_type)( context ***);
+
+ static void unspecified_bool( context ***) {}
+
+ context() :
+ impl_()
+ {}
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+# ifdef BOOST_MSVC
+ template< typename Fn >
+ context( Fn & fn, StackT && stack, bool do_unwind, bool do_return = true) :
+ impl_( make_context_( static_cast< Fn & >( fn), boost::move( stack), do_unwind, do_return) )
+ {}
+
+ template< typename Fn >
+ context( Fn & fn, StackT && stack, bool do_unwind, context & nxt) :
+ impl_( make_context_( static_cast< Fn & >( fn), boost::move( stack), do_unwind, nxt) )
+ {}
+# endif
+ template< typename Fn >
+ context( Fn && fn, StackT && stack, bool do_unwind, bool do_return = true) :
+ impl_( make_context_( static_cast< Fn && >( fn), boost::move( stack), do_unwind, do_return) )
+ {}
+
+ template< typename Fn >
+ context( Fn && fn, StackT && stack, bool do_unwind, context & nxt) :
+ impl_( make_context_( static_cast< Fn && >( fn), boost::move( stack), do_unwind, nxt) )
+ {}
+#else
+ template< typename Fn >
+ context( Fn fn, BOOST_RV_REF( StackT) stack, bool do_unwind, bool do_return = true) :
+ impl_( make_context_( fn, boost::move( stack), do_unwind, do_return) )
+ {}
+
+ template< typename Fn >
+ context( Fn fn, BOOST_RV_REF( StackT) stack, bool do_unwind, context & nxt) :
+ impl_( make_context_( fn, boost::move( stack), do_unwind, nxt) )
+ {}
+
+ template< typename Fn >
+ context( BOOST_RV_REF( Fn) fn, BOOST_RV_REF( StackT) stack, bool do_unwind, bool do_return = true) :
+ impl_( make_context_( fn, boost::move( stack), do_unwind, do_return) )
+ {}
+
+ template< typename Fn >
+ context( BOOST_RV_REF( Fn) fn, BOOST_RV_REF( StackT) stack, bool do_unwind, context & nxt) :
+ impl_( make_context_( fn, boost::move( stack), do_unwind, nxt) )
+ {}
+#endif
+
+#define BOOST_CONTEXT_ARG(z, n, unused) BOOST_PP_CAT(A, n) BOOST_PP_CAT(a, n)
+
+#define BOOST_CONTEXT_ARGS(n) BOOST_PP_ENUM(n, BOOST_CONTEXT_ARG, ~)
+
+#define BOOST_CONTEXT_CTOR(z, n, unused) \
+ template< typename Fn, BOOST_PP_ENUM_PARAMS(n, typename A) > \
+ context( Fn fn, BOOST_CONTEXT_ARGS(n), BOOST_RV_REF( StackT) stack, bool do_unwind, bool do_return = true) : \
+ impl_( \
+ make_context_( \
+ boost::bind( boost::type< void >(), fn, BOOST_PP_ENUM_PARAMS(n, a) ), \
+ boost::move( stack), do_unwind, do_return) ) \
+ {} \
+ \
+ template< typename Fn, BOOST_PP_ENUM_PARAMS(n, typename A) > \
+ context( Fn fn, BOOST_CONTEXT_ARGS(n), BOOST_RV_REF( StackT) stack, bool do_unwind, context & nxt) : \
+ impl_( \
+ make_context_( \
+ boost::bind( boost::type< void >(), fn, BOOST_PP_ENUM_PARAMS(n, a) ), \
+ boost::move( stack), do_unwind, nxt) ) \
+ {} \
+
+#ifndef BOOST_CONTEXT_ARITY
+#define BOOST_CONTEXT_ARITY 10
+#endif
+
+BOOST_PP_REPEAT_FROM_TO( 1, BOOST_CONTEXT_ARITY, BOOST_CONTEXT_CTOR, ~)
+
+#undef BOOST_CONTEXT_CTOR
+#undef BOOST_CONTEXT_ARGS
+#undef BOOST_CONTEXT_ARG
+
+ context( BOOST_RV_REF( context) other) :
+ impl_()
+ { swap( other); }
+
+ context & operator=( BOOST_RV_REF( context) other)
+ {
+ if ( this == & other) return * this;
+ context tmp( boost::move( other) );
+ swap( tmp);
+ return * this;
+ }
+
+ operator unspecified_bool_type() const
+ { return impl_ ? unspecified_bool : 0; }
+
+ bool operator!() const
+ { return ! impl_; }
+
+ void swap( context & other)
+ { impl_.swap( other.impl_); }
+
+ void resume()
+ {
+ BOOST_ASSERT( impl_);
+ return impl_->resume();
+ }
+
+ void suspend()
+ {
+ BOOST_ASSERT( impl_);
+ return impl_->suspend();
+ }
+
+ void unwind_stack()
+ {
+ BOOST_ASSERT( impl_);
+ impl_->unwind_stack();
+ }
+
+ bool is_complete() const
+ {
+ BOOST_ASSERT( impl_);
+ return impl_->is_complete();
+ }
+
+ bool owns_stack() const
+ {
+ BOOST_ASSERT( impl_);
+ return impl_->owns_stack();
+ }
+
+ StackT release_stack()
+ {
+ BOOST_ASSERT( impl_);
+ return impl_->release_stack();
+ }
+};
+
+template< typename StackT >
+void swap( context< StackT > & l, context< StackT > & r)
+{ l.swap( r); }
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXTS_CONTEXT_H
@@ -0,0 +1,31 @@
+
+// Copyright Oliver Kowalke 2009.
+// Distributed under 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)
+
+#ifndef BOOST_CONTEXTS_DETAIL_CONFIG_H
+#define BOOST_CONTEXTS_DETAIL_CONFIG_H
+
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK)
+# if defined(BOOST_CONTEXT_SOURCE)
+# define BOOST_CONTEXT_DECL BOOST_SYMBOL_EXPORT
+# else
+# define BOOST_CONTEXT_DECL BOOST_SYMBOL_IMPORT
+# endif
+#else
+# define BOOST_CONTEXT_DECL
+#endif
+
+#if ! defined(BOOST_CONTEXT_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_CONTEXT_NO_LIB)
+# define BOOST_LIB_NAME boost_context
+# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK)
+# define BOOST_DYN_LINK
+# endif
+# include <boost/config/auto_link.hpp>
+#endif
+
+#endif // BOOST_CONTEXTS_DETAIL_CONFIG_H
@@ -0,0 +1,31 @@
+
+// Copyright Oliver Kowalke 2009.
+// Distributed under 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)
+
+#include <boost/config.hpp>
+
+#if defined(BOOST_WINDOWS)
+# if defined(BOOST_CONTEXT_FIBER)
+# include <boost/context/detail/context_base_fiber.hpp>
+# else
+# if defined(_M_IX86)
+# include <boost/context/detail/context_base_fctx_win32.hpp>
+# elif defined(_M_X64)
+# include <boost/context/detail/context_base_fctx_win64.hpp>
+# else
+# error "fcontext_t not supported by this architecture"
+# endif
+# endif
+#else
+# if defined(BOOST_CONTEXT_UCTX)
+# include <boost/context/detail/context_base_uctx.hpp>
+# else
+# if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__mips__) || defined(__powerpc__)
+# include <boost/context/detail/context_base_fctx_posix.hpp>
+# else
+# error "fcontext_t not supported by this architecture"
+# endif
+# endif
+#endif
Oops, something went wrong.

0 comments on commit db24843

Please sign in to comment.