passenger 5.1.12 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (824) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +18 -1
  3. data/Rakefile +4 -1
  4. data/build/agent.rb +2 -2
  5. data/build/apache2.rb +17 -10
  6. data/build/basics.rb +18 -4
  7. data/build/common_library.rb +7 -3
  8. data/build/cxx_tests.rb +2 -7
  9. data/build/misc.rb +3 -1
  10. data/build/nginx.rb +11 -5
  11. data/build/oxt_tests.rb +0 -3
  12. data/build/packaging.rb +3 -2
  13. data/build/schema_printer.rb +103 -0
  14. data/build/support/cplusplus.rb +2 -2
  15. data/build/support/cxx_dependency_map.rb +2575 -868
  16. data/dev/ci/lib/functions.sh +1 -1
  17. data/dev/ci/lib/set-container-envvars.sh +1 -1
  18. data/dev/ci/lib/setup-container.sh +1 -1
  19. data/dev/ci/run-tests-natively +1 -1
  20. data/dev/ci/run-tests-with-docker +1 -1
  21. data/dev/ci/scripts/debug-console-wrapper.sh +1 -1
  22. data/dev/ci/scripts/docker-entrypoint-stage2.sh +1 -1
  23. data/dev/ci/scripts/docker-entrypoint.sh +1 -1
  24. data/dev/ci/scripts/inituidgid +1 -1
  25. data/dev/ci/scripts/run-tests-natively-stage2.sh +1 -1
  26. data/dev/ci/scripts/setup-host-natively.sh +1 -1
  27. data/dev/ci/setup-host +1 -1
  28. data/dev/ci/tests/apache2/run +1 -1
  29. data/dev/ci/tests/apache2/setup +1 -1
  30. data/dev/ci/tests/cxx/run +1 -1
  31. data/dev/ci/tests/cxx/setup +1 -1
  32. data/dev/ci/tests/debian/Jenkinsfile +0 -1
  33. data/dev/ci/tests/debian/run +1 -1
  34. data/dev/ci/tests/nginx-dynamic/run +1 -1
  35. data/dev/ci/tests/nginx-dynamic/setup +1 -1
  36. data/dev/ci/tests/nginx/run +1 -1
  37. data/dev/ci/tests/nginx/setup +1 -1
  38. data/dev/ci/tests/nodejs/run +1 -1
  39. data/dev/ci/tests/nodejs/setup +1 -1
  40. data/dev/ci/tests/rpm/run +1 -1
  41. data/dev/ci/tests/ruby/run +1 -1
  42. data/dev/ci/tests/ruby/setup +1 -1
  43. data/dev/ci/tests/source-packaging/run +1 -1
  44. data/dev/ci/tests/source-packaging/setup +1 -1
  45. data/dev/ci/tests/standalone/run +1 -1
  46. data/dev/ci/tests/standalone/setup +1 -1
  47. data/dev/configkit-schemas/index.json +1708 -0
  48. data/dev/configkit-schemas/update_schema_inline_comments.rb +118 -0
  49. data/dev/copy_boost_headers +13 -1
  50. data/dev/index_cxx_dependencies.rb +20 -7
  51. data/dev/vagrant/provision.sh +1 -1
  52. data/resources/mime.types +1 -0
  53. data/resources/templates/standalone/http.erb +1 -6
  54. data/src/agent/Core/AdminPanelConnector.h +550 -0
  55. data/src/agent/Core/ApiServer.h +159 -97
  56. data/src/agent/Core/ApplicationPool/Group.h +2 -0
  57. data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +3 -2
  58. data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +109 -0
  59. data/src/agent/Core/ApplicationPool/Implementation.cpp +5 -3
  60. data/src/agent/Core/ApplicationPool/Options.h +5 -6
  61. data/src/agent/Core/ApplicationPool/Pool.h +59 -2
  62. data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +3 -3
  63. data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +2 -2
  64. data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +6 -0
  65. data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +129 -0
  66. data/src/agent/Core/Config.h +475 -0
  67. data/src/agent/Core/ConfigChange.cpp +349 -0
  68. data/src/agent/Core/ConfigChange.h +54 -0
  69. data/src/agent/Core/Controller.h +35 -3
  70. data/src/agent/Core/Controller/CheckoutSession.cpp +1 -1
  71. data/src/agent/Core/Controller/Config.cpp +0 -2
  72. data/src/agent/Core/Controller/Config.h +168 -104
  73. data/src/agent/Core/Controller/ForwardResponse.cpp +1 -1
  74. data/src/agent/Core/Controller/InitRequest.cpp +14 -15
  75. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +34 -44
  76. data/src/agent/Core/Controller/Request.h +0 -1
  77. data/src/agent/Core/CoreMain.cpp +236 -349
  78. data/src/agent/Core/OptionParser.h +75 -89
  79. data/src/agent/Core/SecurityUpdateChecker.h +263 -100
  80. data/src/agent/Core/SpawningKit/Config.h +6 -2
  81. data/src/agent/Core/SpawningKit/Spawner.h +0 -45
  82. data/src/agent/Core/SpawningKit/UserSwitchingRules.h +1 -0
  83. data/src/agent/Shared/ApiAccountUtils.h +318 -0
  84. data/src/agent/Shared/ApiServerUtils.h +3 -104
  85. data/src/agent/Shared/Fundamentals/Initialization.cpp +81 -44
  86. data/src/agent/Shared/Fundamentals/Initialization.h +12 -7
  87. data/src/agent/TempDirToucher/TempDirToucherMain.cpp +21 -0
  88. data/src/agent/Watchdog/AgentWatcher.cpp +1 -1
  89. data/src/agent/Watchdog/ApiServer.h +100 -14
  90. data/src/agent/Watchdog/Config.h +340 -0
  91. data/src/agent/Watchdog/CoreWatcher.cpp +27 -13
  92. data/src/agent/Watchdog/InstanceDirToucher.cpp +1 -1
  93. data/src/agent/Watchdog/WatchdogMain.cpp +190 -206
  94. data/src/apache2_module/Bucket.cpp +4 -0
  95. data/src/apache2_module/Bucket.h +7 -3
  96. data/src/apache2_module/CBindings.cpp +49 -0
  97. data/src/apache2_module/Config.cpp +242 -0
  98. data/src/apache2_module/Config.h +109 -0
  99. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +485 -0
  100. data/src/apache2_module/{ConfigurationCommands.cpp.cxxcodebuilder → ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder} +29 -15
  101. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +298 -0
  102. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp.cxxcodebuilder +171 -0
  103. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +854 -0
  104. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp.cxxcodebuilder +188 -0
  105. data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +610 -0
  106. data/src/apache2_module/ConfigGeneral/SetterFuncs.h +65 -0
  107. data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +174 -0
  108. data/src/apache2_module/{MergeDirConfig.cpp.cxxcodebuilder → DirConfig/AutoGeneratedCreateFunction.cpp.cxxcodebuilder} +54 -32
  109. data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +113 -0
  110. data/src/apache2_module/{SetHeaders.cpp.cxxcodebuilder → DirConfig/AutoGeneratedHeaderSerialization.cpp.cxxcodebuilder} +34 -23
  111. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +426 -0
  112. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +165 -0
  113. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +269 -0
  114. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp.cxxcodebuilder +148 -0
  115. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +534 -0
  116. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +230 -0
  117. data/src/apache2_module/DirectoryMapper.h +19 -16
  118. data/src/apache2_module/Hooks.cpp +124 -138
  119. data/src/apache2_module/Hooks.h +9 -14
  120. data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +263 -0
  121. data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +152 -0
  122. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +299 -0
  123. data/src/apache2_module/{ConfigurationFields.hpp.cxxcodebuilder → ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder} +105 -18
  124. data/src/apache2_module/Utils.h +215 -0
  125. data/src/apache2_module/mod_passenger.c +16 -8
  126. data/src/cxx_supportlib/AppTypes.h +2 -0
  127. data/src/cxx_supportlib/ConfigKit/ConfigKit.h +1 -1
  128. data/src/cxx_supportlib/ConfigKit/DummyTranslator.h +8 -8
  129. data/src/cxx_supportlib/ConfigKit/IN_PRACTICE.md +7 -41
  130. data/src/cxx_supportlib/ConfigKit/PrefixTranslator.h +12 -66
  131. data/src/cxx_supportlib/ConfigKit/Schema.h +62 -11
  132. data/src/cxx_supportlib/ConfigKit/{ValidationUtils.h → SchemaUtils.h} +12 -3
  133. data/src/cxx_supportlib/ConfigKit/Store.h +17 -9
  134. data/src/cxx_supportlib/ConfigKit/SubComponentUtils.h +2 -1
  135. data/src/cxx_supportlib/ConfigKit/TableTranslator.h +13 -70
  136. data/src/cxx_supportlib/ConfigKit/Translator.h +125 -0
  137. data/src/cxx_supportlib/Constants.h +1 -3
  138. data/src/cxx_supportlib/FileTools/FileManip.cpp +297 -0
  139. data/src/cxx_supportlib/FileTools/FileManip.h +162 -0
  140. data/src/cxx_supportlib/{Utils → FileTools}/LargeFiles.cpp +6 -3
  141. data/src/cxx_supportlib/{Utils → FileTools}/LargeFiles.h +7 -5
  142. data/src/cxx_supportlib/FileTools/PathManip.cpp +240 -0
  143. data/src/cxx_supportlib/FileTools/PathManip.h +91 -0
  144. data/src/cxx_supportlib/FileTools/PathManipCBindings.cpp +62 -0
  145. data/src/{apache2_module/Configuration.h → cxx_supportlib/FileTools/PathManipCBindings.h} +12 -19
  146. data/src/cxx_supportlib/Hooks.h +19 -16
  147. data/src/cxx_supportlib/InstanceDirectory.h +11 -0
  148. data/src/cxx_supportlib/JsonTools/Autocast.h +79 -0
  149. data/src/cxx_supportlib/JsonTools/CBindings.cpp +364 -0
  150. data/src/cxx_supportlib/JsonTools/CBindings.h +101 -0
  151. data/src/cxx_supportlib/LoggingKit/Config.h +13 -0
  152. data/src/cxx_supportlib/LoggingKit/Context.h +5 -2
  153. data/src/cxx_supportlib/LoggingKit/Forward.h +0 -1
  154. data/src/cxx_supportlib/LoggingKit/Implementation.cpp +12 -4
  155. data/src/cxx_supportlib/ResourceLocator.h +15 -0
  156. data/src/cxx_supportlib/ServerKit/Config.h +156 -0
  157. data/src/cxx_supportlib/ServerKit/Context.h +59 -38
  158. data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +3 -2
  159. data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +2 -2
  160. data/src/cxx_supportlib/ServerKit/HttpServer.h +16 -2
  161. data/src/cxx_supportlib/ServerKit/Server.h +32 -15
  162. data/src/cxx_supportlib/Utils.cpp +0 -441
  163. data/src/cxx_supportlib/Utils.h +0 -158
  164. data/src/cxx_supportlib/Utils/Curl.h +1 -0
  165. data/src/cxx_supportlib/Utils/ProcessMetricsCollector.h +1 -0
  166. data/src/cxx_supportlib/Utils/StrIntUtilsNoStrictAliasing.cpp +2 -0
  167. data/src/cxx_supportlib/Utils/VariantMap.h +31 -0
  168. data/src/cxx_supportlib/WatchdogLauncher.cpp +7 -79
  169. data/src/cxx_supportlib/WatchdogLauncher.h +50 -53
  170. data/src/cxx_supportlib/WebSocketCommandReverseServer.h +981 -0
  171. data/src/cxx_supportlib/oxt/macros.hpp +9 -0
  172. data/src/cxx_supportlib/vendor-copy/websocketpp/COPYING +145 -0
  173. data/src/cxx_supportlib/vendor-copy/websocketpp/changelog.md +342 -0
  174. data/src/cxx_supportlib/vendor-copy/websocketpp/readme.md +49 -0
  175. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/base64/base64.hpp +178 -0
  176. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/client.hpp +33 -0
  177. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/close.hpp +342 -0
  178. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/asio.hpp +131 -0
  179. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/asio_ssl.hpp +39 -0
  180. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/chrono.hpp +68 -0
  181. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/connection_hdl.hpp +52 -0
  182. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/cpp11.hpp +162 -0
  183. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/functional.hpp +105 -0
  184. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/md5.hpp +448 -0
  185. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/memory.hpp +89 -0
  186. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/network.hpp +106 -0
  187. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/platforms.hpp +46 -0
  188. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/random.hpp +82 -0
  189. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/regex.hpp +59 -0
  190. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/stdint.hpp +73 -0
  191. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/system_error.hpp +84 -0
  192. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/thread.hpp +84 -0
  193. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/time.hpp +56 -0
  194. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/common/type_traits.hpp +65 -0
  195. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/concurrency/basic.hpp +46 -0
  196. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/concurrency/none.hpp +80 -0
  197. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/asio.hpp +77 -0
  198. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/asio_client.hpp +77 -0
  199. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/asio_no_tls.hpp +73 -0
  200. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/asio_no_tls_client.hpp +73 -0
  201. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/boost_config.hpp +72 -0
  202. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/core.hpp +285 -0
  203. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/core_client.hpp +294 -0
  204. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/debug.hpp +286 -0
  205. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/debug_asio.hpp +77 -0
  206. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/debug_asio_no_tls.hpp +73 -0
  207. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/minimal_client.hpp +72 -0
  208. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/config/minimal_server.hpp +312 -0
  209. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/connection.hpp +1651 -0
  210. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/connection_base.hpp +38 -0
  211. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/endpoint.hpp +700 -0
  212. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/endpoint_base.hpp +38 -0
  213. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/error.hpp +277 -0
  214. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/extensions/extension.hpp +102 -0
  215. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/extensions/permessage_deflate/disabled.hpp +128 -0
  216. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/extensions/permessage_deflate/enabled.hpp +752 -0
  217. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/frame.hpp +861 -0
  218. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/http/constants.hpp +308 -0
  219. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/http/impl/parser.hpp +196 -0
  220. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/http/impl/request.hpp +191 -0
  221. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/http/impl/response.hpp +266 -0
  222. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/http/parser.hpp +619 -0
  223. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/http/request.hpp +124 -0
  224. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/http/response.hpp +188 -0
  225. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/impl/connection_impl.hpp +2372 -0
  226. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/impl/endpoint_impl.hpp +269 -0
  227. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/impl/utilities_impl.hpp +87 -0
  228. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/logger/basic.hpp +199 -0
  229. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/logger/levels.hpp +203 -0
  230. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/logger/stub.hpp +119 -0
  231. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/logger/syslog.hpp +146 -0
  232. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/message_buffer/alloc.hpp +105 -0
  233. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/message_buffer/message.hpp +340 -0
  234. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/message_buffer/pool.hpp +229 -0
  235. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/processors/base.hpp +299 -0
  236. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/processors/hybi00.hpp +462 -0
  237. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/processors/hybi07.hpp +78 -0
  238. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/processors/hybi08.hpp +83 -0
  239. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/processors/hybi13.hpp +1056 -0
  240. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/processors/processor.hpp +407 -0
  241. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/random/none.hpp +60 -0
  242. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/random/random_device.hpp +80 -0
  243. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/roles/client_endpoint.hpp +173 -0
  244. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/roles/server_endpoint.hpp +190 -0
  245. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/server.hpp +33 -0
  246. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/sha1/sha1.hpp +189 -0
  247. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/asio/base.hpp +232 -0
  248. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/asio/connection.hpp +1204 -0
  249. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/asio/endpoint.hpp +1147 -0
  250. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/asio/security/base.hpp +159 -0
  251. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/asio/security/none.hpp +370 -0
  252. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/asio/security/tls.hpp +484 -0
  253. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/base/connection.hpp +238 -0
  254. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/base/endpoint.hpp +77 -0
  255. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/debug/base.hpp +104 -0
  256. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/debug/connection.hpp +412 -0
  257. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/debug/endpoint.hpp +140 -0
  258. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/iostream/base.hpp +133 -0
  259. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/iostream/connection.hpp +714 -0
  260. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/iostream/endpoint.hpp +222 -0
  261. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/stub/base.hpp +95 -0
  262. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/stub/connection.hpp +286 -0
  263. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/transport/stub/endpoint.hpp +140 -0
  264. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/uri.hpp +355 -0
  265. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/utf8_validator.hpp +154 -0
  266. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/utilities.hpp +182 -0
  267. data/src/cxx_supportlib/vendor-copy/websocketpp/websocketpp/version.hpp +61 -0
  268. data/src/cxx_supportlib/vendor-modified/boost/asio.hpp +121 -0
  269. data/src/cxx_supportlib/vendor-modified/boost/asio/async_result.hpp +96 -0
  270. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_datagram_socket.hpp +951 -0
  271. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_deadline_timer.hpp +520 -0
  272. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_io_object.hpp +258 -0
  273. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_raw_socket.hpp +942 -0
  274. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_seq_packet_socket.hpp +567 -0
  275. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_serial_port.hpp +697 -0
  276. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_signal_set.hpp +386 -0
  277. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket.hpp +1519 -0
  278. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_acceptor.hpp +1137 -0
  279. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_iostream.hpp +288 -0
  280. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_streambuf.hpp +569 -0
  281. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_stream_socket.hpp +854 -0
  282. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_streambuf.hpp +371 -0
  283. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_streambuf_fwd.hpp +35 -0
  284. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_waitable_timer.hpp +521 -0
  285. data/src/cxx_supportlib/vendor-modified/boost/asio/buffer.hpp +2241 -0
  286. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_read_stream.hpp +246 -0
  287. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_read_stream_fwd.hpp +27 -0
  288. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_stream.hpp +260 -0
  289. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_stream_fwd.hpp +27 -0
  290. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_write_stream.hpp +238 -0
  291. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_write_stream_fwd.hpp +27 -0
  292. data/src/cxx_supportlib/vendor-modified/boost/asio/buffers_iterator.hpp +483 -0
  293. data/src/cxx_supportlib/vendor-modified/boost/asio/completion_condition.hpp +220 -0
  294. data/src/cxx_supportlib/vendor-modified/boost/asio/connect.hpp +825 -0
  295. data/src/cxx_supportlib/vendor-modified/boost/asio/coroutine.hpp +330 -0
  296. data/src/cxx_supportlib/vendor-modified/boost/asio/datagram_socket_service.hpp +438 -0
  297. data/src/cxx_supportlib/vendor-modified/boost/asio/deadline_timer.hpp +40 -0
  298. data/src/cxx_supportlib/vendor-modified/boost/asio/deadline_timer_service.hpp +173 -0
  299. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/addressof.hpp +40 -0
  300. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/array.hpp +40 -0
  301. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/array_fwd.hpp +34 -0
  302. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/assert.hpp +32 -0
  303. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/atomic_count.hpp +47 -0
  304. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/base_from_completion_cond.hpp +70 -0
  305. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/bind_handler.hpp +491 -0
  306. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/buffer_resize_guard.hpp +68 -0
  307. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/buffer_sequence_adapter.hpp +385 -0
  308. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/buffered_stream_storage.hpp +128 -0
  309. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/call_stack.hpp +127 -0
  310. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/chrono_time_traits.hpp +192 -0
  311. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/completion_handler.hpp +83 -0
  312. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/config.hpp +1050 -0
  313. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/consuming_buffers.hpp +294 -0
  314. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/cstdint.hpp +48 -0
  315. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/date_time_fwd.hpp +34 -0
  316. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/deadline_timer_service.hpp +229 -0
  317. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/dependent_type.hpp +38 -0
  318. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/descriptor_ops.hpp +119 -0
  319. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/descriptor_read_op.hpp +121 -0
  320. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/descriptor_write_op.hpp +121 -0
  321. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/dev_poll_reactor.hpp +208 -0
  322. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/epoll_reactor.hpp +244 -0
  323. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/event.hpp +50 -0
  324. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/eventfd_select_interrupter.hpp +85 -0
  325. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/fd_set_adapter.hpp +41 -0
  326. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/fenced_block.hpp +82 -0
  327. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/function.hpp +40 -0
  328. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/gcc_arm_fenced_block.hpp +91 -0
  329. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/gcc_hppa_fenced_block.hpp +68 -0
  330. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/gcc_sync_fenced_block.hpp +65 -0
  331. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/gcc_x86_fenced_block.hpp +99 -0
  332. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_alloc_helpers.hpp +82 -0
  333. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_cont_helpers.hpp +45 -0
  334. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_invoke_helpers.hpp +57 -0
  335. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_tracking.hpp +161 -0
  336. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_type_requirements.hpp +480 -0
  337. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/hash_map.hpp +333 -0
  338. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/buffer_sequence_adapter.ipp +120 -0
  339. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/descriptor_ops.ipp +453 -0
  340. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/dev_poll_reactor.hpp +80 -0
  341. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/dev_poll_reactor.ipp +432 -0
  342. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/epoll_reactor.hpp +78 -0
  343. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/epoll_reactor.ipp +688 -0
  344. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/eventfd_select_interrupter.ipp +167 -0
  345. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/handler_tracking.ipp +307 -0
  346. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/kqueue_reactor.hpp +82 -0
  347. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/kqueue_reactor.ipp +498 -0
  348. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/pipe_select_interrupter.ipp +126 -0
  349. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/posix_event.ipp +49 -0
  350. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/posix_mutex.ipp +48 -0
  351. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/posix_thread.ipp +76 -0
  352. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/posix_tss_ptr.ipp +48 -0
  353. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/reactive_descriptor_service.ipp +210 -0
  354. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/reactive_serial_port_service.ipp +153 -0
  355. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/reactive_socket_service_base.ipp +269 -0
  356. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/resolver_service_base.ipp +132 -0
  357. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/select_reactor.hpp +89 -0
  358. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/select_reactor.ipp +315 -0
  359. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/service_registry.hpp +90 -0
  360. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/service_registry.ipp +190 -0
  361. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/signal_set_service.ipp +649 -0
  362. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/socket_ops.ipp +3470 -0
  363. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/socket_select_interrupter.ipp +178 -0
  364. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/strand_service.hpp +120 -0
  365. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/strand_service.ipp +178 -0
  366. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/task_io_service.hpp +80 -0
  367. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/task_io_service.ipp +476 -0
  368. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/throw_error.ipp +47 -0
  369. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/timer_queue_ptime.ipp +86 -0
  370. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/timer_queue_set.ipp +103 -0
  371. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/io_control.hpp +136 -0
  372. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/keyword_tss_ptr.hpp +72 -0
  373. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/kqueue_reactor.hpp +222 -0
  374. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/limits.hpp +26 -0
  375. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/local_free_on_block_exit.hpp +61 -0
  376. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/macos_fenced_block.hpp +63 -0
  377. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/memory.hpp +31 -0
  378. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/mutex.hpp +50 -0
  379. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/noncopyable.hpp +45 -0
  380. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_event.hpp +90 -0
  381. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_fenced_block.hpp +47 -0
  382. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_mutex.hpp +66 -0
  383. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_reactor.hpp +69 -0
  384. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_signal_blocker.hpp +71 -0
  385. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_socket_service.hpp +500 -0
  386. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_static_mutex.hpp +62 -0
  387. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_thread.hpp +63 -0
  388. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_tss_ptr.hpp +70 -0
  389. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/object_pool.hpp +148 -0
  390. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/old_win_sdk_compat.hpp +216 -0
  391. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/op_queue.hpp +158 -0
  392. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/operation.hpp +40 -0
  393. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/pipe_select_interrupter.hpp +91 -0
  394. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/pop_options.hpp +131 -0
  395. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_event.hpp +128 -0
  396. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_fd_set_adapter.hpp +120 -0
  397. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_mutex.hpp +78 -0
  398. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_signal_blocker.hpp +87 -0
  399. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_static_mutex.hpp +66 -0
  400. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_thread.hpp +107 -0
  401. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_tss_ptr.hpp +81 -0
  402. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/push_options.hpp +166 -0
  403. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_descriptor_service.hpp +324 -0
  404. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_null_buffers_op.hpp +90 -0
  405. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_serial_port_service.hpp +236 -0
  406. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_accept_op.hpp +138 -0
  407. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_connect_op.hpp +108 -0
  408. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_recv_op.hpp +125 -0
  409. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_recvfrom_op.hpp +135 -0
  410. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_recvmsg_op.hpp +127 -0
  411. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_send_op.hpp +122 -0
  412. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_sendto_op.hpp +125 -0
  413. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_service.hpp +460 -0
  414. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_service_base.hpp +452 -0
  415. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactor.hpp +32 -0
  416. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactor_fwd.hpp +42 -0
  417. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactor_op.hpp +63 -0
  418. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactor_op_queue.hpp +170 -0
  419. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/regex_fwd.hpp +35 -0
  420. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolve_endpoint_op.hpp +123 -0
  421. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolve_op.hpp +133 -0
  422. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolver_service.hpp +131 -0
  423. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolver_service_base.hpp +131 -0
  424. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/scoped_lock.hpp +103 -0
  425. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/scoped_ptr.hpp +81 -0
  426. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/select_interrupter.hpp +48 -0
  427. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/select_reactor.hpp +221 -0
  428. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/service_registry.hpp +146 -0
  429. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/shared_ptr.hpp +40 -0
  430. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/signal_blocker.hpp +46 -0
  431. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/signal_handler.hpp +84 -0
  432. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/signal_init.hpp +49 -0
  433. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/signal_op.hpp +51 -0
  434. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/signal_set_service.hpp +218 -0
  435. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/socket_holder.hpp +100 -0
  436. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/socket_ops.hpp +336 -0
  437. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/socket_option.hpp +318 -0
  438. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/socket_select_interrupter.hpp +93 -0
  439. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/socket_types.hpp +410 -0
  440. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/solaris_fenced_block.hpp +63 -0
  441. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/static_mutex.hpp +54 -0
  442. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_event.hpp +178 -0
  443. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_fenced_block.hpp +64 -0
  444. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_mutex.hpp +75 -0
  445. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_static_mutex.hpp +83 -0
  446. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_thread.hpp +67 -0
  447. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/strand_service.hpp +144 -0
  448. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/task_io_service.hpp +203 -0
  449. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/task_io_service_operation.hpp +78 -0
  450. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/task_io_service_thread_info.hpp +42 -0
  451. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/thread.hpp +58 -0
  452. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/thread_info_base.hpp +93 -0
  453. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/throw_error.hpp +55 -0
  454. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/throw_exception.hpp +53 -0
  455. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_queue.hpp +333 -0
  456. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_queue_base.hpp +70 -0
  457. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_queue_ptime.hpp +95 -0
  458. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_queue_set.hpp +68 -0
  459. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_scheduler.hpp +35 -0
  460. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_scheduler_fwd.hpp +42 -0
  461. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/tss_ptr.hpp +71 -0
  462. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/type_traits.hpp +60 -0
  463. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/variadic_templates.hpp +63 -0
  464. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/wait_handler.hpp +85 -0
  465. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/wait_op.hpp +47 -0
  466. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/weak_ptr.hpp +40 -0
  467. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/win_iocp_serial_port_service.hpp +230 -0
  468. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/winsock_init.hpp +130 -0
  469. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/wrapped_handler.hpp +293 -0
  470. data/src/cxx_supportlib/vendor-modified/boost/asio/error.hpp +345 -0
  471. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/basic_endpoint.hpp +195 -0
  472. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/datagram_protocol.hpp +125 -0
  473. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/detail/endpoint.hpp +135 -0
  474. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/detail/impl/endpoint.ipp +111 -0
  475. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/raw_protocol.hpp +123 -0
  476. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/seq_packet_protocol.hpp +124 -0
  477. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/stream_protocol.hpp +129 -0
  478. data/src/cxx_supportlib/vendor-modified/boost/asio/handler_alloc_hook.hpp +83 -0
  479. data/src/cxx_supportlib/vendor-modified/boost/asio/handler_continuation_hook.hpp +56 -0
  480. data/src/cxx_supportlib/vendor-modified/boost/asio/handler_invoke_hook.hpp +87 -0
  481. data/src/cxx_supportlib/vendor-modified/boost/asio/handler_type.hpp +114 -0
  482. data/src/cxx_supportlib/vendor-modified/boost/asio/high_resolution_timer.hpp +65 -0
  483. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/buffered_read_stream.hpp +360 -0
  484. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/buffered_write_stream.hpp +340 -0
  485. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/connect.hpp +432 -0
  486. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/error.ipp +130 -0
  487. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/handler_alloc_hook.ipp +79 -0
  488. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/io_service.hpp +156 -0
  489. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/io_service.ipp +157 -0
  490. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read.hpp +755 -0
  491. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_at.hpp +812 -0
  492. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_until.hpp +1149 -0
  493. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/serial_port_base.hpp +61 -0
  494. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/serial_port_base.ipp +556 -0
  495. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/spawn.hpp +355 -0
  496. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/src.cpp +25 -0
  497. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/src.hpp +73 -0
  498. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/use_future.hpp +179 -0
  499. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/write.hpp +767 -0
  500. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/write_at.hpp +827 -0
  501. data/src/cxx_supportlib/vendor-modified/boost/asio/io_service.hpp +772 -0
  502. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/address.hpp +202 -0
  503. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/address_v4.hpp +243 -0
  504. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/address_v6.hpp +248 -0
  505. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_endpoint.hpp +265 -0
  506. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver.hpp +270 -0
  507. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver_entry.hpp +96 -0
  508. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver_iterator.hpp +262 -0
  509. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver_query.hpp +246 -0
  510. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/detail/endpoint.hpp +141 -0
  511. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/detail/impl/endpoint.ipp +206 -0
  512. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/detail/socket_option.hpp +571 -0
  513. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/host_name.hpp +44 -0
  514. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/icmp.hpp +117 -0
  515. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address.hpp +55 -0
  516. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address.ipp +228 -0
  517. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address_v4.hpp +55 -0
  518. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address_v4.ipp +180 -0
  519. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address_v6.hpp +55 -0
  520. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address_v6.ipp +300 -0
  521. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/basic_endpoint.hpp +57 -0
  522. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/host_name.ipp +56 -0
  523. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/multicast.hpp +193 -0
  524. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/resolver_query_base.hpp +132 -0
  525. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/resolver_service.hpp +178 -0
  526. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/tcp.hpp +157 -0
  527. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/udp.hpp +113 -0
  528. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/unicast.hpp +72 -0
  529. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/v6_only.hpp +71 -0
  530. data/src/cxx_supportlib/vendor-modified/boost/asio/is_read_buffered.hpp +61 -0
  531. data/src/cxx_supportlib/vendor-modified/boost/asio/is_write_buffered.hpp +61 -0
  532. data/src/cxx_supportlib/vendor-modified/boost/asio/local/basic_endpoint.hpp +241 -0
  533. data/src/cxx_supportlib/vendor-modified/boost/asio/local/connect_pair.hpp +106 -0
  534. data/src/cxx_supportlib/vendor-modified/boost/asio/local/datagram_protocol.hpp +82 -0
  535. data/src/cxx_supportlib/vendor-modified/boost/asio/local/detail/endpoint.hpp +135 -0
  536. data/src/cxx_supportlib/vendor-modified/boost/asio/local/detail/impl/endpoint.ipp +130 -0
  537. data/src/cxx_supportlib/vendor-modified/boost/asio/local/stream_protocol.hpp +92 -0
  538. data/src/cxx_supportlib/vendor-modified/boost/asio/placeholders.hpp +125 -0
  539. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/basic_descriptor.hpp +492 -0
  540. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/basic_stream_descriptor.hpp +364 -0
  541. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/descriptor_base.hpp +99 -0
  542. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/stream_descriptor.hpp +39 -0
  543. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/stream_descriptor_service.hpp +262 -0
  544. data/src/cxx_supportlib/vendor-modified/boost/asio/raw_socket_service.hpp +438 -0
  545. data/src/cxx_supportlib/vendor-modified/boost/asio/read.hpp +633 -0
  546. data/src/cxx_supportlib/vendor-modified/boost/asio/read_at.hpp +666 -0
  547. data/src/cxx_supportlib/vendor-modified/boost/asio/read_until.hpp +925 -0
  548. data/src/cxx_supportlib/vendor-modified/boost/asio/seq_packet_socket_service.hpp +386 -0
  549. data/src/cxx_supportlib/vendor-modified/boost/asio/serial_port.hpp +38 -0
  550. data/src/cxx_supportlib/vendor-modified/boost/asio/serial_port_base.hpp +169 -0
  551. data/src/cxx_supportlib/vendor-modified/boost/asio/serial_port_service.hpp +255 -0
  552. data/src/cxx_supportlib/vendor-modified/boost/asio/signal_set.hpp +30 -0
  553. data/src/cxx_supportlib/vendor-modified/boost/asio/signal_set_service.hpp +136 -0
  554. data/src/cxx_supportlib/vendor-modified/boost/asio/socket_acceptor_service.hpp +308 -0
  555. data/src/cxx_supportlib/vendor-modified/boost/asio/socket_base.hpp +522 -0
  556. data/src/cxx_supportlib/vendor-modified/boost/asio/spawn.hpp +267 -0
  557. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl.hpp +30 -0
  558. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/basic_context.hpp +42 -0
  559. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/context.hpp +789 -0
  560. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/context_base.hpp +194 -0
  561. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/context_service.hpp +42 -0
  562. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/buffered_handshake_op.hpp +112 -0
  563. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/engine.hpp +166 -0
  564. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/handshake_op.hpp +70 -0
  565. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/impl/engine.ipp +327 -0
  566. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/impl/openssl_init.ipp +166 -0
  567. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/io.hpp +351 -0
  568. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/openssl_init.hpp +103 -0
  569. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/openssl_types.hpp +30 -0
  570. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/password_callback.hpp +74 -0
  571. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/read_op.hpp +75 -0
  572. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/shutdown_op.hpp +62 -0
  573. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/stream_core.hpp +128 -0
  574. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/verify_callback.hpp +70 -0
  575. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/write_op.hpp +75 -0
  576. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/error.hpp +115 -0
  577. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/context.hpp +73 -0
  578. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/context.ipp +1177 -0
  579. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/error.ipp +102 -0
  580. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/rfc2818_verification.ipp +168 -0
  581. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/src.hpp +28 -0
  582. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/basic_context.hpp +436 -0
  583. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/context_service.hpp +176 -0
  584. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/detail/openssl_context_service.hpp +396 -0
  585. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/detail/openssl_operation.hpp +526 -0
  586. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/detail/openssl_stream_service.hpp +573 -0
  587. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/stream.hpp +503 -0
  588. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/stream_service.hpp +186 -0
  589. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/rfc2818_verification.hpp +102 -0
  590. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/stream.hpp +758 -0
  591. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/stream_base.hpp +54 -0
  592. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/stream_service.hpp +42 -0
  593. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/verify_context.hpp +75 -0
  594. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/verify_mode.hpp +65 -0
  595. data/src/cxx_supportlib/vendor-modified/boost/asio/steady_timer.hpp +63 -0
  596. data/src/cxx_supportlib/vendor-modified/boost/asio/strand.hpp +254 -0
  597. data/src/cxx_supportlib/vendor-modified/boost/asio/stream_socket_service.hpp +382 -0
  598. data/src/cxx_supportlib/vendor-modified/boost/asio/streambuf.hpp +35 -0
  599. data/src/cxx_supportlib/vendor-modified/boost/asio/system_timer.hpp +59 -0
  600. data/src/cxx_supportlib/vendor-modified/boost/asio/time_traits.hpp +88 -0
  601. data/src/cxx_supportlib/vendor-modified/boost/asio/unyield.hpp +21 -0
  602. data/src/cxx_supportlib/vendor-modified/boost/asio/use_future.hpp +94 -0
  603. data/src/cxx_supportlib/vendor-modified/boost/asio/version.hpp +23 -0
  604. data/src/cxx_supportlib/vendor-modified/boost/asio/wait_traits.hpp +43 -0
  605. data/src/cxx_supportlib/vendor-modified/boost/asio/waitable_timer_service.hpp +170 -0
  606. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_handle.hpp +283 -0
  607. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_object_handle.hpp +180 -0
  608. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_random_access_handle.hpp +378 -0
  609. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_stream_handle.hpp +361 -0
  610. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/object_handle.hpp +40 -0
  611. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/object_handle_service.hpp +179 -0
  612. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/overlapped_ptr.hpp +118 -0
  613. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/random_access_handle.hpp +39 -0
  614. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/random_access_handle_service.hpp +222 -0
  615. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/stream_handle.hpp +39 -0
  616. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/stream_handle_service.hpp +220 -0
  617. data/src/cxx_supportlib/vendor-modified/boost/asio/write.hpp +620 -0
  618. data/src/cxx_supportlib/vendor-modified/boost/asio/write_at.hpp +672 -0
  619. data/src/cxx_supportlib/vendor-modified/boost/asio/yield.hpp +23 -0
  620. data/src/cxx_supportlib/vendor-modified/boost/chrono.hpp +20 -0
  621. data/src/cxx_supportlib/vendor-modified/boost/chrono/chrono.hpp +15 -0
  622. data/src/cxx_supportlib/vendor-modified/boost/chrono/chrono_io.hpp +34 -0
  623. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/chrono.hpp +46 -0
  624. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/mac/chrono.hpp +242 -0
  625. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp +356 -0
  626. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/mac/thread_clock.hpp +92 -0
  627. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/posix/chrono.hpp +121 -0
  628. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp +354 -0
  629. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/posix/thread_clock.hpp +92 -0
  630. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/process_cpu_clocks.hpp +46 -0
  631. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/thread_clock.hpp +46 -0
  632. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp +54 -0
  633. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/scan_keyword.hpp +163 -0
  634. data/src/cxx_supportlib/vendor-modified/boost/chrono/floor.hpp +36 -0
  635. data/src/cxx_supportlib/vendor-modified/boost/chrono/include.hpp +23 -0
  636. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_get.hpp +593 -0
  637. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_io.hpp +295 -0
  638. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_put.hpp +317 -0
  639. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_style.hpp +35 -0
  640. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_units.hpp +1003 -0
  641. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/ios_base_state.hpp +152 -0
  642. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/time_point_get.hpp +330 -0
  643. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/time_point_io.hpp +1243 -0
  644. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/time_point_put.hpp +261 -0
  645. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/time_point_units.hpp +260 -0
  646. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/timezone.hpp +30 -0
  647. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/utility/ios_base_state_ptr.hpp +437 -0
  648. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/utility/manip_base.hpp +101 -0
  649. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/utility/to_string.hpp +50 -0
  650. data/src/cxx_supportlib/vendor-modified/boost/chrono/io_v1/chrono_io.hpp +637 -0
  651. data/src/cxx_supportlib/vendor-modified/boost/chrono/process_cpu_clocks.hpp +525 -0
  652. data/src/cxx_supportlib/vendor-modified/boost/chrono/round.hpp +59 -0
  653. data/src/cxx_supportlib/vendor-modified/boost/chrono/thread_clock.hpp +75 -0
  654. data/src/cxx_supportlib/vendor-modified/boost/chrono/typeof/boost/chrono/chrono.hpp +32 -0
  655. data/src/cxx_supportlib/vendor-modified/boost/chrono/typeof/boost/ratio.hpp +24 -0
  656. data/src/cxx_supportlib/vendor-modified/boost/detail/atomic_count.hpp +21 -0
  657. data/src/cxx_supportlib/vendor-modified/boost/integer/common_factor.hpp +16 -0
  658. data/src/cxx_supportlib/vendor-modified/boost/integer/common_factor_rt.hpp +460 -0
  659. data/src/cxx_supportlib/vendor-modified/boost/integer/integer_log2.hpp +112 -0
  660. data/src/cxx_supportlib/vendor-modified/boost/integer/integer_mask.hpp +126 -0
  661. data/src/cxx_supportlib/vendor-modified/boost/integer/static_min_max.hpp +51 -0
  662. data/src/cxx_supportlib/vendor-modified/boost/libs/chrono/src/chrono.cpp +15 -0
  663. data/src/cxx_supportlib/vendor-modified/boost/libs/chrono/src/process_cpu_clocks.cpp +18 -0
  664. data/src/cxx_supportlib/vendor-modified/boost/libs/chrono/src/thread_clock.cpp +19 -0
  665. data/src/cxx_supportlib/vendor-modified/boost/libs/random/src/random_device.cpp +250 -0
  666. data/src/cxx_supportlib/vendor-modified/boost/pointer_cast.hpp +121 -0
  667. data/src/cxx_supportlib/vendor-modified/boost/random.hpp +91 -0
  668. data/src/cxx_supportlib/vendor-modified/boost/random/additive_combine.hpp +283 -0
  669. data/src/cxx_supportlib/vendor-modified/boost/random/bernoulli_distribution.hpp +197 -0
  670. data/src/cxx_supportlib/vendor-modified/boost/random/beta_distribution.hpp +184 -0
  671. data/src/cxx_supportlib/vendor-modified/boost/random/binomial_distribution.hpp +434 -0
  672. data/src/cxx_supportlib/vendor-modified/boost/random/cauchy_distribution.hpp +214 -0
  673. data/src/cxx_supportlib/vendor-modified/boost/random/chi_squared_distribution.hpp +209 -0
  674. data/src/cxx_supportlib/vendor-modified/boost/random/detail/auto_link.hpp +40 -0
  675. data/src/cxx_supportlib/vendor-modified/boost/random/detail/config.hpp +18 -0
  676. data/src/cxx_supportlib/vendor-modified/boost/random/detail/const_mod.hpp +216 -0
  677. data/src/cxx_supportlib/vendor-modified/boost/random/detail/disable_warnings.hpp +29 -0
  678. data/src/cxx_supportlib/vendor-modified/boost/random/detail/enable_warnings.hpp +22 -0
  679. data/src/cxx_supportlib/vendor-modified/boost/random/detail/generator_bits.hpp +36 -0
  680. data/src/cxx_supportlib/vendor-modified/boost/random/detail/generator_seed_seq.hpp +40 -0
  681. data/src/cxx_supportlib/vendor-modified/boost/random/detail/int_float_pair.hpp +121 -0
  682. data/src/cxx_supportlib/vendor-modified/boost/random/detail/integer_log2.hpp +84 -0
  683. data/src/cxx_supportlib/vendor-modified/boost/random/detail/iterator_mixin.hpp +45 -0
  684. data/src/cxx_supportlib/vendor-modified/boost/random/detail/large_arithmetic.hpp +122 -0
  685. data/src/cxx_supportlib/vendor-modified/boost/random/detail/operators.hpp +84 -0
  686. data/src/cxx_supportlib/vendor-modified/boost/random/detail/polynomial.hpp +384 -0
  687. data/src/cxx_supportlib/vendor-modified/boost/random/detail/ptr_helper.hpp +67 -0
  688. data/src/cxx_supportlib/vendor-modified/boost/random/detail/seed.hpp +115 -0
  689. data/src/cxx_supportlib/vendor-modified/boost/random/detail/seed_impl.hpp +398 -0
  690. data/src/cxx_supportlib/vendor-modified/boost/random/detail/signed_unsigned_tools.hpp +89 -0
  691. data/src/cxx_supportlib/vendor-modified/boost/random/detail/uniform_int_float.hpp +76 -0
  692. data/src/cxx_supportlib/vendor-modified/boost/random/detail/vector_io.hpp +75 -0
  693. data/src/cxx_supportlib/vendor-modified/boost/random/discard_block.hpp +241 -0
  694. data/src/cxx_supportlib/vendor-modified/boost/random/discrete_distribution.hpp +636 -0
  695. data/src/cxx_supportlib/vendor-modified/boost/random/exponential_distribution.hpp +386 -0
  696. data/src/cxx_supportlib/vendor-modified/boost/random/extreme_value_distribution.hpp +177 -0
  697. data/src/cxx_supportlib/vendor-modified/boost/random/fisher_f_distribution.hpp +183 -0
  698. data/src/cxx_supportlib/vendor-modified/boost/random/gamma_distribution.hpp +292 -0
  699. data/src/cxx_supportlib/vendor-modified/boost/random/generate_canonical.hpp +96 -0
  700. data/src/cxx_supportlib/vendor-modified/boost/random/geometric_distribution.hpp +267 -0
  701. data/src/cxx_supportlib/vendor-modified/boost/random/hyperexponential_distribution.hpp +883 -0
  702. data/src/cxx_supportlib/vendor-modified/boost/random/independent_bits.hpp +271 -0
  703. data/src/cxx_supportlib/vendor-modified/boost/random/inversive_congruential.hpp +267 -0
  704. data/src/cxx_supportlib/vendor-modified/boost/random/lagged_fibonacci.hpp +537 -0
  705. data/src/cxx_supportlib/vendor-modified/boost/random/laplace_distribution.hpp +175 -0
  706. data/src/cxx_supportlib/vendor-modified/boost/random/linear_congruential.hpp +466 -0
  707. data/src/cxx_supportlib/vendor-modified/boost/random/linear_feedback_shift.hpp +217 -0
  708. data/src/cxx_supportlib/vendor-modified/boost/random/lognormal_distribution.hpp +254 -0
  709. data/src/cxx_supportlib/vendor-modified/boost/random/mersenne_twister.hpp +682 -0
  710. data/src/cxx_supportlib/vendor-modified/boost/random/negative_binomial_distribution.hpp +220 -0
  711. data/src/cxx_supportlib/vendor-modified/boost/random/non_central_chi_squared_distribution.hpp +221 -0
  712. data/src/cxx_supportlib/vendor-modified/boost/random/normal_distribution.hpp +374 -0
  713. data/src/cxx_supportlib/vendor-modified/boost/random/piecewise_constant_distribution.hpp +466 -0
  714. data/src/cxx_supportlib/vendor-modified/boost/random/piecewise_linear_distribution.hpp +531 -0
  715. data/src/cxx_supportlib/vendor-modified/boost/random/poisson_distribution.hpp +360 -0
  716. data/src/cxx_supportlib/vendor-modified/boost/random/random_device.hpp +143 -0
  717. data/src/cxx_supportlib/vendor-modified/boost/random/random_number_generator.hpp +73 -0
  718. data/src/cxx_supportlib/vendor-modified/boost/random/ranlux.hpp +99 -0
  719. data/src/cxx_supportlib/vendor-modified/boost/random/seed_seq.hpp +118 -0
  720. data/src/cxx_supportlib/vendor-modified/boost/random/shuffle_order.hpp +269 -0
  721. data/src/cxx_supportlib/vendor-modified/boost/random/shuffle_output.hpp +51 -0
  722. data/src/cxx_supportlib/vendor-modified/boost/random/student_t_distribution.hpp +180 -0
  723. data/src/cxx_supportlib/vendor-modified/boost/random/subtract_with_carry.hpp +613 -0
  724. data/src/cxx_supportlib/vendor-modified/boost/random/taus88.hpp +45 -0
  725. data/src/cxx_supportlib/vendor-modified/boost/random/traits.hpp +107 -0
  726. data/src/cxx_supportlib/vendor-modified/boost/random/triangle_distribution.hpp +232 -0
  727. data/src/cxx_supportlib/vendor-modified/boost/random/uniform_01.hpp +257 -0
  728. data/src/cxx_supportlib/vendor-modified/boost/random/uniform_int.hpp +99 -0
  729. data/src/cxx_supportlib/vendor-modified/boost/random/uniform_int_distribution.hpp +419 -0
  730. data/src/cxx_supportlib/vendor-modified/boost/random/uniform_on_sphere.hpp +284 -0
  731. data/src/cxx_supportlib/vendor-modified/boost/random/uniform_real.hpp +82 -0
  732. data/src/cxx_supportlib/vendor-modified/boost/random/uniform_real_distribution.hpp +241 -0
  733. data/src/cxx_supportlib/vendor-modified/boost/random/uniform_smallint.hpp +307 -0
  734. data/src/cxx_supportlib/vendor-modified/boost/random/variate_generator.hpp +122 -0
  735. data/src/cxx_supportlib/vendor-modified/boost/random/weibull_distribution.hpp +177 -0
  736. data/src/cxx_supportlib/vendor-modified/boost/random/xor_combine.hpp +208 -0
  737. data/src/cxx_supportlib/vendor-modified/boost/ratio.hpp +14 -0
  738. data/src/cxx_supportlib/vendor-modified/boost/ratio/detail/ratio_io.hpp +1342 -0
  739. data/src/cxx_supportlib/vendor-modified/boost/ratio/include.hpp +16 -0
  740. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/abs.hpp +30 -0
  741. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/arithmetic.hpp +22 -0
  742. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/comparison.hpp +19 -0
  743. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/divides.hpp +30 -0
  744. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/equal_to.hpp +30 -0
  745. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/gcd.hpp +30 -0
  746. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/greater.hpp +30 -0
  747. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/greater_equal.hpp +30 -0
  748. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/lcm.hpp +30 -0
  749. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/less.hpp +30 -0
  750. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/less_equal.hpp +30 -0
  751. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/minus.hpp +30 -0
  752. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/negate.hpp +30 -0
  753. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/not_equal_to.hpp +30 -0
  754. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/numeric_cast.hpp +31 -0
  755. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/plus.hpp +30 -0
  756. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/rational_c_tag.hpp +25 -0
  757. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/rational_constant.hpp +15 -0
  758. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/sign.hpp +30 -0
  759. data/src/cxx_supportlib/vendor-modified/boost/ratio/mpl/times.hpp +30 -0
  760. data/src/cxx_supportlib/vendor-modified/boost/ratio/ratio_io.hpp +1076 -0
  761. data/src/cxx_supportlib/vendor-modified/boost/rational.hpp +1002 -0
  762. data/src/cxx_supportlib/vendor-modified/modp_b64.cpp +11 -0
  763. data/src/helper-scripts/rack-preloader.rb +1 -1
  764. data/src/nginx_module/{ConfigurationCommands.c → ConfigGeneral/AutoGeneratedDefinitions.c} +351 -134
  765. data/src/nginx_module/{ConfigurationCommands.c.cxxcodebuilder → ConfigGeneral/AutoGeneratedDefinitions.c.cxxcodebuilder} +14 -25
  766. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +396 -0
  767. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c.cxxcodebuilder +160 -0
  768. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +831 -0
  769. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c.cxxcodebuilder +168 -0
  770. data/src/nginx_module/ConfigGeneral/ManifestGeneration.c +887 -0
  771. data/src/nginx_module/ConfigGeneral/ManifestGeneration.h +100 -0
  772. data/src/nginx_module/Configuration.c +165 -621
  773. data/src/nginx_module/Configuration.h +43 -33
  774. data/src/nginx_module/ContentHandler.c +46 -40
  775. data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +282 -0
  776. data/src/nginx_module/{CreateLocationConfig.c.cxxcodebuilder → LocationConfig/AutoGeneratedCreateFunction.c.cxxcodebuilder} +43 -17
  777. data/src/nginx_module/{CacheLocationConfig.c → LocationConfig/AutoGeneratedHeaderSerialization.c} +148 -180
  778. data/src/nginx_module/{CacheLocationConfig.c.cxxcodebuilder → LocationConfig/AutoGeneratedHeaderSerialization.c.cxxcodebuilder} +13 -11
  779. data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +595 -0
  780. data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c.cxxcodebuilder +190 -0
  781. data/src/nginx_module/{MergeLocationConfig.c → LocationConfig/AutoGeneratedMergeFunction.c} +32 -42
  782. data/src/nginx_module/{MergeLocationConfig.c.cxxcodebuilder → LocationConfig/AutoGeneratedMergeFunction.c.cxxcodebuilder} +18 -11
  783. data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +220 -0
  784. data/src/nginx_module/{LocationConfig.h.cxxcodebuilder → LocationConfig/AutoGeneratedStruct.h.cxxcodebuilder} +70 -48
  785. data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +163 -0
  786. data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c.cxxcodebuilder +125 -0
  787. data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +303 -0
  788. data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c.cxxcodebuilder +173 -0
  789. data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +133 -0
  790. data/src/nginx_module/MainConfig/AutoGeneratedStruct.h.cxxcodebuilder +154 -0
  791. data/src/nginx_module/config +13 -4
  792. data/src/nginx_module/ngx_http_passenger_module.c +154 -84
  793. data/src/ruby_supportlib/phusion_passenger.rb +2 -2
  794. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +613 -131
  795. data/src/ruby_supportlib/phusion_passenger/apache2/config_utils.rb +52 -0
  796. data/src/ruby_supportlib/phusion_passenger/common_library.rb +18 -4
  797. data/src/ruby_supportlib/phusion_passenger/config/main.rb +2 -0
  798. data/src/ruby_supportlib/phusion_passenger/config/system_properties_command.rb +104 -0
  799. data/src/ruby_supportlib/phusion_passenger/constants.rb +0 -2
  800. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +470 -138
  801. data/src/ruby_supportlib/phusion_passenger/packaging.rb +1 -0
  802. data/src/ruby_supportlib/phusion_passenger/platform_info.rb +17 -0
  803. data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +11 -1
  804. data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +7 -7
  805. data/src/ruby_supportlib/phusion_passenger/platform_info/networking.rb +293 -0
  806. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +8 -54
  807. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +1 -5
  808. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +4 -7
  809. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +1 -1
  810. data/src/schema_printer/SchemaPrinterMain.cpp +78 -0
  811. data/src/schema_printer/SchemaPrinterMain.cpp.cxxcodebuilder +116 -0
  812. metadata +671 -30
  813. data/src/apache2_module/Configuration.cpp +0 -737
  814. data/src/apache2_module/Configuration.hpp +0 -274
  815. data/src/apache2_module/ConfigurationCommands.cpp +0 -199
  816. data/src/apache2_module/ConfigurationFields.hpp +0 -187
  817. data/src/apache2_module/ConfigurationSetters.cpp +0 -436
  818. data/src/apache2_module/ConfigurationSetters.cpp.cxxcodebuilder +0 -144
  819. data/src/apache2_module/CreateDirConfig.cpp +0 -68
  820. data/src/apache2_module/CreateDirConfig.cpp.cxxcodebuilder +0 -81
  821. data/src/apache2_module/MergeDirConfig.cpp +0 -155
  822. data/src/apache2_module/SetHeaders.cpp +0 -111
  823. data/src/nginx_module/CreateLocationConfig.c +0 -100
  824. data/src/nginx_module/LocationConfig.h +0 -95
@@ -0,0 +1,1002 @@
1
+ // Boost rational.hpp header file ------------------------------------------//
2
+
3
+ // (C) Copyright Paul Moore 1999. Permission to copy, use, modify, sell and
4
+ // distribute this software is granted provided this copyright notice appears
5
+ // in all copies. This software is provided "as is" without express or
6
+ // implied warranty, and with no claim as to its suitability for any purpose.
7
+
8
+ // boostinspect:nolicense (don't complain about the lack of a Boost license)
9
+ // (Paul Moore hasn't been in contact for years, so there's no way to change the
10
+ // license.)
11
+
12
+ // See http://www.boost.org/libs/rational for documentation.
13
+
14
+ // Credits:
15
+ // Thanks to the boost mailing list in general for useful comments.
16
+ // Particular contributions included:
17
+ // Andrew D Jewell, for reminding me to take care to avoid overflow
18
+ // Ed Brey, for many comments, including picking up on some dreadful typos
19
+ // Stephen Silver contributed the test suite and comments on user-defined
20
+ // IntType
21
+ // Nickolay Mladenov, for the implementation of operator+=
22
+
23
+ // Revision History
24
+ // 02 Sep 13 Remove unneeded forward declarations; tweak private helper
25
+ // function (Daryle Walker)
26
+ // 30 Aug 13 Improve exception safety of "assign"; start modernizing I/O code
27
+ // (Daryle Walker)
28
+ // 27 Aug 13 Add cross-version constructor template, plus some private helper
29
+ // functions; add constructor to exception class to take custom
30
+ // messages (Daryle Walker)
31
+ // 25 Aug 13 Add constexpr qualification wherever possible (Daryle Walker)
32
+ // 05 May 12 Reduced use of implicit gcd (Mario Lang)
33
+ // 05 Nov 06 Change rational_cast to not depend on division between different
34
+ // types (Daryle Walker)
35
+ // 04 Nov 06 Off-load GCD and LCM to Boost.Integer; add some invariant checks;
36
+ // add std::numeric_limits<> requirement to help GCD (Daryle Walker)
37
+ // 31 Oct 06 Recoded both operator< to use round-to-negative-infinity
38
+ // divisions; the rational-value version now uses continued fraction
39
+ // expansion to avoid overflows, for bug #798357 (Daryle Walker)
40
+ // 20 Oct 06 Fix operator bool_type for CW 8.3 (Joaquín M López Muñoz)
41
+ // 18 Oct 06 Use EXPLICIT_TEMPLATE_TYPE helper macros from Boost.Config
42
+ // (Joaquín M López Muñoz)
43
+ // 27 Dec 05 Add Boolean conversion operator (Daryle Walker)
44
+ // 28 Sep 02 Use _left versions of operators from operators.hpp
45
+ // 05 Jul 01 Recode gcd(), avoiding std::swap (Helmut Zeisel)
46
+ // 03 Mar 01 Workarounds for Intel C++ 5.0 (David Abrahams)
47
+ // 05 Feb 01 Update operator>> to tighten up input syntax
48
+ // 05 Feb 01 Final tidy up of gcd code prior to the new release
49
+ // 27 Jan 01 Recode abs() without relying on abs(IntType)
50
+ // 21 Jan 01 Include Nickolay Mladenov's operator+= algorithm,
51
+ // tidy up a number of areas, use newer features of operators.hpp
52
+ // (reduces space overhead to zero), add operator!,
53
+ // introduce explicit mixed-mode arithmetic operations
54
+ // 12 Jan 01 Include fixes to handle a user-defined IntType better
55
+ // 19 Nov 00 Throw on divide by zero in operator /= (John (EBo) David)
56
+ // 23 Jun 00 Incorporate changes from Mark Rodgers for Borland C++
57
+ // 22 Jun 00 Change _MSC_VER to BOOST_MSVC so other compilers are not
58
+ // affected (Beman Dawes)
59
+ // 6 Mar 00 Fix operator-= normalization, #include <string> (Jens Maurer)
60
+ // 14 Dec 99 Modifications based on comments from the boost list
61
+ // 09 Dec 99 Initial Version (Paul Moore)
62
+
63
+ #ifndef BOOST_RATIONAL_HPP
64
+ #define BOOST_RATIONAL_HPP
65
+
66
+ #include <boost/config.hpp> // for BOOST_NO_STDC_NAMESPACE, BOOST_MSVC, etc
67
+ #ifndef BOOST_NO_IOSTREAM
68
+ #include <iomanip> // for std::setw
69
+ #include <ios> // for std::noskipws, streamsize
70
+ #include <istream> // for std::istream
71
+ #include <ostream> // for std::ostream
72
+ #include <sstream> // for std::ostringstream
73
+ #endif
74
+ #include <cstddef> // for NULL
75
+ #include <stdexcept> // for std::domain_error
76
+ #include <string> // for std::string implicit constructor
77
+ #include <boost/operators.hpp> // for boost::addable etc
78
+ #include <cstdlib> // for std::abs
79
+ #include <boost/call_traits.hpp> // for boost::call_traits
80
+ #include <boost/detail/workaround.hpp> // for BOOST_WORKAROUND
81
+ #include <boost/assert.hpp> // for BOOST_ASSERT
82
+ #include <boost/integer/common_factor_rt.hpp> // for boost::integer::gcd, lcm
83
+ #include <limits> // for std::numeric_limits
84
+ #include <boost/static_assert.hpp> // for BOOST_STATIC_ASSERT
85
+ #include <boost/throw_exception.hpp>
86
+ #include <boost/utility/enable_if.hpp>
87
+ #include <boost/type_traits/is_convertible.hpp>
88
+ #include <boost/type_traits/is_class.hpp>
89
+ #include <boost/type_traits/is_same.hpp>
90
+
91
+ // Control whether depreciated GCD and LCM functions are included (default: yes)
92
+ #ifndef BOOST_CONTROL_RATIONAL_HAS_GCD
93
+ #define BOOST_CONTROL_RATIONAL_HAS_GCD 1
94
+ #endif
95
+
96
+ namespace boost {
97
+
98
+ #if BOOST_CONTROL_RATIONAL_HAS_GCD
99
+ template <typename IntType>
100
+ IntType gcd(IntType n, IntType m)
101
+ {
102
+ // Defer to the version in Boost.Integer
103
+ return integer::gcd( n, m );
104
+ }
105
+
106
+ template <typename IntType>
107
+ IntType lcm(IntType n, IntType m)
108
+ {
109
+ // Defer to the version in Boost.Integer
110
+ return integer::lcm( n, m );
111
+ }
112
+ #endif // BOOST_CONTROL_RATIONAL_HAS_GCD
113
+
114
+ namespace rational_detail{
115
+
116
+ template <class FromInt, class ToInt>
117
+ struct is_compatible_integer
118
+ {
119
+ BOOST_STATIC_CONSTANT(bool, value = ((std::numeric_limits<FromInt>::is_specialized && std::numeric_limits<FromInt>::is_integer
120
+ && (std::numeric_limits<FromInt>::digits <= std::numeric_limits<ToInt>::digits)
121
+ && (std::numeric_limits<FromInt>::radix == std::numeric_limits<ToInt>::radix)
122
+ && ((std::numeric_limits<FromInt>::is_signed == false) || (std::numeric_limits<ToInt>::is_signed == true))
123
+ && is_convertible<FromInt, ToInt>::value)
124
+ || is_same<FromInt, ToInt>::value)
125
+ || (is_class<ToInt>::value && is_class<FromInt>::value && is_convertible<FromInt, ToInt>::value));
126
+ };
127
+
128
+ }
129
+
130
+ class bad_rational : public std::domain_error
131
+ {
132
+ public:
133
+ explicit bad_rational() : std::domain_error("bad rational: zero denominator") {}
134
+ explicit bad_rational( char const *what ) : std::domain_error( what ) {}
135
+ };
136
+
137
+ template <typename IntType>
138
+ class rational
139
+ {
140
+ // Class-wide pre-conditions
141
+ BOOST_STATIC_ASSERT( ::std::numeric_limits<IntType>::is_specialized );
142
+
143
+ // Helper types
144
+ typedef typename boost::call_traits<IntType>::param_type param_type;
145
+
146
+ struct helper { IntType parts[2]; };
147
+ typedef IntType (helper::* bool_type)[2];
148
+
149
+ public:
150
+ // Component type
151
+ typedef IntType int_type;
152
+
153
+ BOOST_CONSTEXPR
154
+ rational() : num(0), den(1) {}
155
+ template <class T>
156
+ BOOST_CONSTEXPR rational(const T& n, typename enable_if_c<
157
+ rational_detail::is_compatible_integer<T, IntType>::value
158
+ >::type const* = 0) : num(n), den(1) {}
159
+ template <class T, class U>
160
+ rational(const T& n, const U& d, typename enable_if_c<
161
+ rational_detail::is_compatible_integer<T, IntType>::value && rational_detail::is_compatible_integer<U, IntType>::value
162
+ >::type const* = 0) : num(n), den(d) {
163
+ normalize();
164
+ }
165
+
166
+ template < typename NewType >
167
+ BOOST_CONSTEXPR explicit
168
+ rational(rational<NewType> const &r, typename enable_if_c<rational_detail::is_compatible_integer<NewType, IntType>::value>::type const* = 0)
169
+ : num(r.numerator()), den(is_normalized(int_type(r.numerator()),
170
+ int_type(r.denominator())) ? r.denominator() :
171
+ (BOOST_THROW_EXCEPTION(bad_rational("bad rational: denormalized conversion")), 0)){}
172
+
173
+ template < typename NewType >
174
+ BOOST_CONSTEXPR explicit
175
+ rational(rational<NewType> const &r, typename disable_if_c<rational_detail::is_compatible_integer<NewType, IntType>::value>::type const* = 0)
176
+ : num(r.numerator()), den(is_normalized(int_type(r.numerator()),
177
+ int_type(r.denominator())) && is_safe_narrowing_conversion(r.denominator()) && is_safe_narrowing_conversion(r.numerator()) ? r.denominator() :
178
+ (BOOST_THROW_EXCEPTION(bad_rational("bad rational: denormalized conversion")), 0)){}
179
+ // Default copy constructor and assignment are fine
180
+
181
+ // Add assignment from IntType
182
+ template <class T>
183
+ typename enable_if_c<
184
+ rational_detail::is_compatible_integer<T, IntType>::value, rational &
185
+ >::type operator=(const T& n) { return assign(static_cast<IntType>(n), static_cast<IntType>(1)); }
186
+
187
+ // Assign in place
188
+ template <class T, class U>
189
+ typename enable_if_c<
190
+ rational_detail::is_compatible_integer<T, IntType>::value && rational_detail::is_compatible_integer<U, IntType>::value, rational &
191
+ >::type assign(const T& n, const U& d)
192
+ {
193
+ return *this = rational<IntType>(static_cast<IntType>(n), static_cast<IntType>(d));
194
+ }
195
+ //
196
+ // The following overloads should probably *not* be provided -
197
+ // but are provided for backwards compatibity reasons only.
198
+ // These allow for construction/assignment from types that
199
+ // are wider than IntType only if there is an implicit
200
+ // conversion from T to IntType, they will throw a bad_rational
201
+ // if the conversion results in loss of precision or undefined behaviour.
202
+ //
203
+ template <class T>
204
+ rational(const T& n, typename enable_if_c<
205
+ std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer
206
+ && !rational_detail::is_compatible_integer<T, IntType>::value
207
+ && (std::numeric_limits<T>::radix == std::numeric_limits<IntType>::radix)
208
+ && is_convertible<T, IntType>::value
209
+ >::type const* = 0)
210
+ {
211
+ assign(n, static_cast<T>(1));
212
+ }
213
+ template <class T, class U>
214
+ rational(const T& n, const U& d, typename enable_if_c<
215
+ (!rational_detail::is_compatible_integer<T, IntType>::value
216
+ || !rational_detail::is_compatible_integer<U, IntType>::value)
217
+ && std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer
218
+ && (std::numeric_limits<T>::radix == std::numeric_limits<IntType>::radix)
219
+ && is_convertible<T, IntType>::value &&
220
+ std::numeric_limits<U>::is_specialized && std::numeric_limits<U>::is_integer
221
+ && (std::numeric_limits<U>::radix == std::numeric_limits<IntType>::radix)
222
+ && is_convertible<U, IntType>::value
223
+ >::type const* = 0)
224
+ {
225
+ assign(n, d);
226
+ }
227
+ template <class T>
228
+ typename enable_if_c<
229
+ std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer
230
+ && !rational_detail::is_compatible_integer<T, IntType>::value
231
+ && (std::numeric_limits<T>::radix == std::numeric_limits<IntType>::radix)
232
+ && is_convertible<T, IntType>::value,
233
+ rational &
234
+ >::type operator=(const T& n) { return assign(n, static_cast<T>(1)); }
235
+
236
+ template <class T, class U>
237
+ typename enable_if_c<
238
+ (!rational_detail::is_compatible_integer<T, IntType>::value
239
+ || !rational_detail::is_compatible_integer<U, IntType>::value)
240
+ && std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer
241
+ && (std::numeric_limits<T>::radix == std::numeric_limits<IntType>::radix)
242
+ && is_convertible<T, IntType>::value &&
243
+ std::numeric_limits<U>::is_specialized && std::numeric_limits<U>::is_integer
244
+ && (std::numeric_limits<U>::radix == std::numeric_limits<IntType>::radix)
245
+ && is_convertible<U, IntType>::value,
246
+ rational &
247
+ >::type assign(const T& n, const U& d)
248
+ {
249
+ if(!is_safe_narrowing_conversion(n) || !is_safe_narrowing_conversion(d))
250
+ BOOST_THROW_EXCEPTION(bad_rational());
251
+ return *this = rational<IntType>(static_cast<IntType>(n), static_cast<IntType>(d));
252
+ }
253
+
254
+ // Access to representation
255
+ BOOST_CONSTEXPR
256
+ const IntType& numerator() const { return num; }
257
+ BOOST_CONSTEXPR
258
+ const IntType& denominator() const { return den; }
259
+
260
+ // Arithmetic assignment operators
261
+ rational& operator+= (const rational& r);
262
+ rational& operator-= (const rational& r);
263
+ rational& operator*= (const rational& r);
264
+ rational& operator/= (const rational& r);
265
+
266
+ template <class T>
267
+ typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, rational&>::type operator+= (const T& i)
268
+ {
269
+ num += i * den;
270
+ return *this;
271
+ }
272
+ template <class T>
273
+ typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, rational&>::type operator-= (const T& i)
274
+ {
275
+ num -= i * den;
276
+ return *this;
277
+ }
278
+ template <class T>
279
+ typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, rational&>::type operator*= (const T& i)
280
+ {
281
+ // Avoid overflow and preserve normalization
282
+ IntType gcd = integer::gcd(static_cast<IntType>(i), den);
283
+ num *= i / gcd;
284
+ den /= gcd;
285
+ return *this;
286
+ }
287
+ template <class T>
288
+ typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, rational&>::type operator/= (const T& i)
289
+ {
290
+ // Avoid repeated construction
291
+ IntType const zero(0);
292
+
293
+ if(i == zero) BOOST_THROW_EXCEPTION(bad_rational());
294
+ if(num == zero) return *this;
295
+
296
+ // Avoid overflow and preserve normalization
297
+ IntType const gcd = integer::gcd(num, static_cast<IntType>(i));
298
+ num /= gcd;
299
+ den *= i / gcd;
300
+
301
+ if(den < zero) {
302
+ num = -num;
303
+ den = -den;
304
+ }
305
+
306
+ return *this;
307
+ }
308
+
309
+ // Increment and decrement
310
+ const rational& operator++() { num += den; return *this; }
311
+ const rational& operator--() { num -= den; return *this; }
312
+
313
+ rational operator++(int)
314
+ {
315
+ rational t(*this);
316
+ ++(*this);
317
+ return t;
318
+ }
319
+ rational operator--(int)
320
+ {
321
+ rational t(*this);
322
+ --(*this);
323
+ return t;
324
+ }
325
+
326
+ // Operator not
327
+ BOOST_CONSTEXPR
328
+ bool operator!() const { return !num; }
329
+
330
+ // Boolean conversion
331
+
332
+ #if BOOST_WORKAROUND(__MWERKS__,<=0x3003)
333
+ // The "ISO C++ Template Parser" option in CW 8.3 chokes on the
334
+ // following, hence we selectively disable that option for the
335
+ // offending memfun.
336
+ #pragma parse_mfunc_templ off
337
+ #endif
338
+
339
+ BOOST_CONSTEXPR
340
+ operator bool_type() const { return operator !() ? 0 : &helper::parts; }
341
+
342
+ #if BOOST_WORKAROUND(__MWERKS__,<=0x3003)
343
+ #pragma parse_mfunc_templ reset
344
+ #endif
345
+
346
+ // Comparison operators
347
+ bool operator< (const rational& r) const;
348
+ bool operator> (const rational& r) const { return r < *this; }
349
+ BOOST_CONSTEXPR
350
+ bool operator== (const rational& r) const;
351
+
352
+ template <class T>
353
+ typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, bool>::type operator< (const T& i) const
354
+ {
355
+ // Avoid repeated construction
356
+ int_type const zero(0);
357
+
358
+ // Break value into mixed-fraction form, w/ always-nonnegative remainder
359
+ BOOST_ASSERT(this->den > zero);
360
+ int_type q = this->num / this->den, r = this->num % this->den;
361
+ while(r < zero) { r += this->den; --q; }
362
+
363
+ // Compare with just the quotient, since the remainder always bumps the
364
+ // value up. [Since q = floor(n/d), and if n/d < i then q < i, if n/d == i
365
+ // then q == i, if n/d == i + r/d then q == i, and if n/d >= i + 1 then
366
+ // q >= i + 1 > i; therefore n/d < i iff q < i.]
367
+ return q < i;
368
+ }
369
+ template <class T>
370
+ typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, bool>::type operator>(const T& i) const
371
+ {
372
+ return operator==(i) ? false : !operator<(i);
373
+ }
374
+ template <class T>
375
+ BOOST_CONSTEXPR typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, bool>::type operator== (const T& i) const
376
+ {
377
+ return ((den == IntType(1)) && (num == i));
378
+ }
379
+
380
+ private:
381
+ // Implementation - numerator and denominator (normalized).
382
+ // Other possibilities - separate whole-part, or sign, fields?
383
+ IntType num;
384
+ IntType den;
385
+
386
+ // Helper functions
387
+ static BOOST_CONSTEXPR
388
+ int_type inner_gcd( param_type a, param_type b, int_type const &zero =
389
+ int_type(0) )
390
+ { return b == zero ? a : inner_gcd(b, a % b, zero); }
391
+
392
+ static BOOST_CONSTEXPR
393
+ int_type inner_abs( param_type x, int_type const &zero = int_type(0) )
394
+ { return x < zero ? -x : +x; }
395
+
396
+ // Representation note: Fractions are kept in normalized form at all
397
+ // times. normalized form is defined as gcd(num,den) == 1 and den > 0.
398
+ // In particular, note that the implementation of abs() below relies
399
+ // on den always being positive.
400
+ bool test_invariant() const;
401
+ void normalize();
402
+
403
+ static BOOST_CONSTEXPR
404
+ bool is_normalized( param_type n, param_type d, int_type const &zero =
405
+ int_type(0), int_type const &one = int_type(1) )
406
+ {
407
+ return d > zero && ( n != zero || d == one ) && inner_abs( inner_gcd(n,
408
+ d, zero), zero ) == one;
409
+ }
410
+ //
411
+ // Conversion checks:
412
+ //
413
+ // (1) From an unsigned type with more digits than IntType:
414
+ //
415
+ template <class T>
416
+ BOOST_CONSTEXPR static typename boost::enable_if_c<(std::numeric_limits<T>::digits > std::numeric_limits<IntType>::digits) && (std::numeric_limits<T>::is_signed == false), bool>::type is_safe_narrowing_conversion(const T& val)
417
+ {
418
+ return val < (T(1) << std::numeric_limits<IntType>::digits);
419
+ }
420
+ //
421
+ // (2) From a signed type with more digits than IntType, and IntType also signed:
422
+ //
423
+ template <class T>
424
+ BOOST_CONSTEXPR static typename boost::enable_if_c<(std::numeric_limits<T>::digits > std::numeric_limits<IntType>::digits) && (std::numeric_limits<T>::is_signed == true) && (std::numeric_limits<IntType>::is_signed == true), bool>::type is_safe_narrowing_conversion(const T& val)
425
+ {
426
+ // Note that this check assumes IntType has a 2's complement representation,
427
+ // we don't want to try to convert a std::numeric_limits<IntType>::min() to
428
+ // a T because that conversion may not be allowed (this happens when IntType
429
+ // is from Boost.Multiprecision).
430
+ return (val < (T(1) << std::numeric_limits<IntType>::digits)) && (val >= -(T(1) << std::numeric_limits<IntType>::digits));
431
+ }
432
+ //
433
+ // (3) From a signed type with more digits than IntType, and IntType unsigned:
434
+ //
435
+ template <class T>
436
+ BOOST_CONSTEXPR static typename boost::enable_if_c<(std::numeric_limits<T>::digits > std::numeric_limits<IntType>::digits) && (std::numeric_limits<T>::is_signed == true) && (std::numeric_limits<IntType>::is_signed == false), bool>::type is_safe_narrowing_conversion(const T& val)
437
+ {
438
+ return (val < (T(1) << std::numeric_limits<IntType>::digits)) && (val >= 0);
439
+ }
440
+ //
441
+ // (4) From a signed type with fewer digits than IntType, and IntType unsigned:
442
+ //
443
+ template <class T>
444
+ BOOST_CONSTEXPR static typename boost::enable_if_c<(std::numeric_limits<T>::digits <= std::numeric_limits<IntType>::digits) && (std::numeric_limits<T>::is_signed == true) && (std::numeric_limits<IntType>::is_signed == false), bool>::type is_safe_narrowing_conversion(const T& val)
445
+ {
446
+ return val >= 0;
447
+ }
448
+ //
449
+ // (5) From an unsigned type with fewer digits than IntType, and IntType signed:
450
+ //
451
+ template <class T>
452
+ BOOST_CONSTEXPR static typename boost::enable_if_c<(std::numeric_limits<T>::digits <= std::numeric_limits<IntType>::digits) && (std::numeric_limits<T>::is_signed == false) && (std::numeric_limits<IntType>::is_signed == true), bool>::type is_safe_narrowing_conversion(const T&)
453
+ {
454
+ return true;
455
+ }
456
+ //
457
+ // (6) From an unsigned type with fewer digits than IntType, and IntType unsigned:
458
+ //
459
+ template <class T>
460
+ BOOST_CONSTEXPR static typename boost::enable_if_c<(std::numeric_limits<T>::digits <= std::numeric_limits<IntType>::digits) && (std::numeric_limits<T>::is_signed == false) && (std::numeric_limits<IntType>::is_signed == false), bool>::type is_safe_narrowing_conversion(const T&)
461
+ {
462
+ return true;
463
+ }
464
+ //
465
+ // (7) From an signed type with fewer digits than IntType, and IntType signed:
466
+ //
467
+ template <class T>
468
+ BOOST_CONSTEXPR static typename boost::enable_if_c<(std::numeric_limits<T>::digits <= std::numeric_limits<IntType>::digits) && (std::numeric_limits<T>::is_signed == true) && (std::numeric_limits<IntType>::is_signed == true), bool>::type is_safe_narrowing_conversion(const T&)
469
+ {
470
+ return true;
471
+ }
472
+ };
473
+
474
+ // Unary plus and minus
475
+ template <typename IntType>
476
+ BOOST_CONSTEXPR
477
+ inline rational<IntType> operator+ (const rational<IntType>& r)
478
+ {
479
+ return r;
480
+ }
481
+
482
+ template <typename IntType>
483
+ inline rational<IntType> operator- (const rational<IntType>& r)
484
+ {
485
+ return rational<IntType>(static_cast<IntType>(-r.numerator()), r.denominator());
486
+ }
487
+
488
+ // Arithmetic assignment operators
489
+ template <typename IntType>
490
+ rational<IntType>& rational<IntType>::operator+= (const rational<IntType>& r)
491
+ {
492
+ // This calculation avoids overflow, and minimises the number of expensive
493
+ // calculations. Thanks to Nickolay Mladenov for this algorithm.
494
+ //
495
+ // Proof:
496
+ // We have to compute a/b + c/d, where gcd(a,b)=1 and gcd(b,c)=1.
497
+ // Let g = gcd(b,d), and b = b1*g, d=d1*g. Then gcd(b1,d1)=1
498
+ //
499
+ // The result is (a*d1 + c*b1) / (b1*d1*g).
500
+ // Now we have to normalize this ratio.
501
+ // Let's assume h | gcd((a*d1 + c*b1), (b1*d1*g)), and h > 1
502
+ // If h | b1 then gcd(h,d1)=1 and hence h|(a*d1+c*b1) => h|a.
503
+ // But since gcd(a,b1)=1 we have h=1.
504
+ // Similarly h|d1 leads to h=1.
505
+ // So we have that h | gcd((a*d1 + c*b1) , (b1*d1*g)) => h|g
506
+ // Finally we have gcd((a*d1 + c*b1), (b1*d1*g)) = gcd((a*d1 + c*b1), g)
507
+ // Which proves that instead of normalizing the result, it is better to
508
+ // divide num and den by gcd((a*d1 + c*b1), g)
509
+
510
+ // Protect against self-modification
511
+ IntType r_num = r.num;
512
+ IntType r_den = r.den;
513
+
514
+ IntType g = integer::gcd(den, r_den);
515
+ den /= g; // = b1 from the calculations above
516
+ num = num * (r_den / g) + r_num * den;
517
+ g = integer::gcd(num, g);
518
+ num /= g;
519
+ den *= r_den/g;
520
+
521
+ return *this;
522
+ }
523
+
524
+ template <typename IntType>
525
+ rational<IntType>& rational<IntType>::operator-= (const rational<IntType>& r)
526
+ {
527
+ // Protect against self-modification
528
+ IntType r_num = r.num;
529
+ IntType r_den = r.den;
530
+
531
+ // This calculation avoids overflow, and minimises the number of expensive
532
+ // calculations. It corresponds exactly to the += case above
533
+ IntType g = integer::gcd(den, r_den);
534
+ den /= g;
535
+ num = num * (r_den / g) - r_num * den;
536
+ g = integer::gcd(num, g);
537
+ num /= g;
538
+ den *= r_den/g;
539
+
540
+ return *this;
541
+ }
542
+
543
+ template <typename IntType>
544
+ rational<IntType>& rational<IntType>::operator*= (const rational<IntType>& r)
545
+ {
546
+ // Protect against self-modification
547
+ IntType r_num = r.num;
548
+ IntType r_den = r.den;
549
+
550
+ // Avoid overflow and preserve normalization
551
+ IntType gcd1 = integer::gcd(num, r_den);
552
+ IntType gcd2 = integer::gcd(r_num, den);
553
+ num = (num/gcd1) * (r_num/gcd2);
554
+ den = (den/gcd2) * (r_den/gcd1);
555
+ return *this;
556
+ }
557
+
558
+ template <typename IntType>
559
+ rational<IntType>& rational<IntType>::operator/= (const rational<IntType>& r)
560
+ {
561
+ // Protect against self-modification
562
+ IntType r_num = r.num;
563
+ IntType r_den = r.den;
564
+
565
+ // Avoid repeated construction
566
+ IntType zero(0);
567
+
568
+ // Trap division by zero
569
+ if (r_num == zero)
570
+ BOOST_THROW_EXCEPTION(bad_rational());
571
+ if (num == zero)
572
+ return *this;
573
+
574
+ // Avoid overflow and preserve normalization
575
+ IntType gcd1 = integer::gcd(num, r_num);
576
+ IntType gcd2 = integer::gcd(r_den, den);
577
+ num = (num/gcd1) * (r_den/gcd2);
578
+ den = (den/gcd2) * (r_num/gcd1);
579
+
580
+ if (den < zero) {
581
+ num = -num;
582
+ den = -den;
583
+ }
584
+ return *this;
585
+ }
586
+
587
+
588
+ //
589
+ // Non-member operators: previously these were provided by Boost.Operator, but these had a number of
590
+ // drawbacks, most notably, that in order to allow inter-operability with IntType code such as this:
591
+ //
592
+ // rational<int> r(3);
593
+ // assert(r == 3.5); // compiles and passes!!
594
+ //
595
+ // Happens to be allowed as well :-(
596
+ //
597
+ // There are three possible cases for each operator:
598
+ // 1) rational op rational.
599
+ // 2) rational op integer
600
+ // 3) integer op rational
601
+ // Cases (1) and (2) are folded into the one function.
602
+ //
603
+ template <class IntType, class Arg>
604
+ inline typename boost::enable_if_c <
605
+ rational_detail::is_compatible_integer<Arg, IntType>::value || is_same<rational<IntType>, Arg>::value, rational<IntType> >::type
606
+ operator + (const rational<IntType>& a, const Arg& b)
607
+ {
608
+ rational<IntType> t(a);
609
+ return t += b;
610
+ }
611
+ template <class Arg, class IntType>
612
+ inline typename boost::enable_if_c <
613
+ rational_detail::is_compatible_integer<Arg, IntType>::value, rational<IntType> >::type
614
+ operator + (const Arg& b, const rational<IntType>& a)
615
+ {
616
+ rational<IntType> t(a);
617
+ return t += b;
618
+ }
619
+
620
+ template <class IntType, class Arg>
621
+ inline typename boost::enable_if_c <
622
+ rational_detail::is_compatible_integer<Arg, IntType>::value || is_same<rational<IntType>, Arg>::value, rational<IntType> >::type
623
+ operator - (const rational<IntType>& a, const Arg& b)
624
+ {
625
+ rational<IntType> t(a);
626
+ return t -= b;
627
+ }
628
+ template <class Arg, class IntType>
629
+ inline typename boost::enable_if_c <
630
+ rational_detail::is_compatible_integer<Arg, IntType>::value, rational<IntType> >::type
631
+ operator - (const Arg& b, const rational<IntType>& a)
632
+ {
633
+ rational<IntType> t(a);
634
+ return -(t -= b);
635
+ }
636
+
637
+ template <class IntType, class Arg>
638
+ inline typename boost::enable_if_c <
639
+ rational_detail::is_compatible_integer<Arg, IntType>::value || is_same<rational<IntType>, Arg>::value, rational<IntType> >::type
640
+ operator * (const rational<IntType>& a, const Arg& b)
641
+ {
642
+ rational<IntType> t(a);
643
+ return t *= b;
644
+ }
645
+ template <class Arg, class IntType>
646
+ inline typename boost::enable_if_c <
647
+ rational_detail::is_compatible_integer<Arg, IntType>::value, rational<IntType> >::type
648
+ operator * (const Arg& b, const rational<IntType>& a)
649
+ {
650
+ rational<IntType> t(a);
651
+ return t *= b;
652
+ }
653
+
654
+ template <class IntType, class Arg>
655
+ inline typename boost::enable_if_c <
656
+ rational_detail::is_compatible_integer<Arg, IntType>::value || is_same<rational<IntType>, Arg>::value, rational<IntType> >::type
657
+ operator / (const rational<IntType>& a, const Arg& b)
658
+ {
659
+ rational<IntType> t(a);
660
+ return t /= b;
661
+ }
662
+ template <class Arg, class IntType>
663
+ inline typename boost::enable_if_c <
664
+ rational_detail::is_compatible_integer<Arg, IntType>::value, rational<IntType> >::type
665
+ operator / (const Arg& b, const rational<IntType>& a)
666
+ {
667
+ rational<IntType> t(b);
668
+ return t /= a;
669
+ }
670
+
671
+ template <class IntType, class Arg>
672
+ inline typename boost::enable_if_c <
673
+ rational_detail::is_compatible_integer<Arg, IntType>::value || is_same<rational<IntType>, Arg>::value, bool>::type
674
+ operator <= (const rational<IntType>& a, const Arg& b)
675
+ {
676
+ return !(a > b);
677
+ }
678
+ template <class Arg, class IntType>
679
+ inline typename boost::enable_if_c <
680
+ rational_detail::is_compatible_integer<Arg, IntType>::value, bool>::type
681
+ operator <= (const Arg& b, const rational<IntType>& a)
682
+ {
683
+ return a >= b;
684
+ }
685
+
686
+ template <class IntType, class Arg>
687
+ inline typename boost::enable_if_c <
688
+ rational_detail::is_compatible_integer<Arg, IntType>::value || is_same<rational<IntType>, Arg>::value, bool>::type
689
+ operator >= (const rational<IntType>& a, const Arg& b)
690
+ {
691
+ return !(a < b);
692
+ }
693
+ template <class Arg, class IntType>
694
+ inline typename boost::enable_if_c <
695
+ rational_detail::is_compatible_integer<Arg, IntType>::value, bool>::type
696
+ operator >= (const Arg& b, const rational<IntType>& a)
697
+ {
698
+ return a <= b;
699
+ }
700
+
701
+ template <class IntType, class Arg>
702
+ inline typename boost::enable_if_c <
703
+ rational_detail::is_compatible_integer<Arg, IntType>::value || is_same<rational<IntType>, Arg>::value, bool>::type
704
+ operator != (const rational<IntType>& a, const Arg& b)
705
+ {
706
+ return !(a == b);
707
+ }
708
+ template <class Arg, class IntType>
709
+ inline typename boost::enable_if_c <
710
+ rational_detail::is_compatible_integer<Arg, IntType>::value, bool>::type
711
+ operator != (const Arg& b, const rational<IntType>& a)
712
+ {
713
+ return !(b == a);
714
+ }
715
+
716
+ template <class Arg, class IntType>
717
+ inline typename boost::enable_if_c <
718
+ rational_detail::is_compatible_integer<Arg, IntType>::value, bool>::type
719
+ operator < (const Arg& b, const rational<IntType>& a)
720
+ {
721
+ return a > b;
722
+ }
723
+ template <class Arg, class IntType>
724
+ inline typename boost::enable_if_c <
725
+ rational_detail::is_compatible_integer<Arg, IntType>::value, bool>::type
726
+ operator > (const Arg& b, const rational<IntType>& a)
727
+ {
728
+ return a < b;
729
+ }
730
+ template <class Arg, class IntType>
731
+ inline typename boost::enable_if_c <
732
+ rational_detail::is_compatible_integer<Arg, IntType>::value, bool>::type
733
+ operator == (const Arg& b, const rational<IntType>& a)
734
+ {
735
+ return a == b;
736
+ }
737
+
738
+ // Comparison operators
739
+ template <typename IntType>
740
+ bool rational<IntType>::operator< (const rational<IntType>& r) const
741
+ {
742
+ // Avoid repeated construction
743
+ int_type const zero( 0 );
744
+
745
+ // This should really be a class-wide invariant. The reason for these
746
+ // checks is that for 2's complement systems, INT_MIN has no corresponding
747
+ // positive, so negating it during normalization keeps it INT_MIN, which
748
+ // is bad for later calculations that assume a positive denominator.
749
+ BOOST_ASSERT( this->den > zero );
750
+ BOOST_ASSERT( r.den > zero );
751
+
752
+ // Determine relative order by expanding each value to its simple continued
753
+ // fraction representation using the Euclidian GCD algorithm.
754
+ struct { int_type n, d, q, r; }
755
+ ts = { this->num, this->den, static_cast<int_type>(this->num / this->den),
756
+ static_cast<int_type>(this->num % this->den) },
757
+ rs = { r.num, r.den, static_cast<int_type>(r.num / r.den),
758
+ static_cast<int_type>(r.num % r.den) };
759
+ unsigned reverse = 0u;
760
+
761
+ // Normalize negative moduli by repeatedly adding the (positive) denominator
762
+ // and decrementing the quotient. Later cycles should have all positive
763
+ // values, so this only has to be done for the first cycle. (The rules of
764
+ // C++ require a nonnegative quotient & remainder for a nonnegative dividend
765
+ // & positive divisor.)
766
+ while ( ts.r < zero ) { ts.r += ts.d; --ts.q; }
767
+ while ( rs.r < zero ) { rs.r += rs.d; --rs.q; }
768
+
769
+ // Loop through and compare each variable's continued-fraction components
770
+ for ( ;; )
771
+ {
772
+ // The quotients of the current cycle are the continued-fraction
773
+ // components. Comparing two c.f. is comparing their sequences,
774
+ // stopping at the first difference.
775
+ if ( ts.q != rs.q )
776
+ {
777
+ // Since reciprocation changes the relative order of two variables,
778
+ // and c.f. use reciprocals, the less/greater-than test reverses
779
+ // after each index. (Start w/ non-reversed @ whole-number place.)
780
+ return reverse ? ts.q > rs.q : ts.q < rs.q;
781
+ }
782
+
783
+ // Prepare the next cycle
784
+ reverse ^= 1u;
785
+
786
+ if ( (ts.r == zero) || (rs.r == zero) )
787
+ {
788
+ // At least one variable's c.f. expansion has ended
789
+ break;
790
+ }
791
+
792
+ ts.n = ts.d; ts.d = ts.r;
793
+ ts.q = ts.n / ts.d; ts.r = ts.n % ts.d;
794
+ rs.n = rs.d; rs.d = rs.r;
795
+ rs.q = rs.n / rs.d; rs.r = rs.n % rs.d;
796
+ }
797
+
798
+ // Compare infinity-valued components for otherwise equal sequences
799
+ if ( ts.r == rs.r )
800
+ {
801
+ // Both remainders are zero, so the next (and subsequent) c.f.
802
+ // components for both sequences are infinity. Therefore, the sequences
803
+ // and their corresponding values are equal.
804
+ return false;
805
+ }
806
+ else
807
+ {
808
+ #ifdef BOOST_MSVC
809
+ #pragma warning(push)
810
+ #pragma warning(disable:4800)
811
+ #endif
812
+ // Exactly one of the remainders is zero, so all following c.f.
813
+ // components of that variable are infinity, while the other variable
814
+ // has a finite next c.f. component. So that other variable has the
815
+ // lesser value (modulo the reversal flag!).
816
+ return ( ts.r != zero ) != static_cast<bool>( reverse );
817
+ #ifdef BOOST_MSVC
818
+ #pragma warning(pop)
819
+ #endif
820
+ }
821
+ }
822
+
823
+ template <typename IntType>
824
+ BOOST_CONSTEXPR
825
+ inline bool rational<IntType>::operator== (const rational<IntType>& r) const
826
+ {
827
+ return ((num == r.num) && (den == r.den));
828
+ }
829
+
830
+ // Invariant check
831
+ template <typename IntType>
832
+ inline bool rational<IntType>::test_invariant() const
833
+ {
834
+ return ( this->den > int_type(0) ) && ( integer::gcd(this->num, this->den) ==
835
+ int_type(1) );
836
+ }
837
+
838
+ // Normalisation
839
+ template <typename IntType>
840
+ void rational<IntType>::normalize()
841
+ {
842
+ // Avoid repeated construction
843
+ IntType zero(0);
844
+
845
+ if (den == zero)
846
+ BOOST_THROW_EXCEPTION(bad_rational());
847
+
848
+ // Handle the case of zero separately, to avoid division by zero
849
+ if (num == zero) {
850
+ den = IntType(1);
851
+ return;
852
+ }
853
+
854
+ IntType g = integer::gcd(num, den);
855
+
856
+ num /= g;
857
+ den /= g;
858
+
859
+ // Ensure that the denominator is positive
860
+ if (den < zero) {
861
+ num = -num;
862
+ den = -den;
863
+ }
864
+
865
+ // ...But acknowledge that the previous step doesn't always work.
866
+ // (Nominally, this should be done before the mutating steps, but this
867
+ // member function is only called during the constructor, so we never have
868
+ // to worry about zombie objects.)
869
+ if (den < zero)
870
+ BOOST_THROW_EXCEPTION(bad_rational("bad rational: non-zero singular denominator"));
871
+
872
+ BOOST_ASSERT( this->test_invariant() );
873
+ }
874
+
875
+ #ifndef BOOST_NO_IOSTREAM
876
+ namespace detail {
877
+
878
+ // A utility class to reset the format flags for an istream at end
879
+ // of scope, even in case of exceptions
880
+ struct resetter {
881
+ resetter(std::istream& is) : is_(is), f_(is.flags()) {}
882
+ ~resetter() { is_.flags(f_); }
883
+ std::istream& is_;
884
+ std::istream::fmtflags f_; // old GNU c++ lib has no ios_base
885
+ };
886
+
887
+ }
888
+
889
+ // Input and output
890
+ template <typename IntType>
891
+ std::istream& operator>> (std::istream& is, rational<IntType>& r)
892
+ {
893
+ using std::ios;
894
+
895
+ IntType n = IntType(0), d = IntType(1);
896
+ char c = 0;
897
+ detail::resetter sentry(is);
898
+
899
+ if ( is >> n )
900
+ {
901
+ if ( is.get(c) )
902
+ {
903
+ if ( c == '/' )
904
+ {
905
+ if ( is >> std::noskipws >> d )
906
+ try {
907
+ r.assign( n, d );
908
+ } catch ( bad_rational & ) { // normalization fail
909
+ try { is.setstate(ios::failbit); }
910
+ catch ( ... ) {} // don't throw ios_base::failure...
911
+ if ( is.exceptions() & ios::failbit )
912
+ throw; // ...but the original exception instead
913
+ // ELSE: suppress the exception, use just error flags
914
+ }
915
+ }
916
+ else
917
+ is.setstate( ios::failbit );
918
+ }
919
+ }
920
+
921
+ return is;
922
+ }
923
+
924
+ // Add manipulators for output format?
925
+ template <typename IntType>
926
+ std::ostream& operator<< (std::ostream& os, const rational<IntType>& r)
927
+ {
928
+ // The slash directly precedes the denominator, which has no prefixes.
929
+ std::ostringstream ss;
930
+
931
+ ss.copyfmt( os );
932
+ ss.tie( NULL );
933
+ ss.exceptions( std::ios::goodbit );
934
+ ss.width( 0 );
935
+ ss << std::noshowpos << std::noshowbase << '/' << r.denominator();
936
+
937
+ // The numerator holds the showpos, internal, and showbase flags.
938
+ std::string const tail = ss.str();
939
+ std::streamsize const w =
940
+ os.width() - static_cast<std::streamsize>( tail.size() );
941
+
942
+ ss.clear();
943
+ ss.str( "" );
944
+ ss.flags( os.flags() );
945
+ ss << std::setw( w < 0 || (os.flags() & std::ios::adjustfield) !=
946
+ std::ios::internal ? 0 : w ) << r.numerator();
947
+ return os << ss.str() + tail;
948
+ }
949
+ #endif // BOOST_NO_IOSTREAM
950
+
951
+ // Type conversion
952
+ template <typename T, typename IntType>
953
+ BOOST_CONSTEXPR
954
+ inline T rational_cast(const rational<IntType>& src)
955
+ {
956
+ return static_cast<T>(src.numerator())/static_cast<T>(src.denominator());
957
+ }
958
+
959
+ // Do not use any abs() defined on IntType - it isn't worth it, given the
960
+ // difficulties involved (Koenig lookup required, there may not *be* an abs()
961
+ // defined, etc etc).
962
+ template <typename IntType>
963
+ inline rational<IntType> abs(const rational<IntType>& r)
964
+ {
965
+ return r.numerator() >= IntType(0)? r: -r;
966
+ }
967
+
968
+ namespace integer {
969
+
970
+ template <typename IntType>
971
+ struct gcd_evaluator< rational<IntType> >
972
+ {
973
+ typedef rational<IntType> result_type,
974
+ first_argument_type, second_argument_type;
975
+ result_type operator() ( first_argument_type const &a
976
+ , second_argument_type const &b
977
+ ) const
978
+ {
979
+ return result_type(integer::gcd(a.numerator(), b.numerator()),
980
+ integer::lcm(a.denominator(), b.denominator()));
981
+ }
982
+ };
983
+
984
+ template <typename IntType>
985
+ struct lcm_evaluator< rational<IntType> >
986
+ {
987
+ typedef rational<IntType> result_type,
988
+ first_argument_type, second_argument_type;
989
+ result_type operator() ( first_argument_type const &a
990
+ , second_argument_type const &b
991
+ ) const
992
+ {
993
+ return result_type(integer::lcm(a.numerator(), b.numerator()),
994
+ integer::gcd(a.denominator(), b.denominator()));
995
+ }
996
+ };
997
+
998
+ } // namespace integer
999
+
1000
+ } // namespace boost
1001
+
1002
+ #endif // BOOST_RATIONAL_HPP